HierarchyMonitoringAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArMonitoring/HierarchyMonitoringAlgorithm.cc
3  *
4  * @brief Implementation of the particle visualisation algorithm.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
13 using namespace pandora;
14 
15 namespace lar_content
16 {
17 
18 HierarchyMonitoringAlgorithm::HierarchyMonitoringAlgorithm() :
19  m_visualizeMC(false),
20  m_visualizeReco(false),
21  m_visualizeDistinct(false),
22  m_visualizeProcess{false},
23  m_match(false),
24  m_collectionOnly{false},
25  m_foldToPrimaries{false},
26  m_foldDynamic{true},
29  m_scalingFactor{1.f}
30 {
31 }
32 
33 //------------------------------------------------------------------------------------------------------------------------------------------
34 
36 {
37  PANDORA_MONITORING_API(SaveTree(this->GetPandora(), "processes", "processes.root", "UPDATE"));
38 }
39 
40 //------------------------------------------------------------------------------------------------------------------------------------------
41 
43 {
44  PANDORA_MONITORING_API(
45  SetEveDisplayParameters(this->GetPandora(), true, DETECTOR_VIEW_XZ, m_transparencyThresholdE, m_energyScaleThresholdE, m_scalingFactor));
46 
47  const CaloHitList *pCaloHitList(nullptr);
48  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_caloHitListName, pCaloHitList));
49  const MCParticleList *pMCParticleList(nullptr);
50  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pMCParticleList));
51  const PfoList *pPfoList(nullptr);
52  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_pfoListName, pPfoList));
53 
55  LArHierarchyHelper::MCHierarchy mcHierarchy(criteria);
59  foldParameters.m_foldToTier = true;
60  else if (m_foldDynamic)
61  foldParameters.m_foldDynamic = true;
62 
63  if (m_visualizeMC || m_match)
64  LArHierarchyHelper::FillMCHierarchy(*pMCParticleList, *pCaloHitList, foldParameters, mcHierarchy);
65  if (m_visualizeReco || m_match)
66  LArHierarchyHelper::FillRecoHierarchy(*pPfoList, foldParameters, recoHierarchy);
67  if (m_match)
68  {
70  LArHierarchyHelper::MatchHierarchies(mcHierarchy, recoHierarchy, matchInfo);
71  matchInfo.Print(mcHierarchy);
72  this->VisualizeMatches(matchInfo);
73  }
74  else
75  {
76  if (m_visualizeMC)
77  {
79  this->VisualizeMCDistinct(mcHierarchy);
80  else if (m_visualizeProcess)
81  this->VisualizeMCProcess(mcHierarchy);
82  else
83  this->VisualizeMC(mcHierarchy);
84  }
85  if (m_visualizeReco)
86  this->VisualizeReco(recoHierarchy);
87  }
88 
89  return STATUS_CODE_SUCCESS;
90 }
91 
92 //------------------------------------------------------------------------------------------------------------------------------------------
93 
95 {
96  const std::map<int, const std::string> keys = {{13, "mu"}, {11, "e"}, {22, "gamma"}, {321, "kaon"}, {211, "pi"}, {2212, "p"}};
97  const std::map<std::string, int> colors = {{"mu", 5}, {"e", 2}, {"gamma", 9}, {"kaon", 1}, {"pi", 3}, {"p", 4}, {"other", 14}};
98 
100  hierarchy.GetFlattenedNodes(nodes);
101 
102  int nodeIdx{0};
103  for (const LArHierarchyHelper::MCHierarchy::Node *pNode : nodes)
104  {
105  std::string key("other");
106  const int pdg{std::abs(pNode->GetParticleId())};
107  if (keys.find(pdg) != keys.end())
108  key = keys.at(pdg);
109 
110  CaloHitList uHits, vHits, wHits;
111  this->FillHitLists(pNode->GetCaloHits(), uHits, vHits, wHits);
112  std::string suffix{std::to_string(nodeIdx) + "_" + key};
113  this->Visualize(uHits, "u_" + suffix, colors.at(key));
114  this->Visualize(vHits, "v_" + suffix, colors.at(key));
115  this->Visualize(wHits, "w_" + suffix, colors.at(key));
116  ++nodeIdx;
117  }
118 
119  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
120 }
121 
122 //------------------------------------------------------------------------------------------------------------------------------------------
123 
125 {
126  const std::map<int, const std::string> keys = {{13, "mu"}, {11, "e"}, {22, "gamma"}, {321, "kaon"}, {211, "pi"}, {2212, "p"}};
127  const int nColours{9};
128  const int colors[nColours] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
129 
131  hierarchy.GetFlattenedNodes(nodes);
132 
133  int nodeIdx{0}, colorIdx{0};
134  for (const LArHierarchyHelper::MCHierarchy::Node *pNode : nodes)
135  {
136  std::string key("other");
137  const int pdg{std::abs(pNode->GetParticleId())};
138  if (keys.find(pdg) != keys.end())
139  key = keys.at(pdg);
140 
141  CaloHitList uHits, vHits, wHits;
142  this->FillHitLists(pNode->GetCaloHits(), uHits, vHits, wHits);
143  std::string suffix{std::to_string(nodeIdx) + "_" + key};
144  this->Visualize(uHits, "u_" + suffix, colors[colorIdx]);
145  this->Visualize(vHits, "v_" + suffix, colors[colorIdx]);
146  this->Visualize(wHits, "w_" + suffix, colors[colorIdx]);
147  colorIdx = (colorIdx + 1) >= nColours ? 0 : colorIdx + 1;
148  ++nodeIdx;
149  }
150 
151  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
152 }
153 
154 //------------------------------------------------------------------------------------------------------------------------------------------
155 
157 {
158  const std::map<MCProcess, std::string> procToCategoryMap = {{MC_PROC_INCIDENT_NU, "invisible"}, {MC_PROC_UNKNOWN, "invisible"},
159  {MC_PROC_PRIMARY, "primary"}, {MC_PROC_COMPT, "compt"}, {MC_PROC_PHOT, "phot"}, {MC_PROC_ANNIHIL, "annihil"}, {MC_PROC_E_IONI, "ioni"},
160  {MC_PROC_E_BREM, "brem"}, {MC_PROC_CONV, "conv"}, {MC_PROC_MU_IONI, "ioni"}, {MC_PROC_MU_MINUS_CAPTURE_AT_REST, "capture"},
161  {MC_PROC_NEUTRON_INELASTIC, "inelastic"}, {MC_PROC_N_CAPTURE, "capture"}, {MC_PROC_HAD_ELASTIC, "elastic"}, {MC_PROC_DECAY, "decay"},
162  {MC_PROC_COULOMB_SCAT, "coulomb"}, {MC_PROC_MU_BREM, "brem"}, {MC_PROC_MU_PAIR_PROD, "pair_prod"}, {MC_PROC_PHOTON_INELASTIC, "inelastic"},
163  {MC_PROC_HAD_IONI, "ioni"}, {MC_PROC_PROTON_INELASTIC, "inelastic"}, {MC_PROC_PI_PLUS_INELASTIC, "inelastic"},
165  {MC_PROC_RAYLEIGH, "rayleigh"}, {MC_PROC_HAD_BREM, "brem"}, {MC_PROC_HAD_PAIR_PROD, "pair_prod"}, {MC_PROC_ION_IONI, "ioni"},
166  {MC_PROC_NEUTRON_KILLER, "kill"}, {MC_PROC_ION_INELASTIC, "inelastic"}, {MC_PROC_HE3_INELASTIC, "inelastic"},
167  {MC_PROC_ALPHA_INELASTIC, "inelastic"}, {MC_PROC_ANTI_HE3_INELASTIC, "inelastic"}, {MC_PROC_ANTI_ALPHA_INELASTIC, "inelastic"},
169  {MC_PROC_ANTI_NEUTRON_INELASTIC, "inelastic"}, {MC_PROC_ANTI_PROTON_INELASTIC, "inelastic"},
170  {MC_PROC_ANTI_TRITON_INELASTIC, "inelastic"}, {MC_PROC_DEUTERON_INELASTIC, "inelastic"}, {MC_PROC_ELECTRON_NUCLEAR, "nuclear"},
171  {MC_PROC_PHOTON_NUCLEAR, "nuclear"}, {MC_PROC_KAON_PLUS_INELASTIC, "inelastic"}, {MC_PROC_KAON_MINUS_INELASTIC, "inelastic"},
172  {MC_PROC_HAD_BERTINI_CAPTURE_AT_REST, "capture"}, {MC_PROC_LAMBDA_INELASTIC, "inelastic"}, {MC_PROC_MU_NUCLEAR, "nuclear"},
173  {MC_PROC_TRITON_INELASTIC, "inelastic"}, {MC_PROC_PRIMARY_BACKGROUND, "background"}};
174 
175  const std::map<std::string, int> categoryToColorMap = {{"invisible", 0}, {"primary", 1}, {"compt", 2}, {"phot", 3}, {"annihil", 4},
176  {"ioni", 5}, {"brem", 6}, {"conv", 3}, {"capture", 6}, {"inelastic", 9}, {"elastic", 8}, {"decay", 7}, {"coulomb", 9},
177  {"pair_prod", 4}, {"transport", 1}, {"rayleigh", 9}, {"kill", 2}, {"nuclear", 5}, {"background", 7}};
178 
180  hierarchy.GetFlattenedNodes(nodes);
181 
182  int nodeIdx{0};
183  for (const LArHierarchyHelper::MCHierarchy::Node *pNode : nodes)
184  {
185  const LArMCParticle *pMC{dynamic_cast<const LArMCParticle *>(pNode->GetLeadingMCParticle())};
186  if (!pMC)
187  continue;
188  const MCProcess process{pMC->GetProcess()};
189  const std::string category{procToCategoryMap.at(process)};
190  const int pdg{std::abs(pNode->GetParticleId())};
191  const int tier{LArMCParticleHelper::GetHierarchyTier(pMC)};
192 
193  CaloHitList uHits, vHits, wHits;
194  this->FillHitLists(pNode->GetCaloHits(), uHits, vHits, wHits);
195  std::string suffix{std::to_string(nodeIdx) + " (" + std::to_string(tier) + ") " + std::to_string(pdg) + " " + category + " " +
197  if (process == MC_PROC_DECAY)
198  {
199  const MCParticleList &parentList{pMC->GetParentList()};
200  if (!parentList.empty())
201  {
202  const MCParticle *pParent{parentList.front()};
203  const int parentPdg{std::abs(pParent->GetParticleId())};
204  suffix += " from " + std::to_string(parentPdg);
205  }
206  }
207 
208  this->Visualize(uHits, "U " + suffix, categoryToColorMap.at(category));
209  this->Visualize(vHits, "V " + suffix, categoryToColorMap.at(category));
210  this->Visualize(wHits, "W " + suffix, categoryToColorMap.at(category));
211  ++nodeIdx;
212 
213  const int proc{static_cast<int>(process)};
214  const float mom{pMC->GetMomentum().GetMagnitude()};
215  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "processes", "process", proc));
216  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), "processes", "momentum", mom));
217  PANDORA_MONITORING_API(FillTree(this->GetPandora(), "processes"));
218  }
219 
220  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
221 }
222 
223 //------------------------------------------------------------------------------------------------------------------------------------------
224 
226 {
227  const int nColors{7};
228  const int colors[nColors] = {5, 2, 9, 1, 3, 4, 14};
229 
231  hierarchy.GetFlattenedNodes(nodes);
232 
233  int colorIdx{0};
234  int pfoIdx{0};
235  for (const LArHierarchyHelper::RecoHierarchy::Node *pNode : nodes)
236  {
237  CaloHitList uHits, vHits, wHits;
238  this->FillHitLists(pNode->GetCaloHits(), uHits, vHits, wHits);
239  const int pdg{pNode->GetParticleId()};
240  const std::string key{pdg == MU_MINUS ? "T" : pdg == E_MINUS ? "S" : "?"};
241  const std::string suffix{std::to_string(pfoIdx) + "_" + key};
242  this->Visualize(uHits, "u_" + suffix, colors[colorIdx]);
243  this->Visualize(vHits, "v_" + suffix, colors[colorIdx]);
244  this->Visualize(wHits, "w_" + suffix, colors[colorIdx]);
245  colorIdx = (colorIdx + 1) >= nColors ? 0 : colorIdx + 1;
246  ++pfoIdx;
247  }
248 
249  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
250 }
251 
252 //------------------------------------------------------------------------------------------------------------------------------------------
253 
255 {
256  std::map<const LArHierarchyHelper::MCHierarchy::Node *, int> mcIdxMap;
257  int mcIdx{0};
258  for (const LArHierarchyHelper::MCMatches &matches : matchInfo.GetMatches())
259  if (mcIdxMap.find(matches.GetMC()) == mcIdxMap.end())
260  mcIdxMap[matches.GetMC()] = mcIdx++;
261 
262  for (const LArHierarchyHelper::MCMatches &matches : matchInfo.GetMatches())
263  this->VisualizeMatchedMC(matches, mcIdxMap.at(matches.GetMC()));
264 
265  for (const LArHierarchyHelper::RecoHierarchy::Node *pNode : matchInfo.GetUnmatchedReco())
266  this->VisualizeUnmatchedReco(pNode);
267 
268  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
269 }
270 
271 //------------------------------------------------------------------------------------------------------------------------------------------
272 
274 {
275  const std::map<int, const std::string> keys = {{13, "mu"}, {11, "e"}, {22, "gamma"}, {321, "kaon"}, {211, "pi"}, {2212, "p"}};
276  const int green{3}, gray{14};
277  const std::map<int, int> colors = {{0, 5}, {1, 2}, {2, 9}, {3, 1}, {4, 4}};
278 
279  const LArHierarchyHelper::MCHierarchy::Node *pMCNode{matches.GetMC()};
280  const int pdg{pMCNode->GetParticleId()};
281 
282  std::string key("other");
283  if (keys.find(pdg) != keys.end())
284  key = keys.at(pdg);
285 
286  CaloHitList mcUHits, mcVHits, mcWHits;
287  this->FillHitLists(pMCNode->GetCaloHits(), mcUHits, mcVHits, mcWHits);
288  std::string leading{pMCNode->IsLeadingLepton() ? "_leading" : ""};
289  if (!matches.GetRecoMatches().empty())
290  {
291  std::string suffix{std::to_string(mcIdx) + "_" + key + leading};
292  this->Visualize(mcUHits, "u_" + suffix, green);
293  this->Visualize(mcVHits, "v_" + suffix, green);
294  this->Visualize(mcWHits, "w_" + suffix, green);
295  }
296  else
297  {
298  std::string suffix{std::to_string(mcIdx) + "_" + key + "_unmatched"};
299  this->Visualize(mcUHits, "u_" + suffix, gray);
300  this->Visualize(mcVHits, "v_" + suffix, gray);
301  this->Visualize(mcWHits, "w_" + suffix, gray);
302  }
303 
304  int recoIdx{0};
305  size_t colorIdx{0};
306  for (const LArHierarchyHelper::RecoHierarchy::Node *pRecoNode : matches.GetRecoMatches())
307  {
308  CaloHitList recoUHits, recoVHits, recoWHits;
309  this->FillHitLists(pRecoNode->GetCaloHits(), recoUHits, recoVHits, recoWHits);
310  const int characterisation{pRecoNode->GetParticleId()};
311  const std::string recoKey{characterisation == MU_MINUS ? "T" : characterisation == E_MINUS ? "S" : "?"};
312  const std::string recoSuffix{std::to_string(mcIdx) + "->" + std::to_string(recoIdx) + "_" + recoKey};
313  if (!recoUHits.empty())
314  {
315  const float purity{matches.GetPurity(pRecoNode, TPC_VIEW_U, true)};
316  const float completeness{matches.GetCompleteness(pRecoNode, TPC_VIEW_U, true)};
317  std::ostringstream metrics;
318  metrics.precision(2);
319  metrics << std::fixed << " p: " << purity << " c: " << completeness;
320  PANDORA_MONITORING_API(
321  VisualizeCaloHits(this->GetPandora(), &recoUHits, "u_" + recoSuffix + metrics.str(), static_cast<Color>(colors.at(colorIdx))));
322  }
323  if (!recoVHits.empty())
324  {
325  const float purity{matches.GetPurity(pRecoNode, TPC_VIEW_V, true)};
326  const float completeness{matches.GetCompleteness(pRecoNode, TPC_VIEW_V, true)};
327  std::ostringstream metrics;
328  metrics.precision(2);
329  metrics << std::fixed << " p: " << purity << " c: " << completeness;
330  PANDORA_MONITORING_API(
331  VisualizeCaloHits(this->GetPandora(), &recoVHits, "v_" + recoSuffix + metrics.str(), static_cast<Color>(colors.at(colorIdx))));
332  }
333  if (!recoWHits.empty())
334  {
335  const float purity{matches.GetPurity(pRecoNode, TPC_VIEW_W, true)};
336  const float completeness{matches.GetCompleteness(pRecoNode, TPC_VIEW_W, true)};
337  std::ostringstream metrics;
338  metrics.precision(2);
339  metrics << std::fixed << " p: " << purity << " c: " << completeness;
340  PANDORA_MONITORING_API(
341  VisualizeCaloHits(this->GetPandora(), &recoWHits, "w_" + recoSuffix + metrics.str(), static_cast<Color>(colors.at(colorIdx))));
342  }
343  colorIdx = (colorIdx + 1) >= colors.size() ? 0 : colorIdx + 1;
344  ++recoIdx;
345  }
346 }
347 
348 //------------------------------------------------------------------------------------------------------------------------------------------
349 
351 {
352  const int gray{14};
353 
354  CaloHitList uHits, vHits, wHits;
355  this->FillHitLists(pNode->GetCaloHits(), uHits, vHits, wHits);
356  const int pdg{pNode->GetParticleId()};
357  const std::string key{pdg == MU_MINUS ? "T" : pdg == E_MINUS ? "S" : "?"};
358  const std::string suffix{"unmatched_reco"};
359  this->Visualize(uHits, "u_" + suffix, gray);
360  this->Visualize(vHits, "v_" + suffix, gray);
361  this->Visualize(wHits, "w_" + suffix, gray);
362 }
363 
364 //------------------------------------------------------------------------------------------------------------------------------------------
365 
366 void HierarchyMonitoringAlgorithm::Visualize(const CaloHitList &hits, const std::string &label, const int color) const
367 {
368  if (!hits.empty() && hits.size() > 1)
369  {
370  if (m_collectionOnly && hits.front()->GetHitType() != TPC_VIEW_W)
371  return;
372  PANDORA_MONITORING_API(VisualizeCaloHits(this->GetPandora(), &hits, label, static_cast<Color>(color)));
373  }
374 }
375 
376 //------------------------------------------------------------------------------------------------------------------------------------------
377 
378 void HierarchyMonitoringAlgorithm::FillHitLists(const CaloHitList &hits, CaloHitList &uHits, CaloHitList &vHits, CaloHitList &wHits) const
379 {
380  for (const CaloHit *pCaloHit : hits)
381  {
382  const HitType view{pCaloHit->GetHitType()};
383  if (view == HitType::TPC_VIEW_U)
384  uHits.emplace_back(pCaloHit);
385  else if (view == HitType::TPC_VIEW_V)
386  vHits.emplace_back(pCaloHit);
387  else if (view == HitType::TPC_VIEW_W)
388  wHits.emplace_back(pCaloHit);
389  }
390 }
391 
392 //------------------------------------------------------------------------------------------------------------------------------------------
393 
394 StatusCode HierarchyMonitoringAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
395 {
396  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "CaloHitListName", m_caloHitListName));
397  if (m_caloHitListName.empty())
398  m_caloHitListName = "CaloHitList2D";
399  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PfoListName", m_pfoListName));
400  if (m_pfoListName.empty())
401  m_pfoListName = "RecreatedPfos";
402  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VisualizeMC", m_visualizeMC));
403  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VisualizeReco", m_visualizeReco));
404  PANDORA_RETURN_RESULT_IF_AND_IF(
405  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VisualizeDistinct", m_visualizeDistinct));
406  PANDORA_RETURN_RESULT_IF_AND_IF(
407  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VisualizeProcess", m_visualizeProcess));
408  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PerformMatching", m_match));
409  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "CollectionOnly", m_collectionOnly));
410  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "FoldToPrimaries", m_foldToPrimaries));
411  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "FoldDynamic", m_foldDynamic));
412  if (m_foldToPrimaries)
413  m_foldDynamic = false;
414  PANDORA_RETURN_RESULT_IF_AND_IF(
415  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "TransparencyThresholdE", m_transparencyThresholdE));
416  PANDORA_RETURN_RESULT_IF_AND_IF(
417  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "EnergyScaleThresholdE", m_energyScaleThresholdE));
418  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "ScalingFactor", m_scalingFactor));
419 
420  return STATUS_CODE_SUCCESS;
421 }
422 
423 } // namespace lar_content
const pandora::CaloHitList & GetCaloHits() const
Retrieve the CaloHits associated with this node.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void Visualize(const pandora::CaloHitList &hits, const std::string &label, const int color) const
Visualize a calo hit list.
bool m_foldToTier
Whether or not to apply folding based on particle tier.
enum cvn::HType HitType
std::string m_pfoListName
Name of input PFO list.
bool m_visualizeMC
Whether or not to visualize the MC nodes.
std::string string
Definition: nybbler.cc:12
void VisualizeMatchedMC(const LArHierarchyHelper::MCMatches &matches, const int mcIdx) const
Visualize the reco nodes matched to a single MC node.
bool m_visualizeProcess
If true, allocate colours based on the MC process.
void VisualizeMCProcess(const LArHierarchyHelper::MCHierarchy &hierarchy) const
Visualize MC nodes based on the MC process that created them.
static int GetHierarchyTier(const pandora::MCParticle *const pMCParticle)
Determine the position in the hierarchy for the MCParticle.
float m_scalingFactor
TEve works with [cm], Pandora usually works with [mm] (but LArContent went with cm too) ...
bool m_visualizeReco
Whether or not to visualize the reco nodes.
const RecoHierarchy::NodeVector & GetRecoMatches() const
Retrieve the vector of matched reco nodes.
void GetFlattenedNodes(NodeVector &nodeVector) const
Retrieve a flat vector of the ndoes in the hierarchy.
Definition: image.cpp:28
static void MatchHierarchies(const MCHierarchy &mcHierarchy, const RecoHierarchy &recoHierarchy, MatchInfo &matchInfo)
Finds the matches between reconstructed and MC hierarchies.
const MCHierarchy::Node * GetMC() const
Retrieve the MC node.
void VisualizeUnmatchedReco(const LArHierarchyHelper::RecoHierarchy::Node *pNode) const
Visualize the unmatched reco node.
const MCMatchesVector & GetMatches() const
Retrieve the vector of matches (this will include null matches - i.e. MC nodes with no corresponding ...
def process(f, kind)
Definition: search.py:254
void VisualizeMatches(const LArHierarchyHelper::MatchInfo &matchInfo) const
Visualize reco to MC matches.
T abs(T value)
LAr mc particle class.
Definition: LArMCParticle.h:94
static void FillRecoHierarchy(const pandora::PfoList &pfoList, const FoldingParameters &foldParameters, RecoHierarchy &hierarchy)
Fill a reconstructed hierarchy based on the specified folding criteria (see RecoHierarchy::FillHierar...
bool m_foldToPrimaries
Whether or not to fold everything back to primaries.
#define nodes
def key(type, name=None)
Definition: graph.py:13
float GetPurity(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the purity of the match.
void VisualizeReco(const LArHierarchyHelper::RecoHierarchy &hierarchy) const
Visualize the reco nodes.
Header file for the particle visualisation algorithm.
void VisualizeMC(const LArHierarchyHelper::MCHierarchy &hierarchy) const
Visualize MC nodes.
std::string m_caloHitListName
Name of input calo hit list.
bool m_foldDynamic
Whether or not to use process and topological information to make folding decisions.
void FillHitLists(const pandora::CaloHitList &hits, pandora::CaloHitList &uHits, pandora::CaloHitList &vHits, pandora::CaloHitList &wHits) const
Fill per view hit lists.
const RecoHierarchy::NodeVector & GetUnmatchedReco() const
Retrieve the vector of unmatched reco nodes.
bool m_match
Whether or not to visualize the reco to MC matches.
void Print(const MCHierarchy &mcHierarchy) const
Prints information about which reco nodes are matched to the MC nodes, information about hit sharing...
std::size_t color(std::string const &procname)
void GetFlattenedNodes(NodeVector &nodeVector) const
Retrieve a flat vector of the nodes in the hierarchy.
static void FillMCHierarchy(const pandora::MCParticleList &mcParticleList, const pandora::CaloHitList &caloHitList, const FoldingParameters &foldParameters, MCHierarchy &hierarchy)
Fill an MC hierarchy based on the specified folding criteria (see MCHierarchy::FillHierarchy for deta...
bool m_collectionOnly
Limit display to the collection plane only.
int GetParticleId() const
Retrieve the PDG code for the leading particle in this node Note, for reco objects the PDG codes repr...
void VisualizeMCDistinct(const LArHierarchyHelper::MCHierarchy &hierarchy) const
Visualize MC nodes without grouping by particle id.
metrics
Definition: train.py:350
float GetCompleteness(const RecoHierarchy::Node *pReco, const bool adcWeighted=false) const
Retrieve the completeness of the match.
float m_transparencyThresholdE
Cell energy for which transparency is saturated (0%, fully opaque)
std::string to_string(ModuleType const mt)
Definition: ModuleType.h:34
bool m_foldDynamic
Whether or not to fold based on process information.
float m_energyScaleThresholdE
Cell energy for which color is at top end of continous color palette.
bool m_visualizeDistinct
If true, allocate colours without consideration of particle id.