Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
CheatingPfoCharacterisationAlgorithm.cc
Go to the documentation of this file.
1
10
13
15
16using namespace pandora;
17
18namespace lar_content
19{
20
22{
23 CaloHitList caloHitList;
24 LArPfoHelper::GetCaloHits(pPfo, TPC_VIEW_U, caloHitList);
25 LArPfoHelper::GetCaloHits(pPfo, TPC_VIEW_V, caloHitList);
26 LArPfoHelper::GetCaloHits(pPfo, TPC_VIEW_W, caloHitList);
27
28 MCParticleWeightMap mcParticleWeightMap;
29
30 for (const CaloHit *const pCaloHit : caloHitList)
31 {
32 for (const MCParticleWeightMap::value_type &mapEntry : pCaloHit->GetMCParticleWeightMap())
33 mcParticleWeightMap[mapEntry.first] += mapEntry.second;
34 }
35
36 float bestWeight(0.f);
37 const MCParticle *pBestMCParticle(nullptr);
38
39 MCParticleList mcParticleList;
40 for (const auto &mapEntry : mcParticleWeightMap)
41 mcParticleList.push_back(mapEntry.first);
42 mcParticleList.sort(LArMCParticleHelper::SortByMomentum);
43
44 for (const MCParticle *const pMCParticle : mcParticleList)
45 {
46 const float weight(mcParticleWeightMap.at(pMCParticle));
47
48 if (weight > bestWeight)
49 {
50 pBestMCParticle = pMCParticle;
51 bestWeight = weight;
52 }
53 }
54
55 if (!pBestMCParticle)
56 return false;
57
58 return ((PHOTON != pBestMCParticle->GetParticleId()) && (E_MINUS != std::abs(pBestMCParticle->GetParticleId())));
59}
60
61//------------------------------------------------------------------------------------------------------------------------------------------
62
64{
65 throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
66}
67
68} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the cheating pfo characterisation algorithm class.
Header file for the lar monte carlo particle helper helper class.
Header file for the pfo helper class.
bool IsClearTrack(const pandora::ParticleFlowObject *const pPfo) const
Whether pfo is identified as a clear track.
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
static void GetCaloHits(const pandora::PfoList &pfoList, const pandora::HitType &hitType, pandora::CaloHitList &caloHitList)
Get a list of calo hits of a particular hit type from a list of pfos.
CaloHit class.
Definition CaloHit.h:26
Cluster class.
Definition Cluster.h:31
MCParticle class.
Definition MCParticle.h:26
int GetParticleId() const
Get the PDG code of the mc particle.
Definition MCParticle.h:285
ParticleFlowObject class.
StatusCodeException class.
MANAGED_CONTAINER< const MCParticle * > MCParticleList
std::unordered_map< const MCParticle *, float > MCParticleWeightMap
MANAGED_CONTAINER< const CaloHit * > CaloHitList