9 #include "Pandora/AlgorithmHeaders.h" 21 HierarchyValidationAlgorithm::HierarchyValidationAlgorithm() :
59 const CaloHitList *pCaloHitList(
nullptr);
60 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_caloHitListName, pCaloHitList));
61 const MCParticleList *pMCParticleList(
nullptr);
62 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*
this, pMCParticleList));
63 const PfoList *pPfoList(
nullptr);
64 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*
this,
m_pfoListName, pPfoList));
82 matchInfo.
Print(mcHierarchy);
86 this->EventValidation(matchInfo);
88 this->MCValidation(matchInfo);
91 return STATUS_CODE_SUCCESS;
102 MCParticleList rootMCParticles;
108 std::map<const LArHierarchyHelper::RecoHierarchy::Node *, const ParticleFlowObject *> recoNodeToRootMap;
109 for (
const ParticleFlowObject *
const pRoot : rootPfos)
112 recoHierarchy.GetFlattenedNodes(pRoot, nodes);
114 recoNodeToRootMap[pNode] = pRoot;
117 std::set<const pandora::ParticleFlowObject *> matchedRecoSliceRoots;
118 for (
const MCParticle *
const pRoot : rootMCParticles)
122 MCParticleList primaries;
126 if (pMCNode->GetHierarchyTier() == 1)
129 primaries.emplace_back(pLeadingMC);
133 if (primaries.size() == 0)
138 const int isCC{descriptor.
IsCC()};
139 const int isQE{descriptor.IsQE()};
140 const int isResonant{descriptor.IsResonant()};
141 const int isDIS{descriptor.IsDIS()};
142 const int isCoherent{descriptor.IsCoherent()};
143 const int isNuMu{descriptor.IsMuonNeutrino()};
144 const int isNuE{descriptor.IsElectronNeutrino()};
145 const int nPiZero{
static_cast<int>(descriptor.GetNumPiZero())};
146 const int nPiPlus{
static_cast<int>(descriptor.GetNumPiPlus())};
147 const int nPiMinus{
static_cast<int>(descriptor.GetNumPiMinus())};
148 const int nPhotons{
static_cast<int>(descriptor.GetNumPhotons())};
149 const int nProtons{
static_cast<int>(descriptor.GetNumProtons())};
151 std::set<const LArHierarchyHelper::MCHierarchy::Node *> trackNodeSet, showerNodeSet;
152 int nGoodTrackMatches{0}, nGoodShowerMatches{0};
153 int nGoodMatches{0}, nPoorMatches{0}, nUnmatched{0};
154 int nGoodTier1Matches{0}, nTier1Nodes{0};
155 int nGoodTier1TrackMatches{0}, nTier1TrackNodes{0};
156 int nGoodTier1ShowerMatches{0}, nTier1ShowerNodes{0};
157 int hasLeadingMuon{0}, hasLeadingElectron{0}, isLeadingLeptonCorrect{0};
163 matchedRecoSliceRoots.insert(recoNodeToRootMap[pReco]);
165 const int nReco{
static_cast<int>(mcMatch.GetRecoMatches().size())};
166 const bool isQuality{mcMatch.IsQuality(matchInfo.
GetQualityCuts())};
167 if (nReco == 1 && isQuality)
173 if (pNode->GetHierarchyTier() == 1)
176 if (nReco == 1 && isQuality)
180 const int pdg{
std::abs(pNode->GetParticleId())};
181 if (pNode->IsLeadingLepton())
185 else if (pdg == E_MINUS)
186 hasLeadingElectron = 1;
187 isLeadingLeptonCorrect = nReco == 1 ? 1 : 0;
190 if (pdg == PHOTON || pdg == E_MINUS)
192 showerNodeSet.insert(pNode);
193 if (nReco == 1 && isQuality)
195 ++nGoodShowerMatches;
196 if (pNode->GetHierarchyTier() == 1)
197 ++nGoodTier1ShowerMatches;
199 if (pNode->GetHierarchyTier() == 1)
204 trackNodeSet.insert(pNode);
205 if (nReco == 1 && isQuality)
208 if (pNode->GetHierarchyTier() == 1)
209 ++nGoodTier1TrackMatches;
211 if (pNode->GetHierarchyTier() == 1)
216 const int nNodes{
static_cast<int>(matchInfo.
GetNMCNodes(pRoot))};
217 const int nTrackNodes{
static_cast<int>(trackNodeSet.size())}, nShowerNodes{
static_cast<int>(showerNodeSet.size())};
218 const int nRecoSlices{
static_cast<int>(matchedRecoSliceRoots.size())};
219 const CartesianVector &trueVertex{pRoot->GetVertex()};
220 const float trueVtxX{trueVertex.GetX()};
221 const float trueVtxY{trueVertex.GetY()};
222 const float trueVtxZ{trueVertex.GetZ()};
223 float recoVtxX{std::numeric_limits<float>::max()};
224 float recoVtxY{std::numeric_limits<float>::max()};
225 float recoVtxZ{std::numeric_limits<float>::max()};
226 float vtxDx{std::numeric_limits<float>::max()};
227 float vtxDy{std::numeric_limits<float>::max()};
228 float vtxDz{std::numeric_limits<float>::max()};
229 float vtxDr{std::numeric_limits<float>::max()};
232 for (
const ParticleFlowObject *pRootPfo : matchedRecoSliceRoots)
237 const float recoVertexX{recoVertex.GetX()};
238 const float recoVertexY{recoVertex.GetY()};
239 const float recoVertexZ{recoVertex.GetZ()};
240 const float dx{recoVertexX - trueVtxX};
241 const float dy{recoVertexY - trueVtxY};
242 const float dz{recoVertexZ - trueVtxZ};
243 const float dr{std::sqrt(dx * dx + dy * dy + dz * dz)};
246 recoVtxX = recoVertexX;
247 recoVtxY = recoVertexY;
248 recoVtxZ = recoVertexZ;
255 catch (StatusCodeException &)
257 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
258 std::cout <<
"HierarchyValidationAlgorithm::EventValidation could not retrieve recoVertex" << std::endl;
264 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nRecoSlices", nRecoSlices));
265 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isCC", isCC));
266 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isQE", isQE));
267 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isResonant", isResonant));
268 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isDIS", isDIS));
269 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isCoherent", isCoherent));
270 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isNuMu", isNuMu));
271 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isNuE", isNuE));
272 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nPiZero", nPiZero));
273 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nPiPlus", nPiPlus));
274 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nPiMinus", nPiMinus));
275 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nPhotons", nPhotons));
276 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nProtons", nProtons));
277 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isFiducial", isFiducial));
278 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"recoVtxX", recoVtxX));
279 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"recoVtxY", recoVtxY));
280 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"recoVtxZ", recoVtxZ));
281 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"trueVtxX", recoVtxX));
282 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"trueVtxY", recoVtxY));
283 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"trueVtxZ", recoVtxZ));
284 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"vtxDx", vtxDx));
285 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"vtxDy", vtxDy));
286 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"vtxDz", vtxDz));
287 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"vtxDr", vtxDr));
288 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nGoodMatches", nGoodMatches));
289 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nPoorMatches", nPoorMatches));
290 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nUnmatched", nUnmatched));
291 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nNodes", nNodes));
292 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nGoodTier1Matches", nGoodTier1Matches));
293 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nTier1Nodes", nTier1Nodes));
294 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nGoodTrackMatches", nGoodTrackMatches));
295 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nGoodShowerMatches", nGoodShowerMatches));
296 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nTrackNodes", nTrackNodes));
297 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nShowerNodes", nShowerNodes));
298 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nGoodTier1TrackMatches", nGoodTier1TrackMatches));
299 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nTier1TrackNodes", nTier1TrackNodes));
300 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nGoodTier1ShowerMatches", nGoodTier1ShowerMatches));
301 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"nTier1ShowerNodes", nTier1ShowerNodes));
302 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"hasLeadingMuon", hasLeadingMuon));
303 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"hasLeadingElectron", hasLeadingElectron));
304 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_eventTreeName.c_str(),
"isLeadingLeptonCorrect", isLeadingLeptonCorrect));
305 PANDORA_MONITORING_API(FillTree(this->GetPandora(),
m_eventTreeName.c_str()));
318 MCParticleList rootMCParticles;
323 std::map<const LArHierarchyHelper::RecoHierarchy::Node *, const ParticleFlowObject *> recoNodeToRootMap;
324 for (
const ParticleFlowObject *
const pRoot : rootPfos)
327 recoHierarchy.GetFlattenedNodes(pRoot, nodes);
329 recoNodeToRootMap[pNode] = pRoot;
332 for (
const MCParticle *
const pRoot : rootMCParticles)
334 MCParticleList primaries;
338 if (pMCNode->GetHierarchyTier() == 1)
341 primaries.emplace_back(pLeadingMC);
345 if (primaries.size() == 0)
354 const int isCosmicRay{!isTestBeam && pMCNode->IsCosmicRay() ? 1 : 0};
355 const int isNeutrinoInt{!(isTestBeam || isCosmicRay) ? 1 : 0};
356 const int mcId{pMCNode->GetId()};
357 const int pdg{pMCNode->GetParticleId()};
358 const int tier{pMCNode->GetHierarchyTier()};
359 const int mcHits{
static_cast<int>(pMCNode->GetCaloHits().size())};
360 const int isLeadingLepton{pMCNode->IsLeadingLepton() ? 1 : 0};
362 const MCParticle *
const pLeadingMC{pMCNode->GetLeadingMCParticle()};
363 const MCParticleList &parentList{pLeadingMC->GetParentList()};
364 const int isElectron{
std::abs(pLeadingMC->GetParticleId()) == E_MINUS ? 1 : 0};
365 const int hasMuonParent{parentList.size() == 1 &&
std::abs(parentList.front()->GetParticleId()) == MU_MINUS ? 1 : 0};
367 const CartesianVector mcMomentum{pLeadingMC->GetMomentum()};
368 const float mcMtm{mcMomentum.GetMagnitude()};
369 const float mcMtmX{mcMomentum.GetX()};
370 const float mcMtmY{mcMomentum.GetY()};
371 const float mcMtmZ{mcMomentum.GetZ()};
372 const float mcEnergy{pLeadingMC->GetEnergy()};
375 const int nMatches{
static_cast<int>(nodeVector.size())};
376 IntVector recoSliceIdVector, recoIdVector, nRecoHitsVector, nSharedHitsVector;
377 FloatVector purityVector, completenessVector;
378 FloatVector purityAdcVector, completenessAdcVector;
379 FloatVector purityVectorU, purityVectorV, purityVectorW, completenessVectorU, completenessVectorV, completenessVectorW;
380 FloatVector purityAdcVectorU, purityAdcVectorV, purityAdcVectorW, completenessAdcVectorU, completenessAdcVectorV, completenessAdcVectorW;
381 const CartesianVector &trueVertex{pLeadingMC->GetVertex()};
382 const float trueVtxX{trueVertex.GetX()};
383 const float trueVtxY{trueVertex.GetY()};
384 const float trueVtxZ{trueVertex.GetZ()};
385 float recoVtxX{std::numeric_limits<float>::max()};
386 float recoVtxY{std::numeric_limits<float>::max()};
387 float recoVtxZ{std::numeric_limits<float>::max()};
388 float vtxDx{std::numeric_limits<float>::max()};
389 float vtxDy{std::numeric_limits<float>::max()};
390 float vtxDz{std::numeric_limits<float>::max()};
391 float vtxDr{std::numeric_limits<float>::max()};
393 const int isCC{descriptor.IsCC()};
394 const int isQE{descriptor.IsQE()};
395 const int isResonant{descriptor.IsResonant()};
396 const int isDIS{descriptor.IsDIS()};
397 const int isCoherent{descriptor.IsCoherent()};
398 const int isNuMu{descriptor.IsMuonNeutrino()};
399 const int isNuE{descriptor.IsElectronNeutrino()};
400 const int nPiZero{
static_cast<int>(descriptor.GetNumPiZero())};
401 const int nPiPlus{
static_cast<int>(descriptor.GetNumPiPlus())};
402 const int nPiMinus{
static_cast<int>(descriptor.GetNumPiMinus())};
403 const int nPhotons{
static_cast<int>(descriptor.GetNumPhotons())};
404 const int nProtons{
static_cast<int>(descriptor.GetNumProtons())};
408 const int sliceId{
static_cast<int>(
409 std::distance(rootPfos.begin(), std::find(rootPfos.begin(), rootPfos.end(), recoNodeToRootMap[pRecoNode])))};
410 recoSliceIdVector.emplace_back(sliceId);
411 recoIdVector.emplace_back(pRecoNode->GetParticleId());
412 nRecoHitsVector.emplace_back(static_cast<int>(pRecoNode->GetCaloHits().size()));
413 nSharedHitsVector.emplace_back(static_cast<int>(matches.GetSharedHits(pRecoNode)));
414 purityVector.emplace_back(matches.GetPurity(pRecoNode));
415 completenessVector.emplace_back(matches.GetCompleteness(pRecoNode));
416 purityAdcVector.emplace_back(matches.GetPurity(pRecoNode,
true));
417 completenessAdcVector.emplace_back(matches.GetCompleteness(pRecoNode,
true));
418 purityVectorU.emplace_back(matches.GetPurity(pRecoNode, TPC_VIEW_U));
419 purityVectorV.emplace_back(matches.GetPurity(pRecoNode, TPC_VIEW_V));
420 purityVectorW.emplace_back(matches.GetPurity(pRecoNode, TPC_VIEW_W));
421 completenessVectorU.emplace_back(matches.GetCompleteness(pRecoNode, TPC_VIEW_U));
422 completenessVectorV.emplace_back(matches.GetCompleteness(pRecoNode, TPC_VIEW_V));
423 completenessVectorW.emplace_back(matches.GetCompleteness(pRecoNode, TPC_VIEW_W));
424 purityAdcVectorU.emplace_back(matches.GetPurity(pRecoNode, TPC_VIEW_U,
true));
425 purityAdcVectorV.emplace_back(matches.GetPurity(pRecoNode, TPC_VIEW_V,
true));
426 purityAdcVectorW.emplace_back(matches.GetPurity(pRecoNode, TPC_VIEW_W,
true));
427 completenessAdcVectorU.emplace_back(matches.GetCompleteness(pRecoNode, TPC_VIEW_U,
true));
428 completenessAdcVectorV.emplace_back(matches.GetCompleteness(pRecoNode, TPC_VIEW_V,
true));
429 completenessAdcVectorW.emplace_back(matches.GetCompleteness(pRecoNode, TPC_VIEW_W,
true));
435 recoVtxX = recoVertex.GetX();
436 recoVtxY = recoVertex.GetY();
437 recoVtxZ = recoVertex.GetZ();
438 vtxDx = recoVtxX - trueVtxX;
439 vtxDy = recoVtxY - trueVtxY;
440 vtxDz = recoVtxZ - trueVtxZ;
441 vtxDr = std::sqrt(vtxDx * vtxDx + vtxDy * vtxDy + vtxDz * vtxDz);
443 catch (StatusCodeException &)
445 if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
446 std::cout <<
"HierarchyValidationAlgorithm::MCValidation could not retrieve recoVertex" << std::endl;
451 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"event",
m_event));
453 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcId", mcId));
454 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcPDG", pdg));
455 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcTier", tier));
456 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcNHits", mcHits));
457 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcMtm", mcMtm));
458 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcMtmX", mcMtmX));
459 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcMtmY", mcMtmY));
460 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcMtmZ", mcMtmZ));
461 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"mcEnergy", mcEnergy));
462 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isNuInteraction", isNeutrinoInt));
463 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isCosmicRay", isCosmicRay));
464 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isTestBeam", isTestBeam));
465 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isLeadingLepton", isLeadingLepton));
466 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isMichel", isMichel));
467 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"nMatches", nMatches));
468 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"recoSliceIdVector", &recoSliceIdVector));
469 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"recoIdVector", &recoIdVector));
470 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"nRecoHitsVector", &nRecoHitsVector));
471 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"nSharedHitsVector", &nSharedHitsVector));
472 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"purityVector", &purityVector));
473 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"completenessVector", &completenessVector));
474 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"purityAdcVector", &purityAdcVector));
475 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"completenessAdcVector", &completenessAdcVector));
476 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"purityVectorU", &purityVectorU));
477 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"purityVectorV", &purityVectorV));
478 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"purityVectorW", &purityVectorW));
479 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"completenessVectorU", &completenessVectorU));
480 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"completenessVectorV", &completenessVectorV));
481 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"completenessVectorW", &completenessVectorW));
482 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"purityAdcVectorU", &purityAdcVectorU));
483 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"purityAdcVectorV", &purityAdcVectorV));
484 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"purityAdcVectorW", &purityAdcVectorW));
485 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"completenessAdcVectorU", &completenessAdcVectorU));
486 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"completenessAdcVectorV", &completenessAdcVectorV));
487 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"completenessAdcVectorW", &completenessAdcVectorW));
488 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"recoVtxX", recoVtxX));
489 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"recoVtxY", recoVtxY));
490 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"recoVtxZ", recoVtxZ));
491 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"trueVtxX", trueVtxX));
492 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"trueVtxY", trueVtxY));
493 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"trueVtxZ", trueVtxZ));
494 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"vtxDx", vtxDx));
495 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"vtxDy", vtxDy));
496 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"vtxDz", vtxDz));
497 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"vtxDr", vtxDr));
498 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isCC", isCC));
499 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isQE", isQE));
500 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isResonant", isResonant));
501 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isDIS", isDIS));
502 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isCoherent", isCoherent));
503 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isNuMu", isNuMu));
504 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"isNuE", isNuE));
505 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"nPiZero", nPiZero));
506 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"nPiPlus", nPiPlus));
507 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"nPiMinus", nPiMinus));
508 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"nPhotons", nPhotons));
509 PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(),
m_MCTreeName.c_str(),
"nProtons", nProtons));
510 PANDORA_MONITORING_API(FillTree(this->GetPandora(),
m_MCTreeName.c_str()));
522 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"CaloHitListName",
m_caloHitListName));
525 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"PfoListName",
m_pfoListName));
529 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"Detector",
m_detector));
531 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ValidateEvent",
m_validateEvent));
532 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"ValidateMC",
m_validateMC));
534 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"WriteEventTree",
m_writeEventTree));
537 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"EventFileName",
m_eventFileName));
538 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"EventTreeName",
m_eventTreeName));
541 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"WriteMCTree",
m_writeMCTree));
544 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MCFileName",
m_MCFileName));
545 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
"MCTreeName",
m_MCTreeName));
548 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"FoldToPrimaries",
m_foldToPrimaries));
549 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"FoldDynamic",
m_foldDynamic));
550 PANDORA_RETURN_RESULT_IF_AND_IF(
551 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"FoldToLeadingShowers",
m_foldToLeadingShowers));
553 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinPurity",
m_minPurity));
554 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinCompleteness",
m_minCompleteness));
555 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinRecoHits",
m_minRecoHits));
556 PANDORA_RETURN_RESULT_IF_AND_IF(
557 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinRecoHitsPerView",
m_minRecoHitsPerView));
558 PANDORA_RETURN_RESULT_IF_AND_IF(
559 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"MinRecoGoodViews",
m_minRecoGoodViews));
560 PANDORA_RETURN_RESULT_IF_AND_IF(
561 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
"RemoveRecoNeutrons",
m_removeRecoNeutrons));
563 return STATUS_CODE_SUCCESS;
unsigned int m_minRecoGoodViews
Minimum number of reconstructed primary good views.
const MCMatchesVector & GetMatches(const pandora::MCParticle *const pRoot) const
Retrieve the vector of matches (this will include null matches - i.e. MC nodes with no corresponding ...
const RecoHierarchy & GetRecoHierarchy() const
Retrieve the reco hierarchy used for the matching.
bool m_foldToTier
Whether or not to apply folding based on particle tier.
bool m_foldToPrimaries
Whether or not to fold the hierarchy back to primary particles.
Header file for the interaction type helper class.
unsigned int m_minRecoHits
Minimum number of reconstructed primary good hits.
std::vector< const Node * > NodeVector
std::string m_detector
Name of the detector.
void GetRootMCParticles(pandora::MCParticleList &rootMCParticles) const
Retrieve the root MC particles of the interaction hierarchies.
bool m_foldToLeadingShowers
Whether or not to fold the hierarchy back to leading shower particles.
bool m_writeEventTree
Whether or not to output event validation information to a ROOT file.
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
bool m_writeMCTree
Whether or not to output MC validation information to a ROOT file.
constexpr auto abs(T v)
Returns the absolute value of the argument.
virtual ~HierarchyValidationAlgorithm()
std::vector< int > IntVector
static void MatchHierarchies(MatchInfo &matchInfo)
Finds the matches between reconstructed and MC hierarchies.
float m_minPurity
Minimum purity to tag a node as being of good quality.
std::string m_MCFileName
The name of the MC ROOT file to write.
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
bool m_removeRecoNeutrons
Whether to remove reconstructed neutrons and their downstream particles.
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...
const pandora::MCParticle * GetLeadingMCParticle() const
Retrieve the leading MC particle associated with this node.
std::string m_eventTreeName
The name of the event ROOT tree to write.
int m_event
The current event.
ReconstructabilityCriteria class.
float m_minCompleteness
Minimum completeness to tag a node as being of good quality.
pandora::StatusCode Run()
static bool IsInFiducialVolume(const pandora::Pandora &pandora, const pandora::CartesianVector &vertex, const std::string &detector)
Determine if a vertex is within a detector's fiducial volume. This throws a STATUS_CODE_INVALID_PARAM...
std::string m_MCTreeName
The name of the MC ROOT tree to write.
static bool IsDecay(const pandora::MCParticle *const pMCParticle)
Check whether or not an MC particle comes from a decay process.
const QualityCuts & GetQualityCuts() const
Retrieve the quality cuts for matching.
std::string m_pfoListName
Name of input PFO list.
bool m_foldDynamic
Whether or not to use process and topological information to make folding decisions.
Header file for the vertex helper class.
bool m_foldDynamic
Whether or not to fold the hierarchy dynamically.
void Print(const MCHierarchy &mcHierarchy) const
Prints information about which reco nodes are matched to the MC nodes, information about hit sharing...
bool m_foldToLeadingShowers
Whether or not to fold shower children to the leading shower particle.
std::string m_caloHitListName
Name of input calo hit list.
std::vector< MCMatches > MCMatchesVector
std::string m_eventFileName
The name of the event ROOT file to write.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void GetRootPfos(pandora::PfoList &rootPfos) const
Retrieve the root particle flow objects of the interaction hierarchies.
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...
unsigned int GetNMCNodes(const pandora::MCParticle *const pRoot) const
Retrieve the number of MC nodes available to match.
unsigned int m_minRecoHitsPerView
Minimum number of reconstructed hits for a good view.
static InteractionDescriptor GetInteractionDescriptor(const pandora::MCParticleList &mcPrimaryList)
Get the interaction descriptor of an event.
bool m_validateMC
Whether to validate at the level of MC nodes.
bool IsCC() const
Whether or not the interaction is CC.
bool IsTestBeamParticle() const
Check if this is a test beam particle.
Header file for the hierarchy validation algorithm.
bool m_validateEvent
Whether to validate at the level of an event.