All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CheatingPfoCharacterisationAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArCheating/CheatingPfoCharacterisationAlgorithm.cc
3  *
4  * @brief Implementation of the cheating pfo characterisation algorithm class.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
13 
15 
16 using namespace pandora;
17 
18 namespace lar_content
19 {
20 
21 bool CheatingPfoCharacterisationAlgorithm::IsClearTrack(const ParticleFlowObject *const pPfo) const
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 
63 bool CheatingPfoCharacterisationAlgorithm::IsClearTrack(const Cluster *const /*pCluster*/) const
64 {
65  throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
66 }
67 
68 } // namespace lar_content
Header file for the pfo helper class.
T abs(T value)
Header file for the cheating pfo characterisation algorithm class.
Header file for the lar monte carlo particle helper helper class.
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
Definition: reco_sbnd.fcl:182