24 m_useTrainingMode(false),
25 m_trainingOutputFile(
""),
27 m_minCompleteness(0.8f),
29 m_filePathEnvironmentVariable(
"FW_SEARCH_PATH"),
30 m_maxNeutrinos(std::numeric_limits<int>::max()),
31 m_minAdaBDTScore(0.f),
42 const LArTPC *
const pFirstLArTPC(larTPCMap.begin()->second);
50 for (
const LArTPCMap::value_type &mapEntry : larTPCMap)
52 const LArTPC *
const pLArTPC(mapEntry.second);
67 std::cout <<
"BdtBeamParticleIdTool::Initialize - unable to initialize LArTPC geometry parameters" << std::endl;
68 return STATUS_CODE_FAILURE;
71 return STATUS_CODE_SUCCESS;
79 if (nuSliceHypotheses.size() != crSliceHypotheses.size())
82 const unsigned int nSlices(nuSliceHypotheses.size());
87 this->
GetSliceFeatures(nuSliceHypotheses, crSliceHypotheses, sliceFeaturesVector);
92 this->
SelectAllPfos(pAlgorithm, crSliceHypotheses, selectedPfos);
97 for (
unsigned int sliceIndex = 0; sliceIndex < nSlices; ++sliceIndex)
99 const SliceFeatures &features(sliceFeaturesVector.at(sliceIndex));
111 std::cout <<
"BdtBeamParticleIdTool::SelectOutputPfos - unable to fill feature vector" << std::endl;
115 bool isGoodTrainingSlice(
false);
116 if (std::find(bestSliceIndices.begin(), bestSliceIndices.end(), sliceIndex) != bestSliceIndices.end())
117 isGoodTrainingSlice =
true;
125 this->
SelectPfosByAdaBDTScore(pAlgorithm, nuSliceHypotheses, crSliceHypotheses, sliceFeaturesVector, selectedPfos);
133 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
141 for (
const PfoList &pfos : hypotheses)
146 metadata.m_propertiesToAdd[
"TestBeamScore"] = -1.f;
158 selectedPfos.insert(selectedPfos.end(), pfos.begin(), pfos.end());
167 const CaloHitList *pAllReconstructedCaloHitList(
nullptr);
186 const CaloHitSet reconstructableCaloHitSet(reconstructableCaloHitList.begin(), reconstructableCaloHitList.end());
188 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
192 this->
Collect2DHits(crSliceHypotheses.at(sliceIndex), reconstructedCaloHitList, reconstructableCaloHitSet);
194 if (nuSliceHypotheses.at(sliceIndex).size() == 1)
196 const PfoList &nuFinalStates(nuSliceHypotheses.at(sliceIndex).front()->GetDaughterPfoList());
197 this->
Collect2DHits(nuFinalStates, reconstructedCaloHitList, reconstructableCaloHitSet);
200 const unsigned int nRecoHits(reconstructedCaloHitList.size());
206 if (mcParticleToHitsInSliceMap.empty())
211 unsigned int nSharedHits(0);
213 for (
const auto &iter : mcParticleToHitsInSliceMap)
215 if (iter.second >
static_cast<int>(nSharedHits))
217 pBestMCParticle = iter.first;
218 nSharedHits = iter.second;
226 const unsigned int nMCHits(mcParticleToReconstructableHitsMap.at(pBestMCParticle));
227 const float purity(nRecoHits > 0 ?
static_cast<float>(nSharedHits) /
static_cast<float>(nRecoHits) : 0.f);
228 const float completeness(nMCHits > 0 ?
static_cast<float>(nSharedHits) /
static_cast<float>(nMCHits) : 0.f);
231 bestSliceIndices.push_back(sliceIndex);
240 for (
const CaloHit *
const pCaloHit : caloHitList)
245 MCParticleToIntMap::iterator iter(mcParticleToIntMap.find(pParentMCParticle));
247 if (iter != mcParticleToIntMap.end())
253 mcParticleToIntMap.insert(MCParticleToIntMap::value_type(pParentMCParticle, 1));
258 if (STATUS_CODE_NOT_INITIALIZED != statusCodeException.
GetStatusCode())
259 throw statusCodeException;
273 for (
const CaloHit *
const pCaloHit : collectedHits)
276 const CaloHit *pParentCaloHit(
static_cast<const CaloHit *
>(pCaloHit->GetParentAddress()));
278 if (!reconstructableCaloHitSet.count(pParentCaloHit))
282 if (std::find(reconstructedCaloHitList.begin(), reconstructedCaloHitList.end(), pParentCaloHit) == reconstructedCaloHitList.end())
283 reconstructedCaloHitList.push_back(pParentCaloHit);
303 std::vector<UintFloatPair> sliceIndexAdaBDTScorePairs;
304 for (
unsigned int sliceIndex = 0, nSlices = nuSliceHypotheses.size(); sliceIndex < nSlices; ++sliceIndex)
306 const float nuAdaBDTScore(sliceFeaturesVector.at(sliceIndex).GetAdaBoostDecisionTreeScore(
m_adaBoostDecisionTree));
311 metadata.m_propertiesToAdd[
"TestBeamScore"] = nuAdaBDTScore;
318 metadata.m_propertiesToAdd[
"TestBeamScore"] = nuAdaBDTScore;
324 this->
SelectPfos(crSliceHypotheses.at(sliceIndex), selectedPfos);
328 sliceIndexAdaBDTScorePairs.push_back(
UintFloatPair(sliceIndex, nuAdaBDTScore));
332 std::sort(sliceIndexAdaBDTScorePairs.begin(), sliceIndexAdaBDTScorePairs.end(),
336 unsigned int nNuSlices(0);
337 for (
const UintFloatPair &slice : sliceIndexAdaBDTScorePairs)
341 this->
SelectPfos(nuSliceHypotheses.at(slice.first), selectedPfos);
346 this->
SelectPfos(crSliceHypotheses.at(slice.first), selectedPfos);
354 m_unitNormal(0.f, 0.f, 0.f),
356 m_d(-1. * static_cast<double>(normal.GetDotProduct(point)))
364 std::cout <<
"BdtBeamParticleIdTool::Plane::Plane - normal vector to plane has a magnitude of zero" << std::endl;
365 throw statusCodeException;
373 if (std::fabs(direction.
GetDotProduct(m_unitNormal)) < std::numeric_limits<float>::epsilon())
374 return CartesianVector(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
376 const float denominator(direction.
GetDotProduct(m_unitNormal));
378 if (std::fabs(denominator) < std::numeric_limits<float>::epsilon())
381 const double t(-1. * (
static_cast<double>(point.
GetDotProduct(m_unitNormal)) + m_d) /
static_cast<double>(denominator));
382 return (point + (direction * t));
389 m_larTPCMinX(std::numeric_limits<float>::max()),
390 m_larTPCMaxX(std::numeric_limits<float>::max()),
391 m_larTPCMinY(std::numeric_limits<float>::max()),
392 m_larTPCMaxY(std::numeric_limits<float>::max()),
393 m_larTPCMinZ(std::numeric_limits<float>::max()),
394 m_larTPCMaxZ(std::numeric_limits<float>::max()),
395 m_beamLArTPCIntersection(0.f, 0.f, 0.f),
396 m_beamDirection(0.f, 0.f, 0.f),
397 m_selectedFraction(10.f),
398 m_nSelectedHits(100),
399 m_containmentLimit(0.01f)
406 const float larTPCMaxY,
const float larTPCMinZ,
const float larTPCMaxZ)
408 m_larTPCMinX = larTPCMinX;
409 m_larTPCMaxX = larTPCMaxX;
410 m_larTPCMinY = larTPCMinY;
411 m_larTPCMaxY = larTPCMaxY;
412 m_larTPCMinZ = larTPCMinZ;
413 m_larTPCMaxZ = larTPCMaxZ;
415 const CartesianVector normalTop(0.f, 0.f, 1.f), pointTop(0.f, 0.f, m_larTPCMaxZ);
416 const CartesianVector normalBottom(0.f, 0.f, -1.f), pointBottom(0.f, 0.f, m_larTPCMinZ);
417 const CartesianVector normalRight(1.f, 0.f, 0.f), pointRight(m_larTPCMaxX, 0.f, 0.f);
418 const CartesianVector normalLeft(-1.f, 0.f, 0.f), pointLeft(m_larTPCMinX, 0.f, 0.f);
419 const CartesianVector normalBack(0.f, 1.f, 0.f), pointBack(0.f, m_larTPCMaxY, 0.f);
420 const CartesianVector normalFront(0.f, -1.f, 0.f), pointFront(0.f, m_larTPCMinY, 0.f);
422 m_larTPCPlanes.emplace_back(normalTop, pointTop);
423 m_larTPCPlanes.emplace_back(normalBottom, pointBottom);
424 m_larTPCPlanes.emplace_back(normalRight, pointRight);
425 m_larTPCPlanes.emplace_back(normalLeft, pointLeft);
426 m_larTPCPlanes.emplace_back(normalBack, pointBack);
427 m_larTPCPlanes.emplace_back(normalFront, pointFront);
434 m_isAvailable(false),
439 double closestDistanceNu(std::numeric_limits<double>::max()), closestDistanceCr(std::numeric_limits<double>::max()),
440 supplementaryAngleToBeamNu(std::numeric_limits<double>::max()), supplementaryAngleToBeamCr(std::numeric_limits<double>::max()),
441 separationNu(std::numeric_limits<double>::max()), separationCr(std::numeric_limits<double>::max());
443 CaloHitList caloHitList3DNu, caloHitList3DCr, selectedCaloHitListNu, selectedCaloHitListCr;
444 PfoList allConnectedPfoListNu, allConnectedPfoListCr;
456 if (!selectedCaloHitListNu.empty() && !selectedCaloHitListCr.empty())
458 float maxYNu(-std::numeric_limits<float>::max()), maxYCr(-std::numeric_limits<float>::max());
459 CartesianVector centroidNu(0.f, 0.f, 0.f), interceptOneNu(0.f, 0.f, 0.f), interceptTwoNu(0.f, 0.f, 0.f),
460 centroidCr(0.f, 0.f, 0.f), interceptOneCr(0.f, 0.f, 0.f), interceptTwoCr(0.f, 0.f, 0.f);
471 separationNu = std::min(separationOneNu, separationTwoNu);
482 separationCr = std::min(separationOneCr, separationTwoCr);
484 for (
const CaloHit *pCaloHit : caloHitList3DNu)
486 if (maxYNu < pCaloHit->GetPositionVector().GetY())
487 maxYNu = pCaloHit->GetPositionVector().GetY();
490 for (
const CaloHit *pCaloHit : caloHitList3DCr)
492 if (maxYCr < pCaloHit->GetPositionVector().GetY())
493 maxYCr = pCaloHit->GetPositionVector().GetY();
526 const CaloHitList &inputCaloHitList,
CaloHitList &outputCaloHitList,
double &closestHitToFaceDistance)
const
528 if (inputCaloHitList.empty())
530 std::cout <<
"BdtBeamParticleIdTool::SliceFeatures::GetLeadingCaloHits - empty calo hit list" << std::endl;
534 typedef std::pair<const CaloHit *, float> HitDistancePair;
535 typedef std::vector<HitDistancePair> HitDistanceVector;
536 HitDistanceVector hitDistanceVector;
538 for (
const CaloHit *
const pCaloHit : inputCaloHitList)
539 hitDistanceVector.emplace_back(
542 std::sort(hitDistanceVector.begin(), hitDistanceVector.end(),
543 [](
const HitDistancePair &lhs,
const HitDistancePair &rhs) ->
bool { return (lhs.second < rhs.second); });
545 if (hitDistanceVector.front().second < 0.f)
547 std::cout <<
"BdtBeamParticleIdTool::SliceFeatures::GetLeadingCaloHits - unphysical magnitude of a vector" << std::endl;
551 closestHitToFaceDistance = std::sqrt(hitDistanceVector.front().second);
553 const unsigned int nInputHits(inputCaloHitList.size());
554 const unsigned int nSelectedCaloHits(
559 for (
const HitDistancePair &hitDistancePair : hitDistanceVector)
561 outputCaloHitList.push_back(hitDistancePair.first);
563 if (outputCaloHitList.size() >= nSelectedCaloHits)
582 std::cout <<
"BdtBeamParticleIdTool::SliceFeatures::GetLArTPCIntercepts - normal vector to plane has a magnitude of zero" << std::endl;
583 throw statusCodeException;
588 const CartesianVector intercept(plane.GetLineIntersection(a0, lineUnitVector));
591 intercepts.push_back(intercept);
594 if (intercepts.size() > 1)
596 float maximumSeparationSquared(0.f);
597 bool interceptsSet(
false);
599 for (
unsigned int i = 0; i < intercepts.size(); i++)
601 for (
unsigned int j = i + 1; j < intercepts.size(); j++)
605 const float separationSquared((candidateInterceptOne - candidateInterceptTwo).GetMagnitudeSquared());
607 if (separationSquared > maximumSeparationSquared)
609 maximumSeparationSquared = separationSquared;
610 interceptOne = candidateInterceptOne;
611 interceptTwo = candidateInterceptTwo;
612 interceptsSet =
true;
619 std::cout <<
"BdtBeamParticleIdTool::SliceFeatures::GetLArTPCIntercepts - unable to set the intercepts between a line and the LArTPC"
626 std::cout <<
"BdtBeamParticleIdTool::SliceFeatures::GetLArTPCIntercepts - inconsistent number of intercepts between a line and the LArTPC"
656 if (!featureVector.empty())
658 std::cout <<
"BdtBeamParticleIdTool::SliceFeatures::FillFeatureVector - feature vector already populated" << std::endl;
662 featureVector.insert(featureVector.end(), m_featureVector.begin(), m_featureVector.end());
671 if (!this->IsFeatureVectorAvailable())
678 this->FillFeatureVector(featureVector);
682 std::cout <<
"BdtBeamParticleIdTool::SliceFeatures::GetAdaBoostDecisionTreeScore - unable to fill feature vector" << std::endl;
710 std::string bdtFileName;
718 if (STATUS_CODE_SUCCESS != statusCode)
720 std::cout <<
"BdtBeamParticleIdTool::ReadSettings - unable to load bdt" << std::endl;
740 if (3 == beamLArTPCIntersection.size())
743 beamLArTPCIntersection.at(0), beamLArTPCIntersection.at(1), beamLArTPCIntersection.at(2));
746 else if (!beamLArTPCIntersection.empty())
748 std::cout <<
"BdtBeamParticleIdTool::ReadSettings - invalid BeamTPCIntersection specified " << std::endl;
749 return STATUS_CODE_INVALID_PARAMETER;
762 if (3 == beamDirection.size())
764 CartesianVector beamDirectionCartesianVector(beamDirection.at(0), beamDirection.at(1), beamDirection.at(2));
767 else if (!beamDirection.empty())
769 std::cout <<
"BdtBeamParticleIdTool::ReadSettings - invalid BeamDirection specified " << std::endl;
770 return STATUS_CODE_INVALID_PARAMETER;
775 const float thetaXZ0(-11.844f * M_PI / 180.f);
776 CartesianVector beamDirectionCartesianVector(std::sin(thetaXZ0), 0.f, std::cos(thetaXZ0));
780 float selectedFraction(0.f);
784 if (selectedFraction > std::numeric_limits<float>::epsilon())
787 unsigned int nSelectedHits(0);
791 if (nSelectedHits > 0)
794 float containmentLimit(0.f);
798 if (containmentLimit < 0.f)
800 std::cout <<
"BdtBeamParticleIdTool::ReadSettings - invalid ContainmentLimit specified " << std::endl;
801 return STATUS_CODE_INVALID_PARAMETER;
803 else if (containmentLimit > 0.f)
808 return STATUS_CODE_SUCCESS;
Header file for the beam particle id tool class.
Header file for the file helper class.
Header file for the lar monte carlo particle helper helper class.
Header file for the principal curve analysis helper class.
Header file for the pfo helper class.
#define PANDORA_THROW_RESULT_IF(StatusCode1, Operator, Command)
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
AdaBoostDecisionTree class.
pandora::StatusCode Initialize(const std::string ¶meterLocation, const std::string &bdtName)
Initialize the bdt model.
pandora::CartesianVector m_unitNormal
Unit normal to plane.
Plane(const pandora::CartesianVector &normal, const pandora::CartesianVector &point)
Constructor, using equation of plane: m_a*x + m_b*y + m_c*z + m_d = 0.
pandora::CartesianVector GetLineIntersection(const pandora::CartesianVector &point, const pandora::CartesianVector &direction) const
Return the intersection between the plane and a line.
SliceFeatureParameters class.
float GetSelectedFraction() const
Get m_selectedFraction.
void SetBeamDirection(const pandora::CartesianVector &beamDirection)
Set m_beamDirection.
float GetLArTPCMinZ() const
Get m_larTPCMinZ.
float GetLArTPCMaxY() const
Get m_larTPCMaxY.
void SetBeamLArTPCIntersection(const pandora::CartesianVector &beamLArTPCIntersection)
Set m_beamLArTPCIntersection.
SliceFeatureParameters()
Constructor.
const pandora::CartesianVector & GetBeamDirection() const
Get the beam direction.
float GetContainmentLimit() const
Get m_containmentLimit.
unsigned int GetNSelectedHits() const
Get m_nSelectedHits.
float GetLArTPCMaxX() const
Get m_larTPCMaxX.
const pandora::CartesianVector & GetBeamLArTPCIntersection() const
Get the beam LArTPC intersection.
const PlaneVector & GetPlanes() const
Get vector of planes.
float GetLArTPCMinY() const
Get m_larTPCMinY.
void SetNSelectedHits(const unsigned int nSelectedHits)
Set m_nSelectedHits.
float GetLArTPCMaxZ() const
Get m_larTPCMaxZ.
void SetContainmentLimit(const float containmentLimit)
Set m_containmentLimit.
void Initialize(const float larTPCMinX, const float larTPCMaxX, const float larTPCMinY, const float larTPCMaxY, const float larTPCMinZ, const float larTPCMaxZ)
Set LArTPC geometry information.
void SetSelectedFraction(const float selectedFraction)
Set m_selectedFraction.
float GetLArTPCMinX() const
Get m_larTPCMinX.
void GetLeadingCaloHits(const pandora::CaloHitList &inputCaloHitList, pandora::CaloHitList &outputCaloHitList, double &closestHitToFaceDistance) const
Select a given fraction of a slice's calo hits that are closest to the beam spot.
const SliceFeatureParameters m_sliceFeatureParameters
Geometry information block.
bool m_isAvailable
Is the feature vector available.
bool IsFeatureVectorAvailable() const
Check if all features were calculable.
SliceFeatures(const pandora::PfoList &nuPfos, const pandora::PfoList &crPfos, const SliceFeatureParameters &sliceFeatureParameters)
Constructor.
float GetAdaBoostDecisionTreeScore(const AdaBoostDecisionTree &adaBoostDecisionTree) const
Get the probability that this slice contains a beam particle.
bool IsContained(const pandora::CartesianVector &spacePoint, const float limit) const
Check if a given 3D spacepoint is inside the global LArTPC volume.
void FillFeatureVector(LArMvaHelper::MvaFeatureVector &featureVector) const
Get the feature vector for the SVM.
void GetLArTPCIntercepts(const pandora::CartesianVector &a0, const pandora::CartesianVector &majorAxis, pandora::CartesianVector &interceptOne, pandora::CartesianVector &interceptTwo) const
Find the intercepts of a line with the protoDUNE detector.
LArMvaHelper::MvaFeatureVector m_featureVector
The MVA feature vector.
BdtBeamParticleIdTool()
Constructor.
bool m_useTrainingMode
Should use training mode. If true, training examples will be written to the output file.
void SelectPfos(const pandora::PfoList &pfos, pandora::PfoList &selectedPfos) const
Add the given pfos to the selected Pfo list.
AdaBoostDecisionTree m_adaBoostDecisionTree
The adaptive boost decision tree.
pandora::StatusCode Initialize()
Perform any operations that must occur after reading settings, but before running the process.
void Collect2DHits(const pandora::PfoList &pfos, pandora::CaloHitList &caloHitList, const pandora::CaloHitSet &reconstructableCaloHitSet) const
Collect all 2D hits in a supplied list of Pfos and push them on to an existing hit list,...
void SelectPfosByAdaBDTScore(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, const SliceFeaturesVector &sliceFeaturesVector, pandora::PfoList &selectedPfos) const
Select pfos based on the AdaBDT score that the slice contains a beam particle interaction.
SliceFeatureParameters m_sliceFeatureParameters
Geometry information block.
void SelectAllPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &hypotheses, pandora::PfoList &selectedPfos) const
Select all pfos under the same hypothesis.
float m_minPurity
Minimum purity of the best slice to use event for training.
std::string m_mcParticleListName
Name of input MC particle list.
void GetSliceFeatures(const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, SliceFeaturesVector &sliceFeaturesVector) const
Get the features of each slice.
unsigned int m_maxNeutrinos
The maximum number of neutrinos to select in any one event.
std::string m_caloHitListName
Name of input calo hit list.
bool PassesQualityCuts(const float purity, const float completeness) const
Determine if the event passes the selection cuts for training.
std::unordered_map< const pandora::MCParticle *, int > MCParticleToIntMap
float m_minAdaBDTScore
Minimum score required to classify a slice as a beam particle.
void GetBestMCSliceIndices(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &nuSliceHypotheses, const SliceHypotheses &crSliceHypotheses, pandora::IntVector &bestSliceIndices) const
Get the slice with the most neutrino induced hits using Monte-Carlo information.
std::string m_trainingOutputFile
Output file name for training examples.
std::pair< unsigned int, float > UintFloatPair
void PopulateMCParticleToHitsMap(MCParticleToIntMap &mcParticleToIntMap, const pandora::CaloHitList &caloHitList) const
Fill mc particle to nHits map from calo hit list.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to bdt files.
void SelectOutputPfos(const pandora::Algorithm *const pAlgorithm, const SliceHypotheses &beamSliceHypotheses, const SliceHypotheses &crSliceHypotheses, pandora::PfoList &selectedPfos)
Select which reconstruction hypotheses to use; neutrino outcomes or cosmic-ray muon outcomes for each...
std::vector< SliceFeatures > SliceFeaturesVector
float m_minCompleteness
Minimum completeness of the best slice to use event for training.
static std::string FindFileInPath(const std::string &unqualifiedFileName, const std::string &environmentVariable, const std::string &delimiter=":")
Find the fully-qualified file name by searching through a list of delimiter-separated paths in a name...
bool m_selectInputHits
whether to select input hits
float m_maxPhotonPropagation
the maximum photon propagation length
static unsigned int GetNuanceCode(const pandora::MCParticle *const pMCParticle)
Get the nuance code of an MCParticle.
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
static void SelectCaloHits(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToTargetMCMap, pandora::CaloHitList &selectedCaloHitList, const bool selectInputHits, const float maxPhotonPropagation)
Select a subset of calo hits representing those that represent "reconstructable" regions of the event...
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
static void GetMCPrimaryMap(const pandora::MCParticleList *const pMCParticleList, MCRelationMap &mcPrimaryMap)
Get mapping from individual mc particles (in a provided list) and their primary parent mc particles.
MvaTypes::MvaFeatureVector MvaFeatureVector
static double CalculateClassificationScore(const MvaInterface &classifier, TCONTAINER &&featureContainer)
Use the trained classifer to calculate the classification score of an example (>0 means boolean class...
static pandora::StatusCode ProduceTrainingExample(const std::string &trainingOutputFile, const bool result, TCONTAINER &&featureContainer)
Produce a training example with the given features and result.
std::vector< pandora::CartesianVector > EigenVectors
static void RunPca(const T &t, pandora::CartesianVector ¢roid, EigenValues &outputEigenValues, EigenVectors &outputEigenVectors)
Run principal component analysis using input calo hits (TPC_VIEW_U,V,W or TPC_3D; all treated as 3D p...
static void GetAllConnectedPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively including all daughters and parents associated with those pf...
static void GetCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of calo hits of a particular hit type from a list of pfos.
Algorithm class. Algorithm addresses are held only by the algorithm manager. They have a fully define...
float GetX() const
Get the cartesian x coordinate.
CartesianVector GetUnitVector() const
Get a unit vector in the direction of the cartesian vector.
float GetZ() const
Get the cartesian z coordinate.
float GetDotProduct(const CartesianVector &rhs) const
Get the dot product of the cartesian vector with a second cartesian vector.
float GetOpeningAngle(const CartesianVector &rhs) const
Get the opening angle of the cartesian vector with respect to a second cartesian vector.
float GetY() const
Get the cartesian y coordinate.
float GetCenterY() const
Get center in y, units mm.
float GetWidthZ() const
Get the width in z, units mm.
float GetCenterZ() const
Get center in z, units mm.
float GetCenterX() const
Get center in x, units mm.
float GetWidthX() const
Get the width in x, units mm.
float GetWidthY() const
Get the width in y, units mm.
static const MCParticle * GetMainMCParticle(const T *const pT)
Find the mc particle making the largest contribution to a specified calo hit, track or cluster.
ParticleFlowObject class.
StatusCode AlterMetadata(const object_creation::ParticleFlowObject::Metadata &metadata)
Alter particle flow object metadata parameters.
const Pandora & GetPandora() const
Get the associated pandora instance.
StatusCodeException class.
StatusCode GetStatusCode() const
Get status code.
static StatusCode ReadVectorOfValues(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, std::vector< T > &vector)
Read a vector of values from a (space separated) list in an xml element.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
std::vector< pandora::PfoList > SliceHypotheses
MANAGED_CONTAINER< const MCParticle * > MCParticleList
std::vector< int > IntVector
std::vector< CartesianVector > CartesianPointVector
std::unordered_set< const CaloHit * > CaloHitSet
std::map< unsigned int, const LArTPC * > LArTPCMap
MANAGED_CONTAINER< const CaloHit * > CaloHitList
std::vector< float > FloatVector
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList