All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LArMuonLeadingHelper.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArHelpers/LArMuonLeadingHelper.cc
3  *
4  * @brief Implementation of the lar delta ray helper class.
5  *
6  * $Log: $
7  */
8 
9 #include "Helpers/MCParticleHelper.h"
10 
14 
15 #include "Pandora/PdgTable.h"
16 
17 #include "Objects/CaloHit.h"
18 #include "Objects/ParticleFlowObject.h"
19 
20 namespace lar_content
21 {
22 
23 using namespace pandora;
24 
26  LArMCParticleHelper::PrimaryParameters(),
27  m_maxBremsstrahlungSeparation(2.5f)
28 {
29 }
30 
31 //------------------------------------------------------------------------------------------------------------------------------------------
32 //------------------------------------------------------------------------------------------------------------------------------------------
33 
34 MCProcess LArMuonLeadingHelper::GetLeadingProcess(const MCParticle *const pMCParticle)
35 {
36  if (LArMCParticleHelper::GetHierarchyTier(pMCParticle) == 0)
37  return MC_PROC_UNKNOWN;
38 
39  const MCParticle *const pLeadingParticle(LArMuonLeadingHelper::GetLeadingParticle(pMCParticle));
40  const LArMCParticle *const pLArMCParticle(dynamic_cast<const LArMCParticle *>(pLeadingParticle));
41 
42  if (!pLArMCParticle)
43  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
44 
45  return pLArMCParticle->GetProcess();
46 }
47 
48 //------------------------------------------------------------------------------------------------------------------------------------------
49 
50 bool LArMuonLeadingHelper::IsDeltaRay(const MCParticle *const pMCParticle)
51 {
53 }
54 
55 //------------------------------------------------------------------------------------------------------------------------------------------
56 
57 bool LArMuonLeadingHelper::IsMichel(const MCParticle *const pMCParticle)
58 {
60 }
61 
62 //------------------------------------------------------------------------------------------------------------------------------------------
63 
64 bool LArMuonLeadingHelper::IsMuonLeading(const MCParticle *const pMCParticle)
65 {
66  const MCParticle *const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMCParticle));
67 
68  return ((LArMCParticleHelper::GetHierarchyTier(pMCParticle) == 1) && (LArMCParticleHelper::IsCosmicRay(pParentMCParticle)));
69 }
70 
71 //------------------------------------------------------------------------------------------------------------------------------------------
72 
73 const MCParticle *LArMuonLeadingHelper::GetLeadingParticle(const MCParticle *const pMCParticle)
74 {
75  if (!pMCParticle)
76  throw StatusCodeException(STATUS_CODE_FAILURE);
77 
78  if (LArMCParticleHelper::GetHierarchyTier(pMCParticle) == 0)
79  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
80 
81  const MCParticle *pParentMCParticle = pMCParticle;
82 
83  while (LArMCParticleHelper::GetHierarchyTier(pParentMCParticle) != 1)
84  {
85  const MCParticleList &parentList(pParentMCParticle->GetParentList());
86 
87  if (parentList.size() != 1)
88  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
89 
90  pParentMCParticle = parentList.front();
91  }
92 
93  return pParentMCParticle;
94 }
95 
96 //------------------------------------------------------------------------------------------------------------------------------------------
97 
98 void LArMuonLeadingHelper::GetMCToLeadingMap(const MCParticleList *const pMCParticleList, LArMCParticleHelper::MCRelationMap &mcToLeadingMap)
99 {
100  for (const MCParticle *const pMCParticle : *pMCParticleList)
101  {
102  const MCParticle *const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMCParticle));
103 
104  if (!LArMCParticleHelper::IsCosmicRay(pParentMCParticle))
105  continue;
106 
107  // For the CRs: fold hits to themselves, for the DRs: fold hits to the leading MCParticle
108  if (pMCParticle == pParentMCParticle)
109  {
110  mcToLeadingMap[pMCParticle] = pMCParticle;
111  }
112  else
113  {
114  const MCParticle *const pLeadingMCParticle(LArMuonLeadingHelper::GetLeadingParticle(pMCParticle));
115  mcToLeadingMap[pMCParticle] = pLeadingMCParticle;
116  }
117  }
118 }
119 
120 //------------------------------------------------------------------------------------------------------------------------------------------
121 
122 void LArMuonLeadingHelper::SelectReconstructableLeadingParticles(const MCParticleList *pMCParticleList, const CaloHitList *pCaloHitList,
123  const ValidationParameters &parameters, const CaloHitList &recoMuonHitList, LArMCParticleHelper::MCContributionMap &selectedMCParticlesToHitsMap)
124 {
125  // Obtain hierarchy folding map:
126  LArMCParticleHelper::MCRelationMap mcToLeadingMCMap;
127  LArMuonLeadingHelper::GetMCToLeadingMap(pMCParticleList, mcToLeadingMCMap);
128 
129  // Select reconstructable hits, e.g. remove delta ray hits 'stolen' by the cosmic rays
130  CaloHitList selectedCaloHitList;
131  LeadingMCParticleToPostBremsstrahlungHitList leadingMCParticleToPostBremsstrahlungHitList;
132  LArMuonLeadingHelper::SelectCaloHits(pCaloHitList, mcToLeadingMCMap, selectedCaloHitList, parameters.m_selectInputHits,
133  parameters.m_minHitSharingFraction, recoMuonHitList, leadingMCParticleToPostBremsstrahlungHitList);
134 
135  // Obtain maps: [hit -> leading MCParticle], [leading MCParticle -> list of hits]
136  LArMCParticleHelper::CaloHitToMCMap trueHitToLeadingMCMap;
137  LArMCParticleHelper::MCContributionMap leadingMCToTrueHitListMap;
138  LArMCParticleHelper::GetMCParticleToCaloHitMatches(&selectedCaloHitList, mcToLeadingMCMap, trueHitToLeadingMCMap, leadingMCToTrueHitListMap);
139 
140  // Add in close post bremsstrahlung hits
142  leadingMCParticleToPostBremsstrahlungHitList, parameters.m_maxBremsstrahlungSeparation, leadingMCToTrueHitListMap);
143 
144  // Obtain vector: all mc particles
145  MCParticleVector leadingMCVector;
146  LArMuonLeadingHelper::SelectLeadingMCParticles(pMCParticleList, leadingMCVector);
147 
148  // Ensure the MCParticles have enough "good" hits to be reconstructed
149  LArMCParticleHelper::SelectParticlesByHitCount(leadingMCVector, leadingMCToTrueHitListMap, mcToLeadingMCMap, parameters, selectedMCParticlesToHitsMap);
150 }
151 
152 //------------------------------------------------------------------------------------------------------------------------------------------
153 
154 void LArMuonLeadingHelper::SelectCaloHits(const CaloHitList *const pCaloHitList, const LArMCParticleHelper::MCRelationMap &mcToTargetMCMap,
155  CaloHitList &selectedCaloHitList, const bool selectInputHits, const float minHitSharingFraction, const CaloHitList &recoMuonHitList,
156  LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList)
157 {
158  if (!selectInputHits)
159  {
160  selectedCaloHitList.insert(selectedCaloHitList.end(), pCaloHitList->begin(), pCaloHitList->end());
161  return;
162  }
163 
164  for (const CaloHit *const pCaloHit : *pCaloHitList)
165  {
166  try
167  {
168  const MCParticle *const pHitParticle(MCParticleHelper::GetMainMCParticle(pCaloHit));
169 
170  if (mcToTargetMCMap.find(pHitParticle) == mcToTargetMCMap.end())
171  continue;
172 
173  // Remove delta ray hits that have been 'stolen' by the muon
174  if (!LArMCParticleHelper::IsCosmicRay(mcToTargetMCMap.at(pHitParticle)))
175  {
176  if (std::find(recoMuonHitList.begin(), recoMuonHitList.end(), pCaloHit) != recoMuonHitList.end())
177  continue;
178  }
179 
180  MCParticleVector mcParticleContributionVector;
181  for (const auto &mapEntry : pCaloHit->GetMCParticleWeightMap())
182  mcParticleContributionVector.push_back(mapEntry.first);
183 
184  std::sort(mcParticleContributionVector.begin(), mcParticleContributionVector.end(), PointerLessThan<MCParticle>());
185 
186  MCParticleWeightMap targetWeightMap;
187  for (const MCParticle *const pMCParticle : mcParticleContributionVector)
188  {
189  const float weight(pCaloHit->GetMCParticleWeightMap().at(pMCParticle));
190  LArMCParticleHelper::MCRelationMap::const_iterator mcIter = mcToTargetMCMap.find(pMCParticle);
191 
192  if (mcToTargetMCMap.end() != mcIter)
193  targetWeightMap[mcIter->second] += weight;
194  }
195 
196  MCParticleVector mcTargetContributionVector;
197  for (const auto &mapEntry : targetWeightMap)
198  mcTargetContributionVector.push_back(mapEntry.first);
199  std::sort(mcTargetContributionVector.begin(), mcTargetContributionVector.end(), PointerLessThan<MCParticle>());
200 
201  float bestTargetWeight(0.f), targetWeightSum(0.f);
202 
203  for (const MCParticle *const pTargetMCParticle : mcTargetContributionVector)
204  {
205  const float targetWeight(targetWeightMap.at(pTargetMCParticle));
206  targetWeightSum += targetWeight;
207 
208  if (targetWeight > bestTargetWeight)
209  {
210  bestTargetWeight = targetWeight;
211  }
212  }
213 
214  if ((targetWeightSum < std::numeric_limits<float>::epsilon()) || ((bestTargetWeight / targetWeightSum) < minHitSharingFraction))
215  continue;
216 
217  // Remove and record post bremsstrahlung hits
218  if (LArMuonLeadingHelper::RejectBremsstrahlungHits(pCaloHit, leadingMCParticleToPostBremsstrahlungHitList))
219  continue;
220 
221  selectedCaloHitList.push_back(pCaloHit);
222  }
223  catch (const StatusCodeException &)
224  {
225  }
226  }
227 }
228 
229 //------------------------------------------------------------------------------------------------------------------------------------------
230 
232  const CaloHit *const pCaloHit, LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList)
233 {
234  const MCParticle *const pHitMCParticle(MCParticleHelper::GetMainMCParticle(pCaloHit));
235 
236  MCParticleList ancestorMCParticleList;
237  LArMCParticleHelper::GetAllAncestorMCParticles(pHitMCParticle, ancestorMCParticleList);
238 
239  bool isPostBremsstrahlung(false);
240  const MCParticle *leadingMCParticle(nullptr);
241 
242  for (const MCParticle *const pAncestorMCParticle : ancestorMCParticleList)
243  {
244  if (LArMCParticleHelper::GetHierarchyTier(pAncestorMCParticle) == 1)
245  {
246  if (LArMuonLeadingHelper::IsMuonLeading(pAncestorMCParticle))
247  leadingMCParticle = pAncestorMCParticle;
248  }
249 
250  if (pAncestorMCParticle->GetParticleId() == PHOTON)
251  isPostBremsstrahlung = true;
252  }
253 
254  if (isPostBremsstrahlung && leadingMCParticle)
255  {
256  leadingMCParticleToPostBremsstrahlungHitList[leadingMCParticle].push_back(pCaloHit);
257  return true;
258  }
259 
260  return false;
261 }
262 
263 //------------------------------------------------------------------------------------------------------------------------------------------
264 
266  const float maxBremsstrahlungSeparation, LArMCParticleHelper::MCContributionMap &leadingMCToTrueHitListMap)
267 {
268  MCParticleVector leadingMCParticleVector;
269  for (auto &entry : leadingMCParticleToPostBremsstrahlungHitList)
270  leadingMCParticleVector.push_back(entry.first);
271 
272  for (const MCParticle *const pLeadingMCParticle : leadingMCParticleVector)
273  {
274  // Do not add in hits for which there are no main particle hits
275  if (leadingMCToTrueHitListMap.find(pLeadingMCParticle) == leadingMCToTrueHitListMap.end())
276  continue;
277 
278  LArMuonLeadingHelper::AddInPostBremsstrahlungHits(pLeadingMCParticle, leadingMCParticleToPostBremsstrahlungHitList,
279  maxBremsstrahlungSeparation, leadingMCToTrueHitListMap, TPC_VIEW_U);
280  LArMuonLeadingHelper::AddInPostBremsstrahlungHits(pLeadingMCParticle, leadingMCParticleToPostBremsstrahlungHitList,
281  maxBremsstrahlungSeparation, leadingMCToTrueHitListMap, TPC_VIEW_V);
282  LArMuonLeadingHelper::AddInPostBremsstrahlungHits(pLeadingMCParticle, leadingMCParticleToPostBremsstrahlungHitList,
283  maxBremsstrahlungSeparation, leadingMCToTrueHitListMap, TPC_VIEW_W);
284  }
285 }
286 
287 //------------------------------------------------------------------------------------------------------------------------------------------
288 
289 void LArMuonLeadingHelper::AddInPostBremsstrahlungHits(const MCParticle *const pLeadingMCParticle,
290  const LeadingMCParticleToPostBremsstrahlungHitList &leadingMCParticleToPostBremsstrahlungHitList,
291  const float maxBremsstrahlungSeparation, LArMCParticleHelper::MCContributionMap &leadingMCToTrueHitListMap, const HitType tpcView)
292 {
293  CaloHitList leadingViewHitList;
294  for (const CaloHit *const pCaloHit : leadingMCToTrueHitListMap.at(pLeadingMCParticle))
295  {
296  if (pCaloHit->GetHitType() == tpcView)
297  leadingViewHitList.push_back(pCaloHit);
298  }
299 
300  if (leadingViewHitList.empty())
301  return;
302 
303  CaloHitList postBremsstrahlungViewHitList;
304  for (const CaloHit *const pCaloHit : leadingMCParticleToPostBremsstrahlungHitList.at(pLeadingMCParticle))
305  {
306  if (pCaloHit->GetHitType() == tpcView)
307  postBremsstrahlungViewHitList.push_back(pCaloHit);
308  }
309 
310  if (postBremsstrahlungViewHitList.empty())
311  return;
312 
313  bool hitsAdded(false);
314 
315  do
316  {
317  hitsAdded = false;
318 
319  for (const CaloHit *const pPostBremsstrahlungHit : postBremsstrahlungViewHitList)
320  {
321  if (std::find(leadingViewHitList.begin(), leadingViewHitList.end(), pPostBremsstrahlungHit) != leadingViewHitList.end())
322  continue;
323 
324  const float separationDistance(LArClusterHelper::GetClosestDistance(pPostBremsstrahlungHit->GetPositionVector(), leadingViewHitList));
325 
326  if (separationDistance < maxBremsstrahlungSeparation)
327  {
328  leadingViewHitList.push_back(pPostBremsstrahlungHit);
329  hitsAdded = true;
330  break;
331  }
332  }
333  } while (hitsAdded);
334 
335  CaloHitList &leadingHitList(leadingMCToTrueHitListMap.at(pLeadingMCParticle));
336  for (const CaloHit *const pCaloHit : leadingViewHitList)
337  {
338  if (std::find(leadingHitList.begin(), leadingHitList.end(), pCaloHit) == leadingHitList.end())
339  leadingHitList.push_back(pCaloHit);
340  }
341 }
342 
343 //------------------------------------------------------------------------------------------------------------------------------------------
344 
345 void LArMuonLeadingHelper::SelectLeadingMCParticles(const MCParticleList *pMCParticleList, MCParticleVector &selectedParticles)
346 {
347  for (const MCParticle *const pMCParticle : *pMCParticleList)
348  {
349  const MCParticle *const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMCParticle));
350 
351  if (!LArMCParticleHelper::IsCosmicRay(pParentMCParticle))
352  continue;
353 
354  if (pMCParticle == pParentMCParticle)
355  {
356  selectedParticles.push_back(pMCParticle);
357  }
358  else
359  {
360  if (LArMuonLeadingHelper::IsMuonLeading(pMCParticle))
361  selectedParticles.push_back(pMCParticle);
362  }
363  }
364 
365  std::sort(selectedParticles.begin(), selectedParticles.end(), LArMCParticleHelper::SortByMomentum);
366 }
367 
368 //------------------------------------------------------------------------------------------------------------------------------------------
369 
370 void LArMuonLeadingHelper::GetPfoMatchContamination(const MCParticle *const pLeadingParticle, const CaloHitList &matchedPfoHitList,
371  CaloHitList &parentTrackHits, CaloHitList &otherTrackHits, CaloHitList &otherShowerHits)
372 {
373  const MCParticle *const pParentCosmicRay(LArMCParticleHelper::GetParentMCParticle(pLeadingParticle));
374 
375  for (const CaloHit *const pCaloHit : matchedPfoHitList)
376  {
377  const MCParticle *const pHitParticle(MCParticleHelper::GetMainMCParticle(pCaloHit));
378 
379  if (LArMCParticleHelper::IsCosmicRay(pHitParticle))
380  {
381  (pHitParticle == pParentCosmicRay) ? parentTrackHits.push_back(pCaloHit) : otherTrackHits.push_back(pCaloHit);
382  }
383  else
384  {
385  const MCParticle *const pHitLeadingParticle(LArMuonLeadingHelper::GetLeadingParticle(pHitParticle));
386 
387  if (pHitLeadingParticle != pLeadingParticle)
388  otherShowerHits.push_back(pCaloHit);
389  }
390  }
391 }
392 
393 //------------------------------------------------------------------------------------------------------------------------------------------
394 
396  const CaloHitList &cosmicRayPfoHitList, const CaloHitList &leadingMCHitList, CaloHitList &leadingHitsInParentCosmicRay)
397 {
398  for (const CaloHit *const pCaloHit : cosmicRayPfoHitList)
399  {
400  if (std::find(leadingMCHitList.begin(), leadingMCHitList.end(), pCaloHit) != leadingMCHitList.end())
401  leadingHitsInParentCosmicRay.push_back(pCaloHit);
402  }
403 }
404 
405 //------------------------------------------------------------------------------------------------------------------------------------------
406 
407 float LArMuonLeadingHelper::GetClosestDistance(const Cluster *const pCluster, const CartesianPointVector &cartesianPointVector)
408 {
409  float closestDistance(std::numeric_limits<float>::max());
410 
411  CaloHitList caloHitList;
412  pCluster->GetOrderedCaloHitList().FillCaloHitList(caloHitList);
413 
414  for (const CaloHit *const pCaloHit : caloHitList)
415  {
416  const float distance(LArMuonLeadingHelper::GetClosestDistance(pCaloHit, cartesianPointVector));
417 
420  }
421 
422  return closestDistance;
423 }
424 
425 //------------------------------------------------------------------------------------------------------------------------------------------
426 
427 float LArMuonLeadingHelper::GetClosestDistance(const CaloHit *const pCaloHit, const CartesianPointVector &cartesianPointVector)
428 {
429  float shortestDistanceSquared(std::numeric_limits<float>::max());
430  const CartesianVector referencePoint(pCaloHit->GetPositionVector());
431 
432  for (const CartesianVector &testPosition : cartesianPointVector)
433  {
434  const float separationSquared((testPosition - referencePoint).GetMagnitudeSquared());
435 
436  if (separationSquared < shortestDistanceSquared)
437  shortestDistanceSquared = separationSquared;
438  }
439 
440  return std::sqrt(shortestDistanceSquared);
441 }
442 
443 //------------------------------------------------------------------------------------------------------------------------------------------
444 
445 StatusCode LArMuonLeadingHelper::GetClosestPosition(const CartesianVector &referencePoint, const CartesianPointVector &cartesianPointVector,
446  const Cluster *const pCluster, const float maxDistanceToCluster, const float maxDistanceToReferencePoint, CartesianVector &closestPosition)
447 {
448  bool found(false);
449  float shortestDistanceSquared(std::numeric_limits<float>::max());
450 
451  for (const CartesianVector &testPosition : cartesianPointVector)
452  {
453  if (LArClusterHelper::GetClosestDistance(testPosition, pCluster) > maxDistanceToCluster)
454  continue;
455 
456  const float separationSquared((testPosition - referencePoint).GetMagnitude());
457 
458  if (separationSquared > maxDistanceToReferencePoint)
459  continue;
460 
461  if (separationSquared < shortestDistanceSquared)
462  {
463  shortestDistanceSquared = separationSquared;
464  closestPosition = testPosition;
465  found = true;
466  }
467  }
468 
469  return found ? STATUS_CODE_SUCCESS : STATUS_CODE_NOT_FOUND;
470 }
471 
472 //------------------------------------------------------------------------------------------------------------------------------------------
473 
474 void LArMuonLeadingHelper::GetClosestPositions(const CartesianPointVector &cartesianPointVector1, const Cluster *const pCluster2,
475  CartesianVector &outputPosition1, CartesianVector &outputPosition2)
476 {
477  bool distanceFound(false);
478  float minDistanceSquared(std::numeric_limits<float>::max());
479 
480  CartesianVector closestPosition1(0.f, 0.f, 0.f);
481  CartesianVector closestPosition2(0.f, 0.f, 0.f);
482 
483  CaloHitList caloHitList2;
484  pCluster2->GetOrderedCaloHitList().FillCaloHitList(caloHitList2);
485 
486  for (const CartesianVector &positionVector1 : cartesianPointVector1)
487  {
488  for (const CaloHit *const pCaloHit : caloHitList2)
489  {
490  const CartesianVector &positionVector2(pCaloHit->GetPositionVector());
491 
492  const float distanceSquared((positionVector1 - positionVector2).GetMagnitudeSquared());
493 
494  if (distanceSquared < minDistanceSquared)
495  {
496  minDistanceSquared = distanceSquared;
497  closestPosition1 = positionVector1;
498  closestPosition2 = positionVector2;
499  distanceFound = true;
500  }
501  }
502  }
503 
504  if (!distanceFound)
505  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
506 
507  outputPosition1 = closestPosition1;
508  outputPosition2 = closestPosition2;
509 }
510 
511 } // namespace lar_content
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
bool m_selectInputHits
whether to select input hits
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.
double closestDistance(const TVector3 &line0, const TVector3 &line1, const TVector3 &p)
MCProcess GetProcess() const
Get the process.
std::unordered_map< const pandora::CaloHit *, const pandora::MCParticle * > CaloHitToMCMap
static int GetHierarchyTier(const pandora::MCParticle *const pMCParticle)
Determine the position in the hierarchy for the MCParticle.
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.
static void SelectParticlesByHitCount(const pandora::MCParticleVector &candidateTargets, const MCContributionMap &mcToTrueHitListMap, const MCRelationMap &mcToTargetMCMap, const PrimaryParameters &parameters, MCContributionMap &selectedMCParticlesToHitsMap)
Filter an input vector of MCParticles to ensure they have sufficient good hits to be reconstructable...
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
LAr mc particle class.
Definition: LArMCParticle.h:94
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
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...
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
Header file for the lar monte carlo particle helper helper class.
Header file for the cluster helper class.
Header file for the muon leading helper class.
static void GetMCParticleToCaloHitMatches(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToTargetMCMap, CaloHitToMCMap &hitToMCMap, MCContributionMap &mcToTrueHitListMap)
Match calo hits to their parent particles.
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...
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
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 &quot;reconstructable&quot; regions of the event...
float m_minHitSharingFraction
the minimum Hit sharing fraction
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 void GetAllAncestorMCParticles(const pandora::MCParticle *const pMCParticle, pandora::MCParticleList &ancestorMCParticleList)
Get all ancestor mc particles.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
Definition: reco_sbnd.fcl:182
LArMCParticleHelper class.
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...
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.