MuonLeadingEventValidationAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArMonitoring/MuonLeadingEventValidationAlgorithm.h
3  *
4  * @brief Header file for the muon leading event validation algorithm.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_MUON_LEADING_EVENT_VALIDATION_ALGORITHM_H
9 #define LAR_MUON_LEADING_EVENT_VALIDATION_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
14 
16 
17 #ifdef MONITORING
18 #include "PandoraMonitoringApi.h"
19 #endif
20 
21 #include <map>
22 
23 namespace lar_content
24 {
25 /**
26  * @brief MuonLeadingEventValidationAlgorithm class
27  */
29 {
30 public:
31  /**
32  * @brief Default constructor
33  */
35 
36  /**
37  * @brief Destructor
38  */
40 
41 private:
42  /**
43  * @brief Fill the validation info containers
44  *
45  * @param pMCParticleList the address of the mc particle list
46  * @param pCaloHitList the address of the calo hit list
47  * @param pPfoList the address of the pfo list
48  * @param validationInfo to receive the validation info
49  */
50  void FillValidationInfo(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList,
51  const pandora::PfoList *const pPfoList, ValidationInfo &validationInfo) const;
52 
53  /**
54  * @brief Determine all reconstructable hits in cosmic ray pfos
55  *
56  * @param pMCParticleList the address of the mc particle list
57  * @param pCaloHitList the address of the calo hit list
58  * @param pPfoList the address of the pfo list
59  * @param recoCosmicRayHitList the output list of cosmic ray pfo reconstructable hits
60  */
61  void GetRecoCosmicRayHits(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList,
62  const pandora::PfoList *const pPfoList, pandora::CaloHitList &recoCosmicRayHitList) const;
63 
64  /**
65  * @brief Perform the main matching procedure
66  *
67  * @param pMCParticleList the address of the mc particle list
68  * @param pCaloHitList the address of the calo hit list
69  * @param pPfoList the address of the pfo list
70  * @param recoCosmicRayHitList the list of cosmic ray pfo reconstructable hits to remove from leading particle maps
71  * @param minHitSharingFraction the minimum hit share fraction of a reconstructable hit
72  * @param validationInfo to receive the validation info
73  */
74  void PerformUnfoldedMatching(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList,
75  const pandora::PfoList *const pPfoList, const pandora::CaloHitList &recoCosmicRayHitList, const float minHitSharingFraction,
76  ValidationInfo &validationInfo) const;
77 
78  /**
79  * @brief Remove incorrectly reconstructed cosmic rays from main matching maps
80  *
81  * @param pMCParticleList the address of the mc particle list
82  * @param pCaloHitList the address of the calo hit list
83  * @param pPfoList the address of the pfo list
84  * @param validationInfo to receive the updated validation info
85  */
86  void RemoveIncorrectlyReconstructedCosmicRays(const pandora::MCParticleList *const pMCParticleList,
87  const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, ValidationInfo &validationInfo) const;
88 
89  /**
90  * @brief Perform the cosmic ray matching procedure and identify incorrectly reconstructed cosmic rays
91  *
92  * @param pMCParticleList the address of the mc particle list
93  * @param pCaloHitList the address of the calo hit list
94  * @param pPfoList the address of the pfo list
95  * @param incorrectlyReconstructedCosmicRays the output list of incorrectly reconstructed cosmic rays
96  */
97  void DetermineIncorrectlyReconstructedCosmicRays(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList,
98  const pandora::PfoList *const pPfoList, pandora::MCParticleList &incorrectlyReconstructedCosmicRays) const;
99 
100  /**
101  * @brief Print matching information in a provided validation info object, and write information to tree if configured to do so
102  *
103  * @param validationInfo the validation info
104  * @param useInterpretedMatching whether to use the interpreted (rather than raw) matching information
105  * @param printToScreen whether to print the information to screen
106  * @param fillTree whether to write the information to tree
107  */
108  void ProcessOutput(const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const;
109 
110  /**
111  * @brief Print leading MCParticle hits
112  *
113  * @param caloHitList the list of hits to print
114  * @param isCR whether the hits belong to a MC cosmic ray or delta ray/michel electron
115  */
116 #ifdef MONITORING
117  void PrintHits(const pandora::CaloHitList caloHitList, const bool isCR) const;
118 #endif
119 
120  /**
121  * @brief Print leading pfo hits
122  *
123  * @param totalCaloHitList the list of hits to print
124  * @param otherShowerCaloHitList the list of hits that in truth belong to a different shower
125  * @param otherTrackCaloHitList the list of hits that in truth belong to a cosmic ray that is not the parent
126  * @param parentTrackCaloHitList the list of hits that in truth belong to the parent cosmic ray
127  * @param stringTag the event display marker string
128  */
129 #ifdef MONITORING
130  void PrintHits(const pandora::CaloHitList totalCaloHitList, const pandora::CaloHitList otherShowerCaloHitList,
131  const pandora::CaloHitList otherTrackCaloHitList, const pandora::CaloHitList parentTrackCaloHitList, const std::string &stringTag) const;
132 #endif
133 
134  /**
135  * @brief Print hits of the parent cosmic ray
136  *
137  * @param totalCaloHitList the list of hits to print
138  * @param leadingCaloHitList the list of hits that in truth belong to the child hierarchy
139  * @param stringTag the event display marker string
140  */
141  void PrintHits(const pandora::CaloHitList totalCaloHitList, const pandora::CaloHitList leadingCaloHitList, const std::string &stringTag) const;
142 
143  /**
144  * @brief Fill an input contamination hit distance vector with the closest distance of each contaminant hit to the true leading particle hits
145  *
146  * @param contaminationHits the list of contaminant hits
147  * @param leadingMCHitList the list of true MCParticles hits
148  * @param bestMatchContaminationHitsDistance the output contaminant hit distance vector
149  */
150  void FillContaminationHitsDistance(const pandora::CaloHitList &contaminationHits, const pandora::CaloHitList &leadingMCHits,
151  pandora::FloatVector &bestMatchContaminationHitsDistance) const;
152 
153  /**
154  * @brief To filter out the hits of a given type from an input list
155  *
156  * @param inputList the input list of hits
157  * @param hitType the specified TPC view
158  * @param outputList the output list of hits of the specified list
159  */
160  void GetHitsOfType(const pandora::CaloHitList &inputList, const pandora::HitType hitType, pandora::CaloHitList &outputList) const;
161 
162  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
163 
164  LArMuonLeadingHelper::ValidationParameters m_validationParameters; ///< The definition of a reconstructable MCParticle
165  bool m_removeRecoCosmicRayHits; ///< Whether to remove the reconstructed cosmic ray hits from leading particle metrics
166  bool m_deltaRayMode; ///< Whether to run in delta ray mode
167  bool m_michelMode; ///< Whether to run in michel mode
168  int m_cosmicRaysToSkip; ///< The number of reconstructable cosmic rays to skip
169  bool m_visualize; ///< Whether to visualize the MC and reco leading particles
170  bool m_ignoreIncorrectCosmicRays; ///< Whether to remove the leading particles with incorrrectly reconstructed parents from metrics
171  bool m_writeRawMatchesToTree; ///< Whether to write all matches to output tree
172  std::vector<int> m_deltaRayIDs; ///< If filled, to contain the list leading particles to run metrics over
173 };
174 
175 } // namespace lar_content
176 
177 #endif // LAR_MUON_LEADING_EVENT_VALIDATION_ALGORITHM_H
bool m_removeRecoCosmicRayHits
Whether to remove the reconstructed cosmic ray hits from leading particle metrics.
void DetermineIncorrectlyReconstructedCosmicRays(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, pandora::MCParticleList &incorrectlyReconstructedCosmicRays) const
Perform the cosmic ray matching procedure and identify incorrectly reconstructed cosmic rays...
enum cvn::HType HitType
std::string string
Definition: nybbler.cc:12
void PerformUnfoldedMatching(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, const pandora::CaloHitList &recoCosmicRayHitList, const float minHitSharingFraction, ValidationInfo &validationInfo) const
Perform the main matching procedure.
std::vector< int > m_deltaRayIDs
If filled, to contain the list leading particles to run metrics over.
void RemoveIncorrectlyReconstructedCosmicRays(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, ValidationInfo &validationInfo) const
Remove incorrectly reconstructed cosmic rays from main matching maps.
void FillValidationInfo(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, ValidationInfo &validationInfo) const
Fill the validation info containers.
void ProcessOutput(const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const
Print matching information in a provided validation info object, and write information to tree if con...
void GetHitsOfType(const pandora::CaloHitList &inputList, const pandora::HitType hitType, pandora::CaloHitList &outputList) const
To filter out the hits of a given type from an input list.
void GetRecoCosmicRayHits(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, pandora::CaloHitList &recoCosmicRayHitList) const
Determine all reconstructable hits in cosmic ray pfos.
bool m_visualize
Whether to visualize the MC and reco leading particles.
Header file for the event validation algorithm.
int m_cosmicRaysToSkip
The number of reconstructable cosmic rays to skip.
Header file for the muon leading helper class.
bool m_ignoreIncorrectCosmicRays
Whether to remove the leading particles with incorrrectly reconstructed parents from metrics...
void PrintHits(const pandora::CaloHitList totalCaloHitList, const pandora::CaloHitList leadingCaloHitList, const std::string &stringTag) const
Print leading MCParticle hits.
void FillContaminationHitsDistance(const pandora::CaloHitList &contaminationHits, const pandora::CaloHitList &leadingMCHits, pandora::FloatVector &bestMatchContaminationHitsDistance) const
Fill an input contamination hit distance vector with the closest distance of each contaminant hit to ...
LArMuonLeadingHelper::ValidationParameters m_validationParameters
The definition of a reconstructable MCParticle.
bool m_writeRawMatchesToTree
Whether to write all matches to output tree.
Dft::FloatVector FloatVector
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)