8 #ifndef LAR_MC_PARTICLE_HELPER_H 9 #define LAR_MC_PARTICLE_HELPER_H 1 11 #include "Pandora/PandoraInternal.h" 15 #include <unordered_map> 27 typedef std::unordered_map<const pandora::MCParticle*, const pandora::MCParticle*>
MCRelationMap;
29 typedef std::unordered_map<const pandora::MCParticle*, const pandora::ParticleFlowObject*>
MCToPfoMap;
31 typedef std::unordered_map<const pandora::CaloHit*, const pandora::MCParticle*>
CaloHitToMCMap;
32 typedef std::unordered_map<const pandora::CaloHit*, const pandora::ParticleFlowObject*>
CaloHitToPfoMap;
34 typedef std::unordered_map<const pandora::MCParticle*, pandora::CaloHitList>
MCContributionMap;
37 typedef std::unordered_map<const pandora::ParticleFlowObject*, pandora::CaloHitList>
PfoContributionMap;
76 static bool IsBeamParticle(
const pandora::MCParticle *
const pMCParticle);
81 static bool IsCosmicRay(
const pandora::MCParticle *
const pMCParticle);
86 static unsigned int GetNuanceCode(
const pandora::MCParticle *
const pMCParticle);
95 static bool IsNeutrino(
const pandora::MCParticle *
const pMCParticle);
104 static bool IsPrimary(
const pandora::MCParticle *
const pMCParticle);
113 static bool IsVisible(
const pandora::MCParticle *
const pMCParticle);
130 static const pandora::MCParticle *
GetPrimaryMCParticle(
const pandora::MCParticle *
const pMCParticle);
147 static const pandora::MCParticle *
GetParentMCParticle(
const pandora::MCParticle *
const pMCParticle);
155 static void GetMCPrimaryMap(
const pandora::MCParticleList *
const pMCParticleList, MCRelationMap &mcPrimaryMap);
164 static const pandora::MCParticle *
GetMainMCParticle(
const pandora::ParticleFlowObject *
const pPfo);
172 static bool SortByMomentum(
const pandora::MCParticle *
const pLhs,
const pandora::MCParticle *
const pRhs);
183 CaloHitToMCMap &hitToMCMap, MCContributionMap &mcToTrueHitListMap);
195 const PrimaryParameters ¶meters, std::function<
bool(
const pandora::MCParticle *
const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap);
205 PfoContributionMap &pfoToReconstructable2DHitsMap);
215 PfoContributionMap &pfoToReconstructable2DHitsMap);
226 static void GetPfoMCParticleHitSharingMaps(
const PfoContributionMap &pfoToReconstructable2DHitsMap,
const MCContributionMapVector &selectedMCParticleToHitsMaps,
227 PfoToMCParticleHitSharingMap &pfoToMCParticleHitSharingMap, MCParticleToPfoHitSharingMap &mcParticleToPfoHitSharingMap);
238 static void SelectCaloHits(
const pandora::CaloHitList *
const pCaloHitList,
const MCRelationMap &mcToPrimaryMCMap,
239 pandora::CaloHitList &selectedCaloHitList,
const bool selectInputHits,
const float maxPhotonPropagation);
249 static void CollectReconstructable2DHits(
const pandora::ParticleFlowObject *
const pPfo,
const MCContributionMapVector &selectedMCParticleToHitsMaps,
250 pandora::CaloHitList &reconstructableCaloHitList2D);
262 static void SelectGoodCaloHits(
const pandora::CaloHitList *
const pSelectedCaloHitList,
const MCRelationMap &mcToPrimaryMCMap,
263 pandora::CaloHitList &selectedGoodCaloHitList,
const bool selectInputHits,
const float minHitSharingFraction);
285 const MCRelationMap &mcToPrimaryMCMap,
const PrimaryParameters ¶meters, MCContributionMap &selectedMCParticlesToHitsMap);
297 static bool PassMCParticleChecks(
const pandora::MCParticle *
const pOriginalPrimary,
const pandora::MCParticle *
const pThisMCParticle,
298 const pandora::MCParticle *
const pHitMCParticle,
const float maxPhotonPropagation);
308 static pandora::CaloHitList
GetSharedHits(
const pandora::CaloHitList &hitListA,
const pandora::CaloHitList &hitListB);
313 #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)
std::unordered_map< const pandora::CaloHit *, const pandora::ParticleFlowObject * > CaloHitToPfoMap
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
bool m_selectInputHits
whether to select input hits
static bool IsPrimary(const pandora::MCParticle *const pMCParticle)
Whether a provided mc particle matches the implemented definition of being primary.
unsigned int m_minPrimaryGoodHits
the minimum number of primary good Hits
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::vector< PfoCaloHitListPair > PfoToSharedHitsVector
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 const pandora::MCParticle * GetMainMCParticle(const pandora::ParticleFlowObject *const pPfo)
Find the mc particle making the largest contribution to 2D clusters in a specified pfo...
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
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
float m_maxPhotonPropagation
the maximum photon propagation length
static void SelectCaloHits(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToPrimaryMCMap, 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 void SelectParticlesByHitCount(const pandora::MCParticleVector &candidateTargets, const MCContributionMap &mcToTrueHitListMap, const MCRelationMap &mcToPrimaryMCMap, const PrimaryParameters ¶meters, 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.
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
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 primary, reconstructable mc particles that match given criteria.
static void SelectParticlesMatchingCriteria(const pandora::MCParticleVector &inputMCParticles, std::function< bool(const pandora::MCParticle *const)> fCriteria, pandora::MCParticleVector &selectedParticles)
Select mc particles matching given criteria from an input list.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
static void GetPfoToReconstructable2DHitsMap(const pandora::PfoList &pfoList, const MCContributionMap &selectedMCParticleToHitsMap, PfoContributionMap &pfoToReconstructable2DHitsMap)
Get mapping from Pfo to reconstructable 2D hits (=good hits belonging to a selected reconstructable M...
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
std::map< const pandora::MCParticle *, PfoToSharedHitsVector > MCParticleToPfoHitSharingMap
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
static void CollectReconstructable2DHits(const pandora::ParticleFlowObject *const pPfo, const MCContributionMapVector &selectedMCParticleToHitsMaps, pandora::CaloHitList &reconstructableCaloHitList2D)
For a given Pfo, collect the hits which are reconstructable (=good hits belonging to a selected recon...
std::unordered_map< const pandora::MCParticle *, const pandora::ParticleFlowObject * > MCToPfoMap
float m_minHitSharingFraction
the minimum Hit sharing fraction
std::unordered_map< const pandora::MCParticle *, PfoContributionMap > MCToPfoMatchingMap
Header file for the lar mc particle class.
static void SelectGoodCaloHits(const pandora::CaloHitList *const pSelectedCaloHitList, const MCRelationMap &mcToPrimaryMCMap, 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::vector< MCContributionMap > MCContributionMapVector
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
static void GetPrimaryMCParticleList(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &mcPrimaryVector)
Get vector of primary MC particles from an input list of MC particles.
std::unordered_map< const pandora::CaloHit *, const pandora::MCParticle * > CaloHitToMCMap
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::MCParticle *, pandora::CaloHitList > MCParticleCaloHitListPair
PrimaryParameters()
Constructor.
static void GetMCParticleToCaloHitMatches(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToPrimaryMCMap, CaloHitToMCMap &hitToMCMap, MCContributionMap &mcToTrueHitListMap)
Match calo hits to their parent particles.
std::vector< MCParticleCaloHitListPair > MCParticleToSharedHitsVector
LArMCParticleHelper class.
std::unordered_map< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoContributionMap
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
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.
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair