LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
CheatedThreeDClusteringTool.cc
Go to the documentation of this file.
1 
10 #include "Pandora/AlgorithmHeaders.h"
12 
13 using namespace pandora;
14 
15 namespace lar_content
16 {
17 
18 CheatedThreeDClusteringTool::CheatedThreeDClusteringTool()
19 {
20 }
21 
22 //------------------------------------------------------------------------------------------------------------------------------------------
23 
24 bool CheatedThreeDClusteringTool::Run(const pandora::CaloHitList &inputCaloHitList, std::vector<pandora::CaloHitList> &outputCaloHitListsVector)
25 {
26  LArMCParticleHelper::MCContributionMap mcParticleCaloHitListMap;
27 
28  for (const CaloHit *const pCaloHit3D : inputCaloHitList)
29  {
30  const CaloHit *const pParentCaloHit2D{static_cast<const CaloHit *>(pCaloHit3D->GetParentAddress())};
31 
32  const MCParticle *const pMainMCParticle(MCParticleHelper::GetMainMCParticle(pParentCaloHit2D));
33 
34  auto it = mcParticleCaloHitListMap.find(pMainMCParticle);
35 
36  if (it != mcParticleCaloHitListMap.end())
37  {
38  it->second.push_back(pCaloHit3D);
39  }
40  else
41  {
42  CaloHitList newList;
43  newList.push_back(pCaloHit3D);
44  mcParticleCaloHitListMap.insert(std::make_pair(pMainMCParticle, newList));
45  }
46  }
47  for (auto &pair : mcParticleCaloHitListMap)
48  outputCaloHitListsVector.push_back(std::ref(pair.second));
49 
50  return true;
51 }
52 
53 //------------------------------------------------------------------------------------------------------------------------------------------
54 
55 StatusCode CheatedThreeDClusteringTool::ReadSettings(const TiXmlHandle /*xmlHandle*/)
56 {
57  return STATUS_CODE_SUCCESS;
58 }
59 
60 } // namespace lar_content
Header file for cheated clustering tool class.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
Header file for the lar monte carlo particle helper helper class.