34 std::cout <<
"---MC-PARTICLE-MONITORING-----------------------------------------------------------------------" << std::endl;
58 if (!nuMCParticlesToGoodHitsMap.empty())
60 std::cout << std::endl <<
"BeamNeutrinos: " << std::endl;
64 if (!beamMCParticlesToGoodHitsMap.empty())
66 std::cout << std::endl <<
"BeamParticles: " << std::endl;
70 if (!crMCParticlesToGoodHitsMap.empty())
72 std::cout << std::endl <<
"CosmicRays: " << std::endl;
76 std::cout <<
"------------------------------------------------------------------------------------------------" << std::endl;
78 return STATUS_CODE_SUCCESS;
88 unsigned int index(0);
90 for (
const MCParticle *
const pMCPrimary : mcPrimaryVector)
92 const CaloHitList &caloHitList(mcContributionMap.at(pMCPrimary));
96 std::cout << std::endl
97 <<
"--Primary " << index <<
", MCPDG " << pMCPrimary->GetParticleId() <<
", Energy " << pMCPrimary->GetEnergy()
98 <<
", Dist. " << (pMCPrimary->GetEndpoint() - pMCPrimary->GetVertex()).GetMagnitude() <<
", nMCHits "
119 const CaloHitList &caloHitList(mcToTrueHitListMap.count(pMCParticle) ? mcToTrueHitListMap.at(pMCParticle) :
CaloHitList());
125 for (
int iDepth = 1; iDepth < depth - 1; ++iDepth)
130 std::cout <<
"MCPDG " << pMCParticle->
GetParticleId() <<
", Energy " << pMCParticle->
GetEnergy() <<
", Dist. "
131 << (pMCParticle->
GetEndpoint() - pMCParticle->
GetVertex()).GetMagnitude() <<
", nMCHits " << caloHitList.size() <<
" ("
138 this->
PrintMCParticle(pDaughterParticle, mcToTrueHitListMap, depth + 1);
154 return STATUS_CODE_SUCCESS;
Header file for the cluster helper class.
Header file for the geometry helper class.
Header file for the lar mc particle class.
Header file for the lar monitoring helper helper class.
Header file for the pfo helper class.
Header file for the lar pfo class.
Header file for the mc particle monitoring algorithm.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
float m_minHitSharingFraction
the minimum Hit sharing fraction
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam 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 target, reconstructable mc particles that match given criteria.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
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.
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.
static void GetOrderedMCParticleVector(const LArMCParticleHelper::MCContributionMapVector &selectedMCParticleToGoodHitsMaps, pandora::MCParticleVector &orderedMCParticleVector)
Order input MCParticles by their number of hits.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
void PrintMCParticle(const pandora::MCParticle *const pMCParticle, const LArMCParticleHelper::MCContributionMap &mcToTrueHitListMap, const int depth) const
Print information for a given mc particle to screen.
MCParticleMonitoringAlgorithm()
Default constructor.
void PrintPrimaryMCParticles(const LArMCParticleHelper::MCContributionMap &mcContributionMap) const
Extract details of each mc primary in a given mc contribution map.
std::string m_caloHitListName
Name of input calo hit list.
pandora::StatusCode Run()
Run the algorithm.
bool m_useTrueNeutrinosOnly
Whether to consider only mc particles that were neutrino induced.
unsigned int m_minHitsForDisplay
Min hits associated with mc particle to warrant display to terminal.
std::string m_mcParticleListName
Name of input MC particle list.
float GetEnergy() const
Get energy of mc particle, units GeV.
const MCParticleList & GetDaughterList() const
Get list of daughters of mc particle.
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.
int GetParticleId() const
Get the PDG code of the mc particle.
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
MANAGED_CONTAINER< const MCParticle * > MCParticleList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
std::vector< const MCParticle * > MCParticleVector
StatusCode
The StatusCode enum.