LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
EventValidationAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_EVENT_VALIDATION_ALGORITHM_H
9 #define LAR_EVENT_VALIDATION_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
14 
15 #ifdef MONITORING
16 #include "PandoraMonitoringApi.h"
17 #endif
18 
19 #include <map>
20 
21 namespace lar_content
22 {
23 
27 class EventValidationAlgorithm: public pandora::Algorithm
28 {
29 public:
34 
39 
40 private:
45  {
46  public:
53 
60 
67 
74 
81 
87  void SetAllMCParticleToHitsMap(const LArMCParticleHelper::MCContributionMap &allMCParticleToHitsMap);
88 
94  void SetTargetMCParticleToHitsMap(const LArMCParticleHelper::MCContributionMap &targetMCParticleToHitsMap);
95 
102 
109 
116 
117  private:
123  };
124 
125  pandora::StatusCode Run();
126 
135  void FillValidationInfo(const pandora::MCParticleList *const pMCParticleList, const pandora::CaloHitList *const pCaloHitList,
136  const pandora::PfoList *const pPfoList, ValidationInfo &validationInfo) const;
137 
138  typedef std::unordered_map<const pandora::ParticleFlowObject*, unsigned int> PfoToIdMap;
139 
145  void PrintAllMatches(const ValidationInfo &validationInfo) const;
146 
152  void PrintInterpretedMatches(const ValidationInfo &validationInfo) const;
153 
159  void WriteInterpretedMatches(const ValidationInfo &validationInfo) const;
160 
169  void ProcessOutput(const ValidationInfo &validationInfo, const bool useInterpretedMatching, const bool printToScreen, const bool fillTree) const;
170 
177  void InterpretMatching(const ValidationInfo &validationInfo, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const;
178 
189  bool GetStrongestPfoMatch(const ValidationInfo &validationInfo, const pandora::MCParticleVector &mcPrimaryVector, pandora::PfoSet &usedPfos,
190  LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const;
191 
200  void GetRemainingPfoMatches(const ValidationInfo &validationInfo, const pandora::MCParticleVector &mcPrimaryVector, const pandora::PfoSet &usedPfos,
201  LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const;
202 
212  bool IsGoodMatch(const pandora::CaloHitList &trueHits, const pandora::CaloHitList &recoHits, const pandora::CaloHitList &sharedHits) const;
213 
214  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
215 
216  typedef std::vector<pandora::HitType> HitTypeVector;
217 
218  std::string m_caloHitListName;
219  std::string m_mcParticleListName;
220  std::string m_pfoListName;
221 
224 
228 
231 
233 
235  unsigned int m_matchingMinSharedHits;
238 
239  std::string m_treeName;
240  std::string m_fileName;
241 
244 };
245 
246 //------------------------------------------------------------------------------------------------------------------------------------------
247 //------------------------------------------------------------------------------------------------------------------------------------------
248 
250 {
252 }
253 
254 //------------------------------------------------------------------------------------------------------------------------------------------
255 
257 {
259 }
260 
261 //------------------------------------------------------------------------------------------------------------------------------------------
262 
264 {
265  return m_pfoToHitsMap;
266 }
267 
268 //------------------------------------------------------------------------------------------------------------------------------------------
269 
271 {
272  return m_mcToPfoHitSharingMap;
273 }
274 
275 //------------------------------------------------------------------------------------------------------------------------------------------
276 
278 {
280 }
281 
282 //------------------------------------------------------------------------------------------------------------------------------------------
283 
285 {
286  m_allMCParticleToHitsMap = allMCParticleToHitsMap;
287 }
288 
289 //------------------------------------------------------------------------------------------------------------------------------------------
290 
292 {
293  m_targetMCParticleToHitsMap = targetMCParticleToHitsMap;
294 }
295 
296 //------------------------------------------------------------------------------------------------------------------------------------------
297 
299 {
300  m_pfoToHitsMap = pfoToHitsMap;
301 }
302 
303 //------------------------------------------------------------------------------------------------------------------------------------------
304 
306 {
307  m_mcToPfoHitSharingMap = mcToPfoHitSharingMap;
308 }
309 
310 //------------------------------------------------------------------------------------------------------------------------------------------
311 
313 {
314  m_interpretedMCToPfoHitSharingMap = interpretedMCToPfoHitSharingMap;
315 }
316 
317 //------------------------------------------------------------------------------------------------------------------------------------------
318 //------------------------------------------------------------------------------------------------------------------------------------------
319 
320 inline void EventValidationAlgorithm::PrintAllMatches(const ValidationInfo &validationInfo) const
321 {
322  return this->ProcessOutput(validationInfo, false, true, false);
323 }
324 
325 //------------------------------------------------------------------------------------------------------------------------------------------
326 
328 {
329  return this->ProcessOutput(validationInfo, true, true, false);
330 }
331 
332 //------------------------------------------------------------------------------------------------------------------------------------------
333 
335 {
336  return this->ProcessOutput(validationInfo, true, false, true);
337 }
338 
339 } // namespace lar_content
340 
341 #endif // LAR_EVENT_VALIDATION_ALGORITHM_H
std::string m_mcParticleListName
Name of input MC particle list.
std::string m_pfoListName
Name of input Pfo list.
void SetAllMCParticleToHitsMap(const LArMCParticleHelper::MCContributionMap &allMCParticleToHitsMap)
Set the all mc particle to hits map.
bool m_useTrueNeutrinosOnly
Whether to consider only mc particles that were neutrino induced.
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 SetTargetMCParticleToHitsMap(const LArMCParticleHelper::MCContributionMap &targetMCParticleToHitsMap)
Set the target mc particle to hits map.
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.
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.
LArMCParticleHelper::MCParticleToPfoHitSharingMap m_mcToPfoHitSharingMap
The mc to pfo hit sharing map.
float m_matchingMinCompleteness
The minimum particle completeness to declare a match.
LArMCParticleHelper::MCContributionMap m_allMCParticleToHitsMap
The all mc particle to hits map.
bool m_testBeamMode
Whether pandora is reconstructing test beam particles.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
std::unordered_map< const pandora::ParticleFlowObject *, unsigned int > PfoToIdMap
bool m_printMatchingToScreen
Whether to print matching output to screen.
void PrintAllMatches(const ValidationInfo &validationInfo) const
Print all/raw matching information 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.
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...
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
Header file for the lar monte carlo particle helper helper class.
void SetPfoToHitsMap(const LArMCParticleHelper::PfoContributionMap &pfoToHitsMap)
Set the pfo to hits map.
LArMCParticleHelper::PfoContributionMap m_pfoToHitsMap
The pfo to hits map.
const LArMCParticleHelper::PfoContributionMap & GetPfoToHitsMap() const
Get the pfo to hits map.
std::map< const pandora::MCParticle *, PfoToSharedHitsVector > MCParticleToPfoHitSharingMap
void PrintInterpretedMatches(const ValidationInfo &validationInfo) const
Print interpreted matching information to screen.
std::vector< pandora::HitType > HitTypeVector
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.
bool m_selectInputHits
Whether to use only hits passing mc-based quality (is "reconstructable") checks.
void SetMCToPfoHitSharingMap(const LArMCParticleHelper::MCParticleToPfoHitSharingMap &mcToPfoHitSharingMap)
Set the mc to pfo hit sharing map.
int m_fileIdentifier
The input file identifier.
void SetInterpretedMCToPfoHitSharingMap(const LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap)
Set the interpreted mc to pfo hit sharing map.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
EventValidationAlgorithm class.
std::string m_fileName
Name of output file.
const LArMCParticleHelper::MCContributionMap & GetAllMCParticleToHitsMap() const
Get the all mc particle to hits map.
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.
LArMCParticleHelper::MCParticleToPfoHitSharingMap m_interpretedMCToPfoHitSharingMap
The interpreted mc to pfo hit sharing map.
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.
LArMCParticleHelper::MCContributionMap m_targetMCParticleToHitsMap
The target mc particle to hits map.
std::unordered_map< const pandora::ParticleFlowObject *, pandora::CaloHitList > PfoContributionMap
void WriteInterpretedMatches(const ValidationInfo &validationInfo) const
Write interpreted matching information to tree.
const LArMCParticleHelper::MCParticleToPfoHitSharingMap & GetInterpretedMCToPfoHitSharingMap() const
Get the interpreted mc to pfo hit sharing map.
std::string m_caloHitListName
Name of input calo hit list.
const LArMCParticleHelper::MCParticleToPfoHitSharingMap & GetMCToPfoHitSharingMap() const
Get the mc to pfo hit sharing map.
void InterpretMatching(const ValidationInfo &validationInfo, LArMCParticleHelper::MCParticleToPfoHitSharingMap &interpretedMCToPfoHitSharingMap) const
Apply an interpretative matching procedure to the comprehensive matches in the provided validation in...
const LArMCParticleHelper::MCContributionMap & GetTargetMCParticleToHitsMap() const
Get the target mc particle to hits map.