LArMuonLeadingHelper.h
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArHelpers/LArMuonLeadingHelper.h
3  *
4  * @brief Header file for the muon leading helper class.
5  *
6  * $Log: $
7  */
8 #ifndef LAR_MUON_LEADING_HELPER_H
9 #define LAR_MUON_LEADING_HELPER_H 1
10 
11 #include "Pandora/PandoraInternal.h"
12 
14 
15 namespace lar_content
16 {
17 /**
18  * @brief LArMuonLeadingHelper class
19  */
21 {
22 public:
23  /**
24  * @brief ValidationParameters class
25  */
27  {
28  public:
29  /**
30  * @brief Constructor
31  */
33 
34  float m_maxBremsstrahlungSeparation; ///< The maximum separation of a reconstructable post-bremsstrahlung hit from the pre-radiation hits
35  };
36 
37  typedef std::map<const pandora::MCParticle *, pandora::CaloHitList> LeadingMCParticleToPostBremsstrahlungHitList;
38 
39  /**
40  * @brief Return the MCProcess of the leading particle (tier 1) in the delta ray/michel hierarchy
41  *
42  * @param pMCParticle the address of the input MCParticle
43  *
44  * @return the MCProcess of the leading particle (tier 1) in the delta ray/michel hierarchy
45  *
46  */
47  static MCProcess GetLeadingProcess(const pandora::MCParticle *const pMCParticle);
48 
49  /**
50  * @brief Return true if input MCParticle is a child of a cosmic ray and has 'delta ray' process tag
51  *
52  * @param pMCParticle the input MCParticle
53  */
54  static bool IsDeltaRay(const pandora::MCParticle *const pMCParticle);
55 
56  /**
57  * @brief Return true if input MCParticle is a child of a cosmic ray and has 'decay' process tag
58  *
59  * @param pMCParticle the input MCParticle
60  */
61  static bool IsMichel(const pandora::MCParticle *const pMCParticle);
62 
63  /**
64  * @brief Return true if input MCParticle is in tier 1 of the cosmic ray hierarchy
65  *
66  * @param pMCParticle the input MCParticle
67  */
68  static bool IsMuonLeading(const pandora::MCParticle *const pMCParticle);
69 
70  /**
71  * @brief Return leading particle in the delta ray/michel hierarchy i.e. tier below cosmic ray
72  *
73  * @param pMCParticle the input MCParticle
74  */
75  static const pandora::MCParticle *GetLeadingParticle(const pandora::MCParticle *const pMCParticle);
76 
77  /**
78  * @brief Select target, reconstructable mc particles in the cosmic ray hierarchy
79  *
80  * @param pMCParticleList the address of the list of MCParticles
81  * @param pCaloHitList the address of the list of CaloHits
82  * @param parameters validation parameters to decide when an MCParticle is considered reconstructable
83  * @param recoMuonHitList the list of reconstructed cosmic ray hits
84  * @param selectedMCParticlesToHitsMap the output mapping from selected MCParticles to their hits
85  */
86  static void SelectReconstructableLeadingParticles(const pandora::MCParticleList *pMCParticleList,
87  const pandora::CaloHitList *pCaloHitList, const ValidationParameters &parameters, const pandora::CaloHitList &recoMuonHitList,
88  LArMCParticleHelper::MCContributionMap &selectedMCParticlesToHitsMap);
89 
90  /**
91  * @brief Separate a leading pfo hit list according to the true owner of the hit e.g. other shower
92  *
93  * @param pLeadingParticle the address of the input leading MCParticle
94  * @param matchedPfoHitList the input leading pfo hit list
95  * @param parentTrackHits the output list of hits that belong to the parent cosmic ray
96  * @param otherTrackHits the output list of hits that belong to a cosmic ray that is not the parent
97  * @param otherShowerHits the output list of hits that belong to a different shower hierarchy
98  */
99  static void GetPfoMatchContamination(const pandora::MCParticle *const pLeadingParticle, const pandora::CaloHitList &matchedPfoHitList,
100  pandora::CaloHitList &parentTrackHits, pandora::CaloHitList &otherTrackHits, pandora::CaloHitList &otherShowerHits);
101 
102  /**
103  * @brief Determine the leading MCParticle hits within a cosmic ray pfo hit list
104  *
105  * @param cosmicRayPfoHitList the cosmic ray pfo hit list
106  * @param leadingMCHitList the list of hits that belong to the leading MCParticle
107  * @param leadingHitsInParentCosmicRay the output list of 'stolen' leading MCParticle hits
108  */
109  static void GetMuonPfoContaminationContribution(const pandora::CaloHitList &cosmicRayPfoHitList,
110  const pandora::CaloHitList &leadingMCHitList, pandora::CaloHitList &leadingHitsInParentCosmicRay);
111 
112  /**
113  * @brief Get closest distance between a specified cluster and list of positions
114  *
115  * @param pCluster address of the input cluster
116  * @param cartesianPointVector the list of input positions
117  *
118  * @return the closest distance
119  */
120  static float GetClosestDistance(const pandora::Cluster *const pCluster, const pandora::CartesianPointVector &cartesianPointVector);
121 
122  /**
123  * @brief Get closest distance between a specified calo hit and list of positions
124  *
125  * @param pCaloHit the address of the input calo hit
126  * @param cartesianPointVector the list of input positions
127  *
128  * @return the closest distance
129  */
130  static float GetClosestDistance(const pandora::CaloHit *const pCaloHit, const pandora::CartesianPointVector &cartesianPointVector);
131 
132  /**
133  * @brief Get the closest position from an input list of projected positions that lies close to both a reference point and an input cluster
134  *
135  * @param referencePoint the input reference point
136  * @param cartesianPointVector the input list of projected positions
137  * @param pCluster the input cluster
138  * @param maxDistanceToCluster the maximum distance to the cluster
139  * @param maxDistanceToReferencePoint the maximum distance to the reference point
140  * @param closestPosition to receive the closest position if found
141  *
142  * @return whether a closest position could be found
143  */
144  static pandora::StatusCode GetClosestPosition(const pandora::CartesianVector &referencePoint,
145  const pandora::CartesianPointVector &cartesianPointVector, const pandora::Cluster *const pCluster, const float maxDistanceToCluster,
146  const float maxDistanceToReferencePoint, pandora::CartesianVector &closestPosition);
147 
148  /**
149  * @brief Get the closest positions between a list of positions and a cluster
150  *
151  * @param cartesianPointVector1 the input list of positions
152  * @param pCluster2 the address of the input cluster
153  * @param outputPosition1 the closest position in the list of positions
154  * @param outputPosition2 the closest position in the cluster
155  */
156  static void GetClosestPositions(const pandora::CartesianPointVector &cartesianPointVector1, const pandora::Cluster *const pCluster2,
157  pandora::CartesianVector &outputPosition1, pandora::CartesianVector &outputPosition2);
158 
159 private:
160  /**
161  * @brief Construct the hierarchy folding map (cosmic rays folded to themselves, delta ray/michel hierarchy folded to leading particle)
162  *
163  * @param pMCParticleList the address of the list of MCParticles
164  * @param mcToLeadingMap the hierarchy folding map
165  */
166  static void GetMCToLeadingMap(const pandora::MCParticleList *const pMCParticleList, LArMCParticleHelper::MCRelationMap &mcToLeadingMap);
167 
168  /**
169  * @brief Select a subset of calo hits representing those that represent "reconstructable" regions of the event
170  *
171  * @param pCaloHitList the address of the input calo hit list
172  * @param mcToTargetMCMap the MCParticle to leading MCParticle map
173  * @param selectedCaloHitList to receive the populated selected calo hit list
174  * @param selectInputHits whether to select input hits
175  * @param minHitSharingFraction the minimum required charge share of the hit
176  * @param recoMuonHitList the list of reconstructed cosmic ray hits
177  * @param leadingMCParticleToPostBremsstrahlungHitList the mapping of leading MCParticles to post-bremsstrahlung hits
178  */
179  static void SelectCaloHits(const pandora::CaloHitList *const pCaloHitList, const LArMCParticleHelper::MCRelationMap &mcToTargetMCMap,
180  pandora::CaloHitList &selectedCaloHitList, const bool selectInputHits, const float minHitSharingFraction,
181  const pandora::CaloHitList &recoMuonHitList, LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList);
182 
183  /**
184  * @brief Identify and record the hits that are post-bremsstralung radiation in a cosmic ray hierarchy
185  *
186  * @param pCaloHit the address of the input calo hit
187  * @param leadingMCParticleToPostBremsstrahlungHitList the mapping of leading MCParticles to post-bremsstrahlung hits
188  *
189  * @return whether the hit lies post-bremsstrahlung radiation in a cosmic ray hierarchy
190  */
191  static bool RejectBremsstrahlungHits(
192  const pandora::CaloHit *const pCaloHit, LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList);
193 
194  /**
195  * @brief Identify the reconstructable post-bremsstrahlung radiation hits
196  *
197  * @param leadingMCParticleToPostBremsstrahlungHitList the mapping of leading MCParticles to post-bremsstrahlung hits
198  * @param maxBremsstrahlungSeparation the maximum separation of a reconstructable post-bremsstrahlung hit from the pre-radiation hits
199  * @param leadingMCToTrueHitListMap the mapping of cosmic ray and leading MCParticles to their reconstructable hits
200  */
201  static void AddInPostBremsstrahlungHits(const LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList,
202  const float maxBremsstrahlungSeparation, LArMCParticleHelper::MCContributionMap &leadingMCToTrueHitListMap);
203 
204  /**
205  * @brief Identify the reconstructable post-bremsstrahlung radiation hits
206  *
207  * @param pLeadingParticle the address of the input leading MCParticle
208  * @param leadingMCParticleToPostBremsstrahlungHitList the mapping of leading MCParticles to post-bremsstrahlung hits
209  * @param maxBremsstrahlungSeparation the maximum separation of a reconstructable post-bremsstrahlung hit from the pre-radiation hits
210  * @param leadingMCToTrueHitListMap the mapping of cosmic ray and leading MCParticles to their reconstructable hits
211  * @param tpcView the TPC view of the hits to be collected
212  */
213  static void AddInPostBremsstrahlungHits(const pandora::MCParticle *const pLeadingParticle,
214  const LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList, const float maxBremsstrahlungSeparation,
215  LArMCParticleHelper::MCContributionMap &leadingMCToTrueHitListMap, const pandora::HitType tpcView);
216 
217  /**
218  * @brief Select all tier 0 and tier 1 MCParticles in cosmic ray hierarchies from an input list
219  *
220  * @param pMCParticle the address of the input MCParticle list
221  * @param selectedParticles the output vector of selected MCParticles
222  */
223  static void SelectLeadingMCParticles(const pandora::MCParticleList *pMCParticleList, pandora::MCParticleVector &selectedParticles);
224 };
225 
226 } // namespace lar_content
227 
228 #endif // #ifndef LAR_MUON_LEADING_HELPER_H
static MCProcess GetLeadingProcess(const pandora::MCParticle *const pMCParticle)
Return the MCProcess of the leading particle (tier 1) in the delta ray/michel hierarchy.
static float GetClosestDistance(const pandora::Cluster *const pCluster, const pandora::CartesianPointVector &cartesianPointVector)
Get closest distance between a specified cluster and list of positions.
static void AddInPostBremsstrahlungHits(const LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList, const float maxBremsstrahlungSeparation, LArMCParticleHelper::MCContributionMap &leadingMCToTrueHitListMap)
Identify the reconstructable post-bremsstrahlung radiation hits.
static void GetMuonPfoContaminationContribution(const pandora::CaloHitList &cosmicRayPfoHitList, const pandora::CaloHitList &leadingMCHitList, pandora::CaloHitList &leadingHitsInParentCosmicRay)
Determine the leading MCParticle hits within a cosmic ray pfo hit list.
static void SelectReconstructableLeadingParticles(const pandora::MCParticleList *pMCParticleList, const pandora::CaloHitList *pCaloHitList, const ValidationParameters &parameters, const pandora::CaloHitList &recoMuonHitList, LArMCParticleHelper::MCContributionMap &selectedMCParticlesToHitsMap)
Select target, reconstructable mc particles in the cosmic ray hierarchy.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
static bool RejectBremsstrahlungHits(const pandora::CaloHit *const pCaloHit, LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList)
Identify and record the hits that are post-bremsstralung radiation in a cosmic ray hierarchy...
static const pandora::MCParticle * GetLeadingParticle(const pandora::MCParticle *const pMCParticle)
Return leading particle in the delta ray/michel hierarchy i.e. tier below cosmic ray.
enum cvn::HType HitType
LArMuonLeadingHelper class.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
static void SelectLeadingMCParticles(const pandora::MCParticleList *pMCParticleList, pandora::MCParticleVector &selectedParticles)
Select all tier 0 and tier 1 MCParticles in cosmic ray hierarchies from an input list.
float m_maxBremsstrahlungSeparation
The maximum separation of a reconstructable post-bremsstrahlung hit from the pre-radiation hits...
std::map< const pandora::MCParticle *, pandora::CaloHitList > LeadingMCParticleToPostBremsstrahlungHitList
static bool IsMichel(const pandora::MCParticle *const pMCParticle)
Return true if input MCParticle is a child of a cosmic ray and has &#39;decay&#39; process tag...
Header file for the lar monte carlo particle helper helper class.
static void GetClosestPositions(const pandora::CartesianPointVector &cartesianPointVector1, const pandora::Cluster *const pCluster2, pandora::CartesianVector &outputPosition1, pandora::CartesianVector &outputPosition2)
Get the closest positions between a list of positions and a cluster.
static void GetPfoMatchContamination(const pandora::MCParticle *const pLeadingParticle, const pandora::CaloHitList &matchedPfoHitList, pandora::CaloHitList &parentTrackHits, pandora::CaloHitList &otherTrackHits, pandora::CaloHitList &otherShowerHits)
Separate a leading pfo hit list according to the true owner of the hit e.g. other shower...
static void SelectCaloHits(const pandora::CaloHitList *const pCaloHitList, const LArMCParticleHelper::MCRelationMap &mcToTargetMCMap, pandora::CaloHitList &selectedCaloHitList, const bool selectInputHits, const float minHitSharingFraction, const pandora::CaloHitList &recoMuonHitList, LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList)
Select a subset of calo hits representing those that represent "reconstructable" regions of the event...
static void GetMCToLeadingMap(const pandora::MCParticleList *const pMCParticleList, LArMCParticleHelper::MCRelationMap &mcToLeadingMap)
Construct the hierarchy folding map (cosmic rays folded to themselves, delta ray/michel hierarchy fol...
static pandora::StatusCode GetClosestPosition(const pandora::CartesianVector &referencePoint, const pandora::CartesianPointVector &cartesianPointVector, const pandora::Cluster *const pCluster, const float maxDistanceToCluster, const float maxDistanceToReferencePoint, pandora::CartesianVector &closestPosition)
Get the closest position from an input list of projected positions that lies close to both a referenc...
static bool IsMuonLeading(const pandora::MCParticle *const pMCParticle)
Return true if input MCParticle is in tier 1 of the cosmic ray hierarchy.
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
static bool IsDeltaRay(const pandora::MCParticle *const pMCParticle)
Return true if input MCParticle is a child of a cosmic ray and has &#39;delta ray&#39; process tag...