LArSoft  v10_06_00
Liquid Argon Software toolkit - https://larsoft.org/
EventClusterValidationAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_EVENT_CLUSTER_VALIDATION_ALGORITHM_H
9 #define LAR_EVENT_CLUSTER_VALIDATION_ALGORITHM_H 1
10 
11 #include "Pandora/Algorithm.h"
12 
13 namespace lar_content
14 {
15 
19 class EventClusterValidationAlgorithm : public pandora::Algorithm
20 {
21 private:
23  {
25 
26  std::vector<int> m_nRecoHits;
27  std::vector<float> m_purities;
28  std::vector<float> m_completenesses;
29  int m_nHits;
32  };
33 
35  {
36  ALL,
39  };
40 
41 public:
43  {
45 
46  const pandora::MCParticle *m_pMainMC;
47  const pandora::Cluster *m_pCluster;
48  };
49 
54 
59 
60 private:
61  typedef std::map<const pandora::Cluster *const, std::map<const pandora::MCParticle *const, int>> ContingencyTable;
62 
63  pandora::StatusCode Run();
64  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
65 
72  void GetMetrics(const std::map<const pandora::CaloHit *const, CaloHitParents> &hitParents, ClusterMetrics &metrics) const;
73 
80  float CalcRandIndex(std::map<const pandora::CaloHit *const, CaloHitParents> &hitParents) const;
81 
89  void GetHitParents(const pandora::CaloHitList &caloHits, const pandora::ClusterList &clusters,
90  std::map<const pandora::CaloHit *const, CaloHitParents> &hitParents) const;
91 
97  void ApplyMCParticleMinSumHits(std::map<const pandora::CaloHit *const, CaloHitParents> &hitParents) const;
98 
105  std::map<const pandora::CaloHit *const, CaloHitParents> ApplyPDGCut(
106  std::map<const pandora::CaloHit *const, CaloHitParents> &hitParents, const ValidationType &valType) const;
107 
115  void SetBranches(ClusterMetrics &metrics, float randIdx, std::string branchPrefix) const;
116 
118  std::string m_fileName;
119  std::string m_treeName;
120  std::string m_caloHitListName;
121  std::vector<std::string> m_clusterListNames;
123 };
124 
125 } // namespace lar_content
126 
127 #endif // LAR_EVENT_CLUSTER_VALIDATION_ALGORITHM_H
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
int m_eventNumber
To track the current event number.
std::map< const pandora::Cluster *const, std::map< const pandora::MCParticle *const, int > > ContingencyTable
float CalcRandIndex(std::map< const pandora::CaloHit *const, CaloHitParents > &hitParents) const
Calculate Rand Index for the clusters with the clusters of true MCParticles. (Ref. for Adjusted Rand Index: https://link.springer.com/article/10.1007/BF01908075)
void GetHitParents(const pandora::CaloHitList &caloHits, const pandora::ClusterList &clusters, std::map< const pandora::CaloHit *const, CaloHitParents > &hitParents) const
Find the cluster and MCParticle each hit belongs to.
std::string m_caloHitListName
The name of the hit list containing all 2D hits.
void ApplyMCParticleMinSumHits(std::map< const pandora::CaloHit *const, CaloHitParents > &hitParents) const
Erase hits associated to an MCParticle that does meet a minimum number of hits in the view...
std::string m_fileName
The filename of the ROOT output file.
void GetMetrics(const std::map< const pandora::CaloHit *const, CaloHitParents > &hitParents, ClusterMetrics &metrics) const
Retrieve the metrics of every cluster in a view.
void SetBranches(ClusterMetrics &metrics, float randIdx, std::string branchPrefix) const
Update the branches of the TTree for this entry.
~EventClusterValidationAlgorithm()
Destructor saves the validation TTree along with making and saving a metadata TTree.
std::vector< std::string > m_clusterListNames
The names of the lists of 2D clusters to process.
int m_minMCHitsPerView
Threshold on total main MCParticle hits in each view for consideration in metric calculations.
std::map< const pandora::CaloHit *const, CaloHitParents > ApplyPDGCut(std::map< const pandora::CaloHit *const, CaloHitParents > &hitParents, const ValidationType &valType) const
Erase hits not associated with an MCParticle PDG incompatible with track/shower/all.