23 const PfoList *
const pPfoList,
float &targetParticleWeight,
float &totalWeight, std::function<
bool(
const MCParticle *
const)> fCriteria)
25 targetParticleWeight = 0.f;
35 for (
const Cluster *
const pCluster : twoDClusters)
42 pCluster->GetOrderedCaloHitList().FillCaloHitList(caloHitList);
45 for (
const CaloHit *
const pCaloHit : caloHitList)
47 float thisTargetParticleWeight = 0.f, thisTotalWeight = 0.f;
50 targetParticleWeight += thisTargetParticleWeight;
51 totalWeight += thisTotalWeight;
59 const CaloHit *
const pCaloHit,
float &targetParticleWeight,
float &totalWeight, std::function<
bool(
const MCParticle *
const)> fCriteria)
61 targetParticleWeight = 0.f;
65 if (hitMCParticleWeightMap.empty())
69 for (
const auto &mapEntry : hitMCParticleWeightMap)
70 mcParticleList.push_back(mapEntry.first);
73 for (
const MCParticle *
const pMCParticle : mcParticleList)
75 const float weight(hitMCParticleWeightMap.at(pMCParticle));
78 if (fCriteria(pParentMCParticle))
79 targetParticleWeight += weight;
81 totalWeight += weight;
85 if (totalWeight > std::numeric_limits<float>::epsilon())
87 targetParticleWeight *= 1.f / totalWeight;
92 targetParticleWeight = 0.f;
101 return STATUS_CODE_SUCCESS;
Header file for the cluster helper class.
Header file for the lar monte carlo particle helper helper class.
Header file for the pfo helper class.
static void GetTargetParticleWeight(const pandora::PfoList *const pPfoList, float &targetParticleWeight, float &totalWeight, std::function< bool(const pandora::MCParticle *const)> fCriteria)
Get the target particle weight in a list of pfos.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
const MCParticleWeightMap & GetMCParticleWeightMap() const
Get mc particle weight map for the calo hit.
ParticleFlowObject class.
StatusCodeException class.
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const MCParticle * > MCParticleList
std::unordered_map< const MCParticle *, float > MCParticleWeightMap
MANAGED_CONTAINER< const Cluster * > ClusterList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
StatusCode
The StatusCode enum.
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList