LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CheatingPfoCharacterisationAlgorithm.cc
Go to the documentation of this file.
1 
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.
constexpr auto abs(T v)
Returns the absolute value of the argument.
TFile f
Definition: plotHisto.C:6
Header file for the cheating pfo characterisation algorithm class.
Header file for the lar monte carlo particle helper helper class.
double weight
Definition: plottest35.C:25