8#ifndef LAR_HIERARCHY_HELPER_H
9#define LAR_HIERARCHY_HELPER_H 1
43 FoldingParameters(
const bool foldDynamic,
const float cosAngleTolerance = 0.9962f);
79 QualityCuts(
const float minPurity,
const float minCompleteness);
115 ReconstructabilityCriteria(
const unsigned int minHits,
const unsigned int minHitsForGoodView,
const unsigned int minGoodViews,
116 const bool removeNeutrons);
263 const std::string
ToString(
const std::string &prefix)
const;
514 const std::string
ToString(
const std::string &prefix)
const;
886 typedef std::set<const pandora::ParticleFlowObject *>
PfoSet;
917 return m_mcParticles;
931 return m_mainParticle;
959 return m_isLeadingLepton;
966 m_isLeadingLepton =
true;
989 return m_pMCParticle;
1003 return m_recoNodes.size();
1011 if (m_matches.find(pRoot) == m_matches.end())
1014 return m_matches.at(pRoot);
1021 return m_unmatchedReco;
1028 return m_mcHierarchy;
1035 return m_recoHierarchy;
1042 return m_qualityCuts;
Header file for the lar monte carlo particle helper helper class.
Header file for the pfo helper class.
Header file for the mc particle helper class.
Header file defining relevant internal typedefs, sort and string conversion functions.
bool m_foldToTier
Whether or not to apply folding based on particle tier.
bool m_foldDynamic
Whether or not to use process and topological information to make folding decisions.
float m_cosAngleTolerance
Cosine of the maximum angle at which topologies can be considered continuous.
FoldingParameters()
Default constructor.
int m_tier
If folding to a tier, the tier to be combined with its child particles.
bool m_foldToLeadingShowers
Whether or not to fold shower children to the leading shower particle.
bool IsTestBeamParticle() const
Check if this is a test beam particle.
const pandora::CaloHitList & GetCaloHits() const
Retrieve the CaloHits associated with this node.
int GetHierarchyTier() const
Retrieve the hierarchy tier of this node.
bool IsLeadingLepton() const
Returns whether or not this particle is the leading lepton in the event.
void FillFlat(const pandora::MCParticle *pRoot)
Fill this node by folding all descendent particles to this node.
void SetLeadingLepton()
Tags the particle as the leading lepton.
virtual ~Node()
Destructor.
void FillHierarchy(const pandora::MCParticle *pRoot, const FoldingParameters &foldParameters)
Recursively fill the hierarchy based on the criteria established for this MCHierarchy.
const NodeVector & GetChildren() const
Return the vector of children for this node.
MCHierarchy & m_hierarchy
The parent MC hierarchy.
NodeVector m_children
The child nodes of this node.
pandora::MCParticleList m_mcParticles
The list of MC particles of which this node is composed.
int m_tier
The hierarchy tier for this node.
const pandora::MCParticle * GetLeadingMCParticle() const
Retrieve the leading MC particle associated with this node.
bool IsReconstructable() const
Return whether or not this node should be considered reconstructable.
const pandora::MCParticleList & GetMCParticles() const
Retrieve the MC particles associated with this node.
const pandora::MCParticle * m_mainParticle
The leading MC particle for this node.
int GetId() const
Retrieve the unique ID of this node.
int m_pdg
The PDG code of the leading MC particle for this node.
int GetParticleId() const
Retrieve the PDG code for the leading particle in this node.
bool IsNeutrinoInduced() const
Check if this is a particle induced by a neutrino interaction.
pandora::CaloHitList m_caloHits
The list of calo hits of which this node is composed.
bool m_isLeadingLepton
Whether or not this node is the leading lepton.
bool IsCosmicRay() const
Check if this is a cosmic ray particle.
ReconstructabilityCriteria class.
const unsigned int m_minHits
the minimum number of primary good Hits
const unsigned int m_minGoodViews
the minimum number of primary good views
const bool m_removeNeutrons
whether to remove neutrons and their downstream particles
ReconstructabilityCriteria()
Default constructor.
const unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
const NodeVector & GetInteractions(const pandora::MCParticle *pRoot) const
Retrieve the root nodes in this hierarchy.
void GetFlattenedNodes(const pandora::MCParticle *const pRoot, NodeVector &nodeVector) const
Retrieve a flat vector of the ndoes in the hierarchy.
const std::string ToString() const
Produce a string representation of the hierarchy.
int m_nextNodeId
The ID to use for the next node.
const pandora::MCParticle * GetNeutrino() const
Retrieve the neutrino at the root of the hierarchy if it exists.
void InterpretHierarchy(const pandora::MCParticle *const pRoot, pandora::MCParticleList &leadingParticles, pandora::MCParticleList &childParticles, const float cosAngleTolerance) const
Interpret the hierarchy below a particular particle to determine if and how it should be folded....
std::map< const Node *, int > m_nodeToIdMap
A map from nodes to unique ids.
std::map< const pandora::MCParticle *, NodeVector > MCNodeVectorMap
void RegisterNode(const Node *pNode)
Register a node with the hierarchy.
std::list< const Node * > NodeList
void CollectContinuations(const pandora::MCParticle *pRoot, pandora::MCParticleList &continuingParticles, pandora::MCParticleList &childParticles, const float cosAngleTolerance) const
Identify downstream particles that represent continuations of the parent particle from a reconstructi...
void GetRootMCParticles(pandora::MCParticleList &rootMCParticles) const
Retrieve the root MC particles of the interaction hierarchies.
std::map< const pandora::MCParticle *, pandora::CaloHitList > m_mcToHitsMap
The map between MC particles and calo hits.
bool IsReconstructable(const pandora::MCParticle *pMCParticle) const
Checks if an individual particle meets reconstructability criteria.
MCHierarchy()
Default constructor.
std::vector< const Node * > NodeVector
MCNodeVectorMap m_interactions
Map from incident particles (e.g. neutrino) to primaries.
virtual ~MCHierarchy()
Destructor.
void FillHierarchy(const pandora::MCParticleList &mcParticleList, const pandora::CaloHitList &caloHitList, const FoldingParameters &foldParameters)
Creates an MC hierarchy representation. Without folding this will be a mirror image of the standard M...
ReconstructabilityCriteria m_recoCriteria
The criteria used to determine if the node is reconstructable.
size_t GetNRecoMatches() const
Get the number of reco nodes matched (both above and below quality cut thresholds) to the MC node.
bool IsQuality(const QualityCuts &qualityCuts) const
Get whether this match passes quality cuts.
const RecoHierarchy::NodeVector & GetRecoMatches() const
Retrieve the vector of matched reco nodes.
pandora::IntVector m_sharedHits
Number of shared hits for each match.
RecoHierarchy::NodeVector m_recoNodes
Matched reco nodes.
void AddRecoMatch(const RecoHierarchy::Node *pReco, const int nSharedHits)
Add a reconstructed node as a match for this MC node.
float GetCompleteness(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the completeness of the match.
const MCHierarchy::Node * GetMC() const
Retrieve the MC node.
unsigned int GetSharedHits(const RecoHierarchy::Node *pReco) const
Retrieve the number of shared hits in the match.
const MCHierarchy::Node * m_pMCParticle
MC node associated with any matches.
float GetPurity(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the purity of the match.
void Print(const MCHierarchy &mcHierarchy) const
Prints information about which reco nodes are matched to the MC nodes, information about hit sharing,...
RecoHierarchy::NodeVector m_unmatchedReco
The vector of unmatched reco nodes.
const RecoHierarchy & m_recoHierarchy
The Reco hierarchy for the matching procedure.
void GetRootMCParticles(pandora::MCParticleList &rootMCParticles) const
Retrieve the root MC particles of the interaction hierarchies.
InteractionInfo m_matches
The map between an interaction and the vector of good matches from MC to reco.
unsigned int GetNMCNodes(const pandora::MCParticle *const pRoot) const
Retrieve the number of MC nodes available to match.
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 ...
QualityCuts m_qualityCuts
The quality cuts to be applied to matches.
unsigned int GetNTestBeamMCNodes(const pandora::MCParticle *const pRoot) const
Retrieve the number of test beam derived MC nodes available to match.
const RecoHierarchy & GetRecoHierarchy() const
Retrieve the reco hierarchy used for the matching.
const RecoHierarchy::NodeVector & GetUnmatchedReco() const
Retrieve the vector of unmatched reco nodes.
const MCHierarchy & m_mcHierarchy
The MC hierarchy for the matching procedure.
const MCHierarchy & GetMCHierarchy() const
Retrieve the MC hierarchy used for the matching.
unsigned int GetNCosmicRayMCNodes(const pandora::MCParticle *const pRoot) const
Retrieve the number of cosmic ray derived MC nodes available to match.
unsigned int GetNNeutrinoMCNodes(const pandora::MCParticle *const pRoot) const
Retrieve the number of neutrino interaction derived MC nodes available to match.
void Match()
Match the nodes in the MC and reco hierarchies.
const QualityCuts & GetQualityCuts() const
Retrieve the quality cuts for matching.
QualityCuts()
Default constructor.
const float m_minPurity
The minimum purity for a match to be considered good.
const float m_minCompleteness
The minimum completeness for a match to be considered good.
void FillFlat(const pandora::ParticleFlowObject *pRoot)
Fill this node by folding all descendent particles to this node.
void FillHierarchy(const pandora::ParticleFlowObject *pRoot, const FoldingParameters &foldParameters)
Recursively fill the hierarchy based on the criteria established for this RecoHierarchy.
pandora::CaloHitList m_caloHits
The list of calo hits of which this node is composed.
const pandora::ParticleFlowObject * m_mainPfo
The leading particle flow object for this node.
pandora::PfoList m_pfos
The list of PFOs of which this node is composed.
const pandora::PfoList & GetRecoParticles() const
Retrieve the PFOs associated with this node.
NodeVector m_children
The child nodes of this nodea.
const pandora::CaloHitList & GetCaloHits() const
Retrieve the CaloHits associated with this node.
const NodeVector & GetChildren() const
Return the vector of children for this node.
int m_pdg
The particle ID (track = muon, shower = electron)
const RecoHierarchy & m_hierarchy
The parent reco hierarchy.
int GetParticleId() const
Retrieve the PDG code for the leading particle in this node Note, for reco objects the PDG codes repr...
virtual ~Node()
Destructor.
const pandora::ParticleFlowObject * GetLeadingPfo() const
Retrieve the leading reco particle for this node.
const pandora::ParticleFlowObject * GetNeutrino() const
Retrieve the neutrino at the root of the hierarchy if it exists.
std::list< const Node * > NodeList
RecoNodeVectorMap m_interactions
Map from the root PFO (e.g. neutrino) to primaries.
std::vector< const Node * > NodeVector
void FillHierarchy(const pandora::PfoList &pfoList, const FoldingParameters &foldParameters)
Creates a reconstructed hierarchy representation. Without folding this will be a mirror image of the ...
const NodeVector & GetInteractions(const pandora::ParticleFlowObject *pRoot) const
Retrieve the root nodes in the hierarchy for a given interaction.
void GetRootPfos(pandora::PfoList &rootPfos) const
Retrieve the root particle flow objects of the interaction hierarchies.
std::map< const pandora::ParticleFlowObject *, NodeVector > RecoNodeVectorMap
void GetFlattenedNodes(const pandora::ParticleFlowObject *const pRoot, NodeVector &nodeVector) const
Retrieve a flat vector of the nodes in the hierarchy.
RecoHierarchy()
Default constructor.
const std::string ToString() const
Produce a string representation of the hierarchy.
virtual ~RecoHierarchy()
Destructor.
LArHierarchyHelper class.
static void GetRecoPrimaries(const pandora::ParticleFlowObject *pRoot, PfoSet &primaries)
Retrieves the primary PFOs from a list and returns the root (neutrino) for hierarchy,...
static void GetMCPrimaries(const pandora::MCParticle *pRoot, MCParticleSet &primaries)
Retrieves the primary MC particles from a list and returns the root (neutrino) for hierarchy,...
std::map< const pandora::MCParticle *, MCMatchesVector > InteractionInfo
std::set< const pandora::MCParticle * > MCParticleSet
static void MatchHierarchies(MatchInfo &matchInfo)
Finds the matches between reconstructed and MC hierarchies.
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...
std::vector< MCMatches > MCMatchesVector
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...
std::set< const pandora::ParticleFlowObject * > PfoSet
ParticleFlowObject class.
StatusCodeException class.
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const MCParticle * > MCParticleList
std::vector< const CaloHit * > CaloHitVector
std::vector< int > IntVector
MANAGED_CONTAINER< const CaloHit * > CaloHitList
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList