32 m_minPrimaryGoodHits(15),
33 m_minHitsForGoodView(5),
34 m_minPrimaryGoodViews(2),
35 m_selectInputHits(true),
36 m_maxPhotonPropagation(2.5f),
37 m_minHitSharingFraction(0.9f),
38 m_foldBackHierarchy(true)
50 return fCriteria(pPrimaryMCParticle);
66 return fCriteria(pLeadingMCParticle);
125 std::cout <<
"LArMCParticleHelper::GetNuanceCode - Error: Can't cast to LArMCParticle" << std::endl;
134 if ((nuance == 0) || (nuance == 2000) || (nuance == 2001) || (nuance == 3000))
137 const int absoluteParticleId(std::abs(pMCParticle->
GetParticleId()));
138 return ((NU_E == absoluteParticleId) || (NU_MU == absoluteParticleId) || (NU_TAU == absoluteParticleId));
175 const MCParticle *pParentMCParticle = pMCParticle;
183 pParentMCParticle = *(pParentMCParticle->
GetParentList().begin());
194 const int absoluteParticleId(std::abs(pMCParticle->
GetParticleId()));
196 if ((E_MINUS == absoluteParticleId) || (MU_MINUS == absoluteParticleId) || (PI_PLUS == absoluteParticleId) || (K_PLUS == absoluteParticleId) ||
197 (SIGMA_MINUS == absoluteParticleId) || (SIGMA_PLUS == absoluteParticleId) || (HYPERON_MINUS == absoluteParticleId) ||
198 (PROTON == absoluteParticleId) || (PHOTON == absoluteParticleId) || (
NEUTRON == absoluteParticleId))
208 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
211 trueNeutrinos.push_back(pMCParticle);
221 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
224 trueTestBeamParticles.push_back(pMCParticle);
234 const MCParticle *pParentMCParticle = pMCParticle;
241 pParentMCParticle = *(pParentMCParticle->
GetParentList().begin());
244 return pParentMCParticle;
253 if (std::find(descendentMCParticleList.begin(), descendentMCParticleList.end(), pDaughterMCParticle) == descendentMCParticleList.end())
255 descendentMCParticleList.emplace_back(pDaughterMCParticle);
268 if (std::find(descendentTrackParticles.begin(), descendentTrackParticles.end(), pDaughterMCParticle) == descendentTrackParticles.end())
270 const int pdg{std::abs(pDaughterMCParticle->GetParticleId())};
271 if (pdg == E_MINUS || pdg == PHOTON)
273 leadingShowerParticles.emplace_back(pDaughterMCParticle);
277 leadingNeutrons.emplace_back(pDaughterMCParticle);
281 descendentTrackParticles.emplace_back(pDaughterMCParticle);
293 if (parentMCParticleList.empty())
295 if (parentMCParticleList.size() != 1)
298 const MCParticle *pParentMCParticle = *parentMCParticleList.begin();
299 if (std::find(ancestorMCParticleList.begin(), ancestorMCParticleList.end(), pParentMCParticle) == ancestorMCParticleList.end())
301 ancestorMCParticleList.push_back(pParentMCParticle);
310 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
313 mcPrimaryVector.push_back(pMCParticle);
323 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
329 mcLeadingVector.push_back(pMCParticle);
342 visibleParticleList.emplace_back(pRoot);
358 const MCParticle *pParentMCParticle = pMCParticle;
359 mcVector.push_back(pParentMCParticle);
366 pParentMCParticle = *(pParentMCParticle->
GetParentList().begin());
367 mcVector.push_back(pParentMCParticle);
371 for (MCParticleVector::const_reverse_iterator iter = mcVector.rbegin(), iterEnd = mcVector.rend(); iter != iterEnd; ++iter)
373 const MCParticle *
const pNextParticle = *iter;
376 return pNextParticle;
395 const MCParticle *pParentMCParticle = pMCParticle;
396 mcVector.push_back(pParentMCParticle);
403 pParentMCParticle = *(pParentMCParticle->
GetParentList().begin());
404 mcVector.push_back(pParentMCParticle);
407 int hierarchyTier(0);
408 const MCParticle *pLeadingMCParticle(
nullptr);
411 for (MCParticleVector::const_reverse_iterator iter = mcVector.rbegin(), iterEnd = mcVector.rend(); iter != iterEnd; ++iter)
413 const MCParticle *
const pNextParticle = *iter;
419 if (hierarchyTier <= hierarchyTierLimit)
420 pLeadingMCParticle = pNextParticle;
425 if (!pLeadingMCParticle)
428 return pLeadingMCParticle;
435 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
440 mcPrimaryMap[pMCParticle] = pPrimaryMCParticle;
452 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
457 mcLeadingMap[pMCParticle] = pLeadingMCParticle;
469 for (
const MCParticle *
const pMCParticle : *pMCParticleList)
471 mcToSelfMap[pMCParticle] = pMCParticle;
492 if (std::fabs(momentumLhs - momentumRhs) > std::numeric_limits<float>::epsilon())
493 return (momentumLhs > momentumRhs);
496 if (std::fabs(pLhs->
GetEnergy() - pRhs->
GetEnergy()) > std::numeric_limits<float>::epsilon())
507 return (positionLhs < positionRhs);
515 for (
const CaloHit *
const pCaloHit : *pCaloHitList)
520 const MCParticle *pTargetParticle(pHitParticle);
523 if (!mcToTargetMCMap.empty())
525 MCRelationMap::const_iterator mcIter = mcToTargetMCMap.find(pHitParticle);
527 if (mcToTargetMCMap.end() == mcIter)
530 pTargetParticle = mcIter->second;
533 mcToTrueHitListMap[pTargetParticle].push_back(pCaloHit);
534 hitToMCMap[pCaloHit] = pTargetParticle;
538 if (STATUS_CODE_FAILURE == statusCodeException.
GetStatusCode())
539 throw statusCodeException;
572 std::copy(pMCParticleList->begin(), pMCParticleList->end(), std::back_inserter(targetMCVector));
611 std::copy(pMCParticleList->begin(), pMCParticleList->end(), std::back_inserter(targetMCVector));
622 for (
const MCParticle *
const pMCParticle : candidateTargets)
628 if (selectedMCParticlesToHitsMap.find(pParentMCParticle) == selectedMCParticlesToHitsMap.end())
631 selectedMCParticlesToHitsMap.insert(MCContributionMap::value_type(pParentMCParticle, caloHitList));
642 pfoList,
MCContributionMapVector({selectedMCParticleToHitsMap}), pfoToReconstructable2DHitsMap, foldBackHierarchy);
651 pfoList,
MCContributionMapVector({selectedMCParticleToHitsMap}), pfoToReconstructable2DHitsMap, foldBackHierarchy);
664 if (!pfoToReconstructable2DHitsMap.insert(PfoContributionMap::value_type(pPfo, pfoHitList)).second)
679 if (!pfoToReconstructable2DHitsMap.insert(PfoContributionMap::value_type(pPfo, pfoHitList)).second)
691 for (
const auto &mapEntry : pfoToReconstructable2DHitsMap)
692 sortedPfos.push_back(mapEntry.first);
697 for (
const MCContributionMap &mcParticleToHitsMap : selectedMCParticleToHitsMaps)
700 for (
const auto &mapEntry : mcParticleToHitsMap)
701 sortedMCParticles.push_back(mapEntry.first);
704 for (
const MCParticle *
const pMCParticle : sortedMCParticles)
707 if (pfoToMCParticleHitSharingMap.find(pPfo) == pfoToMCParticleHitSharingMap.end())
711 if (mcParticleToPfoHitSharingMap.find(pMCParticle) == mcParticleToPfoHitSharingMap.end())
712 if (!mcParticleToPfoHitSharingMap.insert(MCParticleToPfoHitSharingMap::value_type(pMCParticle,
PfoToSharedHitsVector())).second)
719 if (std::any_of(mcHitPairs.begin(), mcHitPairs.end(),
723 if (std::any_of(pfoHitPairs.begin(), pfoHitPairs.end(), [&](
const PfoCaloHitListPair &pair) { return (pair.first == pPfo); }))
730 if (!sharedHits.empty())
736 return ((a.second.size() != b.second.size()) ? a.second.size() > b.second.size()
737 : LArMCParticleHelper::SortByMomentum(a.first, b.first));
741 return ((a.second.size() != b.second.size()) ? a.second.size() > b.second.size() : LArPfoHelper::SortByNHits(a.first, b.first));
762 for (
const Cluster *
const pCluster : clusterList)
767 if (!clusterToReconstructable2DHitsMap.insert(ClusterContributionMap::value_type(pCluster, caloHitList)).second)
780 switch (pLArMCParticle->GetProcess())
801 switch (pLArMCParticle->GetProcess())
824 switch (pLArMCParticle->GetProcess())
843 switch (pLArMCParticle->GetProcess())
865 switch (pLArMCParticle->GetProcess())
902 switch (pLArMCParticle->GetProcess())
924 switch (pLArMCParticle->GetProcess())
945 switch (pLArMCParticle->GetProcess())
963 for (
const CaloHit *
const pCaloHit : hitListA)
965 if (std::find(hitListB.begin(), hitListB.end(), pCaloHit) != hitListB.end())
966 sharedHits.push_back(pCaloHit);
977 if (childDirection.GetMagnitude() < std::numeric_limits<float>::epsilon())
984 CartesianVector parentDirection{pMCUpstream->GetEndpoint() - pMCUpstream->GetVertex()};
985 if (parentDirection.GetMagnitude() > std::numeric_limits<float>::epsilon())
988 return parentDirection.
GetDotProduct(childDirection) >= cosAngleTolerance;
993 const size_t size{parentList.size()};
995 pMCUpstream = parentList.front();
1017 if (foldBackHierarchy)
1023 pfoList.push_back(pPfo);
1038 if (foldBackHierarchy)
1043 pfoList.push_back(pPfo);
1052 pfoList.push_back(pPfo);
1072 for (
const CaloHit *
const pCaloHit : caloHitList2D)
1074 bool isTargetHit(
false);
1075 for (
const MCContributionMap &mcParticleToHitsMap : selectedMCParticleToHitsMaps)
1078 for (
const MCContributionMap::value_type &mapEntry : mcParticleToHitsMap)
1080 if (std::find(mapEntry.second.begin(), mapEntry.second.end(), pCaloHit) != mapEntry.second.end())
1091 reconstructableCaloHitList2D.push_back(pCaloHit);
1103 for (
const CaloHit *pCaloHit : isolatedCaloHitList)
1104 caloHitList.push_back(pCaloHit);
1107 for (
const CaloHit *
const pCaloHit : caloHitList)
1109 bool isTargetHit{
false};
1112 for (
const MCContributionMap::value_type &mapEntry : mcParticleToHitsMap)
1114 if (std::find(mapEntry.second.begin(), mapEntry.second.end(), pCaloHit) != mapEntry.second.end())
1125 reconstructableCaloHitList2D.push_back(pCaloHit);
1132 CaloHitList &selectedCaloHitList,
const bool selectInputHits,
const float maxPhotonPropagation)
1134 if (!selectInputHits)
1136 selectedCaloHitList.insert(selectedCaloHitList.end(), pCaloHitList->begin(), pCaloHitList->end());
1140 for (
const CaloHit *
const pCaloHit : *pCaloHitList)
1146 LArMCParticleHelper::MCRelationMap::const_iterator mcIter = mcToTargetMCMap.find(pHitParticle);
1148 if (mcToTargetMCMap.end() == mcIter)
1154 if (
PassMCParticleChecks(pPrimaryParticle, pPrimaryParticle, pHitParticle, maxPhotonPropagation))
1155 selectedCaloHitList.push_back(pCaloHit);
1167 const MCParticle *pCurrentParticle = pMCParticle;
1177 pCurrentParticle = pParent;
1189 mcParticleList.emplace_back(pRoot);
1190 queue.emplace_back(pRoot);
1192 while (!queue.empty())
1196 for (
const MCParticle *pDaughter : daughters)
1198 mcParticleList.emplace_back(pDaughter);
1199 queue.emplace_back(pDaughter);
1210 for (
const MCParticle *
const pMCTarget : candidateTargets)
1212 MCContributionMap::const_iterator trueHitsIter = mcToTrueHitListMap.find(pMCTarget);
1213 if (mcToTrueHitListMap.end() == trueHitsIter)
1216 const CaloHitList &caloHitList(trueHitsIter->second);
1226 unsigned int nGoodViews(0);
1239 if (!selectedMCParticlesToHitsMap.insert(MCContributionMap::value_type(pMCTarget, caloHitList)).second)
1247 CaloHitList &selectedGoodCaloHitList,
const bool selectInputHits,
const float minHitSharingFraction)
1249 if (!selectInputHits)
1251 selectedGoodCaloHitList.insert(selectedGoodCaloHitList.end(), pSelectedCaloHitList->begin(), pSelectedCaloHitList->end());
1255 for (
const CaloHit *
const pCaloHit : *pSelectedCaloHitList)
1258 for (
const auto &mapEntry : pCaloHit->GetMCParticleWeightMap())
1259 mcParticleVector.push_back(mapEntry.first);
1264 for (
const MCParticle *
const pMCParticle : mcParticleVector)
1266 const float weight(pCaloHit->GetMCParticleWeightMap().at(pMCParticle));
1267 LArMCParticleHelper::MCRelationMap::const_iterator mcIter = mcToTargetMCMap.find(pMCParticle);
1269 if (mcToTargetMCMap.end() != mcIter)
1270 targetWeightMap[mcIter->second] += weight;
1274 for (
const auto &mapEntry : targetWeightMap)
1275 mcTargetVector.push_back(mapEntry.first);
1278 const MCParticle *pBestTargetParticle(
nullptr);
1279 float bestTargetWeight(0.f), targetWeightSum(0.f);
1281 for (
const MCParticle *
const pTargetMCParticle : mcTargetVector)
1283 const float targetWeight(targetWeightMap.at(pTargetMCParticle));
1284 targetWeightSum += targetWeight;
1286 if (targetWeight > bestTargetWeight)
1288 bestTargetWeight = targetWeight;
1289 pBestTargetParticle = pTargetMCParticle;
1293 if (!pBestTargetParticle || (targetWeightSum < std::numeric_limits<float>::epsilon()) || ((bestTargetWeight / targetWeightSum) < minHitSharingFraction))
1296 selectedGoodCaloHitList.push_back(pCaloHit);
1305 for (
const MCParticle *
const pMCParticle : inputMCParticles)
1309 if (!fCriteria(pMCParticle))
1325 selectedParticles.push_back(pMCParticle);
1332 const MCParticle *
const pHitMCParticle,
const float maxPhotonPropagation)
1340 if ((pThisMCParticle->
GetEndpoint() - pThisMCParticle->
GetVertex()).GetMagnitude() > maxPhotonPropagation)
1344 if (pThisMCParticle == pHitMCParticle)
1349 if (
PassMCParticleChecks(pOriginalPrimary, pDaughterMCParticle, pHitMCParticle, maxPhotonPropagation))
Header file for the calo hit class.
Header file for the cluster class.
Header file for the cluster helper class.
Header file for the lar monte carlo particle helper helper class.
Header file for the lar monitoring helper helper class.
Header file for the pfo helper class.
Header file for the mc particle class.
Header file for the mc particle helper class.
Header file defining status codes and relevant preprocessor macros.
bool m_foldBackHierarchy
whether to fold the hierarchy back to the primary (neutrino) or leading particles (test beam)
bool m_selectInputHits
whether to select input hits
float m_minHitSharingFraction
the minimum Hit sharing fraction
float m_maxPhotonPropagation
the maximum photon propagation length
unsigned int m_minPrimaryGoodHits
the minimum number of primary good Hits
unsigned int m_minPrimaryGoodViews
the minimum number of primary good views
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
PrimaryParameters()
Constructor.
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
static pandora::CaloHitList GetSharedHits(const pandora::CaloHitList &hitListA, const pandora::CaloHitList &hitListB)
Get the hits in the intersection of two hit lists.
static bool IsLeading(const pandora::MCParticle *const pMCParticle)
Whether a provided mc particle matches the implemented definition of being leading.
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
static bool IsInelasticScatter(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle came from an inelastic scattering process.
static void SelectReconstructableTestBeamHierarchyMCParticles(const pandora::MCParticleList *pMCParticleList, const pandora::CaloHitList *pCaloHitList, const PrimaryParameters ¶meters, std::function< bool(const pandora::MCParticle *const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap)
Select target, reconstructable mc particles in the relevant hierarchy that match given criteria.
static void GetPfoMCParticleHitSharingMaps(const PfoContributionMap &pfoToReconstructable2DHitsMap, const MCContributionMapVector &selectedMCParticleToHitsMaps, PfoToMCParticleHitSharingMap &pfoToMCParticleHitSharingMap, MCParticleToPfoHitSharingMap &mcParticleToPfoHitSharingMap)
Get the mappings from Pfo -> pair (reconstructable MCparticles, number of reconstructable 2D hits sha...
static void GetAllAncestorMCParticles(const pandora::MCParticle *const pMCParticle, pandora::MCParticleList &ancestorMCParticleList)
Get all ancestor mc particles.
static void GetPrimaryMCParticleList(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &mcPrimaryVector)
Get vector of primary MC particles from an input list of MC particles.
static void GetFirstVisibleMCParticles(const pandora::MCParticle *const pRoot, pandora::MCParticleList &visibleParticleList)
Get the first visible MC particles given a root particle. For example, given a neutrino this would re...
static bool IsPrimary(const pandora::MCParticle *const pMCParticle)
Whether a provided mc particle matches the implemented definition of being primary.
static void GetClusterToReconstructable2DHitsMap(const pandora::ClusterList &clusterList, const MCContributionMap &selectedMCToHitsMap, ClusterContributionMap &clusterToReconstructable2DHitsMap)
Get mapping from cluster to reconstructable 2D hits (=good hits belonging to a selected reconstructab...
static void GetAllDescendentMCParticles(const pandora::MCParticle *const pMCParticle, pandora::MCParticleList &descendentMCParticleList)
Get all descendent mc particles.
static void SelectParticlesByHitCount(const pandora::MCParticleVector &candidateTargets, const MCContributionMap &mcToTrueHitListMap, const MCRelationMap &mcToTargetMCMap, const PrimaryParameters ¶meters, MCContributionMap &selectedMCParticlesToHitsMap)
Filter an input vector of MCParticles to ensure they have sufficient good hits to be reconstructable.
static void GetMCLeadingMap(const pandora::MCParticleList *const pMCParticleList, MCRelationMap &mcLeadingMap)
Get mapping from individual mc particles (in a provided list) and their leading parent mc particles.
static const pandora::MCParticle * GetPrimaryMCParticle(const pandora::MCParticle *const pMCParticle)
Get the primary parent mc particle.
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
static void CollectReconstructable2DHits(const pandora::ParticleFlowObject *const pPfo, const MCContributionMapVector &selectedMCParticleToHitsMaps, pandora::CaloHitList &reconstructableCaloHitList2D, const bool foldBackHierarchy)
For a given Pfo, collect the hits which are reconstructable (=good hits belonging to a selected recon...
static bool IsVisible(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is visible (i.e. long-lived charged particle)
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
static bool IsDecay(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a decay process.
static bool IsCapture(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a capture process.
std::unordered_map< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoContributionMap
std::vector< MCContributionMap > MCContributionMapVector
std::vector< PfoCaloHitListPair > PfoToSharedHitsVector
static bool IsBremsstrahlung(const pandora::MCParticle *const pMCParticle)
static void SelectReconstructableMCParticles(const pandora::MCParticleList *pMCParticleList, const pandora::CaloHitList *pCaloHitList, const PrimaryParameters ¶meters, std::function< bool(const pandora::MCParticle *const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap)
Select target, reconstructable mc particles that match given criteria.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
static const pandora::MCParticle * GetLeadingMCParticle(const pandora::MCParticle *const pMCParticle, const int hierarchyTierLimit=1)
Get the leading particle in the hierarchy, for use at ProtoDUNE.
static void GetMCToSelfMap(const pandora::MCParticleList *const pMCParticleList, MCRelationMap &mcToSelfMap)
Get mapping from individual mc particles (in a provided list) to themselves (to be used when not fold...
static bool IsTriggeredBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary triggered beam MCParticle.
static bool PassMCParticleChecks(const pandora::MCParticle *const pOriginalPrimary, const pandora::MCParticle *const pThisMCParticle, const pandora::MCParticle *const pHitMCParticle, const float maxPhotonPropagation)
Whether it is possible to navigate from a primary mc particle to a downstream mc particle without "pa...
static bool AreTopologicallyContinuous(const pandora::MCParticle *const pMCParent, const pandora::MCParticle *const pMCChild, const float cosAngleTolerance)
Determine if two MC particles are topologically continuous within a given tolerance....
static void GetLeadingMCParticleList(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &mcLeadingVector)
Get vector of leading MC particles from an input list of MC particles.
static void GetBreadthFirstHierarchyRepresentation(const pandora::MCParticle *const pMCParticle, pandora::MCParticleList &mcParticleList)
Retrieve a linearised representation of the MC particle hierarchy in breadth first order....
static bool IsDescendentOf(const pandora::MCParticle *const pMCParticle, const int pdg, const bool isChargeSensitive=false)
Determine if the MC particle is a descendent of a particle with the given PDG code.
static unsigned int GetNuanceCode(const pandora::MCParticle *const pMCParticle)
Get the nuance code of an MCParticle.
static void CollectReconstructableTestBeamHierarchy2DHits(const pandora::ParticleFlowObject *const pPfo, const MCContributionMapVector &selectedMCParticleToHitsMaps, pandora::CaloHitList &reconstructableCaloHitList2D, const bool foldBackHierarchy)
For a given Pfo, collect the hits which are reconstructable (=good hits belonging to a selected recon...
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
static void GetPfoToReconstructable2DHitsMap(const pandora::PfoList &pfoList, const MCContributionMap &selectedMCParticleToHitsMap, PfoContributionMap &pfoToReconstructable2DHitsMap, const bool foldBackHierarchy)
Get mapping from Pfo to reconstructable 2D hits (=good hits belonging to a selected reconstructable M...
static bool IsPairProduction(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a pair production process.
static void GetTrueTestBeamParticles(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &trueTestBeamParticles)
Get triggered test beam MC particles from an input MC particle list.
std::unordered_map< const pandora::CaloHit *, const pandora::MCParticle * > CaloHitToMCMap
static void GetMCParticleToCaloHitMatches(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToTargetMCMap, CaloHitToMCMap &hitToMCMap, MCContributionMap &mcToTrueHitListMap)
Match calo hits to their parent particles.
static void SelectCaloHits(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToTargetMCMap, pandora::CaloHitList &selectedCaloHitList, const bool selectInputHits, const float maxPhotonPropagation)
Select a subset of calo hits representing those that represent "reconstructable" regions of the event...
static bool IsNuclear(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a nuclear interaction process.
static bool DoesPrimaryMeetCriteria(const pandora::MCParticle *const pMCParticle, std::function< bool(const pandora::MCParticle *const)> fCriteria)
Returns true if passed particle whose primary meets the passed criteria.
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
std::vector< MCParticleCaloHitListPair > MCParticleToSharedHitsVector
static void GetMCPrimaryMap(const pandora::MCParticleList *const pMCParticleList, MCRelationMap &mcPrimaryMap)
Get mapping from individual mc particles (in a provided list) and their primary parent mc particles.
static void SelectParticlesMatchingCriteria(const pandora::MCParticleVector &inputMCParticles, std::function< bool(const pandora::MCParticle *const)> fCriteria, pandora::MCParticleVector &selectedParticles, const PrimaryParameters ¶meters, const bool isTestBeam)
Select mc particles matching given criteria from an input list.
static const pandora::MCParticle * GetMainMCParticle(const pandora::ParticleFlowObject *const pPfo)
Find the mc particle making the largest contribution to 2D clusters in a specified pfo.
static bool DoesLeadingMeetCriteria(const pandora::MCParticle *const pMCParticle, std::function< bool(const pandora::MCParticle *const)> fCriteria)
Returns true if passed particle whose leading meets the passed criteria.
std::unordered_map< const pandora::Cluster *, pandora::CaloHitList > ClusterContributionMap
static bool IsIonisation(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from an ionisation process.
static bool IsElasticScatter(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle came from an elastic scattering process.
static int GetHierarchyTier(const pandora::MCParticle *const pMCParticle)
Determine the position in the hierarchy for the MCParticle.
static void SelectGoodCaloHits(const pandora::CaloHitList *const pSelectedCaloHitList, const MCRelationMap &mcToTargetMCMap, pandora::CaloHitList &selectedGoodCaloHitList, const bool selectInputHits, const float minHitSharingFraction)
Apply further selection criteria to end up with a collection of "good" calo hits that can be use to d...
static bool IsLeadingBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a leading beam MCParticle.
static void GetTrueNeutrinos(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &trueNeutrinos)
Get neutrino MC particles from an input MC particle list.
std::map< const pandora::MCParticle *, PfoToSharedHitsVector > MCParticleToPfoHitSharingMap
std::pair< const pandora::MCParticle *, pandora::CaloHitList > MCParticleCaloHitListPair
static bool IsBeamNeutrinoFinalState(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary neutrino final state MCParticle.
static void GetTestBeamHierarchyPfoToReconstructable2DHitsMap(const pandora::PfoList &pfoList, const MCContributionMap &selectedMCParticleToHitsMap, PfoContributionMap &pfoToReconstructable2DHitsMap, const bool foldBackHierarchy)
Get mapping from Pfo in reconstructed test beam hierarchy to reconstructable 2D hits (=good hits belo...
int GetNuanceCode() const
Get the nuance code.
static unsigned int CountHitsByType(const pandora::HitType hitType, const pandora::CaloHitList &caloHitList)
Count the number of calo hits, in a provided list, of a specified type.
static bool IsTestBeam(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a test beam particle.
static void GetAllDownstreamPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively, of all daughters associated with those pfos in an input lis...
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
static void GetIsolatedCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of isolated calo hits of a particular hit type from a list of pfos.
static bool SortByNHits(const pandora::ParticleFlowObject *const pLhs, const pandora::ParticleFlowObject *const pRhs)
Sort pfos by number of constituent hits.
static void GetCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of calo hits of a particular hit type from a list of pfos.
float GetMagnitudeSquared() const
Get the magnitude squared.
CartesianVector GetUnitVector() const
Get a unit vector in the direction of the cartesian vector.
float GetDotProduct(const CartesianVector &rhs) const
Get the dot product of the cartesian vector with a second cartesian vector.
const OrderedCaloHitList & GetOrderedCaloHitList() const
Get the ordered calo hit list.
const CaloHitList & GetIsolatedCaloHitList() const
Get the isolated calo hit list.
static const MCParticle * GetMainMCParticle(const T *const pT)
Find the mc particle making the largest contribution to a specified calo hit, track or cluster.
float GetEnergy() const
Get energy of mc particle, units GeV.
const MCParticleList & GetDaughterList() const
Get list of daughters of mc particle.
const CartesianVector & GetMomentum() const
Get momentum of mc particle, units GeV.
const CartesianVector & GetEndpoint() const
Get the endpoint of the mc particle, units mm.
const CartesianVector & GetVertex() const
Get the production vertex of the mc particle, units mm.
const MCParticleList & GetParentList() const
Get list of parents of mc particle.
int GetParticleId() const
Get the PDG code of the mc particle.
void FillCaloHitList(CaloHitList &caloHitList) const
Fill a provided calo hit list with all the calo hits in the ordered calo hit list.
ParticleFlowObject class.
const PfoList & GetParentPfoList() const
Get the parent pfo list.
Enable ordering of pointers based on properties of target objects.
StatusCodeException class.
StatusCode GetStatusCode() const
Get status code.
@ MC_PROC_HAD_BERTINI_CAPTURE_AT_REST
@ MC_PROC_NEUTRON_INELASTIC
@ MC_PROC_ALPHA_INELASTIC
@ MC_PROC_DEUTERON_INELASTIC
@ MC_PROC_TRITON_INELASTIC
@ MC_PROC_ANTI_DEUTERON_INELASTIC
@ MC_PROC_PI_PLUS_INELASTIC
@ MC_PROC_ANTI_NEUTRON_INELASTIC
@ MC_PROC_ANTI_ALPHA_INELASTIC
@ MC_PROC_CHIPS_NUCLEAR_CAPTURE_AT_REST
@ MC_PROC_ANTI_TRITON_INELASTIC
@ MC_PROC_ELECTRON_NUCLEAR
@ MC_PROC_ANTI_PROTON_INELASTIC
@ MC_PROC_PI_MINUS_INELASTIC
@ MC_PROC_PROTON_INELASTIC
@ MC_PROC_PHOTON_INELASTIC
@ MC_PROC_MU_MINUS_CAPTURE_AT_REST
@ MC_PROC_HAD_FRITIOF_CAPTURE_AT_REST
@ MC_PROC_KAON_PLUS_INELASTIC
@ MC_PROC_LAMBDA_INELASTIC
@ MC_PROC_ANTI_HE3_INELASTIC
@ MC_PROC_KAON_MINUS_INELASTIC
MANAGED_CONTAINER< const MCParticle * > MCParticleList
std::unordered_map< const MCParticle *, float > MCParticleWeightMap
MANAGED_CONTAINER< const Cluster * > ClusterList
std::vector< const ParticleFlowObject * > PfoVector
MANAGED_CONTAINER< const CaloHit * > CaloHitList
std::vector< const MCParticle * > MCParticleVector
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList