9 #include "Pandora/AlgorithmHeaders.h" 31 DLNeutrinoHierarchyAlgorithm::DLNeutrinoHierarchyAlgorithm() :
33 m_trainingMode(false),
34 m_trainingFileName(
"DLHierarchyTrainingFile.root"),
35 m_eventTreeName(
"EventTree"),
36 m_primaryTrackTreeName(
"PrimaryTrackTree"),
37 m_primaryShowerTreeName(
"PrimaryShowerTree"),
38 m_laterTierTrackTrackTreeName(
"LaterTierTrackTrackTree"),
39 m_laterTierTrackShowerTreeName(
"LaterTierTrackShowerTree"),
40 m_mcParticleListName(
"Input"),
41 m_trainingVertexAccuracy(5.
f),
42 m_neutrinoPfoListName(
"NeutrinoParticles3D"),
43 m_pfoListNames({
"TrackParticles3D",
"ShowerParticles3D"}),
87 const ParticleFlowObject *pNeutrinoPfo(
nullptr);
89 return STATUS_CODE_SUCCESS;
92 if (pNeutrinoPfo->GetVertexList().empty())
93 return STATUS_CODE_NOT_INITIALIZED;
103 if ((trackPfos.empty()) && (showerPfos.empty()))
104 return STATUS_CODE_SUCCESS;
107 std::map<const pandora::ParticleFlowObject *, int> particleIDMap;
116 int nPrimaryTrackLinks(0), nPrimaryShowerLinks(0);
117 int nLaterTierTrackTrackLinks(0), nLaterTierTrackShowerLinks(0);
119 this->
FillPrimaryTrees(matchingMap, childToParentPfoMap, pNeutrinoPfo, trackPfos, showerPfos, particleIDMap, nPrimaryTrackLinks, nPrimaryShowerLinks);
120 this->
FillLaterTierTrees(matchingMap, childToParentPfoMap, pNeutrinoPfo, trackPfos, showerPfos, particleIDMap,
121 nLaterTierTrackTrackLinks, nLaterTierTrackShowerLinks);
122 this->
FillEventTree(trackPfos, showerPfos, nPrimaryTrackLinks, nPrimaryShowerLinks, nLaterTierTrackTrackLinks, nLaterTierTrackShowerLinks);
124 return STATUS_CODE_SUCCESS;
152 return STATUS_CODE_SUCCESS;
159 const PfoList *pPfoList(
nullptr);
161 PANDORA_THROW_RESULT_IF_AND_IF(
162 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*
this,
m_neutrinoPfoListName, pPfoList));
164 if (!pPfoList || pPfoList->empty())
168 pNeutrinoPfo = (1 == pPfoList->size()) ? *(pPfoList->begin()) :
nullptr;
170 if (!pNeutrinoPfo || !LArPfoHelper::IsNeutrino(pNeutrinoPfo))
171 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
182 const float pitchU{LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_U)};
183 const float pitchV{LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_V)};
184 const float pitchW{LArGeometryHelper::GetWirePitch(this->GetPandora(), TPC_VIEW_W)};
185 const float slidingFitPitch(std::max({pitchU, pitchV, pitchW}));
191 const PfoList *pPfoList(
nullptr);
193 if (PandoraContentApi::GetList(*
this, pfoListName, pPfoList) != STATUS_CODE_SUCCESS)
196 for (
const ParticleFlowObject *
const pPfo : *pPfoList)
200 pfoVector.emplace_back(pPfo);
205 std::sort(pfoVector.begin(), pfoVector.end(), LArPfoHelper::SortByNHits);
207 for (
const ParticleFlowObject *
const pPfo : pfoVector)
212 ClusterList clusters3D;
213 LArPfoHelper::GetThreeDClusterList(pPfo, clusters3D);
215 if (clusters3D.size() != 1)
227 if (pPfo->GetParticleId() == 13)
229 trackPfos.push_back(
HierarchyPfo(pPfo, slidingFitResult, upstreamPoint, downstreamPoint));
231 else if (pPfo->GetParticleId() == 11)
233 showerPfos.push_back(
HierarchyPfo(pPfo, slidingFitResult, upstreamPoint, downstreamPoint));
249 const Vertex *
const pNeutrinoVertex(LArPfoHelper::GetVertex(pNeutrinoPfo));
250 const CartesianVector nuVertex(
251 pNeutrinoVertex->GetPosition().GetX(), pNeutrinoVertex->GetPosition().GetY(), pNeutrinoVertex->GetPosition().GetZ());
253 if (pPfo->GetParticleId() == 13)
268 if (innerDirection.GetDotProduct(outerVertex - innerVertex) < 0.f)
269 innerDirection *= (-1.
f);
271 if (outerDirection.GetDotProduct(innerVertex - outerVertex) < 0.f)
272 outerDirection *= (-1.
f);
275 if ((innerVertex - nuVertex).GetMagnitudeSquared() < (outerVertex - nuVertex).GetMagnitudeSquared())
277 upstreamPoint.
Set(innerVertex, innerDirection);
278 downstreamPoint.
Set(outerVertex, outerDirection);
282 upstreamPoint.
Set(outerVertex, outerDirection);
283 downstreamPoint.
Set(innerVertex, innerDirection);
294 CartesianVector minLayerDir(0.
f, 0.
f, 0.
f), maxLayerDir(0.
f, 0.
f, 0.
f);
298 if (!minLayerDirSet && !maxLayerDirSet)
306 ExtremalPoint &toChange = (minSepSq < maxSepSq) ? upstreamPoint : downstreamPoint;
312 ExtremalPoint &toChange = (minSepSq < maxSepSq) ? downstreamPoint : upstreamPoint;
324 CartesianPointVector pointVector;
325 LArPfoHelper::GetCoordinateVector(pPfo, TPC_3D, pointVector);
327 if (pointVector.empty())
331 const float angleMin(0.
f), angleMax(2.
f * M_PI);
332 const float binWidth((angleMax - angleMin) / static_cast<float>(
m_nAngularBins));
337 int highestSP(0), bestTheta0YZBin(-1), bestTheta0XZBin(-1);
338 float tieBreaker(std::numeric_limits<float>::max());
340 for (
const CartesianVector &position3D : pointVector)
342 const CartesianVector displacement(position3D - vertex);
343 const float mag(displacement.GetMagnitude());
348 const float magXZ(sqrt((displacement.GetX() * displacement.GetX()) + (displacement.GetZ() * displacement.GetZ())));
350 float theta0YZ((
mag < std::numeric_limits<float>::epsilon()) ? 0.
f 351 : (std::fabs(std::fabs(displacement.GetY() /
mag) - 1.
f) < std::numeric_limits<float>::epsilon())
353 : std::acos(displacement.GetY() /
mag));
355 float theta0XZ((magXZ < std::numeric_limits<float>::epsilon()) ? 0.
f 356 : (std::fabs(std::fabs(displacement.GetX() / magXZ) - 1.
f) < std::numeric_limits<float>::epsilon())
358 : std::acos(displacement.GetX() / magXZ));
361 if (displacement.GetZ() < 0.f)
362 theta0XZ = (2.0 * M_PI) - theta0XZ;
364 const int bin0YZ(std::floor(theta0YZ / binWidth));
365 const int bin0XZ(std::floor(theta0XZ / binWidth));
367 spatialDist[bin0YZ][bin0XZ] += 1;
368 tieBreakerDist[bin0YZ][bin0XZ] += (1.f /
mag);
370 if (((spatialDist[bin0YZ][bin0XZ] == highestSP) && (tieBreakerDist[bin0YZ][bin0XZ] < tieBreaker)) || (spatialDist[bin0YZ][bin0XZ] > highestSP))
372 highestSP = spatialDist[bin0YZ][bin0XZ];
373 tieBreaker = tieBreakerDist[bin0YZ][bin0XZ];
374 bestTheta0YZBin = bin0YZ;
375 bestTheta0XZBin = bin0XZ;
379 if ((bestTheta0YZBin < 0) || (bestTheta0XZBin < 0))
382 const float bestTheta0YZ(angleMin + ((static_cast<float>(bestTheta0YZBin) + 0.5
f) * binWidth));
383 const float bestTheta0XZ(angleMin + ((static_cast<float>(bestTheta0XZBin) + 0.5
f) * binWidth));
385 direction = CartesianVector(std::sin(bestTheta0YZ) * std::cos(bestTheta0XZ), std::cos(bestTheta0YZ), std::sin(bestTheta0YZ) * std::sin(bestTheta0XZ));
396 hierarchyPfo.SetPrimaryScore(this->
GetPrimaryScore(pNeutrinoPfo, trackPfos, hierarchyPfo));
399 hierarchyPfo.SetPrimaryScore(this->
GetPrimaryScore(pNeutrinoPfo, trackPfos, hierarchyPfo));
407 std::vector<DLPrimaryHierarchyTool::DLPrimaryNetworkParams> networkParamVector;
408 float primaryScore(std::numeric_limits<float>::lowest());
410 if (
m_primaryHierarchyTool->
Run(
this, pNeutrinoPfo, trackPfos, hierarchyPfo, networkParamVector, primaryScore) != STATUS_CODE_SUCCESS)
411 return std::numeric_limits<float>::lowest();
419 const bool usePrimaryScore,
const float trackThreshold,
const float showerThreshold,
const bool isLowerThreshold,
423 unsigned int tierIndex(buildPrimaryTier ? 0 : 1);
430 if (!buildPrimaryTier && hierarchy.at(0).empty())
433 PfoVector &thisTier(hierarchy.at(tierIndex));
435 for (
bool isTrack : {
true,
false})
439 for (
HierarchyPfo &childHierarchyPfo : hierarchyPfoVector)
441 const ParticleFlowObject *
const pChildPfo(childHierarchyPfo.GetPfo());
444 if (childHierarchyPfo.GetIsInHierarchy())
447 const ParticleFlowObject *pPredictedParent(pNeutrinoPfo);
450 if (!buildPrimaryTier)
453 if (!childHierarchyPfo.GetPredictedParentPfo())
457 const PfoVector &preceedingTier(hierarchy.at(tierIndex - 1));
459 pPredictedParent = childHierarchyPfo.GetPredictedParentPfo();
461 if (std::find(preceedingTier.begin(), preceedingTier.end(), pPredictedParent) == preceedingTier.end())
466 const float networkScore(usePrimaryScore ? childHierarchyPfo.GetPrimaryScore() : childHierarchyPfo.GetLaterTierScore());
467 const float thresholdScore(isTrack ? trackThreshold : showerThreshold);
469 if ((isLowerThreshold && (networkScore > thresholdScore)) || (!isLowerThreshold && (networkScore < thresholdScore)))
474 thisTier.emplace_back(pChildPfo);
477 childHierarchyPfo.SetIsInHierarchy(
true);
478 childHierarchyPfo.SetParentPfo(pPredictedParent);
481 if (!buildPrimaryTier)
483 const auto iter(std::find(trackPfos.begin(), trackPfos.end(), pPredictedParent));
485 if (iter == trackPfos.end())
486 throw StatusCodeException(STATUS_CODE_FAILURE);
488 iter->AddChildPfo(pChildPfo);
495 if (hierarchy.size() == (tierIndex + 1))
496 hierarchy.push_back(PfoVector());
499 if (buildPrimaryTier)
511 for (
bool isTrack : {
true,
false})
515 for (
HierarchyPfo &childHierarchyPfo : hierarchyPfoVector)
518 if (childHierarchyPfo.GetIsInHierarchy())
522 const Vertex *
const pNeutrinoVertex(LArPfoHelper::GetVertex(pNeutrinoPfo));
523 const CartesianVector nuVertex(
524 pNeutrinoVertex->GetPosition().GetX(), pNeutrinoVertex->GetPosition().GetY(), pNeutrinoVertex->GetPosition().GetZ());
529 float highestScore(std::numeric_limits<float>::lowest());
531 for (
const HierarchyPfo &parentHierarchyPfo : trackPfos)
533 if (childHierarchyPfo == parentHierarchyPfo)
536 const float thisScore(this->
GetLaterTierScore(pNeutrinoPfo, parentHierarchyPfo, childHierarchyPfo));
538 if ((childHierarchyPfo.GetPredictedParentPfo()) && (std::fabs(thisScore - highestScore) < std::numeric_limits<float>::epsilon()))
541 const float currentSep(LArPfoHelper::GetThreeDSeparation(childHierarchyPfo.GetPredictedParentPfo(), childHierarchyPfo.GetPfo()));
542 const float thisSep(LArPfoHelper::GetThreeDSeparation(parentHierarchyPfo.GetPfo(), childHierarchyPfo.GetPfo()));
544 if (thisSep > currentSep)
547 else if (thisScore < highestScore)
552 highestScore = thisScore;
553 childHierarchyPfo.SetLaterTierScore(thisScore);
554 childHierarchyPfo.SetPredictedParentPfo(parentHierarchyPfo.GetPfo());
565 std::vector<DLLaterTierHierarchyTool::DLLaterTierNetworkParams> networkParamVector;
566 float laterTierScore(std::numeric_limits<float>::lowest());
568 if (
m_laterTierHierarchyTool->
Run(
this, pNeutrinoPfo, parentPfo, childPfo, networkParamVector, laterTierScore) != STATUS_CODE_SUCCESS)
569 return std::numeric_limits<float>::lowest();
571 return laterTierScore;
584 const PfoList *pPfoList(
nullptr);
586 if (PandoraContentApi::GetList(*
this, pfoListName, pPfoList) != STATUS_CODE_SUCCESS)
589 for (
const ParticleFlowObject *
const pPfo : *pPfoList)
590 pfoVector.emplace_back(pPfo);
594 std::sort(pfoVector.begin(), pfoVector.end(), LArPfoHelper::SortByNHits);
597 for (
const ParticleFlowObject *
const pPfo : pfoVector)
601 const auto trackIter(std::find(trackPfos.begin(), trackPfos.end(), pPfo));
602 const auto showerIter(std::find(showerPfos.begin(), showerPfos.end(), pPfo));
604 if (trackIter != trackPfos.end())
606 hierarchyPfo = &(*trackIter);
608 else if (showerIter != showerPfos.end())
610 hierarchyPfo = &(*showerIter);
615 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*
this, pNeutrinoPfo, pPfo));
622 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*
this, pNeutrinoPfo, pPfo));
628 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*
this, pNeutrinoPfo, pPfo));
632 std::sort(childPfos.begin(), childPfos.end(), LArPfoHelper::SortByNHits);
635 if ((!childPfos.empty()) && (showerIter != showerPfos.end()))
636 throw StatusCodeException(STATUS_CODE_FAILURE);
638 for (
const ParticleFlowObject *
const pChildPfo : childPfos)
639 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SetPfoParentDaughterRelationship(*
this, pPfo, pChildPfo));
651 const MCParticleList *pMCParticleList(
nullptr);
652 if (PandoraContentApi::GetList(*
this,
m_mcParticleListName, pMCParticleList) != STATUS_CODE_SUCCESS)
655 if (!pMCParticleList || pMCParticleList->empty())
660 LArMCParticleHelper::GetTrueNeutrinos(pMCParticleList, mcNeutrinoVector);
662 if (mcNeutrinoVector.size() != 1)
665 const CartesianVector &trueNuVertex(mcNeutrinoVector.front()->GetVertex());
666 const Vertex *
const pNeutrinoVertex(LArPfoHelper::GetVertex(pNeutrinoPfo));
667 const CartesianVector recoNuVertex(
668 pNeutrinoVertex->GetPosition().GetX(), pNeutrinoVertex->GetPosition().GetY(), pNeutrinoVertex->GetPosition().GetZ());
679 std::map<const ParticleFlowObject *, int> &particleIDMap)
const 684 pfoVector.push_back(hierarchyPfo.GetPfo());
687 pfoVector.push_back(hierarchyPfo.GetPfo());
689 std::sort(pfoVector.begin(), pfoVector.end(), LArPfoHelper::SortByNHits);
691 for (
const ParticleFlowObject *
const pPfo : pfoVector)
692 particleIDMap[pPfo] = particleIDMap.size();
698 const int nPrimaryTrackLinks,
const int nPrimaryShowerLinks,
const int nLaterTierTrackTrackLinks,
const int nLaterTierTrackShowerLinks)
const 700 const int nParticles(trackPfos.size() + showerPfos.size());
702 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"NRecoParticles", nParticles));
704 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"NPrimaryTrackLinks", nPrimaryTrackLinks));
705 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"NPrimaryShowerLinks", nPrimaryShowerLinks));
706 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"NLaterTierTrackTrackLinks", nLaterTierTrackTrackLinks));
707 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"NLaterTierTrackShowerLinks", nLaterTierTrackShowerLinks));
708 PANDORA_MONITORING_API(FillTree(this->GetPandora(),
m_eventTreeName.c_str()));
715 const std::map<const ParticleFlowObject *, int> &particleIDMap,
int &nPrimaryTrackLinks,
int &nPrimaryShowerLinks)
const 719 for (
const bool isTrack : {
true,
false})
724 for (
const HierarchyPfo &hierarchyPfo : hierarchyPfoVector)
726 const ParticleFlowObject *
const pPfo(hierarchyPfo.GetPfo());
729 if (particleIDMap.find(pPfo) == particleIDMap.end())
732 const int particleID(particleIDMap.at(pPfo));
735 bool isNeutronChild(
false);
736 bool isTrainingLink(isTrainingEvent &&
741 bool isTrueLink(
false), trueChildOrientation(
false);
742 if (
m_cheatHierarchyTool->
Run(matchingMap, childToParentPfoMap, pNeutrinoPfo, hierarchyPfo, isTrueLink, trueChildOrientation) != STATUS_CODE_SUCCESS)
748 const MCParticle *
const pMCParticle(matchingMap.at(pPfo));
749 const int matchedPDG(pMCParticle->GetParticleId());
750 const ParticleFlowObject *
const pTrueParentPfo(childToParentPfoMap.at(pPfo).first);
751 const int trueVisibleGen(childToParentPfoMap.at(pPfo).second);
753 int trueParentID(-1);
754 if (pTrueParentPfo != pNeutrinoPfo)
756 if (particleIDMap.find(pTrueParentPfo) == particleIDMap.end())
759 trueParentID = particleIDMap.at(pTrueParentPfo);
763 std::vector<DLPrimaryHierarchyTool::DLPrimaryNetworkParams> networkParamVector;
764 float primaryScore(std::numeric_limits<float>::lowest());
766 if (
m_primaryHierarchyTool->
Run(
this, pNeutrinoPfo, trackPfos, hierarchyPfo, networkParamVector, primaryScore) != STATUS_CODE_SUCCESS)
771 const bool useChildUpstream(std::fabs(networkParams.m_isPOIClosestToNu - 1.f) < std::numeric_limits<float>::epsilon());
773 this->
FillPrimaryTree(treeName, isTrainingLink, isTrueLink, (useChildUpstream == trueChildOrientation), trueVisibleGen,
774 matchedPDG, trueParentID, particleID, networkParams);
776 isTrack ? ++nPrimaryTrackLinks : ++nPrimaryShowerLinks;
785 const bool isOrientationCorrect,
const int trueVisibleGen,
const int truePDG,
const int trueParentID,
const int particleID,
788 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"EventID",
m_eventID));
789 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParticleID", particleID));
790 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"IsTrainingLink", (isTrainingLink ? 1 : 0)));
791 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"IsTrueLink", (isTrueLink ? 1 : 0)));
792 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"IsOrientationCorrect", (isOrientationCorrect ? 1 : 0)));
793 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"TrueVisibleGeneration", trueVisibleGen));
794 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"TruePDG", truePDG));
795 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"TrueVisibleParentID", trueParentID));
796 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"NSpacepoints", primaryNetworkParams.
m_nSpacepoints));
797 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"NuSeparation", primaryNetworkParams.
m_nuSeparation));
798 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"VertexRegionNHits", primaryNetworkParams.
m_vertexRegionNHits));
799 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"VertexRegionNParticles", primaryNetworkParams.
m_vertexRegionNParticles));
800 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"DCA", primaryNetworkParams.
m_dca));
801 PANDORA_MONITORING_API(
802 SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ConnectionExtrapDistance", primaryNetworkParams.
m_connectionExtrapDistance));
803 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"IsPOIClosestToNu", primaryNetworkParams.
m_isPOIClosestToNu));
804 PANDORA_MONITORING_API(
805 SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentConnectionDistance", primaryNetworkParams.
m_parentConnectionDistance));
806 PANDORA_MONITORING_API(
807 SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildConnectionDistance", primaryNetworkParams.
m_childConnectionDistance));
808 PANDORA_MONITORING_API(FillTree(this->GetPandora(), treeName.c_str()));
815 const std::map<const ParticleFlowObject *, int> &particleIDMap,
int &nTrackLinks,
int &nShowerLinks)
const 819 for (
const HierarchyPfo &hierarchyParentPfo : trackPfos)
821 const ParticleFlowObject *
const pParentPfo(hierarchyParentPfo.GetPfo());
823 for (
const bool isTrack : {
true,
false})
828 for (
const HierarchyPfo &hierarchyChildPfo : hierarchyPfoVector)
830 const ParticleFlowObject *
const pChildPfo(hierarchyChildPfo.GetPfo());
832 if (pParentPfo == pChildPfo)
836 if ((particleIDMap.find(pParentPfo) == particleIDMap.end()) || (particleIDMap.find(pChildPfo) == particleIDMap.end()))
841 const int parentID(particleIDMap.at(pParentPfo));
842 const int childID(particleIDMap.at(pChildPfo));
845 bool isTruePrimaryLink(
false), tempBool(
false);
846 if (
m_cheatHierarchyTool->
Run(matchingMap, childToParentPfoMap, pNeutrinoPfo, hierarchyChildPfo, isTruePrimaryLink, tempBool) != STATUS_CODE_SUCCESS)
852 bool isTrainingLink(isTrainingEvent && !isTruePrimaryLink);
856 bool isTrueLink(
false), trueParentOrientation(
false), trueChildOrientation(
false);
857 if (
m_cheatHierarchyTool->
Run(matchingMap, childToParentPfoMap, hierarchyParentPfo, hierarchyChildPfo, isTrueLink,
858 trueParentOrientation, trueChildOrientation) != STATUS_CODE_SUCCESS)
864 const int trueVisibleGen(childToParentPfoMap.at(pChildPfo).second);
867 trueParentOrientation = !trueParentOrientation;
870 float laterTierScore(std::numeric_limits<float>::lowest());
871 std::vector<DLLaterTierHierarchyTool::DLLaterTierNetworkParams> networkParamVector;
873 if (
m_laterTierHierarchyTool->
Run(
this, pNeutrinoPfo, hierarchyParentPfo, hierarchyChildPfo, networkParamVector, laterTierScore) != STATUS_CODE_SUCCESS)
877 int nCorrectLinkOrientation(0);
880 const bool useParentUpstream(std::fabs(networkParams.m_parentIsPOIClosestToNu - 1.f) < std::numeric_limits<float>::epsilon());
881 const bool useChildUpstream(std::fabs(networkParams.m_childIsPOIClosestToNu - 1.f) < std::numeric_limits<float>::epsilon());
882 const bool isOrientationCorrect((useParentUpstream == trueParentOrientation) && (useChildUpstream == trueChildOrientation));
884 if (isOrientationCorrect)
885 ++nCorrectLinkOrientation;
889 isTrainingLink = (isTrainingLink && (nCorrectLinkOrientation == 1));
892 std::pair<float, float> trainingCuts({std::numeric_limits<float>::lowest(), std::numeric_limits<float>::lowest()});
895 trainingCuts = this->
GetTrainingCuts(hierarchyParentPfo, hierarchyChildPfo, trueParentOrientation, trueChildOrientation);
899 const bool useParentUpstream(std::fabs(networkParams.m_parentIsPOIClosestToNu - 1.f) < std::numeric_limits<float>::epsilon());
900 const bool useChildUpstream(std::fabs(networkParams.m_childIsPOIClosestToNu - 1.f) < std::numeric_limits<float>::epsilon());
901 const bool isOrientationCorrect((useParentUpstream == trueParentOrientation) && (useChildUpstream == trueChildOrientation));
903 this->
FillLaterTierTree(treeName, isTrainingLink, isTrueLink, isOrientationCorrect, trueVisibleGen, trainingCuts,
904 parentID, childID, networkParams);
906 isTrack ? ++nTrackLinks : ++nShowerLinks;
916 const HierarchyPfo &childHierarchyPfo,
const bool trueParentOrientation,
const bool trueChildOrientation)
const 918 std::pair<float, float> trainingCuts({std::numeric_limits<float>::lowest(), std::numeric_limits<float>::lowest()});
930 const bool isOrientationCorrect,
const int childTrueGen,
const std::pair<float, float> &trainingCuts,
const int parentID,
933 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"EventID",
m_eventID));
934 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentParticleID", parentID));
935 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildParticleID", childID));
936 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"IsTrainingLink", (isTrainingLink ? 1 : 0)));
937 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"IsTrueLink", (isTrueLink ? 1 : 0)));
938 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"IsOrientationCorrect", (isOrientationCorrect ? 1 : 0)));
939 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildTrueVisibleGeneration", childTrueGen));
940 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"TrainingCutL", trainingCuts.first));
941 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"TrainingCutT", trainingCuts.second));
942 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentTrackScore", networkParams.
m_parentTrackScore));
943 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildTrackScore", networkParams.
m_childTrackScore));
944 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentNSpacepoints", networkParams.
m_parentNSpacepoints));
945 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildNSpacepoints", networkParams.
m_childNSpacepoints));
946 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"Separation3D", networkParams.
m_separation3D));
947 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentNuVertexSep", networkParams.
m_parentNuVertexSep));
948 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildNuVertexSep", networkParams.
m_childNuVertexSep));
949 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentEndRegionNHits", networkParams.
m_parentEndRegionNHits));
950 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentEndRegionNParticles", networkParams.
m_parentEndRegionNParticles));
951 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentEndRegionRToWall", networkParams.
m_parentEndRegionRToWall));
952 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"VertexSeparation", networkParams.
m_vertexSeparation));
953 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"DoesChildConnect", networkParams.
m_doesChildConnect));
954 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"OvershootStartDCA", networkParams.
m_overshootStartDCA));
955 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"OvershootStartL", networkParams.
m_overshootStartL));
956 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"OvershootEndDCA", networkParams.
m_overshootEndDCA));
957 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"OvershootEndL", networkParams.
m_overshootEndL));
958 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildCPDCA", networkParams.
m_childCPDCA));
959 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildCPExtrapDistance", networkParams.
m_childCPExtrapDistance));
960 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildCPLRatio", networkParams.
m_childCPLRatio));
961 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentCPNUpstreamHits", networkParams.
m_parentCPNUpstreamHits));
962 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentCPNDownstreamHits", networkParams.
m_parentCPNDownstreamHits));
963 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentCPNHitRatio", networkParams.
m_parentCPNHitRatio));
964 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentCPEigenvalueRatio", networkParams.
m_parentCPEigenvalueRatio));
965 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentCPOpeningAngle", networkParams.
m_parentCPOpeningAngle));
966 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ParentIsPOIClosestToNu", networkParams.
m_parentIsPOIClosestToNu));
967 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), treeName.c_str(),
"ChildIsPOIClosestToNu", networkParams.
m_childIsPOIClosestToNu));
968 PANDORA_MONITORING_API(FillTree(this->GetPandora(), treeName.c_str()));
977 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EventID",
m_eventID));
978 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TrainingMode",
m_trainingMode));
979 PANDORA_RETURN_RESULT_IF_AND_IF(
980 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MCParticleListName",
m_mcParticleListName));
981 PANDORA_RETURN_RESULT_IF_AND_IF(
982 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TrainingVertexAccuracy",
m_trainingVertexAccuracy));
983 PANDORA_RETURN_RESULT_IF_AND_IF(
984 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"TrainingFileName",
m_trainingFileName));
985 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"EventTreeName",
m_eventTreeName));
986 PANDORA_RETURN_RESULT_IF_AND_IF(
987 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"PrimaryTrackTreeName",
m_primaryTrackTreeName));
988 PANDORA_RETURN_RESULT_IF_AND_IF(
989 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"PrimaryShowerTreeName",
m_primaryShowerTreeName));
990 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
992 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
994 PANDORA_RETURN_RESULT_IF_AND_IF(
995 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"NeutrinoPfoListName",
m_neutrinoPfoListName));
996 PANDORA_RETURN_RESULT_IF_AND_IF(
997 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
"PfoListNames",
m_pfoListNames));
998 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinClusterSize",
m_minClusterSize));
999 PANDORA_RETURN_RESULT_IF_AND_IF(
1000 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"SlidingFitWindow",
m_slidingFitWindow));
1001 PANDORA_RETURN_RESULT_IF_AND_IF(
1002 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"RegionForDirectionFit",
m_regionForDirFit));
1003 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"NAngularBins",
m_nAngularBins));
1004 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"PrimaryRegion",
m_primaryRegion));
1005 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1007 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1009 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1011 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1013 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1015 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1017 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1019 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
1022 AlgorithmTool *pAlgorithmTool(
nullptr);
1023 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmTool(*
this, xmlHandle,
"DLPrimaryHierarchyTool", pAlgorithmTool));
1027 return STATUS_CODE_INVALID_PARAMETER;
1029 pAlgorithmTool =
nullptr;
1030 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmTool(*
this, xmlHandle,
"DLLaterTierHierarchyTool", pAlgorithmTool));
1034 return STATUS_CODE_INVALID_PARAMETER;
1038 pAlgorithmTool =
nullptr;
1039 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmTool(*
this, xmlHandle,
"DLCheatHierarchyTool", pAlgorithmTool));
1043 return STATUS_CODE_INVALID_PARAMETER;
1046 return STATUS_CODE_SUCCESS;
float m_parentNuVertexSep
the separation between the neutrino vertex and assumed parent start point
void Set(const pandora::CartesianVector &position, const pandora::CartesianVector &direction)
Set the the extremal point's position and direction.
float m_primaryThresholdTrackPass2
The threshold applied to tracks in pass 2 primary tier building.
float m_primaryThresholdShowerPass2
The threshold applied to showers in pass 2 primary tier building.
float m_parentCPEigenvalueRatio
the ratio of the second eigenvalues of the downstream and upstream 3D hit groups (set if the child co...
Header file for the pfo helper class.
void FillEventTree(const HierarchyPfoVector &trackPfos, const HierarchyPfoVector &showerPfos, const int nPrimaryTrackLinks, const int nPrimaryShowerLinks, const int nLaterTierTrackTrackLinks, const int nLaterTierTrackShowerLinks) const
Fill the output event tree (containing event-level info)
float m_overshootEndL
the extension distance of the child to the DCA point (set if the child doesn't connect) ...
Header file for the lar pointing cluster class.
float m_laterTierThresholdTrackPass2
The threshold applied to track-track links in pass 2 later tier building.
void FillHierarchyMap(const pandora::Algorithm *const pAlgorithm, PfoToMCParticleMap &pfoToMCParticleMap, ChildToParentPfoMap &childToParentPfoMap) const
Determine the true child -> parent pfo visible matches, filling the pfo->MCParticle matching map in t...
std::string m_primaryTrackTreeName
the name of the output primary track link tree
bool ShouldTrainOnEvent(const pandora::ParticleFlowObject *const pNeutrinoPfo) const
Whether the event should be trained on.
float m_overshootStartL
the extension distance of the child to the DCA point (set if the child doesn't connect) ...
void FillPrimaryTree(const std::string &treeName, const bool isTrainingLink, const bool isTrueLink, const bool isOrientationCorrect, const int trueVisibleGen, const int truePDG, const int trueParentID, const int particleID, const DLPrimaryHierarchyTool::DLPrimaryNetworkParams &primaryNetworkParams) const
Enter an entry into the specified primary tree.
Header file for lar pfo objects.
int m_eventID
the event counter
void FillPrimaryTrees(const PfoToMCParticleMap &matchingMap, const ChildToParentPfoMap &childToParentPfoMap, const pandora::ParticleFlowObject *const pNeutrinoPfo, const HierarchyPfoVector &trackPfos, const HierarchyPfoVector &showerPfos, const std::map< const pandora::ParticleFlowObject *, int > &particleIDMap, int &nPrimaryTrackLinks, int &nPrimaryShowerLinks) const
Fill the primary trees (containing primary link info)
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
pandora::StringVector m_pfoListNames
the name of the pfo lists
float m_childCPDCA
the DCA of the child to the connection point (set if the child connects)
float m_parentEndRegionNHits
the number of 3D hits 'close to' the parent POI
void FillLaterTierTrees(const PfoToMCParticleMap &matchingMap, const ChildToParentPfoMap &childToParentPfoMap, const pandora::ParticleFlowObject *const pNeutrinoPfo, const HierarchyPfoVector &trackPfos, const HierarchyPfoVector &showerPfos, const std::map< const pandora::ParticleFlowObject *, int > &particleIDMap, int &nTrackLinks, int &nShowerLinks) const
Fill the later tier trees (containing later tier link info)
float m_parentEndRegionNParticles
the number of different particles 'close to' the parent POI
std::string m_primaryShowerTreeName
the name of the output primary shower link tree
void FillTrackShowerVectors(const pandora::ParticleFlowObject *const pNeutrinoPfo, HierarchyPfoVector &trackPfos, HierarchyPfoVector &showerPfos) const
Fill the track and shower-like HierarchyPfoVector.
pandora::StatusCode Run(const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pNeutrinoPfo, const HierarchyPfo &parentHierarchyPfo, const HierarchyPfo &childHierarchyPfo, std::vector< DLLaterTierNetworkParams > &networkParamVector, float &laterTierScore)
float m_primaryThresholdTrackPass1
The threshold applied to tracks in pass 1 primary tier building.
std::string m_mcParticleListName
the name of the MCParticle list
Header file for the HierarchyPfo class.
float m_parentCPNHitRatio
the ratio of the number of downstream hits and upstream 3D hits (set if the child connects) ...
pandora::StatusCode Run(const PfoToMCParticleMap &pfoToMCParticleMap, const ChildToParentPfoMap &childToParentPfoMap, const HierarchyPfo &parentPfo, const HierarchyPfo &childPfo, bool &isTrueLink, bool &trueParentOrientation, bool &trueChildOrientation)
float m_overshootStartDCA
the DCA of the child to the parent startpoint (set if the child doesn't connect)
float m_separation3D
the smallest 3D distance between the parent and child 3D hits
std::string m_laterTierTrackTrackTreeName
the name of the output track-track later tier link tree
void BuildPandoraHierarchy(const pandora::ParticleFlowObject *const pNeutrinoPfo, const HierarchyPfoVector &trackPfos, const HierarchyPfoVector &showerPfos) const
Register the parent-child relationships in Pandora.
float m_vertexSeparation
the separation between the parent and child POIs
std::map< const pandora::ParticleFlowObject *, std::pair< const pandora::ParticleFlowObject *, int > > ChildToParentPfoMap
pandora::StatusCode Run()
LArPointingCluster class.
std::vector< HierarchyPfo > HierarchyPfoVector
DLCheatHierarchyTool to calculate variables related to the initial shower region. ...
void GetParticleIDMap(const HierarchyPfoVector &trackPfos, const HierarchyPfoVector &showerPfos, std::map< const pandora::ParticleFlowObject *, int > &particleIDMap) const
Obtain the [pfo -> unique ID] map.
float GetLaterTierScore(const pandora::ParticleFlowObject *const pNeutrinoPfo, const HierarchyPfo &parentPfo, const HierarchyPfo &childPfo) const
Call the later tier network tool to obtain the later tier score of a parent-child link...
float m_overshootEndDCA
the DCA of the child to the parent endpoint (set if the child doesn't connect)
float m_vertexRegionNHits
the number of 3D hits 'close to' the POI
float m_parentCPNUpstreamHits
the number of 3D parent hits upstream of the connection point (set if the child connects) ...
~DLNeutrinoHierarchyAlgorithm()
Default destructor.
Header file for the geometry helper class.
float m_parentCPOpeningAngle
the opening angle between the first eigenvectors of the downstream and upstream 3D hit groups (set if...
float m_dca
the distance of closest approach from the POI to the nu vertex
const pandora::ParticleFlowObject * GetParentPfo() const
Get the parent pfo.
const ExtremalPoint & GetUpstreamPoint() const
Get the upstream extremal point.
Header file for the lar monte carlo particle helper helper class.
const ExtremalPoint & GetDownstreamPoint() const
Get the downstream extremal point.
const Vertex & GetOuterVertex() const
Get the outer vertex.
std::string m_neutrinoPfoListName
the name of the neutrino pfo list
bool GetExtremalVerticesAndDirections(const pandora::ParticleFlowObject *const pNeutrinoPfo, const pandora::ParticleFlowObject *const pPfo, const ThreeDSlidingFitResult &slidingFitResult, ExtremalPoint &upstreamPoint, ExtremalPoint &downstreamPoint) const
Identify the upstream (closest to the nu vertex) and downstream (furthest from the nu vertex) endpoin...
pandora::StatusCode IsNeutronChild(const pandora::ParticleFlowObject *const pPfo, const PfoToMCParticleMap &pfoToMCParticleMap, bool &isNeutronChild) const
Whether the true invisible parent of a particle is a neutron.
const Vertex & GetInnerVertex() const
Get the inner vertex.
float m_parentCPNDownstreamHits
the number of 3D parent hits downstream of the connection point (set if the child connects) ...
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
std::string m_laterTierTrackShowerTreeName
the name of the output track-shower later tier link tree
std::string m_trainingFileName
the name of the output training file
DLLaterTierHierarchyTool to apply the later-tier hierarchy DL networks.
float m_nSpacepoints
the number of 3D spacepoints
float m_parentEndRegionRToWall
the smallest parent POI to detector boundary separation
pandora::StatusCode Run(const pandora::Algorithm *const pAlgorithm, const pandora::ParticleFlowObject *const pNeutrinoPfo, const HierarchyPfoVector &trackPfos, const HierarchyPfo &hierarchyPfo, std::vector< DLPrimaryNetworkParams > &networkParamVector, float &primaryScore)
const pandora::CartesianVector & GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
bool GetNeutrinoPfo(const pandora::ParticleFlowObject *&pNeutrinoPfo) const
Return the neutrino pfo.
float m_parentTrackScore
the track/shower score of the parent pfo
bool m_trainingMode
whether to run in training mode
Header file for the lar three dimensional sliding fit result class.
float m_primaryRegion
the radius of the nu vertex region where particles are assumed to be primaries
const pandora::CartesianVector & GetDirection() const
Get the vertex direction.
float m_primaryThresholdShowerPass1
The threshold applied to showers in pass 1 primary tier building.
float m_nuSeparation
the sep. between the POI and the nu vertex
Header file for the DL neutrino hierarchy algorithm class.
std::vector< pandora::PfoVector > Hierarchy
float m_childTrackScore
the track/shower score of the child pfo
float m_doesChildConnect
whether the backwards trace of the child's path connects to the parent
void FillLaterTierTree(const std::string &treeName, const bool isTrainingLink, const bool isTrueLink, const bool isOrientationCorrect, const int childTrueGen, const std::pair< float, float > &trainingCuts, const int parentID, const int childID, const DLLaterTierHierarchyTool::DLLaterTierNetworkParams &networkParams) const
Enter an entry into the specified later tier tree.
float m_isPOIClosestToNu
whether the POI is that closest to the nu vertex
std::pair< float, float > GetTrainingCuts(const HierarchyPfo &parentHierarchyPfo, const HierarchyPfo &childHierarchyPfo, const bool trueParentOrientation, const bool trueChildOrientation) const
Get the training cuts for the later tier parent-child link these describe how well the child points b...
float m_connectionExtrapDistance
the sep. between the POI and the DCA point
ThreeDSlidingFitResult class.
int m_slidingFitWindow
the sliding fit window to use in pfo sliding linear fits
DLLaterTierHierarchyTool * m_laterTierHierarchyTool
The tool used to build the later tiers.
void CalculateConnectionDistances(const ExtremalPoint &parentPoint, const ExtremalPoint &childPoint, float &parentConnectionDistance, float &childConnectionDistance) const
Calculate the variables describing the extension of a child particle to a given parent (m_parentConne...
float m_childConnectionDistance
the sep. between the POI and the extension point for m_parentConnectionDistance
float m_regionForDirFit
the radius of the region used in shower direction fits
float m_laterTierThresholdTrackPass1
The threshold applied to track-track links in pass 1 later tier building.
void SetLaterTierScores(const pandora::ParticleFlowObject *const pNeutrinoPfo, HierarchyPfoVector &trackPfos, HierarchyPfoVector &showerPfos) const
Set the predicted parent and later tier score of the HierarchyPfos to be considered for the later tie...
DLPrimaryHierarchyTool * m_primaryHierarchyTool
The tool used to build the primary tiers.
std::string m_eventTreeName
the name of the output event tree
float m_childCPLRatio
the ratio of the parent length at the connection point and the full parent length (set if the child c...
unsigned int m_minClusterSize
the minimum threshold of 3D hits of a considered pfo
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
float m_vertexRegionNParticles
the number of different particles 'close to' the POI
DLPrimaryHierarchyTool to apply the primary hierarchy DL networks.
float m_laterTierThresholdShowerPass2
The threshold applied to track-shower links in pass 2 later tier building.
DLCheatHierarchyTool * m_cheatHierarchyTool
The tool used to obtain the true hierarchy.
bool GetShowerDirection(const pandora::ParticleFlowObject *const pPfo, const pandora::CartesianVector &vertex, pandora::CartesianVector &direction) const
Obtain the direction of a shower at a given endpoint from the angular decomposition of the shower's '...
float m_childCPExtrapDistance
the extension distance of the child to the DCA point (set if the child connects)
float m_childNSpacepoints
the number of 3D hits in the child pfo
bool GetIsInHierarchy() const
Get whether the pfo has been assigned to a particle hierarchy.
float m_parentIsPOIClosestToNu
whether the parent POI is that closest to the neutrino vertex
int m_nAngularBins
the number of angle bins used by the shower direction fitter
std::map< const pandora::ParticleFlowObject *, const pandora::MCParticle * > PfoToMCParticleMap
float GetPrimaryScore(const pandora::ParticleFlowObject *const pNeutrinoPfo, const HierarchyPfoVector &trackPfos, const HierarchyPfo &hierarchyPfo) const
Call the primary network tool to obtain the primary score of a HierarchyPfo.
float m_trainingVertexAccuracy
the maximum true-reco nu vertex displacement allowed for training
const pandora::CartesianVector & GetPosition() const
Get the vertex position.
void SetPrimaryScores(const pandora::ParticleFlowObject *const pNeutrinoPfo, HierarchyPfoVector &trackPfos, HierarchyPfoVector &showerPfos) const
Set the primary network scores of the HierarchyPfos.
float m_parentNSpacepoints
the number of 3D hits in the parent pfo
float m_childIsPOIClosestToNu
whether the child POI is that closest to the neutrino vertex
float m_childNuVertexSep
the separation between the neutrino vertex and assumed child start point
float m_parentConnectionDistance
the DCA to the most likely parent pfo endpoint
void UpdateHierarchy(const pandora::ParticleFlowObject *const pNeutrinoPfo, const bool buildPrimaryTier, const bool usePrimaryScore, const float trackThreshold, const float showerThreshold, const bool isLowerThreshold, HierarchyPfoVector &trackPfos, HierarchyPfoVector &showerPfos, Hierarchy &hierarchy) const
Add particles to the hierarchy if they satisfy a criteria.
const pandora::PfoVector & GetChildPfoVector() const
Get the vector of child pfos.
float m_laterTierThresholdShowerPass1
The threshold applied to track-shower links in pass 1 later tier building.
const pandora::CartesianVector & GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.