8 #ifndef LAR_HIERARCHY_HELPER_H
9 #define LAR_HIERARCHY_HELPER_H 1
11 #include "Pandora/PandoraInternal.h"
13 #include "Helpers/MCParticleHelper.h"
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);
141 Node(
MCHierarchy &hierarchy,
const pandora::MCParticle *pMCParticle,
const int tier = 1);
151 Node(
MCHierarchy &hierarchy,
const pandora::MCParticleList &mcParticleList,
const pandora::CaloHitList &caloHitList,
const int tier = 1);
178 void FillFlat(
const pandora::MCParticle *pRoot);
262 const std::string
ToString(
const std::string &prefix)
const;
322 void FillHierarchy(
const pandora::MCParticleList &mcParticleList,
const pandora::CaloHitList &caloHitList,
const FoldingParameters &foldParameters);
333 void InterpretHierarchy(
const pandora::MCParticle *
const pRoot, pandora::MCParticleList &leadingParticles,
334 pandora::MCParticleList &childParticles,
const float cosAngleTolerance)
const;
394 void CollectContinuations(
const pandora::MCParticle *pRoot, pandora::MCParticleList &continuingParticles,
395 pandora::MCParticleList &childParticles,
const float cosAngleTolerance)
const;
454 Node(
const RecoHierarchy &hierarchy,
const pandora::PfoList &pfoList,
const pandora::CaloHitList &caloHitList);
474 void FillFlat(
const pandora::ParticleFlowObject *pRoot);
510 const std::string
ToString(
const std::string &prefix)
const;
573 const pandora::ParticleFlowObject *
GetNeutrino()
const;
699 float GetPurity(
const pandora::CaloHitVector &intersection,
const pandora::CaloHitList &recoHits,
const bool adcWeighted)
const;
710 float GetCompleteness(
const pandora::CaloHitVector &intersection,
const pandora::CaloHitList &mcHits,
const bool adcWeighted)
const;
835 static void FillMCHierarchy(
const pandora::MCParticleList &mcParticleList,
const pandora::CaloHitList &caloHitList,
858 typedef std::set<const pandora::ParticleFlowObject *>
PfoSet;
878 static const pandora::ParticleFlowObject *
GetRecoPrimaries(
const pandora::PfoList &pfoList,
PfoSet &primaries);
893 return m_mcParticles;
907 return m_mainParticle;
935 return m_isLeadingLepton;
942 m_isLeadingLepton =
true;
1002 return m_pMCParticle;
1016 return m_recoNodes.size();
1031 return m_unmatchedReco;
1038 return m_pMCNeutrino;
1045 return m_pRecoNeutrino;
1052 return m_qualityCuts;
1057 #endif // #ifndef LAR_HIERARCHY_HELPER_H
const pandora::MCParticle * m_pNeutrino
The incident neutrino, if it exists.
const pandora::CaloHitList & GetCaloHits() const
Retrieve the CaloHits associated with this node.
MCMatchesVector m_matches
The vector of good matches from MC to reco.
MCMatchesVector m_goodMatches
The vector of good matches - above threshold one reco to one MC matches.
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 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.
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...
MatchInfo()
Default constructor.
const std::string ToString() const
Produce a string representation of the hierarchy.
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.
const std::string ToString(const std::string &prefix) const
Produce a string representation of the hierarchy.
std::map< const pandora::MCParticle *, pandora::CaloHitList > m_mcToHitsMap
The map between MC particles and calo hits.
MCHierarchy()
Default constructor.
ReconstructabilityCriteria()
Default constructor.
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)
void GetFlattenedNodes(NodeVector &nodeVector) const
Retrieve a flat vector of the ndoes in the hierarchy.
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...
QualityCuts m_qualityCuts
The quality cuts to be applied to matches.
virtual ~RecoHierarchy()
Destructor.
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...
const pandora::CaloHitList & GetCaloHits() const
Retrieve the CaloHits associated with this node.
static void MatchHierarchies(const MCHierarchy &mcHierarchy, const RecoHierarchy &recoHierarchy, MatchInfo &matchInfo)
Finds the matches between reconstructed and MC hierarchies.
const pandora::ParticleFlowObject * m_pNeutrino
The incident neutrino, if it exists.
bool m_isLeadingLepton
Whether or not this node is the leading lepton.
static const pandora::ParticleFlowObject * GetRecoPrimaries(const pandora::PfoList &pfoList, PfoSet &primaries)
Retrieves the primary PFOs from a list and returns the root (neutrino) for hierarchy, if it exists.
pandora::CaloHitList m_caloHits
The list of calo hits of which this node is composed.
Node(const RecoHierarchy &hierarchy, const pandora::ParticleFlowObject *pPfo)
Create a node with a primary PFO.
unsigned int GetNTestBeamMCNodes() const
Retrieve the number of test beam derived MC nodes available to match.
unsigned int GetNNeutrinoMCNodes() const
Retrieve the number of neutrino interaction derived MC nodes available to match.
bool IsQuality(const QualityCuts &qualityCuts) const
Get whether this match passes quality cuts.
const MCHierarchy::Node * GetMC() const
Retrieve the MC node.
unsigned int GetNMCNodes() const
Retrieve the number of MC nodes available to match.
MCMatches(const MCHierarchy::Node *pMCParticle)
Constructor.
void Match(const MCHierarchy &mcHierarchy, const RecoHierarchy &recoHierarchy)
Match the nodes in the MC and reco hierarchies.
const MCMatchesVector & GetMatches() const
Retrieve the vector of matches (this will include null matches - i.e. MC nodes with no corresponding ...
void FillHierarchy(const pandora::PfoList &pfoList, const FoldingParameters &foldParameters)
Creates a reconstructed hierarchy representation. Without folding this will be a mirror image of the ...
virtual ~Node()
Destructor.
bool IsNeutrinoHierarchy() const
Check if this is a neutrino hierarchy.
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.
const NodeVector & GetRootNodes() const
Retrieve the root nodes in this hierarchy.
std::vector< const Node * > NodeVector
Header file for the lar monte carlo particle helper helper class.
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...
const float m_minPurity
The minimum purity for a match to be considered good.
bool IsReconstructable() const
Return whether or not this node should be considered reconstructable.
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
void FillHierarchy(const pandora::ParticleFlowObject *pRoot, const FoldingParameters &foldParameters)
Recursively fill the hierarchy based on the criteria established for this RecoHierarchy.
int GetParticleId() const
Retrieve the PDG code for the leading particle in this node.
unsigned int GetSharedHits(const RecoHierarchy::Node *pReco) const
Retrieve the number of shared hits in the match.
float GetPurity(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the purity of the match.
pandora::PfoList m_pfos
The list of PFOs of which this node is composed.
const std::string ToString(const std::string &prefix) const
Produce a string representation of the hierarchy.
float m_cosAngleTolerance
Cosine of the maximum angle at which topologies can be considered continuous.
virtual ~MCHierarchy()
Destructor.
NodeVector m_rootNodes
The leading nodes (e.g. primary particles, cosmic rays, ...)
NodeVector m_children
The child nodes of this node.
virtual ~Node()
Destructor.
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.
const pandora::PfoList & GetRecoParticles() const
Retrieve the PFOs associated with this node.
ReconstructabilityCriteria m_recoCriteria
The criteria used to determine if the node is reconstructable.
void Print(const MCHierarchy &mcHierarchy) const
Prints information about which reco nodes are matched to the MC nodes, information about hit sharing...
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.
const pandora::ParticleFlowObject * GetNeutrino() const
Retrieve the neutrino at the root of the hierarchy if it exists.
MCHierarchy & m_hierarchy
The parent MC hierarchy.
const bool m_removeNeutrons
whether to remove neutrons and their downstream particles
QualityCuts()
Default constructor.
int GetHierarchyTier() const
Retrieve the hierarchy tier of this node.
void GetFlattenedNodes(NodeVector &nodeVector) const
Retrieve a flat vector of the nodes in the hierarchy.
const pandora::MCParticle * m_mainParticle
The leading MC particle for this node.
const std::string ToString() const
Produce a string representation of the hierarchy.
std::vector< MCMatches > MCMatchesVector
const pandora::MCParticle * GetMCNeutrino() const
Retrieve the parent MC neutrino if it exists.
pandora::CaloHitList m_caloHits
The list of calo hits of which this node is composed.
MCMatchesVector m_aboveThresholdMatches
The vector of matches that pass quality but with multiple reco matches to the MC. ...
bool IsReconstructable(const pandora::MCParticle *pMCParticle) const
Checks if an individual particle meets reconstructability criteria.
void SetLeadingLepton()
Tags the particle as the leading lepton.
Node(MCHierarchy &hierarchy, const pandora::MCParticle *pMCParticle, const int tier=1)
Create a node with a primary MC particle.
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.
MCHierarchy::NodeVector m_unmatchedMC
The vector of unmatched MC nodes.
std::list< const Node * > NodeList
int GetParticleId() const
Retrieve the PDG code for the leading particle in this node Note, for reco objects the PDG codes repr...
const NodeVector & GetRootNodes() const
Retrieve the root nodes in this hierarchy.
bool IsTestBeamHierarchy() const
Check if this is a test beam hierarchy.
void FillFlat(const pandora::MCParticle *pRoot)
Fill this node by folding all descendent particles to this node.
int GetId() const
Retrieve the unique ID of this node.
int m_nextNodeId
The ID to use for the next node.
const unsigned int m_minHits
the minimum number of primary good Hits
MCMatchesVector m_subThresholdMatches
The vector of matches that don't pass quality cuts.
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
void RegisterNode(const Node *pNode)
Register a node with the hierarchy.
const pandora::MCParticleList & GetMCParticles() const
Retrieve the MC particles associated with this node.
float GetCompleteness(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the completeness of the match.
bool IsNeutrinoInduced() const
Check if this is a particle induced by a neutrino interaction.
RecoHierarchy()
Default constructor.
const pandora::MCParticle * m_pMCNeutrino
The parent neutrino if it exists.
void FillHierarchy(const pandora::MCParticle *pRoot, const FoldingParameters &foldParameters)
Recursively fill the hierarchy based on the criteria established for this MCHierarchy.
bool IsTestBeamParticle() const
Check if this is a test beam particle.
const pandora::ParticleFlowObject * GetRecoNeutrino() const
Retrieve the parent reco neutrino if it exists.
std::set< const pandora::ParticleFlowObject * > PfoSet
const pandora::ParticleFlowObject * m_pRecoNeutrino
The parent neutrino if it exists.
const float m_minCompleteness
The minimum completeness for a match to be considered good.
static const pandora::MCParticle * GetMCPrimaries(const pandora::MCParticleList &mcParticleList, MCParticleSet &primaries)
Retrieves the primary MC particles from a list and returns the root (neutrino) for hierarchy...
void FillFlat(const pandora::ParticleFlowObject *pRoot)
Fill this node by folding all descendent particles to this node.
std::map< const Node *, int > m_nodeToIdMap
A map from nodes to unique ids.
NodeVector m_rootNodes
The leading nodes (e.g. primary particles, cosmic rays, ...)
unsigned int GetNCosmicRayMCNodes() const
Retrieve the number of cosmic ray derived MC nodes available to match.
void AddRecoMatch(const RecoHierarchy::Node *pReco, const int nSharedHits)
Add a reconstructed node as a match for this MC node.