9 #include "Pandora/AlgorithmHeaders.h"
24 NeutrinoEventValidationAlgorithm::NeutrinoEventValidationAlgorithm() : m_useTrueNeutrinosOnly(
false)
37 const CaloHitList *
const pCaloHitList,
const PfoList *
const pPfoList,
ValidationInfo &validationInfo)
const
39 if (pMCParticleList && pCaloHitList)
65 PfoList allConnectedPfos;
68 PfoList finalStatePfos;
69 for (
const ParticleFlowObject *
const pPfo : allConnectedPfos)
72 finalStatePfos.push_back(pPfo);
90 for (
const MCParticle *pMCParticle : mcPrimaryVector)
92 if (mcToPfoHitSharingMap.find(pMCParticle) == mcToPfoHitSharingMap.end())
95 mcToPfoHitSharingMap.insert(LArMCParticleHelper::MCParticleToPfoHitSharingMap::value_type(pMCParticle, pfoToSharedHitsVector));
109 const ValidationInfo &validationInfo,
const bool useInterpretedMatching,
const bool printToScreen,
const bool fillTree)
const
111 if (printToScreen && useInterpretedMatching)
112 std::cout <<
"---INTERPRETED-MATCHING-OUTPUT------------------------------------------------------------------" << std::endl;
113 else if (printToScreen)
114 std::cout <<
"---RAW-MATCHING-OUTPUT--------------------------------------------------------------------------" << std::endl;
123 int nNeutrinoPrimaries(0);
124 for (
const MCParticle *
const pMCPrimary : mcPrimaryVector)
126 ++nNeutrinoPrimaries;
128 PfoVector primaryPfoVector;
131 int pfoIndex(0), neutrinoPfoIndex(0);
134 for (
const Pfo *
const pPrimaryPfo : primaryPfoVector)
136 pfoToIdMap.insert(PfoToIdMap::value_type(pPrimaryPfo, ++pfoIndex));
139 if (pRecoNeutrino && !neutrinoPfoToIdMap.count(pRecoNeutrino))
140 neutrinoPfoToIdMap.insert(PfoToIdMap::value_type(pRecoNeutrino, ++neutrinoPfoIndex));
145 PfoSet recoNeutrinos;
146 MCParticleList associatedMCPrimaries;
148 int nCorrectNu(0), nTotalNu(0), nCorrectCR(0), nTotalCR(0);
149 int nFakeNu(0), nFakeCR(0), nSplitNu(0), nSplitCR(0), nLost(0), mcPrimaryIndex(0), nTargetMatches(0), nTargetNuMatches(0);
150 int nTargetCRMatches(0), nTargetGoodNuMatches(0), nTargetNuSplits(0), nTargetNuLosses(0);
151 IntVector mcPrimaryId, mcPrimaryPdg, nMCHitsTotal, nMCHitsU, nMCHitsV, nMCHitsW;
152 FloatVector mcPrimaryE, mcPrimaryPX, mcPrimaryPY, mcPrimaryPZ;
153 FloatVector mcPrimaryVtxX, mcPrimaryVtxY, mcPrimaryVtxZ, mcPrimaryEndX, mcPrimaryEndY, mcPrimaryEndZ;
154 IntVector nPrimaryMatchedPfos, nPrimaryMatchedNuPfos, nPrimaryMatchedCRPfos;
155 IntVector bestMatchPfoId, bestMatchPfoPdg, bestMatchPfoIsRecoNu, bestMatchPfoRecoNuId;
156 IntVector bestMatchPfoNHitsTotal, bestMatchPfoNHitsU, bestMatchPfoNHitsV, bestMatchPfoNHitsW;
157 IntVector bestMatchPfoNSharedHitsTotal, bestMatchPfoNSharedHitsU, bestMatchPfoNSharedHitsV, bestMatchPfoNSharedHitsW;
159 std::stringstream targetSS;
160 const std::string
name(
"Nu");
162 for (
const MCParticle *
const pMCPrimary : mcPrimaryVector)
164 const bool hasMatch(mcToPfoHitSharingMap.count(pMCPrimary) && !mcToPfoHitSharingMap.at(pMCPrimary).empty());
167 if (!isTargetPrimary && !hasMatch)
170 associatedMCPrimaries.push_back(pMCPrimary);
171 const int nTargetPrimaries(associatedMCPrimaries.size());
172 const bool isLastNeutrinoPrimary(++mcPrimaryIndex == nNeutrinoPrimaries);
180 const float targetVertexX(targetVertex.GetX()), targetVertexY(targetVertex.GetY()), targetVertexZ(targetVertex.GetZ());
183 targetSS << (!isTargetPrimary ?
"(Non target) " :
"") <<
"PrimaryId " << mcPrimaryIndex <<
", Nu " << isBeamNeutrinoFinalState
184 <<
", CR " << isCosmicRay <<
", MCPDG " << pMCPrimary->GetParticleId() <<
", Energy " << pMCPrimary->GetEnergy()
185 <<
", Dist. " << (pMCPrimary->GetEndpoint() - pMCPrimary->GetVertex()).GetMagnitude() <<
", nMCHits "
190 mcPrimaryId.push_back(mcPrimaryIndex);
191 mcPrimaryPdg.push_back(pMCPrimary->GetParticleId());
192 mcPrimaryE.push_back(pMCPrimary->GetEnergy());
193 mcPrimaryPX.push_back(pMCPrimary->GetMomentum().GetX());
194 mcPrimaryPY.push_back(pMCPrimary->GetMomentum().GetY());
195 mcPrimaryPZ.push_back(pMCPrimary->GetMomentum().GetZ());
196 mcPrimaryVtxX.push_back(pMCPrimary->GetVertex().GetX());
197 mcPrimaryVtxY.push_back(pMCPrimary->GetVertex().GetY());
198 mcPrimaryVtxZ.push_back(pMCPrimary->GetVertex().GetZ());
199 mcPrimaryEndX.push_back(pMCPrimary->GetEndpoint().GetX());
200 mcPrimaryEndY.push_back(pMCPrimary->GetEndpoint().GetY());
201 mcPrimaryEndZ.push_back(pMCPrimary->GetEndpoint().GetZ());
202 nMCHitsTotal.push_back(mcPrimaryHitList.size());
207 int matchIndex(0), nPrimaryMatches(0), nPrimaryNuMatches(0), nPrimaryCRMatches(0), nPrimaryGoodNuMatches(0), nPrimaryNuSplits(0);
209 float recoVertexX(std::numeric_limits<float>::max()), recoVertexY(std::numeric_limits<float>::max()),
210 recoVertexZ(std::numeric_limits<float>::max());
214 const CaloHitList &sharedHitList(pfoToSharedHits.second);
215 const CaloHitList &pfoHitList(validationInfo.
GetPfoToHitsMap().at(pfoToSharedHits.first));
218 const bool isGoodMatch(this->
IsGoodMatch(mcPrimaryHitList, pfoHitList, sharedHitList));
220 const int pfoId(pfoToIdMap.at(pfoToSharedHits.first));
223 if (0 == matchIndex++)
225 bestMatchPfoId.push_back(pfoId);
226 bestMatchPfoPdg.push_back(pfoToSharedHits.first->GetParticleId());
227 bestMatchPfoIsRecoNu.push_back(isRecoNeutrinoFinalState ? 1 : 0);
228 bestMatchPfoRecoNuId.push_back(recoNuId);
229 bestMatchPfoNHitsTotal.push_back(pfoHitList.size());
233 bestMatchPfoNSharedHitsTotal.push_back(sharedHitList.size());
242 recoVertexX = pRecoVertex->GetPosition().GetX();
243 recoVertexY = pRecoVertex->GetPosition().GetY();
244 recoVertexZ = pRecoVertex->GetPosition().GetZ();
246 catch (
const StatusCodeException &)
255 if (isRecoNeutrinoFinalState)
258 const bool isSplitRecoNeutrino(!recoNeutrinos.empty() && !recoNeutrinos.count(pRecoNeutrino));
259 if (!isSplitRecoNeutrino && isGoodMatch)
260 ++nPrimaryGoodNuMatches;
261 if (isSplitRecoNeutrino && isBeamNeutrinoFinalState && isGoodMatch)
263 recoNeutrinos.insert(pRecoNeutrino);
266 if (isRecoNeutrinoFinalState && isGoodMatch)
268 if (!isRecoNeutrinoFinalState && isGoodMatch)
271 targetSS <<
"-" << (!isGoodMatch ?
"(Below threshold) " :
"") <<
"MatchedPfoId " << pfoId <<
", Nu " << isRecoNeutrinoFinalState;
272 if (isRecoNeutrinoFinalState)
273 targetSS <<
" [NuId: " << recoNuId <<
"]";
274 targetSS <<
", CR " << (!isRecoNeutrinoFinalState) <<
", PDG " << pfoToSharedHits.first->GetParticleId() <<
", nMatchedHits "
283 if (mcToPfoHitSharingMap.at(pMCPrimary).empty())
285 targetSS <<
"-No matched Pfo" << std::endl;
286 bestMatchPfoId.push_back(-1);
287 bestMatchPfoPdg.push_back(0);
288 bestMatchPfoIsRecoNu.push_back(0);
289 bestMatchPfoRecoNuId.push_back(-1);
290 bestMatchPfoNHitsTotal.push_back(0);
291 bestMatchPfoNHitsU.push_back(0);
292 bestMatchPfoNHitsV.push_back(0);
293 bestMatchPfoNHitsW.push_back(0);
294 bestMatchPfoNSharedHitsTotal.push_back(0);
295 bestMatchPfoNSharedHitsU.push_back(0);
296 bestMatchPfoNSharedHitsV.push_back(0);
297 bestMatchPfoNSharedHitsW.push_back(0);
300 nPrimaryMatchedPfos.push_back(nPrimaryMatches);
301 nPrimaryMatchedNuPfos.push_back(nPrimaryNuMatches);
302 nPrimaryMatchedCRPfos.push_back(nPrimaryCRMatches);
303 nTargetMatches += nPrimaryMatches;
304 nTargetNuMatches += nPrimaryNuMatches;
305 nTargetCRMatches += nPrimaryCRMatches;
306 nTargetGoodNuMatches += nPrimaryGoodNuMatches;
307 nTargetNuSplits += nPrimaryNuSplits;
308 if (0 == nPrimaryMatches)
314 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"eventNumber",
m_eventNumber - 1));
315 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcNuanceCode", mcNuanceCode));
316 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isNeutrino", isBeamNeutrinoFinalState));
317 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isCosmicRay", isCosmicRay));
318 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nTargetPrimaries", nTargetPrimaries));
319 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"targetVertexX", targetVertexX));
320 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"targetVertexY", targetVertexY));
321 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"targetVertexZ", targetVertexZ));
322 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"recoVertexX", recoVertexX));
323 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"recoVertexY", recoVertexY));
324 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"recoVertexZ", recoVertexZ));
325 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryId", &mcPrimaryId));
326 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryPdg", &mcPrimaryPdg));
327 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryE", &mcPrimaryE));
328 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryPX", &mcPrimaryPX));
329 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryPY", &mcPrimaryPY));
330 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryPZ", &mcPrimaryPZ));
331 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryVtxX", &mcPrimaryVtxX));
332 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryVtxY", &mcPrimaryVtxY));
333 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryVtxZ", &mcPrimaryVtxZ));
334 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryEndX", &mcPrimaryEndX));
335 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryEndY", &mcPrimaryEndY));
336 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryEndZ", &mcPrimaryEndZ));
337 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryNHitsTotal", &nMCHitsTotal));
338 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryNHitsU", &nMCHitsU));
339 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryNHitsV", &nMCHitsV));
340 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"mcPrimaryNHitsW", &nMCHitsW));
341 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nPrimaryMatchedPfos", &nPrimaryMatchedPfos));
342 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nPrimaryMatchedNuPfos", &nPrimaryMatchedNuPfos));
343 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nPrimaryMatchedCRPfos", &nPrimaryMatchedCRPfos));
344 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoId", &bestMatchPfoId));
345 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoPdg", &bestMatchPfoPdg));
346 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoIsRecoNu", &bestMatchPfoIsRecoNu));
347 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoRecoNuId", &bestMatchPfoRecoNuId));
348 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoNHitsTotal", &bestMatchPfoNHitsTotal));
349 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoNHitsU", &bestMatchPfoNHitsU));
350 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoNHitsV", &bestMatchPfoNHitsV));
351 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoNHitsW", &bestMatchPfoNHitsW));
352 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoNSharedHitsTotal", &bestMatchPfoNSharedHitsTotal));
353 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoNSharedHitsU", &bestMatchPfoNSharedHitsU));
354 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoNSharedHitsV", &bestMatchPfoNSharedHitsV));
355 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"bestMatchPfoNSharedHitsW", &bestMatchPfoNSharedHitsW));
356 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nTargetMatches", nTargetMatches));
357 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nTargetNuMatches", nTargetNuMatches));
358 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nTargetCRMatches", nTargetCRMatches));
359 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nTargetGoodNuMatches", nTargetGoodNuMatches));
360 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nTargetNuSplits", nTargetNuSplits));
361 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"nTargetNuLosses", nTargetNuLosses));
364 if (isLastNeutrinoPrimary || isCosmicRay)
368 const int interactionTypeInt(static_cast<int>(interactionType));
371 const int isCorrectNu(isBeamNeutrinoFinalState && (nTargetGoodNuMatches == nTargetNuMatches) && (nTargetGoodNuMatches == nTargetPrimaries) &&
372 (nTargetCRMatches == 0) && (nTargetNuSplits == 0) && (nTargetNuLosses == 0));
373 const int isCorrectCR(isCosmicRay && (nTargetNuMatches == 0) && (nTargetCRMatches == 1));
374 const int isFakeNu(isCosmicRay && (nTargetNuMatches > 0));
375 const int isFakeCR(!isCosmicRay && (nTargetCRMatches > 0));
376 const int isSplitNu(!isCosmicRay && ((nTargetNuMatches > nTargetPrimaries) || (nTargetNuSplits > 0)));
377 const int isSplitCR(isCosmicRay && (nTargetCRMatches > 1));
378 const int isLost(nTargetMatches == 0);
380 std::stringstream outcomeSS;
382 << isBeamNeutrinoFinalState <<
", CR " << isCosmicRay <<
")" << std::endl;
384 if (isLastNeutrinoPrimary)
404 outcomeSS <<
"IsCorrectNu ";
406 outcomeSS <<
"IsCorrectCR ";
408 outcomeSS <<
"IsFake" << name <<
" ";
410 outcomeSS <<
"IsFakeCR ";
412 outcomeSS <<
"isSplit" << name <<
" ";
414 outcomeSS <<
"IsSplitCR ";
416 outcomeSS <<
"IsLost ";
417 if (nTargetNuMatches > 0)
418 outcomeSS <<
"(N" << name <<
"Matches: " << nTargetNuMatches <<
") ";
419 if (nTargetNuLosses > 0)
420 outcomeSS <<
"(N" << name <<
"Losses: " << nTargetNuLosses <<
") ";
421 if (nTargetNuSplits > 0)
422 outcomeSS <<
"(N" << name <<
"Splits: " << nTargetNuSplits <<
") ";
423 if (nTargetCRMatches > 0)
424 outcomeSS <<
"(NCRMatches: " << nTargetCRMatches <<
") ";
426 std::cout << outcomeSS.str() << std::endl << targetSS.str() << std::endl;
430 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"interactionType", interactionTypeInt));
431 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isCorrectNu", isCorrectNu));
432 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isCorrectCR", isCorrectCR));
433 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isFakeNu", isFakeNu));
434 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isFakeCR", isFakeCR));
435 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isSplitNu", isSplitNu));
436 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isSplitCR", isSplitCR));
437 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_treeName.c_str(),
"isLost", isLost));
438 PANDORA_MONITORING_API(FillTree(this->GetPandora(),
m_treeName.c_str()));
441 targetSS.str(std::string());
443 recoNeutrinos.clear();
444 associatedMCPrimaries.clear();
446 nTargetNuMatches = 0;
447 nTargetCRMatches = 0;
448 nTargetGoodNuMatches = 0;
452 mcPrimaryPdg.clear();
453 nMCHitsTotal.clear();
461 mcPrimaryVtxX.clear();
462 mcPrimaryVtxY.clear();
463 mcPrimaryVtxZ.clear();
464 mcPrimaryEndX.clear();
465 mcPrimaryEndY.clear();
466 mcPrimaryEndZ.clear();
467 nPrimaryMatchedPfos.clear();
468 nPrimaryMatchedNuPfos.clear();
469 nPrimaryMatchedCRPfos.clear();
470 bestMatchPfoId.clear();
471 bestMatchPfoPdg.clear();
472 bestMatchPfoIsRecoNu.clear();
473 bestMatchPfoRecoNuId.clear();
474 bestMatchPfoNHitsTotal.clear();
475 bestMatchPfoNHitsU.clear();
476 bestMatchPfoNHitsV.clear();
477 bestMatchPfoNHitsW.clear();
478 bestMatchPfoNSharedHitsTotal.clear();
479 bestMatchPfoNSharedHitsU.clear();
480 bestMatchPfoNSharedHitsV.clear();
481 bestMatchPfoNSharedHitsW.clear();
485 if (useInterpretedMatching)
487 std::stringstream summarySS;
488 summarySS <<
"---SUMMARY--------------------------------------------------------------------------------------" << std::endl;
490 summarySS <<
"#CorrectNu: " << nCorrectNu <<
"/" << nTotalNu
491 <<
", Fraction: " << (nTotalNu > 0 ?
static_cast<float>(nCorrectNu) / static_cast<float>(nTotalNu) : 0.f) << std::endl;
493 summarySS <<
"#CorrectCR: " << nCorrectCR <<
"/" << nTotalCR
494 <<
", Fraction: " << (nTotalCR > 0 ?
static_cast<float>(nCorrectCR) / static_cast<float>(nTotalCR) : 0.f) << std::endl;
496 summarySS <<
"#Fake" << name <<
": " << nFakeNu <<
" ";
498 summarySS <<
"#FakeCR: " << nFakeCR <<
" ";
500 summarySS <<
"#Split" << name <<
": " << nSplitNu <<
" ";
502 summarySS <<
"#SplitCR: " << nSplitCR <<
" ";
504 summarySS <<
"#Lost: " << nLost <<
" ";
505 if (nFakeNu || nFakeCR || nSplitNu || nSplitCR || nLost)
506 summarySS << std::endl;
512 std::cout <<
"------------------------------------------------------------------------------------------------" << std::endl
520 PANDORA_RETURN_RESULT_IF_AND_IF(
521 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"UseTrueNeutrinosOnly",
m_useTrueNeutrinosOnly));
const LArMCParticleHelper::PfoContributionMap & GetPfoToHitsMap() const
Get the pfo to hits map.
Header file for the pfo helper class.
Header file for the neutrino event validation algorithm.
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.
int m_eventNumber
The event number.
int m_fileIdentifier
The input file identifier.
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...
static void GetPfoToReconstructable2DHitsMap(const pandora::PfoList &pfoList, const MCContributionMap &selectedMCParticleToHitsMap, PfoContributionMap &pfoToReconstructable2DHitsMap, const bool foldBackHierarchy)
Get mapping from Pfo to reconstructable 2D hits (=good hits belonging to a selected reconstructable M...
const LArMCParticleHelper::MCContributionMap & GetAllMCParticleToHitsMap() const
Get the all mc particle to hits map.
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
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.
std::vector< PfoCaloHitListPair > PfoToSharedHitsVector
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
bool m_foldBackHierarchy
whether to fold the hierarchy back to the primary (neutrino) or leading particles (test beam) ...
bool m_useTrueNeutrinosOnly
Whether to consider only mc particles that were neutrino induced.
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.
static InteractionType GetInteractionType(const pandora::MCParticleList &mcPrimaryList)
Get the interaction type of an event.
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
~NeutrinoEventValidationAlgorithm()
Destructor.
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 ¶meters, std::function< bool(const pandora::MCParticle *const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap)
Select target, reconstructable mc particles that match given criteria.
std::unordered_map< const pandora::MCParticle *, int > MCParticleIntMap
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.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
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.
static const pandora::ParticleFlowObject * GetParentNeutrino(const pandora::ParticleFlowObject *const pPfo)
Get primary neutrino or antineutrino.
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::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToIdMap
required by fuzzyCluster table::sbnd_g4_services gaushitTruthMatch pandora
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
static bool IsFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a primary parent particle.
std::string m_treeName
Name of output tree.
void SetPfoToHitsMap(const LArMCParticleHelper::PfoContributionMap &pfoToHitsMap)
Set the pfo to hits map.
static bool IsNeutrinoFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a final-state particle from a neutrino (or antineutrino) interaction.
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 bool IsBeamNeutrinoFinalState(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary neutrino final state MCParticle.
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.
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...
BEGIN_PROLOG could also be cout
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)