9 #include "Pandora/AlgorithmHeaders.h" 26 MCParticleMonitoringAlgorithm::MCParticleMonitoringAlgorithm() :
27 m_useTrueNeutrinosOnly(false),
28 m_minHitsForDisplay(1)
36 std::cout <<
"---MC-PARTICLE-MONITORING-----------------------------------------------------------------------" << std::endl;
37 const MCParticleList *pMCParticleList =
nullptr;
38 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_mcParticleListName, pMCParticleList));
40 const CaloHitList *pCaloHitList =
nullptr;
41 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_caloHitListName, pCaloHitList));
57 if (!nuMCParticlesToGoodHitsMap.empty())
59 std::cout << std::endl <<
"BeamNeutrinos: " << std::endl;
63 if (!beamMCParticlesToGoodHitsMap.empty())
65 std::cout << std::endl <<
"BeamParticles: " << std::endl;
69 if (!crMCParticlesToGoodHitsMap.empty())
71 std::cout << std::endl <<
"CosmicRays: " << std::endl;
75 std::cout <<
"------------------------------------------------------------------------------------------------" << std::endl;
77 return STATUS_CODE_SUCCESS;
87 unsigned int index(0);
89 for (
const MCParticle *
const pMCPrimary : mcPrimaryVector)
91 const CaloHitList &caloHitList(mcContributionMap.at(pMCPrimary));
95 std::cout << std::endl <<
"--Primary " << index <<
", MCPDG " << pMCPrimary->GetParticleId() <<
", Energy " << pMCPrimary->GetEnergy()
96 <<
", Dist. " << (pMCPrimary->GetEndpoint() - pMCPrimary->GetVertex()).GetMagnitude() <<
", nMCHits " << caloHitList.size()
115 const int depth)
const 117 const CaloHitList &caloHitList(mcToTrueHitListMap.count(pMCParticle) ? mcToTrueHitListMap.at(pMCParticle) : CaloHitList());
123 for (
int iDepth = 1; iDepth < depth - 1; ++iDepth) std::cout <<
" ";
127 std::cout <<
"MCPDG " << pMCParticle->GetParticleId() <<
", Energy " << pMCParticle->GetEnergy()
128 <<
", Dist. " << (pMCParticle->GetEndpoint() - pMCParticle->GetVertex()).GetMagnitude() <<
", nMCHits " << caloHitList.size()
134 for (
const MCParticle *
const pDaughterParticle : pMCParticle->GetDaughterList())
135 this->
PrintMCParticle(pDaughterParticle, mcToTrueHitListMap, depth + 1);
142 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"CaloHitListName",
m_caloHitListName));
143 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MCParticleListName",
m_mcParticleListName));
145 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
148 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
151 return STATUS_CODE_SUCCESS;
Header file for the pfo helper class.
Header file for the mc particle monitoring algorithm.
Header file for the lar pfo class.
bool m_useTrueNeutrinosOnly
Whether to consider only mc particles that were neutrino induced.
Header file for the lar monitoring helper helper class.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
unsigned int m_minHitsForDisplay
Min hits associated with mc particle to warrant display to terminal.
pandora::StatusCode Run()
Header file for the geometry helper class.
static void GetOrderedMCParticleVector(const LArMCParticleHelper::MCContributionMapVector &selectedMCParticleToGoodHitsMaps, pandora::MCParticleVector &orderedMCParticleVector)
Order input MCParticles by their number of hits.
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.
void PrintMCParticle(const pandora::MCParticle *const pMCParticle, const LArMCParticleHelper::MCContributionMap &mcToTrueHitListMap, const int depth) const
Print information for a given mc particle to screen.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
Header file for the cluster helper class.
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
std::string m_caloHitListName
Name of input calo hit list.
void PrintPrimaryMCParticles(const LArMCParticleHelper::MCContributionMap &mcContributionMap) const
Extract details of each mc primary in a given mc contribution map.
float m_minHitSharingFraction
the minimum Hit sharing fraction
Header file for the lar mc particle class.
std::unordered_map< const pandora::CaloHit *, const pandora::MCParticle * > CaloHitToMCMap
static void GetMCParticleToCaloHitMatches(const pandora::CaloHitList *const pCaloHitList, const MCRelationMap &mcToPrimaryMCMap, CaloHitToMCMap &hitToMCMap, MCContributionMap &mcToTrueHitListMap)
Match calo hits to their parent particles.
std::string m_mcParticleListName
Name of input MC particle list.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
static bool IsBeamNeutrinoFinalState(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary neutrino final state MCParticle.
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.