LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::EventValidationAlgorithm Class Reference

EventValidationAlgorithm class. More...

#include "EventValidationAlgorithm.h"

Inheritance diagram for lar_content::EventValidationAlgorithm:

Classes

class  ValidationInfo
 ValidationInfo class. More...
 

Public Member Functions

 EventValidationAlgorithm ()
 Default constructor. More...
 
 ~EventValidationAlgorithm ()
 Destructor. More...
 

Private Types

typedef std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToIdMap
 
typedef std::vector< pandora::HitType > HitTypeVector
 

Private Member Functions

pandora::StatusCode Run ()
 
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. More...
 
void PrintAllMatches (const ValidationInfo &validationInfo) const
 Print all/raw matching information to screen. More...
 
void PrintInterpretedMatches (const ValidationInfo &validationInfo) const
 Print interpreted matching information to screen. More...
 
void WriteInterpretedMatches (const ValidationInfo &validationInfo) const
 Write interpreted matching information to tree. More...
 
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 configured to do so. More...
 
void InterpretMatching (const ValidationInfo &validationInfo, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const
 Apply an interpretative matching procedure to the comprehensive matches in the provided validation info object. More...
 
bool GetStrongestPfoMatch (const ValidationInfo &validationInfo, const pandora::MCParticleVector &mcPrimaryVector, pandora::PfoSet &usedPfos, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const
 Get the strongest pfo match (most matched hits) between an available mc primary and an available pfo. More...
 
void GetRemainingPfoMatches (const ValidationInfo &validationInfo, const pandora::MCParticleVector &mcPrimaryVector, const pandora::PfoSet &usedPfos, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const
 Get the best matches for any pfos left-over after the strong matching procedure. More...
 
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. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

std::string m_caloHitListName
 Name of input calo hit list. More...
 
std::string m_mcParticleListName
 Name of input MC particle list. More...
 
std::string m_pfoListName
 Name of input Pfo list. More...
 
bool m_useTrueNeutrinosOnly
 Whether to consider only mc particles that were neutrino induced. More...
 
bool m_testBeamMode
 Whether pandora is reconstructing test beam particles. More...
 
bool m_selectInputHits
 Whether to use only hits passing mc-based quality (is "reconstructable") checks. More...
 
float m_minHitSharingFraction
 Minimum fraction of energy deposited by selected primary in a single "good" hit. More...
 
float m_maxPhotonPropagation
 Maximum distance travelled by photon, downstream of a track, in mc particle hierarchy. More...
 
bool m_printAllToScreen
 Whether to print all/raw matching details to screen. More...
 
bool m_printMatchingToScreen
 Whether to print matching output to screen. More...
 
bool m_writeToTree
 Whether to write all/raw matching details to tree. More...
 
bool m_useSmallPrimaries
 Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits. More...
 
unsigned int m_matchingMinSharedHits
 The minimum number of shared hits used in matching scheme. More...
 
float m_matchingMinCompleteness
 The minimum particle completeness to declare a match. More...
 
float m_matchingMinPurity
 The minimum particle purity to declare a match. More...
 
std::string m_treeName
 Name of output tree. More...
 
std::string m_fileName
 Name of output file. More...
 
int m_fileIdentifier
 The input file identifier. More...
 
int m_eventNumber
 The event number. More...
 

Detailed Description

EventValidationAlgorithm class.

Definition at line 27 of file EventValidationAlgorithm.h.

Member Typedef Documentation

typedef std::vector<pandora::HitType> lar_content::EventValidationAlgorithm::HitTypeVector
private

Definition at line 216 of file EventValidationAlgorithm.h.

typedef std::unordered_map<const pandora::ParticleFlowObject*, unsigned int> lar_content::EventValidationAlgorithm::PfoToIdMap
private

Definition at line 138 of file EventValidationAlgorithm.h.

Constructor & Destructor Documentation

lar_content::EventValidationAlgorithm::EventValidationAlgorithm ( )

Default constructor.

Definition at line 24 of file EventValidationAlgorithm.cc.

24  :
26  m_testBeamMode(false),
27  m_selectInputHits(true),
30  m_printAllToScreen(false),
32  m_writeToTree(false),
33  m_useSmallPrimaries(true),
38  m_eventNumber(0)
39 {
40 }
bool m_useTrueNeutrinosOnly
Whether to consider only mc particles that were neutrino induced.
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
bool m_printAllToScreen
Whether to print all/raw matching details to screen.
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
bool m_testBeamMode
Whether pandora is reconstructing test beam particles.
bool m_printMatchingToScreen
Whether to print matching output to screen.
TFile f
Definition: plotHisto.C:6
float m_minHitSharingFraction
Minimum fraction of energy deposited by selected primary in a single "good" hit.
bool m_writeToTree
Whether to write all/raw matching details to tree.
bool m_selectInputHits
Whether to use only hits passing mc-based quality (is "reconstructable") checks.
int m_fileIdentifier
The input file identifier.
float m_matchingMinPurity
The minimum particle purity to declare a match.
unsigned int m_matchingMinSharedHits
The minimum number of shared hits used in matching scheme.
float m_maxPhotonPropagation
Maximum distance travelled by photon, downstream of a track, in mc particle hierarchy.
lar_content::EventValidationAlgorithm::~EventValidationAlgorithm ( )

Destructor.

Definition at line 44 of file EventValidationAlgorithm.cc.

References m_fileName, m_treeName, and m_writeToTree.

45 {
46  if (m_writeToTree)
47  {
48  try
49  {
50  PANDORA_MONITORING_API(SaveTree(this->GetPandora(), m_treeName.c_str(), m_fileName.c_str(), "UPDATE"));
51  }
52  catch (const StatusCodeException &)
53  {
54  std::cout << "EventValidationAlgorithm: Unable to write tree " << m_treeName << " to file " << m_fileName << std::endl;
55  }
56  }
57 }
bool m_writeToTree
Whether to write all/raw matching details to tree.
std::string m_treeName
Name of output tree.
std::string m_fileName
Name of output file.

Member Function Documentation

void lar_content::EventValidationAlgorithm::FillValidationInfo ( const pandora::MCParticleList *const  pMCParticleList,
const pandora::CaloHitList *const  pCaloHitList,
const pandora::PfoList *const  pPfoList,
ValidationInfo validationInfo 
) const
private

Fill the validation info containers.

Parameters
pMCParticleListthe address of the mc particle list
pCaloHitListthe address of the calo hit list
pPfoListthe address of the pfo list
validationInfoto receive the validation info

Definition at line 91 of file EventValidationAlgorithm.cc.

References lar_content::LArPfoHelper::GetAllConnectedPfos(), lar_content::EventValidationAlgorithm::ValidationInfo::GetAllMCParticleToHitsMap(), lar_content::LArMCParticleHelper::GetPfoMCParticleHitSharingMaps(), lar_content::EventValidationAlgorithm::ValidationInfo::GetPfoToHitsMap(), lar_content::LArMCParticleHelper::GetPfoToReconstructable2DHitsMap(), InterpretMatching(), lar_content::LArMCParticleHelper::IsBeamNeutrinoFinalState(), lar_content::LArMCParticleHelper::IsBeamParticle(), lar_content::LArMCParticleHelper::IsCosmicRay(), lar_content::LArPfoHelper::IsFinalState(), lar_content::LArMCParticleHelper::PrimaryParameters::m_maxPhotonPropagation, m_maxPhotonPropagation, lar_content::LArMCParticleHelper::PrimaryParameters::m_minHitsForGoodView, lar_content::LArMCParticleHelper::PrimaryParameters::m_minHitSharingFraction, m_minHitSharingFraction, lar_content::LArMCParticleHelper::PrimaryParameters::m_minPrimaryGoodHits, lar_content::LArMCParticleHelper::PrimaryParameters::m_selectInputHits, m_selectInputHits, m_testBeamMode, m_useTrueNeutrinosOnly, lar_content::LArMCParticleHelper::SelectReconstructableMCParticles(), lar_content::EventValidationAlgorithm::ValidationInfo::SetAllMCParticleToHitsMap(), lar_content::EventValidationAlgorithm::ValidationInfo::SetInterpretedMCToPfoHitSharingMap(), lar_content::EventValidationAlgorithm::ValidationInfo::SetMCToPfoHitSharingMap(), lar_content::EventValidationAlgorithm::ValidationInfo::SetPfoToHitsMap(), and lar_content::EventValidationAlgorithm::ValidationInfo::SetTargetMCParticleToHitsMap().

Referenced by Run().

93 {
94  if (pMCParticleList && pCaloHitList)
95  {
96  LArMCParticleHelper::PrimaryParameters parameters;
97 
98  parameters.m_selectInputHits = m_selectInputHits;
99  parameters.m_minHitSharingFraction = m_minHitSharingFraction;
100  parameters.m_maxPhotonPropagation = m_maxPhotonPropagation;
101  LArMCParticleHelper::MCContributionMap targetMCParticleToHitsMap;
102  LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsBeamNeutrinoFinalState, targetMCParticleToHitsMap);
103  if (!m_useTrueNeutrinosOnly) LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsBeamParticle, targetMCParticleToHitsMap);
104  if (!m_useTrueNeutrinosOnly) LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsCosmicRay, targetMCParticleToHitsMap);
105 
106  parameters.m_minPrimaryGoodHits = 0;
107  parameters.m_minHitsForGoodView = 0;
108  parameters.m_minHitSharingFraction = 0.f;
109  LArMCParticleHelper::MCContributionMap allMCParticleToHitsMap;
110  LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsBeamNeutrinoFinalState, allMCParticleToHitsMap);
111  if (!m_useTrueNeutrinosOnly) LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsBeamParticle, allMCParticleToHitsMap);
112  if (!m_useTrueNeutrinosOnly) LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, parameters, LArMCParticleHelper::IsCosmicRay, allMCParticleToHitsMap);
113 
114  validationInfo.SetTargetMCParticleToHitsMap(targetMCParticleToHitsMap);
115  validationInfo.SetAllMCParticleToHitsMap(allMCParticleToHitsMap);
116  }
117 
118  if (pPfoList)
119  {
120  PfoList allConnectedPfos;
121  LArPfoHelper::GetAllConnectedPfos(*pPfoList, allConnectedPfos);
122 
123  PfoList finalStatePfos;
124  for (const ParticleFlowObject *const pPfo : allConnectedPfos)
125  {
126  if ((!m_testBeamMode && LArPfoHelper::IsFinalState(pPfo)) || (m_testBeamMode && pPfo->GetParentPfoList().empty()))
127  finalStatePfos.push_back(pPfo);
128  }
129 
131  LArMCParticleHelper::GetPfoToReconstructable2DHitsMap(finalStatePfos, validationInfo.GetAllMCParticleToHitsMap(), pfoToHitsMap);
132  validationInfo.SetPfoToHitsMap(pfoToHitsMap);
133  }
134 
137  LArMCParticleHelper::GetPfoMCParticleHitSharingMaps(validationInfo.GetPfoToHitsMap(), {validationInfo.GetAllMCParticleToHitsMap()}, pfoToMCHitSharingMap, mcToPfoHitSharingMap);
138  validationInfo.SetMCToPfoHitSharingMap(mcToPfoHitSharingMap);
139 
140  LArMCParticleHelper::MCParticleToPfoHitSharingMap interpretedMCToPfoHitSharingMap;
141  this->InterpretMatching(validationInfo, interpretedMCToPfoHitSharingMap);
142  validationInfo.SetInterpretedMCToPfoHitSharingMap(interpretedMCToPfoHitSharingMap);
143 }
bool m_useTrueNeutrinosOnly
Whether to consider only mc particles that were neutrino induced.
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...
bool m_testBeamMode
Whether pandora is reconstructing test beam particles.
static bool IsCosmicRay(const pandora::MCParticle *const pMCParticle)
Return true if passed a primary cosmic ray MCParticle.
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 primary, reconstructable mc particles that match given criteria.
float m_minHitSharingFraction
Minimum fraction of energy deposited by selected primary in a single "good" hit.
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
static void GetPfoToReconstructable2DHitsMap(const pandora::PfoList &pfoList, const MCContributionMap &selectedMCParticleToHitsMap, PfoContributionMap &pfoToReconstructable2DHitsMap)
Get mapping from Pfo to reconstructable 2D hits (=good hits belonging to a selected reconstructable M...
static bool IsBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary beam MCParticle.
std::map< const pandora::MCParticle *, PfoToSharedHitsVector > MCParticleToPfoHitSharingMap
bool m_selectInputHits
Whether to use only hits passing mc-based quality (is "reconstructable") checks.
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
static bool IsFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a primary parent particle.
float m_maxPhotonPropagation
Maximum distance travelled by photon, downstream of a track, in mc particle hierarchy.
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.
void InterpretMatching(const ValidationInfo &validationInfo, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const
Apply an interpretative matching procedure to the comprehensive matches in the provided validation in...
void lar_content::EventValidationAlgorithm::GetRemainingPfoMatches ( const ValidationInfo validationInfo,
const pandora::MCParticleVector &  mcPrimaryVector,
const pandora::PfoSet &  usedPfos,
LArMCParticleHelper::MCParticleToPfoHitSharingMap interpretedMCToPfoHitSharingMap 
) const
private

Get the best matches for any pfos left-over after the strong matching procedure.

Parameters
validationInfothe validation info
mcPrimaryVectorthe mc primary vector
usedPfosthe set of previously used pfos
interpretedMCToPfoHitSharingMapthe output, interpreted mc particle to pfo hit sharing map

Definition at line 565 of file EventValidationAlgorithm.cc.

References lar_content::EventValidationAlgorithm::ValidationInfo::GetMCToPfoHitSharingMap(), lar_content::EventValidationAlgorithm::ValidationInfo::GetTargetMCParticleToHitsMap(), and m_useSmallPrimaries.

Referenced by InterpretMatching().

567 {
568  LArMCParticleHelper::PfoToMCParticleHitSharingMap pfoToMCParticleHitSharingMap;
569 
570  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
571  {
572  if (!m_useSmallPrimaries && !validationInfo.GetTargetMCParticleToHitsMap().count(pMCPrimary))
573  continue;
574 
575  if (!validationInfo.GetMCToPfoHitSharingMap().count(pMCPrimary))
576  continue;
577 
578  for (const LArMCParticleHelper::PfoCaloHitListPair &pfoToSharedHits : validationInfo.GetMCToPfoHitSharingMap().at(pMCPrimary))
579  {
580  if (usedPfos.count(pfoToSharedHits.first))
581  continue;
582 
583  const LArMCParticleHelper::MCParticleCaloHitListPair mcParticleToHits(pMCPrimary, pfoToSharedHits.second);
584  LArMCParticleHelper::PfoToMCParticleHitSharingMap::iterator iter(pfoToMCParticleHitSharingMap.find(pfoToSharedHits.first));
585 
586  if (pfoToMCParticleHitSharingMap.end() == iter)
587  {
588  pfoToMCParticleHitSharingMap[pfoToSharedHits.first].push_back(mcParticleToHits);
589  }
590  else
591  {
592  if (1 != iter->second.size())
593  throw StatusCodeException(STATUS_CODE_FAILURE);
594 
595  LArMCParticleHelper::MCParticleCaloHitListPair &originalMCParticleToHits(iter->second.at(0));
596 
597  if (mcParticleToHits.second.size() > originalMCParticleToHits.second.size())
598  originalMCParticleToHits = mcParticleToHits;
599  }
600  }
601  }
602 
603  for (const auto &mapEntry : pfoToMCParticleHitSharingMap)
604  {
605  const LArMCParticleHelper::MCParticleCaloHitListPair &mcParticleToHits(mapEntry.second.at(0));
606  interpretedMCToPfoHitSharingMap[mcParticleToHits.first].push_back(LArMCParticleHelper::PfoCaloHitListPair(mapEntry.first, mcParticleToHits.second));
607  }
608 }
intermediate_table::iterator iterator
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
std::pair< const pandora::MCParticle *, pandora::CaloHitList > MCParticleCaloHitListPair
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
bool lar_content::EventValidationAlgorithm::GetStrongestPfoMatch ( const ValidationInfo validationInfo,
const pandora::MCParticleVector &  mcPrimaryVector,
pandora::PfoSet &  usedPfos,
LArMCParticleHelper::MCParticleToPfoHitSharingMap interpretedMCToPfoHitSharingMap 
) const
private

Get the strongest pfo match (most matched hits) between an available mc primary and an available pfo.

Parameters
validationInfothe validation info
mcPrimaryVectorthe mc primary vector
usedPfosthe set of previously used pfos
interpretedMCToPfoHitSharingMapthe output, interpreted mc particle to pfo hit sharing map
Returns
whether a strong match was identified

Definition at line 522 of file EventValidationAlgorithm.cc.

References lar_content::EventValidationAlgorithm::ValidationInfo::GetAllMCParticleToHitsMap(), lar_content::EventValidationAlgorithm::ValidationInfo::GetMCToPfoHitSharingMap(), lar_content::EventValidationAlgorithm::ValidationInfo::GetPfoToHitsMap(), lar_content::EventValidationAlgorithm::ValidationInfo::GetTargetMCParticleToHitsMap(), IsGoodMatch(), and m_useSmallPrimaries.

Referenced by InterpretMatching().

524 {
525  const MCParticle *pBestMCParticle(nullptr);
526  LArMCParticleHelper::PfoCaloHitListPair bestPfoHitPair(nullptr, CaloHitList());
527 
528  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
529  {
530  if (interpretedMCToPfoHitSharingMap.count(pMCPrimary))
531  continue;
532 
533  if (!m_useSmallPrimaries && !validationInfo.GetTargetMCParticleToHitsMap().count(pMCPrimary))
534  continue;
535 
536  if (!validationInfo.GetMCToPfoHitSharingMap().count(pMCPrimary))
537  continue;
538 
539  for (const LArMCParticleHelper::PfoCaloHitListPair &pfoToSharedHits : validationInfo.GetMCToPfoHitSharingMap().at(pMCPrimary))
540  {
541  if (usedPfos.count(pfoToSharedHits.first))
542  continue;
543 
544  if (!this->IsGoodMatch(validationInfo.GetAllMCParticleToHitsMap().at(pMCPrimary), validationInfo.GetPfoToHitsMap().at(pfoToSharedHits.first), pfoToSharedHits.second))
545  continue;
546 
547  if (pfoToSharedHits.second.size() > bestPfoHitPair.second.size())
548  {
549  pBestMCParticle = pMCPrimary;
550  bestPfoHitPair = pfoToSharedHits;
551  }
552  }
553  }
554 
555  if (!pBestMCParticle || !bestPfoHitPair.first)
556  return false;
557 
558  interpretedMCToPfoHitSharingMap[pBestMCParticle].push_back(bestPfoHitPair);
559  usedPfos.insert(bestPfoHitPair.first);
560  return true;
561 }
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
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::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
void lar_content::EventValidationAlgorithm::InterpretMatching ( const ValidationInfo validationInfo,
LArMCParticleHelper::MCParticleToPfoHitSharingMap interpretedMCToPfoHitSharingMap 
) const
private

Apply an interpretative matching procedure to the comprehensive matches in the provided validation info object.

Parameters
validationInfothe validation info
interpretedMCToPfoHitSharingMapthe output, interpreted mc particle to pfo hit sharing map

Definition at line 502 of file EventValidationAlgorithm.cc.

References lar_content::EventValidationAlgorithm::ValidationInfo::GetAllMCParticleToHitsMap(), lar_content::LArMonitoringHelper::GetOrderedMCParticleVector(), GetRemainingPfoMatches(), GetStrongestPfoMatch(), and lar_content::LArPfoHelper::SortByNHits().

Referenced by FillValidationInfo().

503 {
504  MCParticleVector mcPrimaryVector;
505  LArMonitoringHelper::GetOrderedMCParticleVector({validationInfo.GetAllMCParticleToHitsMap()}, mcPrimaryVector);
506 
507  PfoSet usedPfos;
508  while (this->GetStrongestPfoMatch(validationInfo, mcPrimaryVector, usedPfos, interpretedMCToPfoHitSharingMap)) {}
509  this->GetRemainingPfoMatches(validationInfo, mcPrimaryVector, usedPfos, interpretedMCToPfoHitSharingMap);
510 
511  // Ensure all primaries have an entry, and sorting is as desired
512  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
513  {
514  LArMCParticleHelper::PfoToSharedHitsVector &pfoHitPairs(interpretedMCToPfoHitSharingMap[pMCPrimary]);
515  std::sort(pfoHitPairs.begin(), pfoHitPairs.end(), [] (const LArMCParticleHelper::PfoCaloHitListPair &a, const LArMCParticleHelper::PfoCaloHitListPair &b) -> bool {
516  return ((a.second.size() != b.second.size()) ? a.second.size() > b.second.size() : LArPfoHelper::SortByNHits(a.first, b.first)); });
517  }
518 }
static bool SortByNHits(const pandora::ParticleFlowObject *const pLhs, const pandora::ParticleFlowObject *const pRhs)
Sort pfos by number of constituent hits.
bool GetStrongestPfoMatch(const ValidationInfo &validationInfo, const pandora::MCParticleVector &mcPrimaryVector, pandora::PfoSet &usedPfos, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const
Get the strongest pfo match (most matched hits) between an available mc primary and an available pfo...
std::vector< PfoCaloHitListPair > PfoToSharedHitsVector
void GetRemainingPfoMatches(const ValidationInfo &validationInfo, const pandora::MCParticleVector &mcPrimaryVector, const pandora::PfoSet &usedPfos, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const
Get the best matches for any pfos left-over after the strong matching procedure.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
static void GetOrderedMCParticleVector(const LArMCParticleHelper::MCContributionMapVector &selectedMCParticleToGoodHitsMaps, pandora::MCParticleVector &orderedMCParticleVector)
Order input MCParticles by their number of hits.
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
bool lar_content::EventValidationAlgorithm::IsGoodMatch ( const pandora::CaloHitList &  trueHits,
const pandora::CaloHitList &  recoHits,
const pandora::CaloHitList &  sharedHits 
) const
private

Whether a provided mc primary and pfo are deemed to be a good match.

Parameters
trueHitsthe list of true hits
recoHitsthe list of reco hits
sharedHitsthe list of shared hits
Returns
boolean

Definition at line 612 of file EventValidationAlgorithm.cc.

References f, m_matchingMinCompleteness, m_matchingMinPurity, and m_matchingMinSharedHits.

Referenced by GetStrongestPfoMatch(), and ProcessOutput().

613 {
614  const float purity((recoHits.size() > 0) ? static_cast<float>(sharedHits.size()) / static_cast<float>(recoHits.size()) : 0.f);
615  const float completeness((trueHits.size() > 0) ? static_cast<float>(sharedHits.size()) / static_cast<float>(trueHits.size()) : 0.f);
616 
617  return ((sharedHits.size() >= m_matchingMinSharedHits) && (purity >= m_matchingMinPurity) && (completeness >= m_matchingMinCompleteness));
618 }
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
TFile f
Definition: plotHisto.C:6
float m_matchingMinPurity
The minimum particle purity to declare a match.
unsigned int m_matchingMinSharedHits
The minimum number of shared hits used in matching scheme.
void lar_content::EventValidationAlgorithm::PrintAllMatches ( const ValidationInfo validationInfo) const
inlineprivate

Print all/raw matching information to screen.

Parameters
validationInfothe validation info

Definition at line 320 of file EventValidationAlgorithm.h.

References ProcessOutput().

Referenced by Run().

321 {
322  return this->ProcessOutput(validationInfo, false, true, false);
323 }
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 lar_content::EventValidationAlgorithm::PrintInterpretedMatches ( const ValidationInfo validationInfo) const
inlineprivate

Print interpreted matching information to screen.

Parameters
validationInfothe validation info

Definition at line 327 of file EventValidationAlgorithm.h.

References ProcessOutput().

Referenced by Run().

328 {
329  return this->ProcessOutput(validationInfo, true, true, false);
330 }
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 lar_content::EventValidationAlgorithm::ProcessOutput ( const ValidationInfo validationInfo,
const bool  useInterpretedMatching,
const bool  printToScreen,
const bool  fillTree 
) const
private

Print matching information in a provided validation info object, and write information to tree if configured to do so.

Parameters
validationInfothe validation info
useInterpretedMatchingwhether to use the interpreted (rather than raw) matching information
printToScreenwhether to print the information to screen
fillTreewhether to write the information to tree

Definition at line 147 of file EventValidationAlgorithm.cc.

References lar_content::LArMonitoringHelper::CountHitsByType(), lar_content::EventValidationAlgorithm::ValidationInfo::GetAllMCParticleToHitsMap(), lar_content::LArInteractionTypeHelper::GetInteractionType(), lar_content::EventValidationAlgorithm::ValidationInfo::GetInterpretedMCToPfoHitSharingMap(), lar_content::EventValidationAlgorithm::ValidationInfo::GetMCToPfoHitSharingMap(), lar_content::LArMCParticleHelper::GetNuanceCode(), lar_content::LArMonitoringHelper::GetOrderedMCParticleVector(), lar_content::LArMonitoringHelper::GetOrderedPfoVector(), lar_content::LArMCParticleHelper::GetParentMCParticle(), lar_content::LArPfoHelper::GetParentNeutrino(), lar_content::EventValidationAlgorithm::ValidationInfo::GetPfoToHitsMap(), lar_content::EventValidationAlgorithm::ValidationInfo::GetTargetMCParticleToHitsMap(), lar_content::LArPfoHelper::GetVertex(), lar_content::LArMCParticleHelper::IsBeamNeutrinoFinalState(), lar_content::LArMCParticleHelper::IsBeamParticle(), lar_content::LArMCParticleHelper::IsCosmicRay(), IsGoodMatch(), lar_content::LArPfoHelper::IsNeutrinoFinalState(), lar_content::LArPfoHelper::IsTestBeam(), m_eventNumber, m_fileIdentifier, m_testBeamMode, m_treeName, max, and lar_content::LArInteractionTypeHelper::ToString().

Referenced by PrintAllMatches(), PrintInterpretedMatches(), and WriteInterpretedMatches().

148 {
149  if (printToScreen && useInterpretedMatching) std::cout << "---INTERPRETED-MATCHING-OUTPUT------------------------------------------------------------------" << std::endl;
150  else if (printToScreen) std::cout << "---RAW-MATCHING-OUTPUT--------------------------------------------------------------------------" << std::endl;
151 
152  const LArMCParticleHelper::MCParticleToPfoHitSharingMap &mcToPfoHitSharingMap(useInterpretedMatching ?
153  validationInfo.GetInterpretedMCToPfoHitSharingMap() : validationInfo.GetMCToPfoHitSharingMap());
154 
155  MCParticleVector mcPrimaryVector;
156  LArMonitoringHelper::GetOrderedMCParticleVector({validationInfo.GetTargetMCParticleToHitsMap()}, mcPrimaryVector);
157 
158  int nNeutrinoPrimaries(0);
159  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
160  if (LArMCParticleHelper::IsBeamNeutrinoFinalState(pMCPrimary) && validationInfo.GetTargetMCParticleToHitsMap().count(pMCPrimary)) ++nNeutrinoPrimaries;
161 
162  PfoVector primaryPfoVector;
163  LArMonitoringHelper::GetOrderedPfoVector(validationInfo.GetPfoToHitsMap(), primaryPfoVector);
164 
165  int pfoIndex(0), neutrinoPfoIndex(0);
166  PfoToIdMap pfoToIdMap, neutrinoPfoToIdMap;
167  for (const Pfo *const pPrimaryPfo : primaryPfoVector)
168  {
169  pfoToIdMap.insert(PfoToIdMap::value_type(pPrimaryPfo, ++pfoIndex));
170  const Pfo *const pRecoNeutrino(LArPfoHelper::IsNeutrinoFinalState(pPrimaryPfo) ? LArPfoHelper::GetParentNeutrino(pPrimaryPfo) : nullptr);
171 
172  if (pRecoNeutrino && !neutrinoPfoToIdMap.count(pRecoNeutrino))
173  neutrinoPfoToIdMap.insert(PfoToIdMap::value_type(pRecoNeutrino, ++neutrinoPfoIndex));
174  }
175 
176  PfoSet recoNeutrinos;
177  MCParticleList associatedMCPrimaries;
178 
179  int nCorrectNu(0), nTotalNu(0), nCorrectTB(0), nTotalTB(0), nCorrectCR(0), nTotalCR(0), nFakeNu(0), nFakeCR(0), nSplitNu(0), nSplitCR(0), nLost(0);
180  int mcPrimaryIndex(0), nTargetMatches(0), nTargetNuMatches(0), nTargetCRMatches(0), nTargetGoodNuMatches(0), nTargetNuSplits(0), nTargetNuLosses(0);
181  IntVector mcPrimaryId, mcPrimaryPdg, nMCHitsTotal, nMCHitsU, nMCHitsV, nMCHitsW;
182  FloatVector mcPrimaryE, mcPrimaryPX, mcPrimaryPY, mcPrimaryPZ;
183  FloatVector mcPrimaryVtxX, mcPrimaryVtxY, mcPrimaryVtxZ, mcPrimaryEndX, mcPrimaryEndY, mcPrimaryEndZ;
184  IntVector nPrimaryMatchedPfos, nPrimaryMatchedNuPfos, nPrimaryMatchedCRPfos;
185  IntVector bestMatchPfoId, bestMatchPfoPdg, bestMatchPfoIsRecoNu, bestMatchPfoRecoNuId, bestMatchPfoIsTestBeam;
186  IntVector bestMatchPfoNHitsTotal, bestMatchPfoNHitsU, bestMatchPfoNHitsV, bestMatchPfoNHitsW;
187  IntVector bestMatchPfoNSharedHitsTotal, bestMatchPfoNSharedHitsU, bestMatchPfoNSharedHitsV, bestMatchPfoNSharedHitsW;
188 
189  std::stringstream targetSS;
190 
191  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
192  {
193  const bool hasMatch(mcToPfoHitSharingMap.count(pMCPrimary) && !mcToPfoHitSharingMap.at(pMCPrimary).empty());
194  const bool isTargetPrimary(validationInfo.GetTargetMCParticleToHitsMap().count(pMCPrimary));
195 
196  if (!hasMatch && !isTargetPrimary)
197  continue;
198 
199  associatedMCPrimaries.push_back(pMCPrimary);
200  const int nTargetPrimaries(associatedMCPrimaries.size());
201  const bool isLastNeutrinoPrimary(++mcPrimaryIndex == nNeutrinoPrimaries);
202  const CaloHitList &mcPrimaryHitList(validationInfo.GetAllMCParticleToHitsMap().at(pMCPrimary));
203 
205  const int isBeamNeutrinoFinalState(LArMCParticleHelper::IsBeamNeutrinoFinalState(pMCPrimary));
206  const int isBeamParticle(LArMCParticleHelper::IsBeamParticle(pMCPrimary));
207  const int isCosmicRay(LArMCParticleHelper::IsCosmicRay(pMCPrimary));
208 #ifdef MONITORING
209  const CartesianVector &targetVertex(LArMCParticleHelper::GetParentMCParticle(pMCPrimary)->GetVertex());
210  const float targetVertexX(targetVertex.GetX()), targetVertexY(targetVertex.GetY()), targetVertexZ(targetVertex.GetZ());
211 #endif
212  targetSS << (!isTargetPrimary ? "(Non target) " : "")
213  << "PrimaryId " << mcPrimaryIndex
214  << ", Nu " << isBeamNeutrinoFinalState
215  << ", TB " << isBeamParticle
216  << ", CR " << isCosmicRay
217  << ", MCPDG " << pMCPrimary->GetParticleId()
218  << ", Energy " << pMCPrimary->GetEnergy()
219  << ", Dist. " << (pMCPrimary->GetEndpoint() - pMCPrimary->GetVertex()).GetMagnitude()
220  << ", nMCHits " << mcPrimaryHitList.size()
221  << " (" << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, mcPrimaryHitList)
222  << ", " << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, mcPrimaryHitList)
223  << ", " << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, mcPrimaryHitList) << ")" << std::endl;
224 
225  mcPrimaryId.push_back(mcPrimaryIndex);
226  mcPrimaryPdg.push_back(pMCPrimary->GetParticleId());
227  mcPrimaryE.push_back(pMCPrimary->GetEnergy());
228  mcPrimaryPX.push_back(pMCPrimary->GetMomentum().GetX());
229  mcPrimaryPY.push_back(pMCPrimary->GetMomentum().GetY());
230  mcPrimaryPZ.push_back(pMCPrimary->GetMomentum().GetZ());
231  mcPrimaryVtxX.push_back(pMCPrimary->GetVertex().GetX());
232  mcPrimaryVtxY.push_back(pMCPrimary->GetVertex().GetY());
233  mcPrimaryVtxZ.push_back(pMCPrimary->GetVertex().GetZ());
234  mcPrimaryEndX.push_back(pMCPrimary->GetEndpoint().GetX());
235  mcPrimaryEndY.push_back(pMCPrimary->GetEndpoint().GetY());
236  mcPrimaryEndZ.push_back(pMCPrimary->GetEndpoint().GetZ());
237  nMCHitsTotal.push_back(mcPrimaryHitList.size());
238  nMCHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, mcPrimaryHitList));
239  nMCHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, mcPrimaryHitList));
240  nMCHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, mcPrimaryHitList));
241 
242  int matchIndex(0), nPrimaryMatches(0), nPrimaryNuMatches(0), nPrimaryCRMatches(0), nPrimaryGoodNuMatches(0), nPrimaryNuSplits(0);
243 #ifdef MONITORING
244  float recoVertexX(std::numeric_limits<float>::max()), recoVertexY(std::numeric_limits<float>::max()), recoVertexZ(std::numeric_limits<float>::max());
245 #endif
246  for (const LArMCParticleHelper::PfoCaloHitListPair &pfoToSharedHits : mcToPfoHitSharingMap.at(pMCPrimary))
247  {
248  const CaloHitList &sharedHitList(pfoToSharedHits.second);
249  const CaloHitList &pfoHitList(validationInfo.GetPfoToHitsMap().at(pfoToSharedHits.first));
250 
251  const bool isRecoNeutrinoFinalState(LArPfoHelper::IsNeutrinoFinalState(pfoToSharedHits.first));
252  const bool isRecoTestBeam(LArPfoHelper::IsTestBeam(pfoToSharedHits.first));
253  const bool isGoodMatch(this->IsGoodMatch(mcPrimaryHitList, pfoHitList, sharedHitList));
254 
255  const int pfoId(pfoToIdMap.at(pfoToSharedHits.first));
256  const int recoNuId(isRecoNeutrinoFinalState ? neutrinoPfoToIdMap.at(LArPfoHelper::GetParentNeutrino(pfoToSharedHits.first)) : -1);
257 
258  if (0 == matchIndex++)
259  {
260  bestMatchPfoId.push_back(pfoId);
261  bestMatchPfoPdg.push_back(pfoToSharedHits.first->GetParticleId());
262  bestMatchPfoIsRecoNu.push_back(isRecoNeutrinoFinalState ? 1 : 0);
263  bestMatchPfoRecoNuId.push_back(recoNuId);
264  bestMatchPfoIsTestBeam.push_back(isRecoTestBeam ? 1 : 0);
265  bestMatchPfoNHitsTotal.push_back(pfoHitList.size());
266  bestMatchPfoNHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, pfoHitList));
267  bestMatchPfoNHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, pfoHitList));
268  bestMatchPfoNHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, pfoHitList));
269  bestMatchPfoNSharedHitsTotal.push_back(sharedHitList.size());
270  bestMatchPfoNSharedHitsU.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, sharedHitList));
271  bestMatchPfoNSharedHitsV.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, sharedHitList));
272  bestMatchPfoNSharedHitsW.push_back(LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, sharedHitList));
273 #ifdef MONITORING
274  try
275  {
276  const Vertex *const pRecoVertex(LArPfoHelper::GetVertex(isRecoNeutrinoFinalState ? LArPfoHelper::GetParentNeutrino(pfoToSharedHits.first) : pfoToSharedHits.first));
277  recoVertexX = pRecoVertex->GetPosition().GetX();
278  recoVertexY = pRecoVertex->GetPosition().GetY();
279  recoVertexZ = pRecoVertex->GetPosition().GetZ();
280  }
281  catch (const StatusCodeException &) {}
282 #endif
283  }
284 
285  if (isGoodMatch) ++nPrimaryMatches;
286 
287  if (isRecoNeutrinoFinalState)
288  {
289  const Pfo *const pRecoNeutrino(LArPfoHelper::GetParentNeutrino(pfoToSharedHits.first));
290  const bool isSplitRecoNeutrino(!recoNeutrinos.empty() && !recoNeutrinos.count(pRecoNeutrino));
291  if (!isSplitRecoNeutrino && isGoodMatch) ++nPrimaryGoodNuMatches;
292  if (isSplitRecoNeutrino && isBeamNeutrinoFinalState && isGoodMatch) ++nPrimaryNuSplits;
293  recoNeutrinos.insert(pRecoNeutrino);
294  }
295 
296  if (!m_testBeamMode)
297  {
298  if (isRecoNeutrinoFinalState && isGoodMatch) ++nPrimaryNuMatches;
299  if (!isRecoNeutrinoFinalState && isGoodMatch) ++nPrimaryCRMatches;
300  }
301  else
302  {
303  bool isTestBeam(LArPfoHelper::IsTestBeam(pfoToSharedHits.first));
304  if (isTestBeam && isGoodMatch) ++nPrimaryNuMatches;
305  if (!isTestBeam && isGoodMatch) ++nPrimaryCRMatches;
306  }
307 
308  targetSS << "-" << (!isGoodMatch ? "(Below threshold) " : "")
309  << "MatchedPfoId " << pfoId
310  << ", Nu " << isRecoNeutrinoFinalState;
311  if (isRecoNeutrinoFinalState) targetSS << " [NuId: " << recoNuId << "]";
312  targetSS << ", TB " << isRecoTestBeam
313  << ", CR " << (!isRecoNeutrinoFinalState && !isRecoTestBeam)
314  << ", PDG " << pfoToSharedHits.first->GetParticleId()
315  << ", nMatchedHits " << sharedHitList.size()
316  << " (" << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, sharedHitList)
317  << ", " << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, sharedHitList)
318  << ", " << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, sharedHitList) << ")"
319  << ", nPfoHits " << pfoHitList.size()
320  << " (" << LArMonitoringHelper::CountHitsByType(TPC_VIEW_U, pfoHitList)
321  << ", " << LArMonitoringHelper::CountHitsByType(TPC_VIEW_V, pfoHitList)
322  << ", " << LArMonitoringHelper::CountHitsByType(TPC_VIEW_W, pfoHitList) << ")" << std::endl;
323  }
324 
325  if (mcToPfoHitSharingMap.at(pMCPrimary).empty())
326  {
327  targetSS << "-No matched Pfo" << std::endl;
328  bestMatchPfoId.push_back(-1); bestMatchPfoPdg.push_back(0); bestMatchPfoIsRecoNu.push_back(0); bestMatchPfoRecoNuId.push_back(-1); bestMatchPfoIsTestBeam.push_back(0);
329  bestMatchPfoNHitsTotal.push_back(0); bestMatchPfoNHitsU.push_back(0); bestMatchPfoNHitsV.push_back(0); bestMatchPfoNHitsW.push_back(0);
330  bestMatchPfoNSharedHitsTotal.push_back(0); bestMatchPfoNSharedHitsU.push_back(0); bestMatchPfoNSharedHitsV.push_back(0); bestMatchPfoNSharedHitsW.push_back(0);
331  }
332 
333  nPrimaryMatchedPfos.push_back(nPrimaryMatches);
334  nPrimaryMatchedNuPfos.push_back(nPrimaryNuMatches);
335  nPrimaryMatchedCRPfos.push_back(nPrimaryCRMatches);
336  nTargetMatches += nPrimaryMatches;
337  nTargetNuMatches += nPrimaryNuMatches;
338  nTargetCRMatches += nPrimaryCRMatches;
339  nTargetGoodNuMatches += nPrimaryGoodNuMatches;
340  nTargetNuSplits += nPrimaryNuSplits;
341  if (0 == nPrimaryMatches) ++nTargetNuLosses;
342 
343  if (fillTree)
344  {
345  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "fileIdentifier", m_fileIdentifier));
346  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "eventNumber", m_eventNumber - 1));
347  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcNuanceCode", mcNuanceCode));
348  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isNeutrino", isBeamNeutrinoFinalState));
349  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isBeamParticle", isBeamParticle));
350  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isCosmicRay", isCosmicRay));
351  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetPrimaries", nTargetPrimaries));
352  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "targetVertexX", targetVertexX));
353  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "targetVertexY", targetVertexY));
354  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "targetVertexZ", targetVertexZ));
355  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "recoVertexX", recoVertexX));
356  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "recoVertexY", recoVertexY));
357  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "recoVertexZ", recoVertexZ));
358  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryId", &mcPrimaryId));
359  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryPdg", &mcPrimaryPdg));
360  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryE", &mcPrimaryE));
361  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryPX", &mcPrimaryPX));
362  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryPY", &mcPrimaryPY));
363  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryPZ", &mcPrimaryPZ));
364  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryVtxX", &mcPrimaryVtxX));
365  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryVtxY", &mcPrimaryVtxY));
366  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryVtxZ", &mcPrimaryVtxZ));
367  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryEndX", &mcPrimaryEndX));
368  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryEndY", &mcPrimaryEndY));
369  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryEndZ", &mcPrimaryEndZ));
370  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryNHitsTotal", &nMCHitsTotal));
371  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryNHitsU", &nMCHitsU));
372  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryNHitsV", &nMCHitsV));
373  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "mcPrimaryNHitsW", &nMCHitsW));
374  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nPrimaryMatchedPfos", &nPrimaryMatchedPfos));
375  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nPrimaryMatchedNuPfos", &nPrimaryMatchedNuPfos));
376  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nPrimaryMatchedCRPfos", &nPrimaryMatchedCRPfos));
377  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoId", &bestMatchPfoId));
378  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoPdg", &bestMatchPfoPdg));
379  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoIsRecoNu", &bestMatchPfoIsRecoNu));
380  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoRecoNuId", &bestMatchPfoRecoNuId));
381  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNHitsTotal", &bestMatchPfoNHitsTotal));
382  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNHitsU", &bestMatchPfoNHitsU));
383  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNHitsV", &bestMatchPfoNHitsV));
384  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNHitsW", &bestMatchPfoNHitsW));
385  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNSharedHitsTotal", &bestMatchPfoNSharedHitsTotal));
386  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNSharedHitsU", &bestMatchPfoNSharedHitsU));
387  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNSharedHitsV", &bestMatchPfoNSharedHitsV));
388  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoNSharedHitsW", &bestMatchPfoNSharedHitsW));
389  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetMatches", nTargetMatches));
390  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetNuMatches", nTargetNuMatches));
391  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetCRMatches", nTargetCRMatches));
392 
393  if (m_testBeamMode)
394  {
395  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "bestMatchPfoIsTestBeam", &bestMatchPfoIsTestBeam));
396  }
397 
398  if (!m_testBeamMode)
399  {
400  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetGoodNuMatches", nTargetGoodNuMatches));
401  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetNuSplits", nTargetNuSplits));
402  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "nTargetNuLosses", nTargetNuLosses));
403  }
404  }
405 
406  if (isLastNeutrinoPrimary || isBeamParticle || isCosmicRay)
407  {
409 #ifdef MONITORING
410  const int interactionTypeInt(static_cast<int>(interactionType));
411 #endif
412  // ATTN Some redundancy introduced to contributing variables
413  const int isCorrectNu(isBeamNeutrinoFinalState && (nTargetGoodNuMatches == nTargetNuMatches) && (nTargetGoodNuMatches == nTargetPrimaries) && (nTargetCRMatches == 0) && (nTargetNuSplits == 0) && (nTargetNuLosses == 0));
414  const int isCorrectTB(isBeamParticle && (nTargetNuMatches == 1) && (nTargetCRMatches == 0));
415  const int isCorrectCR(isCosmicRay && (nTargetNuMatches == 0) && (nTargetCRMatches == 1));
416  const int isFakeNu(isCosmicRay && (nTargetNuMatches > 0));
417  const int isFakeCR(!isCosmicRay && (nTargetCRMatches > 0));
418  const int isSplitNu(!isCosmicRay && ((nTargetNuMatches > nTargetPrimaries) || (nTargetNuSplits > 0)));
419  const int isSplitCR(isCosmicRay && (nTargetCRMatches > 1));
420  const int isLost(nTargetMatches == 0);
421 
422  std::stringstream outcomeSS;
423  outcomeSS << LArInteractionTypeHelper::ToString(interactionType) << " (Nuance " << mcNuanceCode << ", Nu " << isBeamNeutrinoFinalState << ", TB " << isBeamParticle << ", CR " << isCosmicRay << ")" << std::endl;
424 
425  if (isLastNeutrinoPrimary) ++nTotalNu;
426  if (isBeamParticle) ++nTotalTB;
427  if (isCosmicRay) ++nTotalCR;
428  if (isCorrectNu) ++nCorrectNu;
429  if (isCorrectTB) ++nCorrectTB;
430  if (isCorrectCR) ++nCorrectCR;
431  if (isFakeNu) ++nFakeNu;
432  if (isFakeCR) ++nFakeCR;
433  if (isSplitNu) ++nSplitNu;
434  if (isSplitCR) ++nSplitCR;
435  if (isLost) ++nLost;
436 
437  if (isCorrectNu) outcomeSS << "IsCorrectNu ";
438  if (isCorrectTB) outcomeSS << "IsCorrectTB ";
439  if (isCorrectCR) outcomeSS << "IsCorrectCR ";
440  if (isFakeNu) outcomeSS << "IsFakeNu ";
441  if (isFakeCR) outcomeSS << "IsFakeCR ";
442  if (isSplitNu) outcomeSS << "isSplitNu ";
443  if (isSplitCR) outcomeSS << "IsSplitCR ";
444  if (isLost) outcomeSS << "IsLost ";
445  if (nTargetNuMatches > 0) outcomeSS << "(NNuMatches: " << nTargetNuMatches << ") ";
446  if (nTargetNuLosses > 0) outcomeSS << "(NNuLosses: " << nTargetNuLosses << ") ";
447  if (nTargetNuSplits > 0) outcomeSS << "(NNuSplits: " << nTargetNuSplits << ") ";
448  if (nTargetCRMatches > 0) outcomeSS << "(NCRMatches: " << nTargetCRMatches << ") ";
449  if (printToScreen) std::cout << outcomeSS.str() << std::endl << targetSS.str() << std::endl;
450 
451  if (fillTree)
452  {
453  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "interactionType", interactionTypeInt));
454  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isCorrectNu", isCorrectNu));
455  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isCorrectTB", isCorrectTB));
456  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isCorrectCR", isCorrectCR));
457  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isFakeNu", isFakeNu));
458  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isFakeCR", isFakeCR));
459  if (!m_testBeamMode)
460  {
461  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isSplitNu", isSplitNu));
462  }
463  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isSplitCR", isSplitCR));
464  PANDORA_MONITORING_API(SetTreeVariable(this->GetPandora(), m_treeName.c_str(), "isLost", isLost));
465  PANDORA_MONITORING_API(FillTree(this->GetPandora(), m_treeName.c_str()));
466  }
467 
468  targetSS.str(std::string()); targetSS.clear();
469  recoNeutrinos.clear(); associatedMCPrimaries.clear();
470  nTargetMatches = 0; nTargetNuMatches = 0; nTargetCRMatches = 0; nTargetGoodNuMatches = 0; nTargetNuSplits = 0; nTargetNuLosses = 0;
471  mcPrimaryId.clear(); mcPrimaryPdg.clear(); nMCHitsTotal.clear(); nMCHitsU.clear(); nMCHitsV.clear(); nMCHitsW.clear();
472  mcPrimaryE.clear(); mcPrimaryPX.clear(); mcPrimaryPY.clear(); mcPrimaryPZ.clear();
473  mcPrimaryVtxX.clear(); mcPrimaryVtxY.clear(); mcPrimaryVtxZ.clear(); mcPrimaryEndX.clear(); mcPrimaryEndY.clear(); mcPrimaryEndZ.clear();
474  nPrimaryMatchedPfos.clear(); nPrimaryMatchedNuPfos.clear(); nPrimaryMatchedCRPfos.clear();
475  bestMatchPfoId.clear(); bestMatchPfoPdg.clear(); bestMatchPfoIsRecoNu.clear(); bestMatchPfoRecoNuId.clear(); bestMatchPfoIsTestBeam.clear();
476  bestMatchPfoNHitsTotal.clear(); bestMatchPfoNHitsU.clear(); bestMatchPfoNHitsV.clear(); bestMatchPfoNHitsW.clear();
477  bestMatchPfoNSharedHitsTotal.clear(); bestMatchPfoNSharedHitsU.clear(); bestMatchPfoNSharedHitsV.clear(); bestMatchPfoNSharedHitsW.clear();
478  }
479  }
480 
481  if (useInterpretedMatching)
482  {
483  std::stringstream summarySS;
484  summarySS << "---SUMMARY--------------------------------------------------------------------------------------" << std::endl;
485  if (nTotalNu > 0) summarySS << "#CorrectNu: " << nCorrectNu << "/" << nTotalNu << ", Fraction: " << (nTotalNu > 0 ? static_cast<float>(nCorrectNu) / static_cast<float>(nTotalNu) : 0.f) << std::endl;
486  if (nTotalTB > 0) summarySS << "#CorrectTB: " << nCorrectTB << "/" << nTotalTB << ", Fraction: " << (nTotalTB > 0 ? static_cast<float>(nCorrectTB) / static_cast<float>(nTotalTB) : 0.f) << std::endl;
487  if (nTotalCR > 0) summarySS << "#CorrectCR: " << nCorrectCR << "/" << nTotalCR << ", Fraction: " << (nTotalCR > 0 ? static_cast<float>(nCorrectCR) / static_cast<float>(nTotalCR) : 0.f) << std::endl;
488  if (nFakeNu > 0) summarySS << "#FakeNu: " << nFakeNu << " ";
489  if (nFakeCR > 0) summarySS << "#FakeCR: " << nFakeCR << " ";
490  if (nSplitNu > 0) summarySS << "#SplitNu: " << nSplitNu << " ";
491  if (nSplitCR > 0) summarySS << "#SplitCR: " << nSplitCR << " ";
492  if (nLost > 0) summarySS << "#Lost: " << nLost << " ";
493  if (nFakeNu || nFakeCR || nSplitNu || nSplitCR || nLost) summarySS << std::endl;
494  if (printToScreen) std::cout << summarySS.str();
495  }
496 
497  if (printToScreen) std::cout << "------------------------------------------------------------------------------------------------" << std::endl << std::endl;
498 }
static const pandora::Vertex * GetVertex(const pandora::ParticleFlowObject *const pPfo)
Get the pfo vertex.
STL namespace.
std::vector< int > IntVector
bool m_testBeamMode
Whether pandora is reconstructing test beam particles.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
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.
std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToIdMap
TFile f
Definition: plotHisto.C:6
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.
Int_t max
Definition: plot.C:27
std::string m_treeName
Name of output tree.
static bool IsTestBeam(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a test beam particle.
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.
std::map< const pandora::MCParticle *, PfoToSharedHitsVector > MCParticleToPfoHitSharingMap
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.
int m_fileIdentifier
The input file identifier.
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.
static bool IsNeutrinoFinalState(const pandora::ParticleFlowObject *const pPfo)
Whether a pfo is a final-state particle from a neutrino (or antineutrino) interaction.
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.
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
StatusCode lar_content::EventValidationAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 622 of file EventValidationAlgorithm.cc.

References m_caloHitListName, m_fileIdentifier, m_fileName, m_matchingMinCompleteness, m_matchingMinPurity, m_matchingMinSharedHits, m_maxPhotonPropagation, m_mcParticleListName, m_minHitSharingFraction, m_pfoListName, m_printAllToScreen, m_printMatchingToScreen, m_selectInputHits, m_testBeamMode, m_treeName, m_useSmallPrimaries, m_useTrueNeutrinosOnly, and m_writeToTree.

623 {
624  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "CaloHitListName", m_caloHitListName));
625  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "MCParticleListName", m_mcParticleListName));
626  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "PfoListName", m_pfoListName));
627 
628  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
629  "UseTrueNeutrinosOnly", m_useTrueNeutrinosOnly));
630 
631  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
632  "TestBeamMode", m_testBeamMode));
633 
634  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
635  "SelectInputHits", m_selectInputHits));
636 
637  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
638  "MinHitSharingFraction", m_minHitSharingFraction));
639 
640  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
641  "MaxPhotonPropagation", m_maxPhotonPropagation));
642 
643  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
644  "PrintAllToScreen", m_printAllToScreen));
645 
646  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
647  "PrintMatchingToScreen", m_printMatchingToScreen));
648 
649  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
650  "WriteToTree", m_writeToTree));
651 
652  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
653  "UseSmallPrimaries", m_useSmallPrimaries));
654 
655  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
656  "MatchingMinSharedHits", m_matchingMinSharedHits));
657 
658  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
659  "MatchingMinCompleteness", m_matchingMinCompleteness));
660 
661  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
662  "MatchingMinPurity", m_matchingMinPurity));
663 
664  if (m_writeToTree)
665  {
666  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputTree", m_treeName));
667  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputFile", m_fileName));
668 
669  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
670  "FileIdentifier", m_fileIdentifier));
671  }
672 
673  return STATUS_CODE_SUCCESS;
674 }
std::string m_mcParticleListName
Name of input MC particle list.
std::string m_pfoListName
Name of input Pfo list.
bool m_useTrueNeutrinosOnly
Whether to consider only mc particles that were neutrino induced.
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
bool m_printAllToScreen
Whether to print all/raw matching details to screen.
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
bool m_testBeamMode
Whether pandora is reconstructing test beam particles.
bool m_printMatchingToScreen
Whether to print matching output to screen.
float m_minHitSharingFraction
Minimum fraction of energy deposited by selected primary in a single "good" hit.
bool m_writeToTree
Whether to write all/raw matching details to tree.
std::string m_treeName
Name of output tree.
bool m_selectInputHits
Whether to use only hits passing mc-based quality (is "reconstructable") checks.
int m_fileIdentifier
The input file identifier.
std::string m_fileName
Name of output file.
float m_matchingMinPurity
The minimum particle purity to declare a match.
unsigned int m_matchingMinSharedHits
The minimum number of shared hits used in matching scheme.
float m_maxPhotonPropagation
Maximum distance travelled by photon, downstream of a track, in mc particle hierarchy.
std::string m_caloHitListName
Name of input calo hit list.
StatusCode lar_content::EventValidationAlgorithm::Run ( )
private

Definition at line 61 of file EventValidationAlgorithm.cc.

References FillValidationInfo(), m_caloHitListName, m_eventNumber, m_mcParticleListName, m_pfoListName, m_printAllToScreen, m_printMatchingToScreen, m_writeToTree, PrintAllMatches(), PrintInterpretedMatches(), and WriteInterpretedMatches().

62 {
63  ++m_eventNumber;
64 
65  const MCParticleList *pMCParticleList = nullptr;
66  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_mcParticleListName, pMCParticleList));
67 
68  const CaloHitList *pCaloHitList = nullptr;
69  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_caloHitListName, pCaloHitList));
70 
71  const PfoList *pPfoList = nullptr;
72  (void) PandoraContentApi::GetList(*this, m_pfoListName, pPfoList);
73 
74  ValidationInfo validationInfo;
75  this->FillValidationInfo(pMCParticleList, pCaloHitList, pPfoList, validationInfo);
76 
78  this->PrintAllMatches(validationInfo);
79 
81  this->PrintInterpretedMatches(validationInfo);
82 
83  if (m_writeToTree)
84  this->WriteInterpretedMatches(validationInfo);
85 
86  return STATUS_CODE_SUCCESS;
87 }
std::string m_mcParticleListName
Name of input MC particle list.
std::string m_pfoListName
Name of input Pfo list.
bool m_printAllToScreen
Whether to print all/raw matching details to screen.
bool m_printMatchingToScreen
Whether to print matching output to screen.
void PrintAllMatches(const ValidationInfo &validationInfo) const
Print all/raw matching information to screen.
bool m_writeToTree
Whether to write all/raw matching details to tree.
void PrintInterpretedMatches(const ValidationInfo &validationInfo) const
Print interpreted matching information to screen.
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.
void WriteInterpretedMatches(const ValidationInfo &validationInfo) const
Write interpreted matching information to tree.
std::string m_caloHitListName
Name of input calo hit list.
void lar_content::EventValidationAlgorithm::WriteInterpretedMatches ( const ValidationInfo validationInfo) const
inlineprivate

Write interpreted matching information to tree.

Parameters
validationInfothe validation info

Definition at line 334 of file EventValidationAlgorithm.h.

References ProcessOutput().

Referenced by Run().

335 {
336  return this->ProcessOutput(validationInfo, true, false, true);
337 }
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...

Member Data Documentation

std::string lar_content::EventValidationAlgorithm::m_caloHitListName
private

Name of input calo hit list.

Definition at line 218 of file EventValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

int lar_content::EventValidationAlgorithm::m_eventNumber
private

The event number.

Definition at line 243 of file EventValidationAlgorithm.h.

Referenced by ProcessOutput(), and Run().

int lar_content::EventValidationAlgorithm::m_fileIdentifier
private

The input file identifier.

Definition at line 242 of file EventValidationAlgorithm.h.

Referenced by ProcessOutput(), and ReadSettings().

std::string lar_content::EventValidationAlgorithm::m_fileName
private

Name of output file.

Definition at line 240 of file EventValidationAlgorithm.h.

Referenced by ReadSettings(), and ~EventValidationAlgorithm().

float lar_content::EventValidationAlgorithm::m_matchingMinCompleteness
private

The minimum particle completeness to declare a match.

Definition at line 236 of file EventValidationAlgorithm.h.

Referenced by IsGoodMatch(), and ReadSettings().

float lar_content::EventValidationAlgorithm::m_matchingMinPurity
private

The minimum particle purity to declare a match.

Definition at line 237 of file EventValidationAlgorithm.h.

Referenced by IsGoodMatch(), and ReadSettings().

unsigned int lar_content::EventValidationAlgorithm::m_matchingMinSharedHits
private

The minimum number of shared hits used in matching scheme.

Definition at line 235 of file EventValidationAlgorithm.h.

Referenced by IsGoodMatch(), and ReadSettings().

float lar_content::EventValidationAlgorithm::m_maxPhotonPropagation
private

Maximum distance travelled by photon, downstream of a track, in mc particle hierarchy.

Definition at line 227 of file EventValidationAlgorithm.h.

Referenced by FillValidationInfo(), and ReadSettings().

std::string lar_content::EventValidationAlgorithm::m_mcParticleListName
private

Name of input MC particle list.

Definition at line 219 of file EventValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

float lar_content::EventValidationAlgorithm::m_minHitSharingFraction
private

Minimum fraction of energy deposited by selected primary in a single "good" hit.

Definition at line 226 of file EventValidationAlgorithm.h.

Referenced by FillValidationInfo(), and ReadSettings().

std::string lar_content::EventValidationAlgorithm::m_pfoListName
private

Name of input Pfo list.

Definition at line 220 of file EventValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

bool lar_content::EventValidationAlgorithm::m_printAllToScreen
private

Whether to print all/raw matching details to screen.

Definition at line 229 of file EventValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

bool lar_content::EventValidationAlgorithm::m_printMatchingToScreen
private

Whether to print matching output to screen.

Definition at line 230 of file EventValidationAlgorithm.h.

Referenced by ReadSettings(), and Run().

bool lar_content::EventValidationAlgorithm::m_selectInputHits
private

Whether to use only hits passing mc-based quality (is "reconstructable") checks.

Definition at line 225 of file EventValidationAlgorithm.h.

Referenced by FillValidationInfo(), and ReadSettings().

bool lar_content::EventValidationAlgorithm::m_testBeamMode
private

Whether pandora is reconstructing test beam particles.

Definition at line 223 of file EventValidationAlgorithm.h.

Referenced by FillValidationInfo(), ProcessOutput(), and ReadSettings().

std::string lar_content::EventValidationAlgorithm::m_treeName
private

Name of output tree.

Definition at line 239 of file EventValidationAlgorithm.h.

Referenced by ProcessOutput(), ReadSettings(), and ~EventValidationAlgorithm().

bool lar_content::EventValidationAlgorithm::m_useSmallPrimaries
private

Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.

Definition at line 234 of file EventValidationAlgorithm.h.

Referenced by GetRemainingPfoMatches(), GetStrongestPfoMatch(), and ReadSettings().

bool lar_content::EventValidationAlgorithm::m_useTrueNeutrinosOnly
private

Whether to consider only mc particles that were neutrino induced.

Definition at line 222 of file EventValidationAlgorithm.h.

Referenced by FillValidationInfo(), and ReadSettings().

bool lar_content::EventValidationAlgorithm::m_writeToTree
private

Whether to write all/raw matching details to tree.

Definition at line 232 of file EventValidationAlgorithm.h.

Referenced by ReadSettings(), Run(), and ~EventValidationAlgorithm().


The documentation for this class was generated from the following files: