All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CosmicRayTaggingMonitoringTool.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArMonitoring/CosmicRayTaggingMonitoringTool.h
3  *
4  * @brief Header file for the cosmic-ray tagging monitoring tool class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_COSMIC_RAY_TAGGING_MONITORING_TOOL_H
9 #define LAR_COSMIC_RAY_TAGGING_MONITORING_TOOL_H 1
10 
12 
15 
16 #include <unordered_map>
17 
18 namespace lar_content
19 {
20 
21 /**
22  * @brief CosmicRayTaggingMonitoringTool class
23  */
25 {
26 public:
27  /**
28  * @brief Default constructor
29  */
31 
32  void FindAmbiguousPfos(const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm);
33 
34 private:
35  /**
36  * @brief
37  */
39  {
48  };
49 
50  typedef std::map<const pandora::ParticleFlowObject *, float> PfoToFloatMap;
51  typedef std::map<const pandora::ParticleFlowObject *, Classification> PfoClassificationMap;
52 
53  /**
54  * @brief Calculate metrics to classify Pfos based on the target reconstructable MCParticles with which they share hits
55  *
56  * @param hitSharingMap input mapping from Pfos to MCParticles + number of shared hits pairs
57  * @param pfoToCaloHitListMap input mapping from Pfos to their reconstructable 2D hits
58  * @param targetsToGoodHitsMaps input mapping from target reconstructable MCParticles (those which shouldn't be tagged) to their good hits
59  * @param pfoSignificanceMap output mapping from Pfos to their target significance
60  * @param pfoPurityMap output mapping from Pfos to their target purities
61  * @param pfoClassificationMap output mapping from Pfos to their classification
62  */
64  const LArMCParticleHelper::PfoContributionMap &pfoToCaloHitListMap, const LArMCParticleHelper::MCContributionMapVector &targetsToGoodHitsMaps,
65  PfoToFloatMap &pfoSignificanceMap, PfoToFloatMap &pfoPurityMap, PfoClassificationMap &pfoClassificationMap) const;
66 
67  /**
68  * @brief Returns true if the main MCParticle of the supplied Pfo is a muon
69  */
70  bool IsMainMCParticleMuon(const pandora::ParticleFlowObject *const pPfo) const;
71 
72  /**
73  * @brief Classify a pfo given some metrics
74  *
75  * @param nHits the number of reconstructable hits in the Pfo
76  * @param significance the number of target MCParticles represented by the Pfo
77  * @param purity the fraction of reconstructable hits in the Pfo that come from a target MCParticle
78  * @param isMuon is the main MCParticle that the Pfo represents a muon?
79  */
80  Classification ClassifyPfo(const unsigned int &nHits, const float &significance, const float &purity, const bool isMuon) const;
81 
82  /**
83  * @brief Returns a unique color for each possible Pfo classification
84  */
86 
87  /**
88  * @brief Returns a string for each classification
89  */
90  std::string GetClassificationName(const Classification &classification) const;
91 
92  /**
93  * @brief Prints a table detailing all input Pfos and their classifications
94  *
95  * @param orderedPfoVector input vector of Pfos in print order
96  * @param pfoToReconstructable2DHitsMap input mapping from Pfos to their reconstructable 2D hits
97  * @param pfoPurityMap input mapping from Pfos to their purity
98  * @param pfoSignificanceMap input mapping from Pfos to their significance
99  * @param pfoClassificationMap input mapping from Pfos to their classification
100  * @param ambiguousPfos input list of ambiguous Pfos as (not) tagged by a previous CR tagging module
101  */
102  void PrintPfoTable(const pandora::PfoVector &orderedPfoVector,
103  const LArMCParticleHelper::PfoContributionMap &pfoToReconstructable2DHitsMap, const PfoToFloatMap &pfoPurityMap,
104  const PfoToFloatMap &pfoSignificanceMap, const PfoClassificationMap &pfoClassificationMap, const pandora::PfoList &ambiguousPfos) const;
105 
106  /**
107  * @brief Read settings
108  */
109  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
110 
111  LArMCParticleHelper::PrimaryParameters m_parameters; ///< Parameters used to decide when an MCParticle is reconstructable
112  unsigned int m_minHitsToConsiderTagging; ///< The minimum number of hits to consider a Pfo for tagging
113  float m_minPurity; ///< The minimum purity to consider a Pfo as "pure"
114  float m_minImpurity; ///< The minimum impurity to consider a Pfo as "impure"
115  float m_minSignificance; ///< The minimum significance to consider a Pfo as "significant"
116  std::string m_caloHitList2D; ///< The 2D calo hit list
117 };
118 
119 } // namespace lar_content
120 
121 #endif // #ifndef LAR_COSMIC_RAY_TAGGING_MONITORING_TOOL_H
void CalculatePfoMetrics(const LArMCParticleHelper::PfoToMCParticleHitSharingMap &hitSharingMap, const LArMCParticleHelper::PfoContributionMap &pfoToCaloHitListMap, const LArMCParticleHelper::MCContributionMapVector &targetsToGoodHitsMaps, PfoToFloatMap &pfoSignificanceMap, PfoToFloatMap &pfoPurityMap, PfoClassificationMap &pfoClassificationMap) const
Calculate metrics to classify Pfos based on the target reconstructable MCParticles with which they sh...
Classification ClassifyPfo(const unsigned int &nHits, const float &significance, const float &purity, const bool isMuon) const
Classify a pfo given some metrics.
LArFormattingHelper::Color GetClassificationColor(const Classification &classification) const
Returns a unique color for each possible Pfo classification.
CosmicRayTaggingBaseTool class.
void FindAmbiguousPfos(const pandora::PfoList &parentCosmicRayPfos, pandora::PfoList &ambiguousPfos, const MasterAlgorithm *const pAlgorithm)
Find the list of ambiguous pfos (could represent cosmic-ray muons or neutrinos)
LArMCParticleHelper::PrimaryParameters m_parameters
Parameters used to decide when an MCParticle is reconstructable.
std::string GetClassificationName(const Classification &classification) const
Returns a string for each classification.
std::map< const pandora::ParticleFlowObject *, float > PfoToFloatMap
std::map< const pandora::ParticleFlowObject *, Classification > PfoClassificationMap
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read settings.
Header file for the master algorithm class.
Header file for the lar monte carlo particle helper helper class.
unsigned int m_minHitsToConsiderTagging
The minimum number of hits to consider a Pfo for tagging.
float m_minSignificance
The minimum significance to consider a Pfo as &quot;significant&quot;.
std::vector< MCContributionMap > MCContributionMapVector
MasterAlgorithm class.
float m_minImpurity
The minimum impurity to consider a Pfo as &quot;impure&quot;.
float m_minPurity
The minimum purity to consider a Pfo as &quot;pure&quot;.
std::unordered_map< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoContributionMap
bool IsMainMCParticleMuon(const pandora::ParticleFlowObject *const pPfo) const
Returns true if the main MCParticle of the supplied Pfo is a muon.
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
void PrintPfoTable(const pandora::PfoVector &orderedPfoVector, const LArMCParticleHelper::PfoContributionMap &pfoToReconstructable2DHitsMap, const PfoToFloatMap &pfoPurityMap, const PfoToFloatMap &pfoSignificanceMap, const PfoClassificationMap &pfoClassificationMap, const pandora::PfoList &ambiguousPfos) const
Prints a table detailing all input Pfos and their classifications.