LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::EventValidationBaseAlgorithm Class Referenceabstract

EventValidationBaseAlgorithm class. More...

#include "EventValidationBaseAlgorithm.h"

Inheritance diagram for lar_content::EventValidationBaseAlgorithm:
lar_content::MuonLeadingEventValidationAlgorithm lar_content::NeutrinoEventValidationAlgorithm lar_content::TestBeamEventValidationAlgorithm lar_content::TestBeamHierarchyEventValidationAlgorithm

Classes

class  ValidationInfo
 ValidationInfo class. More...
 

Protected Member Functions

 EventValidationBaseAlgorithm ()
 Default constructor. More...
 
 ~EventValidationBaseAlgorithm ()
 Destructor. More...
 
virtual void FillValidationInfo (const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, ValidationInfo &validationInfo) const =0
 Fill the validation info containers. More...
 
virtual void ProcessOutput (const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const =0
 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)
 

Protected Attributes

LArMCParticleHelper::PrimaryParameters m_primaryParameters
 The mc particle primary selection parameters. More...
 
int m_fileIdentifier
 The input file identifier. More...
 
int m_eventNumber
 The event number. More...
 
std::string m_treeName
 Name of output tree. More...
 

Private Member Functions

pandora::StatusCode Run ()
 
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...
 

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_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_fileName
 Name of output file. More...
 

Detailed Description

Constructor & Destructor Documentation

lar_content::EventValidationBaseAlgorithm::EventValidationBaseAlgorithm ( )
protected

Default constructor.

Definition at line 24 of file EventValidationBaseAlgorithm.cc.

24  :
26  m_eventNumber(0),
27  m_printAllToScreen(false),
29  m_writeToTree(false),
30  m_useSmallPrimaries(true),
34 {
35 }
float m_matchingMinPurity
The minimum particle purity to declare a match.
bool m_printAllToScreen
Whether to print all/raw matching details to screen.
TFile f
Definition: plotHisto.C:6
bool m_writeToTree
Whether to write all/raw matching details to tree.
unsigned int m_matchingMinSharedHits
The minimum number of shared hits used in matching scheme.
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
bool m_printMatchingToScreen
Whether to print matching output to screen.
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
lar_content::EventValidationBaseAlgorithm::~EventValidationBaseAlgorithm ( )
protected

Destructor.

Definition at line 39 of file EventValidationBaseAlgorithm.cc.

References m_fileName, m_treeName, and m_writeToTree.

40 {
41  if (m_writeToTree)
42  {
43  try
44  {
45  PANDORA_MONITORING_API(SaveTree(this->GetPandora(), m_treeName.c_str(), m_fileName.c_str(), "UPDATE"));
46  }
47  catch (const StatusCodeException &)
48  {
49  std::cout << "EventValidationBaseAlgorithm: Unable to write tree " << m_treeName << " to file " << m_fileName << std::endl;
50  }
51  }
52 }
bool m_writeToTree
Whether to write all/raw matching details to tree.

Member Function Documentation

virtual void lar_content::EventValidationBaseAlgorithm::FillValidationInfo ( const pandora::MCParticleList *const  pMCParticleList,
const pandora::CaloHitList *const  pCaloHitList,
const pandora::PfoList *const  pPfoList,
ValidationInfo validationInfo 
) const
protectedpure virtual

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

Implemented in lar_content::NeutrinoEventValidationAlgorithm, lar_content::TestBeamEventValidationAlgorithm, lar_content::TestBeamHierarchyEventValidationAlgorithm, and lar_content::MuonLeadingEventValidationAlgorithm.

Referenced by Run().

void lar_content::EventValidationBaseAlgorithm::GetRemainingPfoMatches ( const ValidationInfo validationInfo,
const pandora::MCParticleVector &  mcPrimaryVector,
const pandora::PfoSet &  usedPfos,
LArMCParticleHelper::MCParticleToPfoHitSharingMap interpretedMCToPfoHitSharingMap 
) const
protected

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 155 of file EventValidationBaseAlgorithm.cc.

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

Referenced by InterpretMatching().

157 {
158  LArMCParticleHelper::PfoToMCParticleHitSharingMap pfoToMCParticleHitSharingMap;
159 
160  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
161  {
162  if (!m_useSmallPrimaries && !validationInfo.GetTargetMCParticleToHitsMap().count(pMCPrimary))
163  continue;
164 
165  if (!validationInfo.GetMCToPfoHitSharingMap().count(pMCPrimary))
166  continue;
167 
168  for (const LArMCParticleHelper::PfoCaloHitListPair &pfoToSharedHits : validationInfo.GetMCToPfoHitSharingMap().at(pMCPrimary))
169  {
170  if (usedPfos.count(pfoToSharedHits.first))
171  continue;
172 
173  const LArMCParticleHelper::MCParticleCaloHitListPair mcParticleToHits(pMCPrimary, pfoToSharedHits.second);
174  LArMCParticleHelper::PfoToMCParticleHitSharingMap::iterator iter(pfoToMCParticleHitSharingMap.find(pfoToSharedHits.first));
175 
176  if (pfoToMCParticleHitSharingMap.end() == iter)
177  {
178  pfoToMCParticleHitSharingMap[pfoToSharedHits.first].push_back(mcParticleToHits);
179  }
180  else
181  {
182  if (1 != iter->second.size())
183  throw StatusCodeException(STATUS_CODE_FAILURE);
184 
185  LArMCParticleHelper::MCParticleCaloHitListPair &originalMCParticleToHits(iter->second.at(0));
186 
187  if (mcParticleToHits.second.size() > originalMCParticleToHits.second.size())
188  originalMCParticleToHits = mcParticleToHits;
189  }
190  }
191  }
192 
193  for (const auto &mapEntry : pfoToMCParticleHitSharingMap)
194  {
195  const LArMCParticleHelper::MCParticleCaloHitListPair &mcParticleToHits(mapEntry.second.at(0));
196  interpretedMCToPfoHitSharingMap[mcParticleToHits.first].push_back(
197  LArMCParticleHelper::PfoCaloHitListPair(mapEntry.first, mcParticleToHits.second));
198  }
199 }
intermediate_table::iterator iterator
std::pair< const pandora::MCParticle *, pandora::CaloHitList > MCParticleCaloHitListPair
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
std::map< const pandora::ParticleFlowObject *, MCParticleToSharedHitsVector > PfoToMCParticleHitSharingMap
bool lar_content::EventValidationBaseAlgorithm::GetStrongestPfoMatch ( const ValidationInfo validationInfo,
const pandora::MCParticleVector &  mcPrimaryVector,
pandora::PfoSet &  usedPfos,
LArMCParticleHelper::MCParticleToPfoHitSharingMap interpretedMCToPfoHitSharingMap 
) const
protected

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 111 of file EventValidationBaseAlgorithm.cc.

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

Referenced by InterpretMatching().

113 {
114  const MCParticle *pBestMCParticle(nullptr);
115  LArMCParticleHelper::PfoCaloHitListPair bestPfoHitPair(nullptr, CaloHitList());
116 
117  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
118  {
119  if (interpretedMCToPfoHitSharingMap.count(pMCPrimary))
120  continue;
121 
122  if (!m_useSmallPrimaries && !validationInfo.GetTargetMCParticleToHitsMap().count(pMCPrimary))
123  continue;
124 
125  if (!validationInfo.GetMCToPfoHitSharingMap().count(pMCPrimary))
126  continue;
127 
128  for (const LArMCParticleHelper::PfoCaloHitListPair &pfoToSharedHits : validationInfo.GetMCToPfoHitSharingMap().at(pMCPrimary))
129  {
130  if (usedPfos.count(pfoToSharedHits.first))
131  continue;
132 
133  if (!this->IsGoodMatch(validationInfo.GetAllMCParticleToHitsMap().at(pMCPrimary),
134  validationInfo.GetPfoToHitsMap().at(pfoToSharedHits.first), pfoToSharedHits.second))
135  continue;
136 
137  if (pfoToSharedHits.second.size() > bestPfoHitPair.second.size())
138  {
139  pBestMCParticle = pMCPrimary;
140  bestPfoHitPair = pfoToSharedHits;
141  }
142  }
143  }
144 
145  if (!pBestMCParticle || !bestPfoHitPair.first)
146  return false;
147 
148  interpretedMCToPfoHitSharingMap[pBestMCParticle].push_back(bestPfoHitPair);
149  usedPfos.insert(bestPfoHitPair.first);
150  return true;
151 }
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
std::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
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.
void lar_content::EventValidationBaseAlgorithm::InterpretMatching ( const ValidationInfo validationInfo,
LArMCParticleHelper::MCParticleToPfoHitSharingMap interpretedMCToPfoHitSharingMap 
) const
protected

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 86 of file EventValidationBaseAlgorithm.cc.

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

Referenced by lar_content::NeutrinoEventValidationAlgorithm::FillValidationInfo(), and lar_content::MuonLeadingEventValidationAlgorithm::PerformUnfoldedMatching().

88 {
89  MCParticleVector mcPrimaryVector;
90  LArMonitoringHelper::GetOrderedMCParticleVector({validationInfo.GetAllMCParticleToHitsMap()}, mcPrimaryVector);
91 
92  PfoSet usedPfos;
93  while (this->GetStrongestPfoMatch(validationInfo, mcPrimaryVector, usedPfos, interpretedMCToPfoHitSharingMap))
94  {
95  }
96  this->GetRemainingPfoMatches(validationInfo, mcPrimaryVector, usedPfos, interpretedMCToPfoHitSharingMap);
97 
98  // Ensure all primaries have an entry, and sorting is as desired
99  for (const MCParticle *const pMCPrimary : mcPrimaryVector)
100  {
101  LArMCParticleHelper::PfoToSharedHitsVector &pfoHitPairs(interpretedMCToPfoHitSharingMap[pMCPrimary]);
102  std::sort(pfoHitPairs.begin(), pfoHitPairs.end(),
104  return ((a.second.size() != b.second.size()) ? a.second.size() > b.second.size() : LArPfoHelper::SortByNHits(a.first, b.first));
105  });
106  }
107 }
static bool SortByNHits(const pandora::ParticleFlowObject *const pLhs, const pandora::ParticleFlowObject *const pRhs)
Sort pfos by number of constituent hits.
std::vector< PfoCaloHitListPair > PfoToSharedHitsVector
static void GetOrderedMCParticleVector(const LArMCParticleHelper::MCContributionMapVector &selectedMCParticleToGoodHitsMaps, pandora::MCParticleVector &orderedMCParticleVector)
Order input MCParticles by their number of hits.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
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...
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::pair< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoCaloHitListPair
bool lar_content::EventValidationBaseAlgorithm::IsGoodMatch ( const pandora::CaloHitList &  trueHits,
const pandora::CaloHitList &  recoHits,
const pandora::CaloHitList &  sharedHits 
) const
protected

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 203 of file EventValidationBaseAlgorithm.cc.

References f, m_matchingMinCompleteness, m_matchingMinPurity, and m_matchingMinSharedHits.

Referenced by lar_content::MuonLeadingEventValidationAlgorithm::DetermineIncorrectlyReconstructedCosmicRays(), GetStrongestPfoMatch(), lar_content::NeutrinoEventValidationAlgorithm::ProcessOutput(), and lar_content::MuonLeadingEventValidationAlgorithm::ProcessOutput().

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

Print all/raw matching information to screen.

Parameters
validationInfothe validation info

Definition at line 313 of file EventValidationBaseAlgorithm.h.

References ProcessOutput().

Referenced by Run().

314 {
315  return this->ProcessOutput(validationInfo, false, true, false);
316 }
virtual void ProcessOutput(const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const =0
Print matching information in a provided validation info object, and write information to tree if con...
void lar_content::EventValidationBaseAlgorithm::PrintInterpretedMatches ( const ValidationInfo validationInfo) const
inlineprivate

Print interpreted matching information to screen.

Parameters
validationInfothe validation info

Definition at line 320 of file EventValidationBaseAlgorithm.h.

References ProcessOutput().

Referenced by Run().

321 {
322  return this->ProcessOutput(validationInfo, true, true, false);
323 }
virtual void ProcessOutput(const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const =0
Print matching information in a provided validation info object, and write information to tree if con...
virtual void lar_content::EventValidationBaseAlgorithm::ProcessOutput ( const ValidationInfo validationInfo,
const bool  useInterpretedMatching,
const bool  printToScreen,
const bool  fillTree 
) const
protectedpure virtual

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

Implemented in lar_content::MuonLeadingEventValidationAlgorithm, lar_content::NeutrinoEventValidationAlgorithm, lar_content::TestBeamEventValidationAlgorithm, and lar_content::TestBeamHierarchyEventValidationAlgorithm.

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

StatusCode lar_content::EventValidationBaseAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protected

Definition at line 213 of file EventValidationBaseAlgorithm.cc.

References m_caloHitListName, m_fileIdentifier, m_fileName, lar_content::LArMCParticleHelper::PrimaryParameters::m_foldBackHierarchy, m_matchingMinCompleteness, m_matchingMinPurity, m_matchingMinSharedHits, lar_content::LArMCParticleHelper::PrimaryParameters::m_maxPhotonPropagation, m_mcParticleListName, lar_content::LArMCParticleHelper::PrimaryParameters::m_minHitsForGoodView, lar_content::LArMCParticleHelper::PrimaryParameters::m_minHitSharingFraction, lar_content::LArMCParticleHelper::PrimaryParameters::m_minPrimaryGoodHits, lar_content::LArMCParticleHelper::PrimaryParameters::m_minPrimaryGoodViews, m_pfoListName, m_primaryParameters, m_printAllToScreen, m_printMatchingToScreen, lar_content::LArMCParticleHelper::PrimaryParameters::m_selectInputHits, m_treeName, m_useSmallPrimaries, and m_writeToTree.

Referenced by lar_content::NeutrinoEventValidationAlgorithm::ReadSettings(), and lar_content::MuonLeadingEventValidationAlgorithm::ReadSettings().

214 {
215  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "CaloHitListName", m_caloHitListName));
216  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "MCParticleListName", m_mcParticleListName));
217  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "PfoListName", m_pfoListName));
218 
219  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
220  XmlHelper::ReadValue(xmlHandle, "MinPrimaryGoodHits", m_primaryParameters.m_minPrimaryGoodHits));
221 
222  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
223  XmlHelper::ReadValue(xmlHandle, "MinHitsForGoodView", m_primaryParameters.m_minHitsForGoodView));
224 
225  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
226  XmlHelper::ReadValue(xmlHandle, "MinPrimaryGoodViews", m_primaryParameters.m_minPrimaryGoodViews));
227 
228  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
229  XmlHelper::ReadValue(xmlHandle, "SelectInputHits", m_primaryParameters.m_selectInputHits));
230 
231  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
232  XmlHelper::ReadValue(xmlHandle, "MinHitSharingFraction", m_primaryParameters.m_minHitSharingFraction));
233 
234  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
235  XmlHelper::ReadValue(xmlHandle, "MaxPhotonPropagation", m_primaryParameters.m_maxPhotonPropagation));
236 
237  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
238  XmlHelper::ReadValue(xmlHandle, "FoldToPrimaries", m_primaryParameters.m_foldBackHierarchy));
239 
240  PANDORA_RETURN_RESULT_IF_AND_IF(
241  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PrintAllToScreen", m_printAllToScreen));
242 
243  PANDORA_RETURN_RESULT_IF_AND_IF(
244  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PrintMatchingToScreen", m_printMatchingToScreen));
245 
246  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "WriteToTree", m_writeToTree));
247 
248  PANDORA_RETURN_RESULT_IF_AND_IF(
249  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "UseSmallPrimaries", m_useSmallPrimaries));
250 
251  PANDORA_RETURN_RESULT_IF_AND_IF(
252  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MatchingMinSharedHits", m_matchingMinSharedHits));
253 
254  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
255  XmlHelper::ReadValue(xmlHandle, "MatchingMinCompleteness", m_matchingMinCompleteness));
256 
257  PANDORA_RETURN_RESULT_IF_AND_IF(
258  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MatchingMinPurity", m_matchingMinPurity));
259 
260  if (m_writeToTree)
261  {
262  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputTree", m_treeName));
263  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputFile", m_fileName));
264 
265  PANDORA_RETURN_RESULT_IF_AND_IF(
266  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "FileIdentifier", m_fileIdentifier));
267  }
268 
269  return STATUS_CODE_SUCCESS;
270 }
unsigned int m_minPrimaryGoodViews
the minimum number of primary good views
bool m_selectInputHits
whether to select input hits
unsigned int m_minPrimaryGoodHits
the minimum number of primary good Hits
float m_matchingMinPurity
The minimum particle purity to declare a match.
bool m_foldBackHierarchy
whether to fold the hierarchy back to the primary (neutrino) or leading particles (test beam) ...
bool m_printAllToScreen
Whether to print all/raw matching details to screen.
unsigned int m_minHitsForGoodView
the minimum number of Hits for a good view
float m_maxPhotonPropagation
the maximum photon propagation length
std::string m_pfoListName
Name of input Pfo list.
LArMCParticleHelper::PrimaryParameters m_primaryParameters
The mc particle primary selection parameters.
std::string m_mcParticleListName
Name of input MC particle list.
bool m_writeToTree
Whether to write all/raw matching details to tree.
unsigned int m_matchingMinSharedHits
The minimum number of shared hits used in matching scheme.
float m_minHitSharingFraction
the minimum Hit sharing fraction
bool m_useSmallPrimaries
Whether to consider matches to mc primaries with fewer than m_matchingMinPrimaryHits.
bool m_printMatchingToScreen
Whether to print matching output to screen.
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
std::string m_caloHitListName
Name of input calo hit list.
StatusCode lar_content::EventValidationBaseAlgorithm::Run ( )
private

Definition at line 56 of file EventValidationBaseAlgorithm.cc.

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

57 {
58  ++m_eventNumber;
59 
60  const MCParticleList *pMCParticleList = nullptr;
61  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_mcParticleListName, pMCParticleList));
62 
63  const CaloHitList *pCaloHitList = nullptr;
64  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_caloHitListName, pCaloHitList));
65 
66  const PfoList *pPfoList = nullptr;
67  (void)PandoraContentApi::GetList(*this, m_pfoListName, pPfoList);
68 
69  ValidationInfo validationInfo;
70  this->FillValidationInfo(pMCParticleList, pCaloHitList, pPfoList, validationInfo);
71 
73  this->PrintAllMatches(validationInfo);
74 
76  this->PrintInterpretedMatches(validationInfo);
77 
78  if (m_writeToTree)
79  this->WriteInterpretedMatches(validationInfo);
80 
81  return STATUS_CODE_SUCCESS;
82 }
void PrintAllMatches(const ValidationInfo &validationInfo) const
Print all/raw matching information to screen.
bool m_printAllToScreen
Whether to print all/raw matching details to screen.
void WriteInterpretedMatches(const ValidationInfo &validationInfo) const
Write interpreted matching information to tree.
std::string m_pfoListName
Name of input Pfo list.
void PrintInterpretedMatches(const ValidationInfo &validationInfo) const
Print interpreted matching information to screen.
std::string m_mcParticleListName
Name of input MC particle list.
bool m_writeToTree
Whether to write all/raw matching details to tree.
bool m_printMatchingToScreen
Whether to print matching output to screen.
virtual void FillValidationInfo(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList, const pandora::PfoList *const pPfoList, ValidationInfo &validationInfo) const =0
Fill the validation info containers.
std::string m_caloHitListName
Name of input calo hit list.
void lar_content::EventValidationBaseAlgorithm::WriteInterpretedMatches ( const ValidationInfo validationInfo) const
inlineprivate

Write interpreted matching information to tree.

Parameters
validationInfothe validation info

Definition at line 327 of file EventValidationBaseAlgorithm.h.

References ProcessOutput().

Referenced by Run().

328 {
329  return this->ProcessOutput(validationInfo, true, false, true);
330 }
virtual void ProcessOutput(const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const =0
Print matching information in a provided validation info object, and write information to tree if con...

Member Data Documentation

std::string lar_content::EventValidationBaseAlgorithm::m_caloHitListName
private

Name of input calo hit list.

Definition at line 222 of file EventValidationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().

int lar_content::EventValidationBaseAlgorithm::m_eventNumber
protected
int lar_content::EventValidationBaseAlgorithm::m_fileIdentifier
protected

The input file identifier.

Definition at line 193 of file EventValidationBaseAlgorithm.h.

Referenced by lar_content::NeutrinoEventValidationAlgorithm::ProcessOutput(), and ReadSettings().

std::string lar_content::EventValidationBaseAlgorithm::m_fileName
private

Name of output file.

Definition at line 235 of file EventValidationBaseAlgorithm.h.

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

float lar_content::EventValidationBaseAlgorithm::m_matchingMinCompleteness
private

The minimum particle completeness to declare a match.

Definition at line 232 of file EventValidationBaseAlgorithm.h.

Referenced by IsGoodMatch(), and ReadSettings().

float lar_content::EventValidationBaseAlgorithm::m_matchingMinPurity
private

The minimum particle purity to declare a match.

Definition at line 233 of file EventValidationBaseAlgorithm.h.

Referenced by IsGoodMatch(), and ReadSettings().

unsigned int lar_content::EventValidationBaseAlgorithm::m_matchingMinSharedHits
private

The minimum number of shared hits used in matching scheme.

Definition at line 231 of file EventValidationBaseAlgorithm.h.

Referenced by IsGoodMatch(), and ReadSettings().

std::string lar_content::EventValidationBaseAlgorithm::m_mcParticleListName
private

Name of input MC particle list.

Definition at line 223 of file EventValidationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().

std::string lar_content::EventValidationBaseAlgorithm::m_pfoListName
private

Name of input Pfo list.

Definition at line 224 of file EventValidationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().

LArMCParticleHelper::PrimaryParameters lar_content::EventValidationBaseAlgorithm::m_primaryParameters
protected

The mc particle primary selection parameters.

Definition at line 192 of file EventValidationBaseAlgorithm.h.

Referenced by lar_content::NeutrinoEventValidationAlgorithm::FillValidationInfo(), and ReadSettings().

bool lar_content::EventValidationBaseAlgorithm::m_printAllToScreen
private

Whether to print all/raw matching details to screen.

Definition at line 226 of file EventValidationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().

bool lar_content::EventValidationBaseAlgorithm::m_printMatchingToScreen
private

Whether to print matching output to screen.

Definition at line 227 of file EventValidationBaseAlgorithm.h.

Referenced by ReadSettings(), and Run().

std::string lar_content::EventValidationBaseAlgorithm::m_treeName
protected
bool lar_content::EventValidationBaseAlgorithm::m_useSmallPrimaries
private

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

Definition at line 230 of file EventValidationBaseAlgorithm.h.

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

bool lar_content::EventValidationBaseAlgorithm::m_writeToTree
private

Whether to write all/raw matching details to tree.

Definition at line 228 of file EventValidationBaseAlgorithm.h.

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


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