9 #include "Pandora/AlgorithmHeaders.h" 24 TestBeamEventValidationAlgorithm::TestBeamEventValidationAlgorithm()
30 TestBeamEventValidationAlgorithm::~TestBeamEventValidationAlgorithm()
36 void TestBeamEventValidationAlgorithm::FillValidationInfo(
const MCParticleList *
const pMCParticleList,
37 const CaloHitList *
const pCaloHitList,
const PfoList *
const pPfoList,
ValidationInfo &validationInfo)
const 39 if (pMCParticleList && pCaloHitList)
42 LArMCParticleHelper::SelectReconstructableMCParticles(
43 pMCParticleList, pCaloHitList, m_primaryParameters, LArMCParticleHelper::IsBeamParticle, targetMCParticleToHitsMap);
44 LArMCParticleHelper::SelectReconstructableMCParticles(
45 pMCParticleList, pCaloHitList, m_primaryParameters, LArMCParticleHelper::IsCosmicRay, targetMCParticleToHitsMap);
52 LArMCParticleHelper::SelectReconstructableMCParticles(
53 pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsBeamParticle, allMCParticleToHitsMap);
54 LArMCParticleHelper::SelectReconstructableMCParticles(
55 pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsCosmicRay, allMCParticleToHitsMap);
63 PfoList allConnectedPfos;
64 LArPfoHelper::GetAllConnectedPfos(*pPfoList, allConnectedPfos);
66 PfoList finalStatePfos;
67 for (
const ParticleFlowObject *
const pPfo : allConnectedPfos)
69 if (pPfo->GetParentPfoList().empty())
70 finalStatePfos.push_back(pPfo);
74 LArMCParticleHelper::GetPfoToReconstructable2DHitsMap(
82 LArMCParticleHelper::GetPfoMCParticleHitSharingMaps(
87 this->InterpretMatching(validationInfo, interpretedMCToPfoHitSharingMap);
93 void TestBeamEventValidationAlgorithm::ProcessOutput(
94 const ValidationInfo &validationInfo,
const bool useInterpretedMatching,
const bool printToScreen,
const bool fillTree)
const 96 static int eventNumber{-1};
98 if (printToScreen && useInterpretedMatching)
99 std::cout <<
"---EVENT-" << eventNumber <<
"-INTERPRETED-MATCHING-OUTPUT----------------------------------------------------------" 101 else if (printToScreen)
102 std::cout <<
"---EVENT-" << eventNumber <<
"-RAW-MATCHING-OUTPUT------------------------------------------------------------------" 112 PfoVector primaryPfoVector;
113 LArMonitoringHelper::GetOrderedPfoVector(validationInfo.
GetPfoToHitsMap(), primaryPfoVector);
115 int pfoIndex(0), testBeamPfoIndex(0);
118 for (
const Pfo *
const pPrimaryPfo : primaryPfoVector)
120 pfoToIdMap.insert(PfoToIdMap::value_type(pPrimaryPfo, ++pfoIndex));
121 const Pfo *
const pRecoTestBeam(LArPfoHelper::IsTestBeamFinalState(pPrimaryPfo) ? LArPfoHelper::GetParentPfo(pPrimaryPfo) :
nullptr);
123 if (pRecoTestBeam && !testBeamPfoToIdMap.count(pRecoTestBeam))
124 testBeamPfoToIdMap.insert(PfoToIdMap::value_type(pRecoTestBeam, ++testBeamPfoIndex));
129 MCParticleList associatedMCPrimaries;
131 int nCorrectTB(0), nTotalTB(0), nCorrectCR(0), nTotalCR(0), nFakeTB(0), nFakeCR(0), nSplitTB(0), nSplitCR(0), nLost(0);
132 int mcPrimaryIndex(0), nTargetMatches(0), nTargetTBMatches(0), nTargetCRMatches(0);
133 IntVector mcPrimaryId, mcPrimaryPdg, nMCHitsTotal, nMCHitsU, nMCHitsV, nMCHitsW;
134 FloatVector mcPrimaryE, mcPrimaryPX, mcPrimaryPY, mcPrimaryPZ;
135 FloatVector mcPrimaryVtxX, mcPrimaryVtxY, mcPrimaryVtxZ, mcPrimaryEndX, mcPrimaryEndY, mcPrimaryEndZ;
136 IntVector nPrimaryMatchedPfos, nPrimaryMatchedTBPfos, nPrimaryMatchedCRPfos;
137 IntVector bestMatchPfoId, bestMatchPfoPdg, bestMatchPfoIsTB;
138 IntVector bestMatchPfoNHitsTotal, bestMatchPfoNHitsU, bestMatchPfoNHitsV, bestMatchPfoNHitsW;
139 IntVector bestMatchPfoNSharedHitsTotal, bestMatchPfoNSharedHitsU, bestMatchPfoNSharedHitsV, bestMatchPfoNSharedHitsW;
140 FloatVector bestMatchPfoX0;
142 std::stringstream targetSS;
144 for (
const MCParticle *
const pMCPrimary : mcPrimaryVector)
146 const bool hasMatch(mcToPfoHitSharingMap.count(pMCPrimary) && !mcToPfoHitSharingMap.at(pMCPrimary).empty());
149 if (!isTargetPrimary && !hasMatch)
152 associatedMCPrimaries.push_back(pMCPrimary);
156 const int mcNuanceCode(LArMCParticleHelper::GetNuanceCode(LArMCParticleHelper::GetParentMCParticle(pMCPrimary)));
157 const int isBeamParticle(LArMCParticleHelper::IsBeamParticle(pMCPrimary));
158 const int isCosmicRay(LArMCParticleHelper::IsCosmicRay(pMCPrimary));
160 const int nTargetPrimaries(associatedMCPrimaries.size());
161 const CartesianVector &targetVertex(LArMCParticleHelper::GetParentMCParticle(pMCPrimary)->GetVertex());
162 const float targetVertexX(targetVertex.GetX()), targetVertexY(targetVertex.GetY()), targetVertexZ(targetVertex.GetZ());
165 targetSS << (!isTargetPrimary ?
"(Non target) " :
"") <<
"PrimaryId " << mcPrimaryIndex <<
", TB " << isBeamParticle <<
", CR " 166 << isCosmicRay <<
", MCPDG " << pMCPrimary->GetParticleId() <<
", Energy " << pMCPrimary->GetEnergy() <<
", Dist. " 167 << (pMCPrimary->GetEndpoint() - pMCPrimary->GetVertex()).GetMagnitude() <<
", nMCHits " << mcPrimaryHitList.size() <<
" (" 168 << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, mcPrimaryHitList) <<
", " 169 << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, mcPrimaryHitList) <<
", " 170 << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, mcPrimaryHitList) <<
")" << std::endl;
172 mcPrimaryId.push_back(mcPrimaryIndex);
173 mcPrimaryPdg.push_back(pMCPrimary->GetParticleId());
174 mcPrimaryE.push_back(pMCPrimary->GetEnergy());
175 mcPrimaryPX.push_back(pMCPrimary->GetMomentum().GetX());
176 mcPrimaryPY.push_back(pMCPrimary->GetMomentum().GetY());
177 mcPrimaryPZ.push_back(pMCPrimary->GetMomentum().GetZ());
178 mcPrimaryVtxX.push_back(pMCPrimary->GetVertex().GetX());
179 mcPrimaryVtxY.push_back(pMCPrimary->GetVertex().GetY());
180 mcPrimaryVtxZ.push_back(pMCPrimary->GetVertex().GetZ());
181 mcPrimaryEndX.push_back(pMCPrimary->GetEndpoint().GetX());
182 mcPrimaryEndY.push_back(pMCPrimary->GetEndpoint().GetY());
183 mcPrimaryEndZ.push_back(pMCPrimary->GetEndpoint().GetZ());
184 nMCHitsTotal.push_back(mcPrimaryHitList.size());
185 nMCHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, mcPrimaryHitList));
186 nMCHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, mcPrimaryHitList));
187 nMCHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, mcPrimaryHitList));
189 int matchIndex(0), nPrimaryMatches(0), nPrimaryTBMatches(0), nPrimaryCRMatches(0);
191 float recoVertexX(std::numeric_limits<float>::max()), recoVertexY(std::numeric_limits<float>::max()),
192 recoVertexZ(std::numeric_limits<float>::max());
196 const CaloHitList &sharedHitList(pfoToSharedHits.second);
197 const CaloHitList &pfoHitList(validationInfo.
GetPfoToHitsMap().at(pfoToSharedHits.first));
199 const bool isRecoTestBeam(LArPfoHelper::IsTestBeam(pfoToSharedHits.first));
200 const bool isGoodMatch(this->IsGoodMatch(mcPrimaryHitList, pfoHitList, sharedHitList));
202 const int pfoId(pfoToIdMap.at(pfoToSharedHits.first));
204 if (0 == matchIndex++)
206 bestMatchPfoId.push_back(pfoId);
207 bestMatchPfoPdg.push_back(pfoToSharedHits.first->GetParticleId());
208 bestMatchPfoIsTB.push_back(isRecoTestBeam ? 1 : 0);
209 bestMatchPfoNHitsTotal.push_back(pfoHitList.size());
210 bestMatchPfoNHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, pfoHitList));
211 bestMatchPfoNHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, pfoHitList));
212 bestMatchPfoNHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, pfoHitList));
213 bestMatchPfoNSharedHitsTotal.push_back(sharedHitList.size());
214 bestMatchPfoNSharedHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, sharedHitList));
215 bestMatchPfoNSharedHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, sharedHitList));
216 bestMatchPfoNSharedHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, sharedHitList));
217 bestMatchPfoX0.push_back(pfoToSharedHits.first->GetPropertiesMap().count(
"X0") ? pfoToSharedHits.first->GetPropertiesMap().at(
"X0")
218 : std::numeric_limits<float>::max());
222 const Vertex *
const pRecoVertex(isRecoTestBeam ? LArPfoHelper::GetTestBeamInteractionVertex(pfoToSharedHits.first)
223 : LArPfoHelper::GetVertex(pfoToSharedHits.first));
224 recoVertexX = pRecoVertex->GetPosition().GetX();
225 recoVertexY = pRecoVertex->GetPosition().GetY();
226 recoVertexZ = pRecoVertex->GetPosition().GetZ();
228 catch (
const StatusCodeException &)
237 if (isRecoTestBeam && isGoodMatch)
239 if (!isRecoTestBeam && isGoodMatch)
242 targetSS <<
"-" << (!isGoodMatch ?
"(Below threshold) " :
"") <<
"MatchedPfoId " << pfoId <<
", TB " << isRecoTestBeam
243 <<
", CR " << (!isRecoTestBeam) <<
", PDG " << pfoToSharedHits.first->GetParticleId() <<
", nMatchedHits " 244 << sharedHitList.size() <<
" (" << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, sharedHitList) <<
", " 245 << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, sharedHitList) <<
", " 246 << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, sharedHitList) <<
")" 247 <<
", nPfoHits " << pfoHitList.size() <<
" (" << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, pfoHitList) <<
", " 248 << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, pfoHitList) <<
", " 249 << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, pfoHitList) <<
")" << std::endl;
252 if (mcToPfoHitSharingMap.at(pMCPrimary).empty())
254 targetSS <<
"-No matched Pfo" << std::endl;
255 bestMatchPfoId.push_back(-1);
256 bestMatchPfoPdg.push_back(0);
257 bestMatchPfoIsTB.push_back(0);
258 bestMatchPfoNHitsTotal.push_back(0);
259 bestMatchPfoNHitsU.push_back(0);
260 bestMatchPfoNHitsV.push_back(0);
261 bestMatchPfoNHitsW.push_back(0);
262 bestMatchPfoNSharedHitsTotal.push_back(0);
263 bestMatchPfoNSharedHitsU.push_back(0);
264 bestMatchPfoNSharedHitsV.push_back(0);
265 bestMatchPfoNSharedHitsW.push_back(0);
266 bestMatchPfoX0.push_back(std::numeric_limits<float>::max());
269 nPrimaryMatchedPfos.push_back(nPrimaryMatches);
270 nPrimaryMatchedTBPfos.push_back(nPrimaryTBMatches);
271 nPrimaryMatchedCRPfos.push_back(nPrimaryCRMatches);
272 nTargetMatches += nPrimaryMatches;
273 nTargetTBMatches += nPrimaryTBMatches;
274 nTargetCRMatches += nPrimaryCRMatches;
278 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"fileIdentifier", m_fileIdentifier));
279 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"eventNumber", eventNumber));
280 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcNuanceCode", mcNuanceCode));
281 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isBeamParticle", isBeamParticle));
282 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isCosmicRay", isCosmicRay));
283 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"nTargetPrimaries", nTargetPrimaries));
284 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"targetVertexX", targetVertexX));
285 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"targetVertexY", targetVertexY));
286 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"targetVertexZ", targetVertexZ));
287 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"recoVertexX", recoVertexX));
288 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"recoVertexY", recoVertexY));
289 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"recoVertexZ", recoVertexZ));
290 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryId", &mcPrimaryId));
291 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryPdg", &mcPrimaryPdg));
292 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryE", &mcPrimaryE));
293 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryPX", &mcPrimaryPX));
294 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryPY", &mcPrimaryPY));
295 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryPZ", &mcPrimaryPZ));
296 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryVtxX", &mcPrimaryVtxX));
297 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryVtxY", &mcPrimaryVtxY));
298 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryVtxZ", &mcPrimaryVtxZ));
299 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryEndX", &mcPrimaryEndX));
300 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryEndY", &mcPrimaryEndY));
301 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryEndZ", &mcPrimaryEndZ));
302 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryNHitsTotal", &nMCHitsTotal));
303 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryNHitsU", &nMCHitsU));
304 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryNHitsV", &nMCHitsV));
305 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"mcPrimaryNHitsW", &nMCHitsW));
306 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"nPrimaryMatchedPfos", &nPrimaryMatchedPfos));
307 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"nPrimaryMatchedTBPfos", &nPrimaryMatchedTBPfos));
308 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"nPrimaryMatchedCRPfos", &nPrimaryMatchedCRPfos));
309 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoId", &bestMatchPfoId));
310 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoPdg", &bestMatchPfoPdg));
311 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoNHitsTotal", &bestMatchPfoNHitsTotal));
312 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoNHitsU", &bestMatchPfoNHitsU));
313 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoNHitsV", &bestMatchPfoNHitsV));
314 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoNHitsW", &bestMatchPfoNHitsW));
315 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoNSharedHitsTotal", &bestMatchPfoNSharedHitsTotal));
316 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoNSharedHitsU", &bestMatchPfoNSharedHitsU));
317 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoNSharedHitsV", &bestMatchPfoNSharedHitsV));
318 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoNSharedHitsW", &bestMatchPfoNSharedHitsW));
319 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoX0", &bestMatchPfoX0));
320 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"nTargetMatches", nTargetMatches));
321 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"nTargetTBMatches", nTargetTBMatches));
322 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"nTargetCRMatches", nTargetCRMatches));
323 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"bestMatchPfoIsTB", &bestMatchPfoIsTB));
326 if (isBeamParticle || isCosmicRay)
330 const int interactionTypeInt(static_cast<int>(interactionType));
333 const int isCorrectTB(isBeamParticle && (nTargetTBMatches == 1) && (nTargetCRMatches == 0));
334 const int isCorrectCR(isCosmicRay && (nTargetTBMatches == 0) && (nTargetCRMatches == 1));
335 const int isFakeTB(isCosmicRay && (nTargetTBMatches > 0));
336 const int isFakeCR(!isCosmicRay && (nTargetCRMatches > 0));
337 const int isSplitTB(!isCosmicRay && (nTargetTBMatches > 1));
338 const int isSplitCR(isCosmicRay && (nTargetCRMatches > 1));
339 const int isLost(nTargetMatches == 0);
341 std::stringstream outcomeSS;
342 outcomeSS << LArInteractionTypeHelper::ToString(interactionType) <<
" (Nuance " << mcNuanceCode <<
", TB " << isBeamParticle
343 <<
", CR " << isCosmicRay <<
")" << std::endl;
365 outcomeSS <<
"IsCorrectTB ";
367 outcomeSS <<
"IsCorrectCR ";
369 outcomeSS <<
"IsFakeTB ";
371 outcomeSS <<
"IsFakeCR ";
373 outcomeSS <<
"isSplitTB ";
375 outcomeSS <<
"IsSplitCR ";
377 outcomeSS <<
"IsLost ";
378 if (nTargetTBMatches > 0)
379 outcomeSS <<
"(NTBMatches: " << nTargetTBMatches <<
") ";
380 if (nTargetCRMatches > 0)
381 outcomeSS <<
"(NCRMatches: " << nTargetCRMatches <<
") ";
383 std::cout << outcomeSS.str() << std::endl << targetSS.str() << std::endl;
387 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"interactionType", interactionTypeInt));
388 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isCorrectTB", isCorrectTB));
389 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isCorrectCR", isCorrectCR));
390 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isFakeTB", isFakeTB));
391 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isFakeCR", isFakeCR));
392 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isSplitTB", isSplitTB));
393 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isSplitCR", isSplitCR));
394 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(),
"isLost", isLost));
395 PANDORA_MONITORING_API(FillTree(this->GetPandora(), m_treeName.c_str()));
398 targetSS.str(std::string());
400 associatedMCPrimaries.clear();
402 nTargetTBMatches = 0;
403 nTargetCRMatches = 0;
405 mcPrimaryPdg.clear();
406 nMCHitsTotal.clear();
414 mcPrimaryVtxX.clear();
415 mcPrimaryVtxY.clear();
416 mcPrimaryVtxZ.clear();
417 mcPrimaryEndX.clear();
418 mcPrimaryEndY.clear();
419 mcPrimaryEndZ.clear();
420 nPrimaryMatchedPfos.clear();
421 nPrimaryMatchedTBPfos.clear();
422 nPrimaryMatchedCRPfos.clear();
423 bestMatchPfoId.clear();
424 bestMatchPfoPdg.clear();
425 bestMatchPfoIsTB.clear();
426 bestMatchPfoNHitsTotal.clear();
427 bestMatchPfoNHitsU.clear();
428 bestMatchPfoNHitsV.clear();
429 bestMatchPfoNHitsW.clear();
430 bestMatchPfoNSharedHitsTotal.clear();
431 bestMatchPfoNSharedHitsU.clear();
432 bestMatchPfoNSharedHitsV.clear();
433 bestMatchPfoNSharedHitsW.clear();
434 bestMatchPfoX0.clear();
438 if (useInterpretedMatching)
440 std::stringstream summarySS;
441 summarySS <<
"---SUMMARY--------------------------------------------------------------------------------------" << std::endl;
443 summarySS <<
"#CorrectTB: " << nCorrectTB <<
"/" << nTotalTB
444 <<
", Fraction: " << (nTotalTB > 0 ?
static_cast<float>(nCorrectTB) / static_cast<float>(nTotalTB) : 0.f) << std::endl;
446 summarySS <<
"#CorrectCR: " << nCorrectCR <<
"/" << nTotalCR
447 <<
", Fraction: " << (nTotalCR > 0 ?
static_cast<float>(nCorrectCR) / static_cast<float>(nTotalCR) : 0.f) << std::endl;
449 summarySS <<
"#FakeTB: " << nFakeTB <<
" ";
451 summarySS <<
"#FakeCR: " << nFakeCR <<
" ";
453 summarySS <<
"#SplitTB: " << nSplitTB <<
" ";
455 summarySS <<
"#SplitCR: " << nSplitCR <<
" ";
457 summarySS <<
"#Lost: " << nLost <<
" ";
458 if (nFakeTB || nFakeCR || nSplitTB || nSplitCR || nLost)
459 summarySS << std::endl;
461 std::cout << summarySS.str();
465 std::cout <<
"------------------------------------------------------------------------------------------------" << std::endl
471 StatusCode TestBeamEventValidationAlgorithm::ReadSettings(
const TiXmlHandle xmlHandle)
473 return EventValidationBaseAlgorithm::ReadSettings(xmlHandle);
std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToIdMap
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
const LArMCParticleHelper::MCContributionMap & GetTargetMCParticleToHitsMap() const
Get the target mc particle to hits map.
Header file for the interaction type helper class.
unsigned int m_minPrimaryGoodHits
the minimum number of primary good Hits
const LArMCParticleHelper::MCContributionMap & GetAllMCParticleToHitsMap() const
Get the all mc particle to hits map.
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
Header file for the lar monitoring helper helper class.
void SetMCToPfoHitSharingMap(const LArMCParticleHelper::MCParticleToPfoHitSharingMap &mcToPfoHitSharingMap)
Set the mc to pfo hit sharing map.
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
void SetTargetMCParticleToHitsMap(const LArMCParticleHelper::MCContributionMap &targetMCParticleToHitsMap)
Set the target mc particle to hits map.
std::unordered_map< const pandora::MCParticle *, int > MCParticleIntMap
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
const LArMCParticleHelper::MCParticleToPfoHitSharingMap & GetInterpretedMCToPfoHitSharingMap() const
Get the interpreted mc to pfo hit sharing map.
float m_minHitSharingFraction
the minimum Hit sharing fraction
InteractionType
InteractionType enum.
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.
Header file for the test beam event validation algorithm.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
std::unordered_map< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoContributionMap
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap