8 #ifndef LAR_MC_PARTICLE_HELPER_H 9 #define LAR_MC_PARTICLE_HELPER_H 1 11 #include "Pandora/PandoraInternal.h" 16 #include <unordered_map> 27 typedef std::unordered_map<const pandora::MCParticle *, const pandora::MCParticle *>
MCRelationMap;
30 typedef std::unordered_map<const pandora::MCParticle *, const pandora::ParticleFlowObject *>
MCToPfoMap;
32 typedef std::unordered_map<const pandora::CaloHit *, const pandora::MCParticle *>
CaloHitToMCMap;
33 typedef std::unordered_map<const pandora::CaloHit *, const pandora::ParticleFlowObject *>
CaloHitToPfoMap;
35 typedef std::unordered_map<const pandora::MCParticle *, pandora::CaloHitList>
MCContributionMap;
39 typedef std::unordered_map<const pandora::ParticleFlowObject *, pandora::CaloHitList>
PfoContributionMap;
101 static bool IsBeamParticle(
const pandora::MCParticle *
const pMCParticle);
111 static bool IsCosmicRay(
const pandora::MCParticle *
const pMCParticle);
116 static unsigned int GetNuanceCode(
const pandora::MCParticle *
const pMCParticle);
125 static bool IsNeutrino(
const pandora::MCParticle *
const pMCParticle);
134 static bool IsPrimary(
const pandora::MCParticle *
const pMCParticle);
143 static bool IsLeading(
const pandora::MCParticle *
const pMCParticle);
161 static bool IsVisible(
const pandora::MCParticle *
const pMCParticle);
186 static const pandora::MCParticle *
GetPrimaryMCParticle(
const pandora::MCParticle *
const pMCParticle);
195 static const pandora::MCParticle *
GetLeadingMCParticle(
const pandora::MCParticle *
const pMCParticle,
const int hierarchyTierLimit = 1);
220 static const pandora::MCParticle *
GetParentMCParticle(
const pandora::MCParticle *
const pMCParticle);
228 static void GetAllDescendentMCParticles(
const pandora::MCParticle *
const pMCParticle, pandora::MCParticleList &descendentMCParticleList);
240 static void GetAllDescendentMCParticles(
const pandora::MCParticle *
const pMCParticle, pandora::MCParticleList &descendentTrackParticles,
241 pandora::MCParticleList &leadingShowerParticles, pandora::MCParticleList &leadingNeutrons);
249 static void GetAllAncestorMCParticles(
const pandora::MCParticle *
const pMCParticle, pandora::MCParticleList &ancestorMCParticleList);
257 static void GetMCPrimaryMap(
const pandora::MCParticleList *
const pMCParticleList, MCRelationMap &mcPrimaryMap);
265 static void GetMCLeadingMap(
const pandora::MCParticleList *
const pMCParticleList, MCRelationMap &mcLeadingMap);
273 static void GetMCToSelfMap(
const pandora::MCParticleList *
const pMCParticleList, MCRelationMap &mcToSelfMap);
282 static const pandora::MCParticle *
GetMainMCParticle(
const pandora::ParticleFlowObject *
const pPfo);
290 static bool SortByMomentum(
const pandora::MCParticle *
const pLhs,
const pandora::MCParticle *
const pRhs);
301 CaloHitToMCMap &hitToMCMap, MCContributionMap &mcToTrueHitListMap);
314 MCContributionMap &selectedMCParticlesToHitsMap);
327 std::function<
bool(
const pandora::MCParticle *
const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap);
338 PfoContributionMap &pfoToReconstructable2DHitsMap,
const bool foldBackHierarchy);
350 const MCContributionMap &selectedMCParticleToHitsMap, PfoContributionMap &pfoToReconstructable2DHitsMap,
const bool foldBackHierarchy);
361 PfoContributionMap &pfoToReconstructable2DHitsMap,
const bool foldBackHierarchy);
373 const MCContributionMapVector &selectedMCParticleToHitsMaps, PfoContributionMap &pfoToReconstructable2DHitsMap,
const bool foldBackHierarchy);
383 ClusterContributionMap &clusterToReconstructable2DHitsMap);
393 const MCContributionMapVector &selectedMCToHitsMaps, ClusterContributionMap &clusterToReconstructable2DHitsMap);
405 const MCContributionMapVector &selectedMCParticleToHitsMaps, PfoToMCParticleHitSharingMap &pfoToMCParticleHitSharingMap,
406 MCParticleToPfoHitSharingMap &mcParticleToPfoHitSharingMap);
417 static void SelectCaloHits(
const pandora::CaloHitList *
const pCaloHitList,
const MCRelationMap &mcToTargetMCMap,
418 pandora::CaloHitList &selectedCaloHitList,
const bool selectInputHits,
const float maxPhotonPropagation);
429 static bool IsDescendentOf(
const pandora::MCParticle *
const pMCParticle,
const int pdg,
const bool isChargeSensitive =
false);
451 const MCRelationMap &mcToTargetMCMap,
const PrimaryParameters ¶meters, MCContributionMap &selectedMCParticlesToHitsMap);
461 static pandora::CaloHitList
GetSharedHits(
const pandora::CaloHitList &hitListA,
const pandora::CaloHitList &hitListB);
479 static bool IsCapture(
const pandora::MCParticle *
const pMCParticle);
488 static bool IsDecay(
const pandora::MCParticle *
const pMCParticle);
515 static bool IsIonisation(
const pandora::MCParticle *
const pMCParticle);
524 static bool IsNuclear(
const pandora::MCParticle *
const pMCParticle);
547 const pandora::MCParticle *
const pMCParent,
const pandora::MCParticle *
const pMCChild,
const float cosAngleTolerance);
558 static void CollectReconstructable2DHits(
const pandora::ParticleFlowObject *
const pPfo,
const MCContributionMapVector &selectedMCParticleToHitsMaps,
559 pandora::CaloHitList &reconstructableCaloHitList2D,
const bool foldBackHierarchy);
571 const MCContributionMapVector &selectedMCParticleToHitsMaps, pandora::CaloHitList &reconstructableCaloHitList2D,
const bool foldBackHierarchy);
581 pandora::CaloHitList &reconstructableCaloHitList2D);
591 const MCContributionMapVector &selectedMCParticleToHitsMaps, pandora::CaloHitList &reconstructableCaloHitList2D);
603 static void SelectGoodCaloHits(
const pandora::CaloHitList *
const pSelectedCaloHitList,
const MCRelationMap &mcToTargetMCMap,
604 pandora::CaloHitList &selectedGoodCaloHitList,
const bool selectInputHits,
const float minHitSharingFraction);
629 static bool PassMCParticleChecks(
const pandora::MCParticle *
const pOriginalPrimary,
const pandora::MCParticle *
const pThisMCParticle,
630 const pandora::MCParticle *
const pHitMCParticle,
const float maxPhotonPropagation);
635 #endif // #ifndef LAR_MC_PARTICLE_HELPER_H static bool IsVisible(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is visible (i.e. long-lived charged particle)
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...
unsigned int m_minPrimaryGoodViews
the minimum number of primary good views
static bool IsNuclear(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a nuclear interaction process.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
bool m_selectInputHits
whether to select input hits
std::pair< const pandora::MCParticle *, pandora::CaloHitList > MCParticleCaloHitListPair
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...
static bool IsPrimary(const pandora::MCParticle *const pMCParticle)
Whether a provided mc particle matches the implemented definition of being primary.
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 bool IsLeadingBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a leading beam MCParticle.
unsigned int m_minPrimaryGoodHits
the minimum number of primary good Hits
std::unordered_map< const pandora::CaloHit *, const pandora::ParticleFlowObject * > CaloHitToPfoMap
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...
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 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 const pandora::MCParticle * GetPrimaryMCParticle(const pandora::MCParticle *const pMCParticle)
Get the primary parent mc particle.
std::map< const pandora::MCParticle *, PfoToSharedHitsVector > MCParticleToPfoHitSharingMap
std::vector< PfoCaloHitListPair > PfoToSharedHitsVector
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...
std::pair< const pandora::Cluster *, pandora::CaloHitList > ClusterCaloHitListPair
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
bool m_foldBackHierarchy
whether to fold the hierarchy back to the primary (neutrino) or leading particles (test beam) ...
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 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 bool IsPairProduction(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a pair production process.
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 unsigned int GetNuanceCode(const pandora::MCParticle *const pMCParticle)
Get the nuance code of an MCParticle.
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
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.
float m_maxPhotonPropagation
the maximum photon propagation length
std::unordered_map< const pandora::MCParticle *, const pandora::ParticleFlowObject * > MCToPfoMap
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 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 bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
static bool IsInelasticScatter(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle came from an inelastic scattering process.
static bool IsLeading(const pandora::MCParticle *const pMCParticle)
Whether a provided mc particle matches the implemented definition of being leading.
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.
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...
std::unordered_map< const pandora::MCParticle *, int > MCParticleIntMap
static void GetMCParticleToCaloHitMatches(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToTargetMCMap, CaloHitToMCMap &hitToMCMap, MCContributionMap &mcToTrueHitListMap)
Match calo hits to their parent particles.
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
std::unordered_map< const pandora::Cluster *, pandora::CaloHitList > ClusterContributionMap
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
static bool IsTriggeredBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary triggered beam MCParticle.
float m_minHitSharingFraction
the minimum Hit sharing fraction
Header file for the lar mc particle class.
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 bool IsDecay(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a decay process.
std::vector< MCContributionMap > MCContributionMapVector
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. If the parent does not travel any distance, a travelling parent is sought and the comparison made between this and the child. If no travelling parent can be found, the particles are treated as continuous.
static bool IsBremsstrahlung(const pandora::MCParticle *const pMCParticle)
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 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.
static void GetAllAncestorMCParticles(const pandora::MCParticle *const pMCParticle, pandora::MCParticleList &ancestorMCParticleList)
Get all ancestor mc particles.
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 void GetTrueNeutrinos(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &trueNeutrinos)
Get neutrino MC particles from an input MC particle list.
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
static bool IsCapture(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a capture process.
PrimaryParameters()
Constructor.
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...
std::unordered_map< const pandora::MCParticle *, PfoContributionMap > MCToPfoMatchingMap
static bool IsIonisation(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from an ionisation process.
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::vector< MCParticleCaloHitListPair > MCParticleToSharedHitsVector
LArMCParticleHelper class.
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 void GetTrueTestBeamParticles(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &trueTestBeamParticles)
Get triggered test beam MC particles from an input MC particle list.
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.
std::unordered_map< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoContributionMap
static void GetAllDescendentMCParticles(const pandora::MCParticle *const pMCParticle, pandora::MCParticleList &descendentMCParticleList)
Get all descendent mc particles.
void function(int client, int *resource, int parblock, int *test, int p)
static pandora::CaloHitList GetSharedHits(const pandora::CaloHitList &hitListA, const pandora::CaloHitList &hitListB)
Get the hits in the intersection of two hit lists.
static bool IsBeamNeutrinoFinalState(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary neutrino final state MCParticle.
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
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 IsElasticScatter(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle came from an elastic scattering process.
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
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...