LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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) mcParticleList.push_back(mapEntry.first);
41  mcParticleList.sort(LArMCParticleHelper::SortByMomentum);
42 
43  for (const MCParticle *const pMCParticle : mcParticleList)
44  {
45  const float weight(mcParticleWeightMap.at(pMCParticle));
46 
47  if (weight > bestWeight)
48  {
49  pBestMCParticle = pMCParticle;
50  bestWeight = weight;
51  }
52  }
53 
54  if (!pBestMCParticle)
55  return false;
56 
57  return ((PHOTON != pBestMCParticle->GetParticleId()) && (E_MINUS != std::abs(pBestMCParticle->GetParticleId())));
58 }
59 
60 //------------------------------------------------------------------------------------------------------------------------------------------
61 
62 bool CheatingPfoCharacterisationAlgorithm::IsClearTrack(const Cluster *const /*pCluster*/) const
63 {
64  throw StatusCodeException(STATUS_CODE_NOT_ALLOWED);
65 }
66 
67 } // namespace lar_content
Header file for the pfo helper class.
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