8 #ifndef LAR_HIERARCHY_HELPER_H 9 #define LAR_HIERARCHY_HELPER_H 1 11 #include "Pandora/PandoraInternal.h" 13 #include "Helpers/MCParticleHelper.h" 80 QualityCuts(
const float minPurity,
const float minCompleteness,
const bool selectRecoHits =
false);
117 ReconstructabilityCriteria(
const unsigned int minHits,
const unsigned int minHitsForGoodView,
const unsigned int minGoodViews,
118 const bool removeNeutrons);
144 Node(
MCHierarchy &hierarchy,
const pandora::MCParticle *pMCParticle,
const int tier = 1);
154 Node(
MCHierarchy &hierarchy,
const pandora::MCParticleList &mcParticleList,
const pandora::CaloHitList &caloHitList,
const int tier = 1);
166 bool IsReconstructable()
const;
174 void FillHierarchy(
const pandora::MCParticle *pRoot,
const FoldingParameters &foldParameters);
181 void FillFlat(
const pandora::MCParticle *pRoot);
188 const NodeVector &GetChildren()
const;
202 const pandora::MCParticle *GetLeadingMCParticle()
const;
209 const pandora::MCParticleList &GetMCParticles()
const;
216 const pandora::CaloHitList &GetCaloHits()
const;
223 int GetParticleId()
const;
230 int GetHierarchyTier()
const;
237 bool IsNeutrinoInduced()
const;
244 bool IsTestBeamParticle()
const;
251 bool IsCosmicRay()
const;
258 bool IsLeadingLepton()
const;
265 const std::string ToString(
const std::string &prefix)
const;
271 void SetLeadingLepton();
325 void FillHierarchy(
const pandora::MCParticleList &mcParticleList,
const pandora::CaloHitList &caloHitList,
const FoldingParameters &foldParameters);
336 void InterpretHierarchy(
const pandora::MCParticle *
const pRoot, pandora::MCParticleList &leadingParticles,
337 pandora::MCParticleList &childParticles,
const float cosAngleTolerance)
const;
344 const pandora::MCParticle *GetNeutrino()
const;
353 const NodeVector &GetInteractions(
const pandora::MCParticle *pRoot)
const;
360 void GetRootMCParticles(pandora::MCParticleList &rootMCParticles)
const;
368 void GetFlattenedNodes(
const pandora::MCParticle *
const pRoot, NodeVector &nodeVector)
const;
375 void RegisterNode(
const Node *pNode);
382 const std::string ToString()
const;
393 void CollectContinuations(
const pandora::MCParticle *pRoot, pandora::MCParticleList &continuingParticles,
394 pandora::MCParticleList &childParticles,
const float cosAngleTolerance)
const;
403 bool IsReconstructable(
const pandora::MCParticle *pMCParticle)
const;
412 bool IsReconstructable(
const pandora::CaloHitList &caloHits)
const;
445 Node(
const RecoHierarchy &hierarchy,
const pandora::ParticleFlowObject *pPfo,
const int tier = 1);
455 Node(
const RecoHierarchy &hierarchy,
const pandora::PfoList &pfoList,
const pandora::CaloHitList &caloHitList,
const int tier = 1);
468 void FillHierarchy(
const pandora::ParticleFlowObject *pRoot,
const FoldingParameters &foldParameters);
475 void FillFlat(
const pandora::ParticleFlowObject *pRoot);
482 const NodeVector &GetChildren()
const;
489 const pandora::PfoList &GetRecoParticles()
const;
496 const pandora::ParticleFlowObject *GetLeadingPfo()
const;
503 const pandora::CaloHitList &GetCaloHits()
const;
511 int GetParticleId()
const;
518 int GetHierarchyTier()
const;
525 const std::string ToString(
const std::string &prefix)
const;
569 void FillHierarchy(
const pandora::PfoList &pfoList,
const FoldingParameters &foldParameters);
578 const NodeVector &GetInteractions(
const pandora::ParticleFlowObject *pRoot)
const;
585 void GetRootPfos(pandora::PfoList &rootPfos)
const;
593 void GetFlattenedNodes(
const pandora::ParticleFlowObject *
const pRoot, NodeVector &nodeVector)
const;
600 const pandora::ParticleFlowObject *GetNeutrino()
const;
607 const std::string ToString()
const;
635 void AddRecoMatch(
const RecoHierarchy::Node *pReco,
const int nSharedHits,
const pandora::CaloHitList &selectedRecoHits);
698 float GetCompleteness(
const RecoHierarchy::Node *pReco,
const bool adcWeighted =
false)
const;
716 size_t GetNRecoMatches()
const;
725 bool IsQuality(
const QualityCuts &qualityCuts)
const;
737 float GetPurity(
const pandora::CaloHitVector &intersection,
const pandora::CaloHitList &recoHits,
const bool adcWeighted)
const;
748 float GetCompleteness(
const pandora::CaloHitVector &intersection,
const pandora::CaloHitList &mcHits,
const bool adcWeighted)
const;
795 const MCMatchesVector &GetMatches(
const pandora::MCParticle *
const pRoot)
const;
809 unsigned int GetNMCNodes(
const pandora::MCParticle *
const pRoot)
const;
818 unsigned int GetNNeutrinoMCNodes(
const pandora::MCParticle *
const pRoot)
const;
827 unsigned int GetNCosmicRayMCNodes(
const pandora::MCParticle *
const pRoot)
const;
836 unsigned int GetNTestBeamMCNodes(
const pandora::MCParticle *
const pRoot)
const;
857 void GetRootMCParticles(pandora::MCParticleList &rootMCParticles)
const;
874 const pandora::CaloHitList GetSelectedRecoHits(
const RecoHierarchy::Node *pRecoNode,
const pandora::CaloHitList &allMCHits)
const;
900 static void FillMCHierarchy(
const pandora::MCParticleList &mcParticleList,
const pandora::CaloHitList &caloHitList,
921 typedef std::set<const pandora::ParticleFlowObject *>
PfoSet;
929 static void GetMCPrimaries(
const pandora::MCParticle *pRoot, MCParticleSet &primaries);
937 static void GetRecoPrimaries(
const pandora::ParticleFlowObject *pRoot, PfoSet &primaries);
952 return m_mcParticles;
966 return m_mainParticle;
994 return m_isLeadingLepton;
1001 m_isLeadingLepton =
true;
1032 return m_pMCParticle;
1046 return m_recoNodes.size();
1054 if (m_matches.find(pRoot) == m_matches.end())
1055 throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
1057 return m_matches.at(pRoot);
1064 return m_unmatchedReco;
1071 return m_mcHierarchy;
1078 return m_recoHierarchy;
1085 return m_qualityCuts;
1090 #endif // #ifndef LAR_HIERARCHY_HELPER_H static void GetRecoPrimaries(const pandora::ParticleFlowObject *pRoot, PfoSet &primaries)
Retrieves the primary PFOs from a list and returns the root (neutrino) for hierarchy, if it exists.
int m_tier
The hierarchy tier for this node.
const unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
std::set< const pandora::MCParticle * > MCParticleSet
FoldingParameters()
Default constructor.
Header file for the pfo helper class.
const MCMatchesVector & GetMatches(const pandora::MCParticle *const pRoot) const
Retrieve the vector of matches (this will include null matches - i.e. MC nodes with no corresponding ...
const RecoHierarchy & GetRecoHierarchy() const
Retrieve the reco hierarchy used for the matching.
const MCHierarchy::Node * m_pMCParticle
MC node associated with any matches.
const NodeVector & GetChildren() const
Return the vector of children for this node.
bool m_foldToTier
Whether or not to apply folding based on particle tier.
int m_tier
If folding to a tier, the tier to be combined with its child particles.
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
const pandora::ParticleFlowObject * GetLeadingPfo() const
Retrieve the leading reco particle for this node.
std::vector< const Node * > NodeVector
pandora::IntVector m_sharedHits
Number of shared hits for each match.
int m_pdg
The PDG code of the leading MC particle for this node.
std::map< const pandora::MCParticle *, pandora::CaloHitList > m_mcToHitsMap
The map between MC particles and calo hits.
static void GetMCPrimaries(const pandora::MCParticle *pRoot, MCParticleSet &primaries)
Retrieves the primary MC particles from a list and returns the root (neutrino) for hierarchy...
const RecoHierarchy & m_hierarchy
The parent reco hierarchy.
const RecoHierarchy::NodeVector & GetRecoMatches() const
Retrieve the vector of matched reco nodes.
int m_pdg
The particle ID (track = muon, shower = electron)
std::map< const pandora::ParticleFlowObject *, NodeVector > RecoNodeVectorMap
QualityCuts m_qualityCuts
The quality cuts to be applied to matches.
std::map< const RecoHierarchy::Node *, const pandora::CaloHitList > SelectedRecoHitsMap
std::vector< int > IntVector
size_t GetNRecoMatches() const
Get the number of reco nodes matched (both above and below quality cut thresholds) to the MC node...
int GetHierarchyTier() const
Retrieve the hierarchy tier of this node.
const pandora::CaloHitList & GetCaloHits() const
Retrieve the CaloHits associated with this node.
bool m_isLeadingLepton
Whether or not this node is the leading lepton.
static void MatchHierarchies(MatchInfo &matchInfo)
Finds the matches between reconstructed and MC hierarchies.
pandora::CaloHitList m_caloHits
The list of calo hits of which this node is composed.
SelectedRecoHitsMap m_selectedRecoHitsMap
Map storing the selected CaloHits for a given reco node.
const MCHierarchy::Node * GetMC() const
Retrieve the MC node.
static void FillRecoHierarchy(const pandora::PfoList &pfoList, const FoldingParameters &foldParameters, RecoHierarchy &hierarchy)
Fill a reconstructed hierarchy based on the specified folding criteria (see RecoHierarchy::FillHierar...
const pandora::MCParticle * GetLeadingMCParticle() const
Retrieve the leading MC particle associated with this node.
std::vector< const Node * > NodeVector
Header file for the lar monte carlo particle helper helper class.
const bool m_selectRecoHits
Whether to only use reco hits that overlap with the MC particle hits.
RecoNodeVectorMap m_interactions
Map from the root PFO (e.g. neutrino) to primaries.
const float m_minPurity
The minimum purity for a match to be considered good.
NodeVector m_children
The child nodes of this node.
ReconstructabilityCriteria class.
bool IsCosmicRay() const
Check if this is a cosmic ray particle.
std::list< const Node * > NodeList
int GetParticleId() const
Retrieve the PDG code for the leading particle in this node.
pandora::PfoList m_pfos
The list of PFOs of which this node is composed.
float m_cosAngleTolerance
Cosine of the maximum angle at which topologies can be considered continuous.
void Print(G4Element &ele)
NodeVector m_children
The child nodes of this node.
LArHierarchyHelper class.
const QualityCuts & GetQualityCuts() const
Retrieve the quality cuts for matching.
bool IsLeadingLepton() const
Returns whether or not this particle is the leading lepton in the event.
bool m_foldDynamic
Whether or not to use process and topological information to make folding decisions.
const RecoHierarchy::NodeVector & GetUnmatchedReco() const
Retrieve the vector of unmatched reco nodes.
ReconstructabilityCriteria m_recoCriteria
The criteria used to determine if the node is reconstructable.
const NodeVector & GetChildren() const
Return the vector of children for this node.
bool m_foldToLeadingShowers
Whether or not to fold shower children to the leading shower particle.
MCHierarchy & m_hierarchy
The parent MC hierarchy.
const bool m_removeNeutrons
whether to remove neutrons and their downstream particles
int GetHierarchyTier() const
Retrieve the hierarchy tier of this node.
const pandora::MCParticle * m_mainParticle
The leading MC particle for this node.
const pandora::ParticleFlowObject * m_mainPfo
The leading particle flow object for this node.
std::vector< MCMatches > MCMatchesVector
pandora::CaloHitList m_caloHits
The list of calo hits of which this node is composed.
const MCHierarchy & GetMCHierarchy() const
Retrieve the MC hierarchy used for the matching.
const MCHierarchy & m_mcHierarchy
The MC hierarchy for the matching procedure.
void SetLeadingLepton()
Tags the particle as the leading lepton.
const RecoHierarchy & m_recoHierarchy
The Reco hierarchy for the matching procedure.
static void FillMCHierarchy(const pandora::MCParticleList &mcParticleList, const pandora::CaloHitList &caloHitList, const FoldingParameters &foldParameters, MCHierarchy &hierarchy)
Fill an MC hierarchy based on the specified folding criteria (see MCHierarchy::FillHierarchy for deta...
pandora::MCParticleList m_mcParticles
The list of MC particles of which this node is composed.
std::list< const Node * > NodeList
int m_nextNodeId
The ID to use for the next node.
const unsigned int m_minHits
the minimum number of primary good Hits
RecoHierarchy::NodeVector m_unmatchedReco
The vector of unmatched reco nodes.
int m_tier
The hierarchy tier for this node.
const unsigned int m_minGoodViews
the minimum number of primary good views
const pandora::MCParticleList & GetMCParticles() const
Retrieve the MC particles associated with this node.
MCNodeVectorMap m_interactions
Map from incident particles (e.g. neutrino) to primaries.
bool IsNeutrinoInduced() const
Check if this is a particle induced by a neutrino interaction.
std::map< const pandora::MCParticle *, MCMatchesVector > InteractionInfo
std::map< const pandora::MCParticle *, NodeVector > MCNodeVectorMap
bool IsTestBeamParticle() const
Check if this is a test beam particle.
std::set< const pandora::ParticleFlowObject * > PfoSet
const float m_minCompleteness
The minimum completeness for a match to be considered good.
std::map< const Node *, int > m_nodeToIdMap
A map from nodes to unique ids.
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.