TestBeamHierarchyEventValidationAlgorithm.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArMonitoring/TestBeamHierarchyEventValidationAlgorithm.cc
3  *
4  * @brief Implementation of the test beam hierarchy event validation algorithm.
5  *
6  * $Log: $
7  */
8 
9 #include "Pandora/AlgorithmHeaders.h"
10 
14 
16 
17 #include <sstream>
18 
19 using namespace pandora;
20 
21 namespace lar_content
22 {
23 
24 TestBeamHierarchyEventValidationAlgorithm::TestBeamHierarchyEventValidationAlgorithm() : m_eventNumber(0)
25 {
26 }
27 
28 //------------------------------------------------------------------------------------------------------------------------------------------
29 
31 {
32 }
33 
34 //------------------------------------------------------------------------------------------------------------------------------------------
35 
36 void TestBeamHierarchyEventValidationAlgorithm::FillValidationInfo(const MCParticleList *const pMCParticleList,
37  const CaloHitList *const pCaloHitList, const PfoList *const pPfoList, ValidationInfo &validationInfo) const
38 {
39  if (pMCParticleList && pCaloHitList)
40  {
41  LArMCParticleHelper::MCContributionMap targetMCParticleToHitsMap;
43  pMCParticleList, pCaloHitList, m_primaryParameters, LArMCParticleHelper::IsLeadingBeamParticle, targetMCParticleToHitsMap);
45  pMCParticleList, pCaloHitList, m_primaryParameters, LArMCParticleHelper::IsCosmicRay, targetMCParticleToHitsMap);
46 
48  parameters.m_minPrimaryGoodHits = 0;
49  parameters.m_minHitsForGoodView = 0;
50  parameters.m_minHitSharingFraction = 0.f;
51  LArMCParticleHelper::MCContributionMap allMCParticleToHitsMap;
53  pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsLeadingBeamParticle, allMCParticleToHitsMap);
55  pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsCosmicRay, allMCParticleToHitsMap);
56 
57  validationInfo.SetTargetMCParticleToHitsMap(targetMCParticleToHitsMap);
58  validationInfo.SetAllMCParticleToHitsMap(allMCParticleToHitsMap);
59  }
60 
61  if (pPfoList)
62  {
63  PfoList allConnectedPfos;
64  LArPfoHelper::GetAllConnectedPfos(*pPfoList, allConnectedPfos);
65 
66  PfoList finalStatePfos;
67  for (const ParticleFlowObject *const pPfo : allConnectedPfos)
68  {
69  // ATTN: Is test beam only set for parent pfo, therefor add parent and daughters for that particle
70  if (LArPfoHelper::IsTestBeam(pPfo))
71  {
72  finalStatePfos.push_back(pPfo);
73  for (const ParticleFlowObject *const pDaughterPfo : pPfo->GetDaughterPfoList())
74  finalStatePfos.push_back(pDaughterPfo);
75  }
76  else if (pPfo->GetParentPfoList().empty())
77  {
78  finalStatePfos.push_back(pPfo);
79  }
80  }
81 
84  finalStatePfos, validationInfo.GetAllMCParticleToHitsMap(), pfoToHitsMap, m_primaryParameters.m_foldBackHierarchy);
85  validationInfo.SetPfoToHitsMap(pfoToHitsMap);
86  }
87 
91  validationInfo.GetPfoToHitsMap(), {validationInfo.GetAllMCParticleToHitsMap()}, pfoToMCHitSharingMap, mcToPfoHitSharingMap);
92  validationInfo.SetMCToPfoHitSharingMap(mcToPfoHitSharingMap);
93 
94  LArMCParticleHelper::MCParticleToPfoHitSharingMap interpretedMCToPfoHitSharingMap;
95  this->InterpretMatching(validationInfo, interpretedMCToPfoHitSharingMap);
96  validationInfo.SetInterpretedMCToPfoHitSharingMap(interpretedMCToPfoHitSharingMap);
97 }
98 
99 //------------------------------------------------------------------------------------------------------------------------------------------
100 
102  const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const
103 {
104  if (printToScreen && useInterpretedMatching)
105  std::cout << "---INTERPRETED-MATCHING-OUTPUT------------------------------------------------------------------" << std::endl;
106  else if (printToScreen)
107  std::cout << "---RAW-MATCHING-OUTPUT--------------------------------------------------------------------------" << std::endl;
108 
109  PfoVector primaryPfoVector;
110  LArMonitoringHelper::GetOrderedPfoVector(validationInfo.GetPfoToHitsMap(), primaryPfoVector);
111 
112  // Test Beam Hierarchy Validation Pfo Bookkeeping
113  int pfoIndex(0), testBeamPfoIndex(0);
114  PfoToIdMap pfoToIdMap, testBeamPfoToIdMap;
115 
116  for (const Pfo *const pPrimaryPfo : primaryPfoVector)
117  {
118  pfoToIdMap.insert(PfoToIdMap::value_type(pPrimaryPfo, ++pfoIndex));
119  const Pfo *const pRecoTestBeam(LArPfoHelper::IsTestBeamFinalState(pPrimaryPfo) ? LArPfoHelper::GetParentPfo(pPrimaryPfo) : nullptr);
120 
121  if (pRecoTestBeam && !testBeamPfoToIdMap.count(pRecoTestBeam))
122  testBeamPfoToIdMap.insert(PfoToIdMap::value_type(pRecoTestBeam, ++testBeamPfoIndex));
123  }
124 
125  const LArMCParticleHelper::MCParticleToPfoHitSharingMap &mcToPfoHitSharingMap(
126  useInterpretedMatching ? validationInfo.GetInterpretedMCToPfoHitSharingMap() : validationInfo.GetMCToPfoHitSharingMap());
127 
128  // Test Beam Hierarchy Validation MCParticle Bookkeeping
129  MCParticleVector mcPrimaryVector;
131  LArMCParticleHelper::MCParticleIntMap triggeredToLeading, triggeredToLeadingCounter;
132 
133  // ATTN: At this stage the mcPrimaryVector is ordered from neutrinos, beam and then cosmics. Here we extract the beam and reorder
134  // to ensure the order follows primary parent beam 1, daughter 1 of beam 1, daughter 2 of beam 1, ..., primary parent beam 2,
135  // daughter 1 of beam 2, etc... as expected by downstream logic
136  MCParticleVector mcPrimaryVectorCopy(mcPrimaryVector), triggeredBeamParticles;
137  LArMCParticleHelper::MCRelationMap leadingToTriggeredMap;
138  mcPrimaryVector.clear();
139 
140  for (const MCParticle *const pMCPrimary : mcPrimaryVectorCopy)
141  {
143  {
144  const MCParticle *const pParentMCParticle(LArMCParticleHelper::GetParentMCParticle(pMCPrimary));
145  leadingToTriggeredMap.insert(LArMCParticleHelper::MCRelationMap::value_type(pMCPrimary, pParentMCParticle));
146 
147  if (std::find(triggeredBeamParticles.begin(), triggeredBeamParticles.end(), pParentMCParticle) == triggeredBeamParticles.end())
148  triggeredBeamParticles.push_back(pParentMCParticle);
149  }
150  else
151  {
152  mcPrimaryVector.push_back(pMCPrimary);
153  }
154  }
155 
156  for (const MCParticle *const pMCParent : triggeredBeamParticles)
157  {
158  // Parent appears first
159  mcPrimaryVector.push_back(pMCParent);
160  triggeredToLeading.insert(LArMCParticleHelper::MCParticleIntMap::value_type(pMCParent, 1));
161  triggeredToLeadingCounter.insert(LArMCParticleHelper::MCParticleIntMap::value_type(pMCParent, 0));
162 
163  for (const auto iter : leadingToTriggeredMap)
164  {
165  // Followed by daughters, veto parent <-> parent matche
166  if (iter.second == pMCParent && iter.first != pMCParent)
167  {
168  mcPrimaryVector.push_back(iter.first);
169  triggeredToLeading.at(pMCParent)++;
170  }
171  }
172  }
173 
174  PfoSet recoTestBeamHierarchies;
175  MCParticleList associatedMCPrimaries;
176 
177  int nCorrectTB(0), nTotalTB(0), nCorrectTBHierarchy(0), nTotalTBHierarchy(0), nCorrectCR(0), nTotalCR(0);
178  int nFakeTBHierarchy(0), nFakeCR(0), nSplitTBHierarchy(0), nSplitCR(0), nLost(0), mcPrimaryIndex(0), nTargetMatches(0),
179  nTargetTBHierarchyMatches(0);
180  int nTargetCRMatches(0), nTargetGoodTBHierarchyMatches(0), nTargetTBHierarchySplits(0), nTargetTBHierarchyLosses(0);
181  IntVector mcPrimaryId, mcPrimaryPdg, mcPrimaryTier, nMCHitsTotal, nMCHitsU, nMCHitsV, nMCHitsW;
182  FloatVector mcPrimaryE, mcPrimaryPX, mcPrimaryPY, mcPrimaryPZ;
183  FloatVector mcPrimaryVtxX, mcPrimaryVtxY, mcPrimaryVtxZ, mcPrimaryEndX, mcPrimaryEndY, mcPrimaryEndZ;
184  IntVector nPrimaryMatchedPfos, nPrimaryMatchedTBHierarchyPfos, nPrimaryMatchedCRPfos;
185  IntVector bestMatchPfoId, bestMatchPfoPdg, bestMatchPfoTier, bestMatchPfoIsTestBeam, bestMatchPfoIsTestBeamHierarchy;
186  IntVector bestMatchPfoRecoTBId, bestMatchPfoNHitsTotal, bestMatchPfoNHitsU, bestMatchPfoNHitsV, bestMatchPfoNHitsW;
187  IntVector bestMatchPfoNSharedHitsTotal, bestMatchPfoNSharedHitsU, bestMatchPfoNSharedHitsV, bestMatchPfoNSharedHitsW;
188  FloatVector bestMatchPfoX0;
189 
190  std::stringstream targetSS;
191  const std::string name("TB");
192 
193  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
194  {
195  const bool hasMatch(mcToPfoHitSharingMap.count(pMCPrimary) && !mcToPfoHitSharingMap.at(pMCPrimary).empty());
196  const bool isTargetPrimary(validationInfo.GetTargetMCParticleToHitsMap().count(pMCPrimary));
197 
198  if (!isTargetPrimary)
199  continue;
200 
201  // Parent in hierarchy needed even if no match
202  const bool hasVisibleTargets(
203  (!triggeredToLeading.empty() && LArMCParticleHelper::IsBeamParticle(LArMCParticleHelper::GetParentMCParticle(pMCPrimary)))
204  ? triggeredToLeading.at(LArMCParticleHelper::GetParentMCParticle(pMCPrimary)) != 1
205  : false);
206 
207  if (!hasMatch && !hasVisibleTargets)
208  continue;
209 
210  associatedMCPrimaries.push_back(pMCPrimary);
211  const int nTargetPrimaries(associatedMCPrimaries.size());
212  ++mcPrimaryIndex;
213  const CaloHitList &mcPrimaryHitList(validationInfo.GetAllMCParticleToHitsMap().at(pMCPrimary));
214 
216  const int isBeamParticle(LArMCParticleHelper::IsBeamParticle(pMCPrimary));
217 
218  // Leading beam particle is the primary beam particle or a daughter of that particle
219  const int isLeadingBeamParticle(LArMCParticleHelper::IsLeadingBeamParticle(pMCPrimary));
220  const int isCosmicRay(LArMCParticleHelper::IsCosmicRay(pMCPrimary));
221 
222  // Tier (0) : Primary, (1) : Daughter, (2) : Granddaughter etc... Note tier increases for both visible and invisible particles
223  const int mcHierarchyTier(LArMCParticleHelper::GetHierarchyTier(pMCPrimary));
224 
225  // Identify the number of matched leading particles and flag whether last particle in hierarchy is being considered
226  bool isLastTestBeamLeading(false);
227  if (isLeadingBeamParticle)
228  {
229  triggeredToLeadingCounter.at(LArMCParticleHelper::GetParentMCParticle(pMCPrimary))++;
230  const int nHierarchyLeading(triggeredToLeadingCounter.at(LArMCParticleHelper::GetParentMCParticle(pMCPrimary)));
231  isLastTestBeamLeading = (nHierarchyLeading == triggeredToLeading.at(LArMCParticleHelper::GetParentMCParticle(pMCPrimary)));
232  }
233 
234 #ifdef MONITORING
235  const CartesianVector &targetVertex(LArMCParticleHelper::GetParentMCParticle(pMCPrimary)->GetVertex());
236  const float targetVertexX(targetVertex.GetX()), targetVertexY(targetVertex.GetY()), targetVertexZ(targetVertex.GetZ());
237 #endif
238 
239  for (int tier = 0; tier < mcHierarchyTier; tier++)
240  targetSS << " -> ";
241 
242  targetSS << (!isTargetPrimary ? "(Non target) " : "") << "PrimaryId " << mcPrimaryIndex << ", TB " << isBeamParticle << ", TB Hierarchy "
243  << isLeadingBeamParticle << ", CR " << isCosmicRay << ", MCPDG " << pMCPrimary->GetParticleId() << ", Tier " << mcHierarchyTier
244  << ", Energy " << pMCPrimary->GetEnergy() << ", Dist. " << (pMCPrimary->GetEndpoint() - pMCPrimary->GetVertex()).GetMagnitude()
245  << ", nMCHits " << mcPrimaryHitList.size() << " (" << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, mcPrimaryHitList)
246  << ", " << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, mcPrimaryHitList) << ", "
247  << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, mcPrimaryHitList) << ")" << std::endl;
248 
249  mcPrimaryId.push_back(mcPrimaryIndex);
250  mcPrimaryPdg.push_back(pMCPrimary->GetParticleId());
251  mcPrimaryTier.push_back(mcHierarchyTier);
252  mcPrimaryE.push_back(pMCPrimary->GetEnergy());
253  mcPrimaryPX.push_back(pMCPrimary->GetMomentum().GetX());
254  mcPrimaryPY.push_back(pMCPrimary->GetMomentum().GetY());
255  mcPrimaryPZ.push_back(pMCPrimary->GetMomentum().GetZ());
256  mcPrimaryVtxX.push_back(pMCPrimary->GetVertex().GetX());
257  mcPrimaryVtxY.push_back(pMCPrimary->GetVertex().GetY());
258  mcPrimaryVtxZ.push_back(pMCPrimary->GetVertex().GetZ());
259  mcPrimaryEndX.push_back(pMCPrimary->GetEndpoint().GetX());
260  mcPrimaryEndY.push_back(pMCPrimary->GetEndpoint().GetY());
261  mcPrimaryEndZ.push_back(pMCPrimary->GetEndpoint().GetZ());
262  nMCHitsTotal.push_back(mcPrimaryHitList.size());
263  nMCHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, mcPrimaryHitList));
264  nMCHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, mcPrimaryHitList));
265  nMCHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, mcPrimaryHitList));
266 
267  int matchIndex(0), nPrimaryMatches(0), nPrimaryTBHierarchyMatches(0), nPrimaryCRMatches(0), nPrimaryGoodTBHierarchyMatches(0),
268  nPrimaryTBHierarchySplits(0);
269 #ifdef MONITORING
270  float recoVertexX(std::numeric_limits<float>::max()), recoVertexY(std::numeric_limits<float>::max()),
271  recoVertexZ(std::numeric_limits<float>::max());
272 #endif
273  for (const LArMCParticleHelper::PfoCaloHitListPair &pfoToSharedHits : mcToPfoHitSharingMap.at(pMCPrimary))
274  {
275  const CaloHitList &sharedHitList(pfoToSharedHits.second);
276  const CaloHitList &pfoHitList(validationInfo.GetPfoToHitsMap().at(pfoToSharedHits.first));
277 
278  const bool isRecoTestBeam(LArPfoHelper::IsTestBeam(pfoToSharedHits.first));
279  const bool isRecoTestBeamHierarchy(LArPfoHelper::IsTestBeamFinalState(pfoToSharedHits.first));
280  const bool isGoodMatch(this->IsGoodMatch(mcPrimaryHitList, pfoHitList, sharedHitList));
281 
282  // Tier (0) : Primary, (1) : Daughter, (2) : Granddaughter etc... Note that the tier only increases for visible particle
283  const int pfoHierarchyTier(LArPfoHelper::GetHierarchyTier(pfoToSharedHits.first));
284  const int pfoId(pfoToIdMap.at(pfoToSharedHits.first));
285  const int recoTBId(
286  isRecoTestBeam || isRecoTestBeamHierarchy ? testBeamPfoToIdMap.at(LArPfoHelper::GetParentPfo(pfoToSharedHits.first)) : -1);
287 
288  if (0 == matchIndex++)
289  {
290  bestMatchPfoId.push_back(pfoId);
291  bestMatchPfoPdg.push_back(pfoToSharedHits.first->GetParticleId());
292  bestMatchPfoTier.push_back(pfoHierarchyTier);
293  bestMatchPfoIsTestBeam.push_back(isRecoTestBeam ? 1 : 0);
294  bestMatchPfoIsTestBeamHierarchy.push_back(isRecoTestBeamHierarchy ? 1 : 0);
295  bestMatchPfoRecoTBId.push_back(recoTBId);
296  bestMatchPfoNHitsTotal.push_back(pfoHitList.size());
297  bestMatchPfoNHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, pfoHitList));
298  bestMatchPfoNHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, pfoHitList));
299  bestMatchPfoNHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, pfoHitList));
300  bestMatchPfoNSharedHitsTotal.push_back(sharedHitList.size());
301  bestMatchPfoNSharedHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, sharedHitList));
302  bestMatchPfoNSharedHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, sharedHitList));
303  bestMatchPfoNSharedHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, sharedHitList));
304  bestMatchPfoX0.push_back(pfoToSharedHits.first->GetPropertiesMap().count("X0") ? pfoToSharedHits.first->GetPropertiesMap().at("X0")
306 #ifdef MONITORING
307  try
308  {
309  const Vertex *const pRecoVertex(
310  isRecoTestBeamHierarchy ? LArPfoHelper::GetTestBeamInteractionVertex(LArPfoHelper::GetParentPfo(pfoToSharedHits.first))
311  : LArPfoHelper::GetVertex(pfoToSharedHits.first));
312  recoVertexX = pRecoVertex->GetPosition().GetX();
313  recoVertexY = pRecoVertex->GetPosition().GetY();
314  recoVertexZ = pRecoVertex->GetPosition().GetZ();
315  }
316  catch (const StatusCodeException &)
317  {
318  }
319 #endif
320  }
321 
322  if (isGoodMatch)
323  ++nPrimaryMatches;
324 
325  // ATTN: In hierarchy mode let TBHierarchyMatches become effective TBHierarchyMatches and treat the same
326  if (isRecoTestBeamHierarchy && isGoodMatch)
327  ++nPrimaryTBHierarchyMatches;
328  if (!isRecoTestBeamHierarchy && isGoodMatch)
329  ++nPrimaryCRMatches;
330 
331  if (isRecoTestBeamHierarchy)
332  {
333  // Account for splitting of test beam particle into separate reconstructed primary pfos
334  const Pfo *const pRecoTB(LArPfoHelper::GetParentPfo(pfoToSharedHits.first));
335  const bool isSplitRecoTBHierarchy(!recoTestBeamHierarchies.empty() && !recoTestBeamHierarchies.count(pRecoTB));
336  if (!isSplitRecoTBHierarchy && isGoodMatch)
337  ++nPrimaryGoodTBHierarchyMatches;
338  if (isSplitRecoTBHierarchy && isLeadingBeamParticle && isGoodMatch)
339  ++nPrimaryTBHierarchySplits;
340  recoTestBeamHierarchies.insert(pRecoTB);
341  }
342 
343  for (int tier = 0; tier < mcHierarchyTier; tier++)
344  targetSS << " ";
345 
346  targetSS << "-" << (!isGoodMatch ? "(Below threshold) " : "") << "MatchedPfoId " << pfoId << ", TB " << isRecoTestBeam
347  << ", TB Hierarchy " << isRecoTestBeamHierarchy;
348  if (isRecoTestBeamHierarchy)
349  targetSS << " [TBId: " << recoTBId << "]";
350  targetSS << ", CR " << (!isRecoTestBeam && !isRecoTestBeamHierarchy) << ", PDG " << pfoToSharedHits.first->GetParticleId()
351  << ", Tier " << pfoHierarchyTier << ", nMatchedHits " << sharedHitList.size() << " ("
352  << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, sharedHitList) << ", "
353  << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, sharedHitList) << ", "
354  << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, sharedHitList) << ")"
355  << ", nPfoHits " << pfoHitList.size() << " (" << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, pfoHitList) << ", "
356  << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, pfoHitList) << ", "
357  << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, pfoHitList) << ")" << std::endl;
358  }
359 
360  if (mcToPfoHitSharingMap.at(pMCPrimary).empty())
361  {
362  for (int tier = 0; tier < mcHierarchyTier; tier++)
363  targetSS << " ";
364  targetSS << "-No matched Pfo" << std::endl;
365  bestMatchPfoId.push_back(-1);
366  bestMatchPfoPdg.push_back(0);
367  bestMatchPfoTier.push_back(-1);
368  bestMatchPfoIsTestBeam.push_back(0);
369  bestMatchPfoIsTestBeamHierarchy.push_back(0);
370  bestMatchPfoRecoTBId.push_back(-1);
371  bestMatchPfoNHitsTotal.push_back(0);
372  bestMatchPfoNHitsU.push_back(0);
373  bestMatchPfoNHitsV.push_back(0);
374  bestMatchPfoNHitsW.push_back(0);
375  bestMatchPfoNSharedHitsTotal.push_back(0);
376  bestMatchPfoNSharedHitsU.push_back(0);
377  bestMatchPfoNSharedHitsV.push_back(0);
378  bestMatchPfoNSharedHitsW.push_back(0);
379  bestMatchPfoX0.push_back(std::numeric_limits<float>::max());
380  }
381 
382  nPrimaryMatchedPfos.push_back(nPrimaryMatches);
383  nPrimaryMatchedTBHierarchyPfos.push_back(nPrimaryTBHierarchyMatches);
384  nPrimaryMatchedCRPfos.push_back(nPrimaryCRMatches);
385  nTargetMatches += nPrimaryMatches;
386  nTargetTBHierarchyMatches += nPrimaryTBHierarchyMatches;
387  nTargetCRMatches += nPrimaryCRMatches;
388  nTargetGoodTBHierarchyMatches += nPrimaryGoodTBHierarchyMatches;
389  nTargetTBHierarchySplits += nPrimaryTBHierarchySplits;
390  if (0 == nPrimaryMatches)
391  ++nTargetTBHierarchyLosses;
392 
393  if (fillTree)
394  {
395  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "fileIdentifier", m_fileIdentifier));
396  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "eventNumber", m_eventNumber - 1));
397  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcNuanceCode", mcNuanceCode));
398  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isBeamParticle", isBeamParticle));
399  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isCosmicRay", isCosmicRay));
400  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetPrimaries", nTargetPrimaries));
401  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "targetVertexX", targetVertexX));
402  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "targetVertexY", targetVertexY));
403  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "targetVertexZ", targetVertexZ));
404  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "recoVertexX", recoVertexX));
405  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "recoVertexY", recoVertexY));
406  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "recoVertexZ", recoVertexZ));
407  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryId", &mcPrimaryId));
408  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryPdg", &mcPrimaryPdg));
409  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryTier", &mcPrimaryTier));
410  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryE", &mcPrimaryE));
411  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryPX", &mcPrimaryPX));
412  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryPY", &mcPrimaryPY));
413  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryPZ", &mcPrimaryPZ));
414  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryVtxX", &mcPrimaryVtxX));
415  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryVtxY", &mcPrimaryVtxY));
416  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryVtxZ", &mcPrimaryVtxZ));
417  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryEndX", &mcPrimaryEndX));
418  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryEndY", &mcPrimaryEndY));
419  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryEndZ", &mcPrimaryEndZ));
420  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryNHitsTotal", &nMCHitsTotal));
421  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryNHitsU", &nMCHitsU));
422  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryNHitsV", &nMCHitsV));
423  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryNHitsW", &nMCHitsW));
424  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nPrimaryMatchedPfos", &nPrimaryMatchedPfos));
425  PANDORA_MONITORING_API(
426  SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nPrimaryMatchedTBHierarchyPfos", &nPrimaryMatchedTBHierarchyPfos));
427  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nPrimaryMatchedCRPfos", &nPrimaryMatchedCRPfos));
428  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoId", &bestMatchPfoId));
429  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoPdg", &bestMatchPfoPdg));
430  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoTier", &bestMatchPfoTier));
431  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNHitsTotal", &bestMatchPfoNHitsTotal));
432  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNHitsU", &bestMatchPfoNHitsU));
433  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNHitsV", &bestMatchPfoNHitsV));
434  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNHitsW", &bestMatchPfoNHitsW));
435  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNSharedHitsTotal", &bestMatchPfoNSharedHitsTotal));
436  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNSharedHitsU", &bestMatchPfoNSharedHitsU));
437  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNSharedHitsV", &bestMatchPfoNSharedHitsV));
438  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNSharedHitsW", &bestMatchPfoNSharedHitsW));
439  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoX0", &bestMatchPfoX0));
440  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetMatches", nTargetMatches));
441  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetTBHierarchyMatches", nTargetTBHierarchyMatches));
442  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetCRMatches", nTargetCRMatches));
443 
444  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoIsTestBeam", &bestMatchPfoIsTestBeam));
445  PANDORA_MONITORING_API(
446  SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoIsTestBeamHierarchy", &bestMatchPfoIsTestBeamHierarchy));
447  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoRecoTBId", &bestMatchPfoRecoTBId));
448  PANDORA_MONITORING_API(
449  SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetGoodTBHierarchyMatches", nTargetGoodTBHierarchyMatches));
450  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetTBHierarchySplits", nTargetTBHierarchySplits));
451  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetTBHierarchyLosses", nTargetTBHierarchyLosses));
452  }
453 
454  if (isCosmicRay || isLastTestBeamLeading)
455  {
456  const LArInteractionTypeHelper::InteractionType interactionType(
458 #ifdef MONITORING
459  const int interactionTypeInt(static_cast<int>(interactionType));
460 #endif
461  // ATTN Some redundancy introduced to contributing variables
462  const int isCorrectTB(isBeamParticle && (nTargetTBHierarchyMatches == 1) && (nTargetCRMatches == 0));
463  const int isCorrectTBHierarchy(isLeadingBeamParticle && (nTargetGoodTBHierarchyMatches == nTargetTBHierarchyMatches) &&
464  (nTargetGoodTBHierarchyMatches == nTargetPrimaries) && (nTargetCRMatches == 0) &&
465  (nTargetTBHierarchySplits == 0) && (nTargetTBHierarchyLosses == 0));
466  const int isCorrectCR(isCosmicRay && (nTargetTBHierarchyMatches == 0) && (nTargetCRMatches == 1));
467  const int isFakeTBHierarchy(isCosmicRay && (nTargetTBHierarchyMatches > 0));
468  const int isFakeCR(!isCosmicRay && (nTargetCRMatches > 0));
469  const int isSplitTBHierarchy(!isCosmicRay && ((nTargetTBHierarchyMatches > nTargetPrimaries) || (nTargetTBHierarchySplits > 0)));
470  const int isSplitCR(isCosmicRay && (nTargetCRMatches > 1));
471  const int isLost(nTargetMatches == 0);
472 
473  std::stringstream outcomeSS;
474  const bool isBeamHierarchy((mcNuanceCode == 2001) | (mcNuanceCode == 2000));
475  outcomeSS << LArInteractionTypeHelper::ToString(interactionType) << " (Nuance " << mcNuanceCode << ", TB " << isBeamHierarchy
476  << ", CR " << isCosmicRay << ")" << std::endl;
477 
478  if (isBeamParticle)
479  ++nTotalTB;
480  if (isLastTestBeamLeading)
481  ++nTotalTBHierarchy;
482  if (isCosmicRay)
483  ++nTotalCR;
484  if (isCorrectTB)
485  ++nCorrectTB;
486  if (isCorrectTBHierarchy)
487  ++nCorrectTBHierarchy;
488  if (isCorrectCR)
489  ++nCorrectCR;
490  if (isFakeTBHierarchy)
491  ++nFakeTBHierarchy;
492  if (isFakeCR)
493  ++nFakeCR;
494  if (isSplitTBHierarchy)
495  ++nSplitTBHierarchy;
496  if (isSplitCR)
497  ++nSplitCR;
498  if (isLost)
499  ++nLost;
500 
501  if (isCorrectTBHierarchy)
502  outcomeSS << "IsCorrectTBHierarchy";
503  if (isCorrectCR)
504  outcomeSS << "IsCorrectCR ";
505  if (isFakeTBHierarchy)
506  outcomeSS << "IsFake" << name << " ";
507  if (isFakeCR)
508  outcomeSS << "IsFakeCR ";
509  if (isSplitTBHierarchy)
510  outcomeSS << "isSplit" << name << " ";
511  if (isSplitCR)
512  outcomeSS << "IsSplitCR ";
513  if (isLost)
514  outcomeSS << "IsLost ";
515  if (nTargetTBHierarchyMatches > 0)
516  outcomeSS << "(N" << name << "Matches: " << nTargetTBHierarchyMatches << ") ";
517  if (nTargetTBHierarchyLosses > 0)
518  outcomeSS << "(N" << name << "Losses: " << nTargetTBHierarchyLosses << ") ";
519  if (nTargetTBHierarchySplits > 0)
520  outcomeSS << "(N" << name << "Splits: " << nTargetTBHierarchySplits << ") ";
521  if (nTargetCRMatches > 0)
522  outcomeSS << "(NCRMatches: " << nTargetCRMatches << ") ";
523  if (printToScreen)
524  std::cout << outcomeSS.str() << std::endl << targetSS.str() << std::endl;
525 
526  if (fillTree)
527  {
528  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "interactionType", interactionTypeInt));
529  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isCorrectTBHierarchy", isCorrectTBHierarchy));
530  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isCorrectCR", isCorrectCR));
531  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isFakeTBHierarchy", isFakeTBHierarchy));
532  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isFakeCR", isFakeCR));
533  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isSplitTBHierarchy", isSplitTBHierarchy));
534  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isSplitCR", isSplitCR));
535  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isLost", isLost));
536  PANDORA_MONITORING_API(FillTree(this->GetPandora(), m_treeName.c_str()));
537  }
538 
539  targetSS.str(std::string());
540  targetSS.clear();
541  associatedMCPrimaries.clear();
542  nTargetMatches = 0;
543  nTargetTBHierarchyMatches = 0;
544  nTargetCRMatches = 0;
545  nTargetGoodTBHierarchyMatches = 0;
546  nTargetTBHierarchySplits = 0;
547  nTargetTBHierarchyLosses = 0;
548  mcPrimaryId.clear();
549  mcPrimaryPdg.clear();
550  mcPrimaryTier.clear();
551  nMCHitsTotal.clear();
552  nMCHitsU.clear();
553  nMCHitsV.clear();
554  nMCHitsW.clear();
555  mcPrimaryE.clear();
556  mcPrimaryPX.clear();
557  mcPrimaryPY.clear();
558  mcPrimaryPZ.clear();
559  mcPrimaryVtxX.clear();
560  mcPrimaryVtxY.clear();
561  mcPrimaryVtxZ.clear();
562  mcPrimaryEndX.clear();
563  mcPrimaryEndY.clear();
564  mcPrimaryEndZ.clear();
565  nPrimaryMatchedPfos.clear();
566  nPrimaryMatchedTBHierarchyPfos.clear();
567  nPrimaryMatchedCRPfos.clear();
568  bestMatchPfoId.clear();
569  bestMatchPfoPdg.clear();
570  bestMatchPfoTier.clear();
571  bestMatchPfoIsTestBeam.clear();
572  bestMatchPfoIsTestBeamHierarchy.clear();
573  bestMatchPfoRecoTBId.clear();
574  bestMatchPfoNHitsTotal.clear();
575  bestMatchPfoNHitsU.clear();
576  bestMatchPfoNHitsV.clear();
577  bestMatchPfoNHitsW.clear();
578  bestMatchPfoNSharedHitsTotal.clear();
579  bestMatchPfoNSharedHitsU.clear();
580  bestMatchPfoNSharedHitsV.clear();
581  bestMatchPfoNSharedHitsW.clear();
582  bestMatchPfoX0.clear();
583  }
584  }
585 
586  if (useInterpretedMatching)
587  {
588  std::stringstream summarySS;
589  summarySS << "---SUMMARY--------------------------------------------------------------------------------------" << std::endl;
590  if (nTotalTBHierarchy > 0)
591  summarySS << "#CorrectTBHierarchy: " << nCorrectTBHierarchy << "/" << nTotalTBHierarchy << ", Fraction: "
592  << (nTotalTBHierarchy > 0 ? static_cast<float>(nCorrectTBHierarchy) / static_cast<float>(nTotalTBHierarchy) : 0.f)
593  << std::endl;
594  if (nTotalCR > 0)
595  summarySS << "#CorrectCR: " << nCorrectCR << "/" << nTotalCR
596  << ", Fraction: " << (nTotalCR > 0 ? static_cast<float>(nCorrectCR) / static_cast<float>(nTotalCR) : 0.f) << std::endl;
597  if (nFakeTBHierarchy > 0)
598  summarySS << "#Fake" << name << ": " << nFakeTBHierarchy << " ";
599  if (nFakeCR > 0)
600  summarySS << "#FakeCR: " << nFakeCR << " ";
601  if (nSplitTBHierarchy > 0)
602  summarySS << "#Split" << name << ": " << nSplitTBHierarchy << " ";
603  if (nSplitCR > 0)
604  summarySS << "#SplitCR: " << nSplitCR << " ";
605  if (nLost > 0)
606  summarySS << "#Lost: " << nLost << " ";
607  if (nFakeTBHierarchy || nFakeCR || nSplitTBHierarchy || nSplitCR || nLost)
608  summarySS << std::endl;
609  if (printToScreen)
610  std::cout << summarySS.str();
611  }
612 
613  if (printToScreen)
614  std::cout << "------------------------------------------------------------------------------------------------" << std::endl
615  << std::endl;
616 }
617 
618 //------------------------------------------------------------------------------------------------------------------------------------------
619 
620 StatusCode TestBeamHierarchyEventValidationAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
621 {
623 }
624 
625 } // namespace lar_content
static QCString name
Definition: declinfo.cpp:673
const LArMCParticleHelper::PfoContributionMap & GetPfoToHitsMap() const
Get the pfo to hits map.
Header file for the pfo helper class.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
static void GetTestBeamHierarchyPfoToReconstructable2DHitsMap(const pandora::PfoList &pfoList, const MCContributionMap &selectedMCParticleToHitsMap, PfoContributionMap &pfoToReconstructable2DHitsMap, const bool foldBackHierarchy)
Get mapping from Pfo in reconstructed test beam hierarchy to reconstructable 2D hits (=good hits belo...
const LArMCParticleHelper::MCContributionMap & GetTargetMCParticleToHitsMap() const
Get the target mc particle to hits map.
Header file for the interaction type helper class.
std::string string
Definition: nybbler.cc:12
static bool IsLeadingBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a leading beam MCParticle.
unsigned int m_minPrimaryGoodHits
the minimum number of primary good Hits
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
void InterpretMatching(const ValidationInfo &validationInfo, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const
Apply an interpretative matching procedure to the comprehensive matches in the provided validation in...
const LArMCParticleHelper::MCContributionMap & GetAllMCParticleToHitsMap() const
Get the all mc particle to hits map.
static int GetHierarchyTier(const pandora::MCParticle *const pMCParticle)
Determine the position in the hierarchy for the MCParticle.
static const pandora::Vertex * GetTestBeamInteractionVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo test beam interaction vertex.
static void GetPfoMCParticleHitSharingMaps(const PfoContributionMap &pfoToReconstructable2DHitsMap, const MCContributionMapVector &selectedMCParticleToHitsMaps, PfoToMCParticleHitSharingMap &pfoToMCParticleHitSharingMap, MCParticleToPfoHitSharingMap &mcParticleToPfoHitSharingMap)
Get the mappings from Pfo -> pair (reconstructable MCparticles, number of reconstructable 2D hits sha...
std::map< const pandora::MCParticle *, PfoToSharedHitsVector > MCParticleToPfoHitSharingMap
const LArMCParticleHelper::MCParticleToPfoHitSharingMap & GetMCToPfoHitSharingMap() const
Get the mc to pfo hit sharing map.
void SetInterpretedMCToPfoHitSharingMap(const LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap)
Set the interpreted mc to pfo hit sharing map.
std::vector< int > IntVector
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
bool m_foldBackHierarchy
whether to fold the hierarchy back to the primary (neutrino) or leading particles (test beam) ...
static void SelectReconstructableTestBeamHierarchyMCParticles(const pandora::MCParticleList *pMCParticleList, const pandora::CaloHitList *pCaloHitList, const PrimaryParameters &parameters, std::function< bool(const pandora::MCParticle *const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap)
Select target, reconstructable mc particles in the relevant hierarchy that match given criteria...
Header file for the lar monitoring helper helper class.
void SetMCToPfoHitSharingMap(const LArMCParticleHelper::MCParticleToPfoHitSharingMap &mcToPfoHitSharingMap)
Set the mc to pfo hit sharing map.
static unsigned int GetNuanceCode(const pandora::MCParticle *const pMCParticle)
Get the nuance code of an MCParticle.
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
Header file for the test beam hierarchy event validation algorithm.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
static void GetOrderedMCParticleVector(const LArMCParticleHelper::MCContributionMapVector &selectedMCParticleToGoodHitsMaps, pandora::MCParticleVector &orderedMCParticleVector)
Order input MCParticles by their number of hits.
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
void SetTargetMCParticleToHitsMap(const LArMCParticleHelper::MCContributionMap &targetMCParticleToHitsMap)
Set the target mc particle to hits map.
static void SelectReconstructableMCParticles(const pandora::MCParticleList *pMCParticleList, const pandora::CaloHitList *pCaloHitList, const PrimaryParameters &parameters, std::function< bool(const pandora::MCParticle *const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap)
Select target, reconstructable mc particles that match given criteria.
static int GetHierarchyTier(const pandora::ParticleFlowObject *const pPfo)
Determine the position in the hierarchy for the MCParticle.
static bool IsTestBeam(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a test beam particle.
std::unordered_map< const pandora::MCParticle *, int > MCParticleIntMap
static const pandora::ParticleFlowObject * GetParentPfo(const pandora::ParticleFlowObject *const pPfo)
Get the primary parent pfo.
LArMCParticleHelper::PrimaryParameters m_primaryParameters
The mc particle primary selection parameters.
static std::string ToString(const InteractionType interactionType)
Get a string representation of an interaction type.
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
static const pandora::MCParticle * GetParentMCParticle(const pandora::MCParticle *const pMCParticle)
Get the parent mc particle.
static void GetOrderedPfoVector(const LArMCParticleHelper::PfoContributionMap &pfoToReconstructable2DHitsMap, pandora::PfoVector &orderedPfoVector)
Order input Pfos by their number of hits.
const LArMCParticleHelper::MCParticleToPfoHitSharingMap & GetInterpretedMCToPfoHitSharingMap() const
Get the interpreted mc to pfo hit sharing map.
static int max(int a, int b)
float m_minHitSharingFraction
the minimum Hit sharing fraction
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void SetAllMCParticleToHitsMap(const LArMCParticleHelper::MCContributionMap &allMCParticleToHitsMap)
Set the all mc particle to hits map.
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
void SetPfoToHitsMap(const LArMCParticleHelper::PfoContributionMap &pfoToHitsMap)
Set the pfo to hits map.
std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToIdMap
void ProcessOutput(const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const
Print matching information in a provided validation info object, and write information to tree if con...
void FillValidationInfo(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, ValidationInfo &validationInfo) const
Fill the validation info containers.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
Dft::FloatVector FloatVector
static InteractionType GetTestBeamHierarchyInteractionType(const pandora::MCParticleList &mcPrimaryList)
Get the test beam hierarchy interaction type of an event.
bool IsGoodMatch(const pandora::CaloHitList &trueHits, const pandora::CaloHitList &recoHits, const pandora::CaloHitList &sharedHits) const
Whether a provided mc primary and pfo are deemed to be a good match.
std::unordered_map< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoContributionMap
static void GetAllConnectedPfos(const pandora::PfoList &inputPfoList, pandora::PfoList &outputPfoList)
Get a flat list of all pfos, recursively including all daughters and parents associated with those pf...
static unsigned int CountHitsByType(const pandora::HitType hitType, const pandora::CaloHitList &caloHitList)
Count the number of calo hits, in a provided list, of a specified type.
std::unordered_map< const pandora::MCParticle *, const pandora::MCParticle * > MCRelationMap
static bool IsTestBeamFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a final-state particle from a test beam particle interaction.
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
QTextStream & endl(QTextStream &s)