MCMatchAlg.h
Go to the documentation of this file.
1 /**
2  * \file MCMatchAlg.h
3  *
4  * \ingroup MCComp
5  *
6  * \brief Class def header for a class MCMatchAlg
7  *
8  * @author kazuhiro
9  */
10 
11 /** \addtogroup MCComp
12 
13  @{*/
14 #ifndef RECOTOOL_MCMATCHALG_H
15 #define RECOTOOL_MCMATCHALG_H
16 
18 
19 #include "MCBTAlg.h"
22 namespace detinfo {
23  class DetectorClocksData;
24 }
25 
26 #include <cstddef>
27 #include <utility>
28 #include <vector>
29 
30 namespace btutil {
31  /**
32  \class MCMatchAlg
33  User defined class MCMatchAlg ... these comments are used to generate
34  doxygen documentation!
35  */
36  class MCMatchAlg {
37 
38  public:
39  /// Default constructor
40  MCMatchAlg();
41 
42  /// Default destructor
43  virtual ~MCMatchAlg(){};
44 
45  /// Constructs needed information for Reco=>MC matching
46  bool BuildMap(detinfo::DetectorClocksData const& clockData,
47  const std::vector<unsigned int>& g4_trackid_v,
48  const std::vector<sim::SimChannel>& simch_v,
49  const std::vector<std::vector<art::Ptr<recob::Hit>>>& cluster_v);
50 
51  /// Constructs needed information for Reco=>MC matching
52  bool BuildMap(detinfo::DetectorClocksData const& clockData,
53  const std::vector<std::vector<unsigned int>>& g4_trackid_v,
54  const std::vector<sim::SimChannel>& simch_v,
55  const std::vector<std::vector<art::Ptr<recob::Hit>>>& cluster_v);
56 
57  /**
58  For a specified MC object (via index in MCShower/MCTrack), returns best-matched clusters
59  represented by an index number of clusters. The return vector length is same as
60  # of planes, and "-1" if there is no cluster found on the corresponding plane.
61  */
62  const std::vector<int>& BestClusters(const size_t mcshower_index) const;
63 
64  /**
65  For a specified cluster, compute the correctness for the specified
66  MC object
67  */
68  double ClusterCorrectness(const size_t cluster_index, const size_t mcshower_index) const;
69 
70  /**
71  Similar to ClusterCorrectness() function except this one computes the correctness for multiple
72  clusters. It is meant to compute the correctness for a cluster combination that is matched
73  across plane to represent one 3D reco object. The return is a pair of best-matched MC object
74  and correctness.
75  */
76  std::pair<size_t, double> ShowerCorrectness(
77  const std::vector<unsigned int> cluster_indices) const;
78 
79  ///For a specified cluster, compute cluster efficiency and purity in terms of specified MC object
80  std::pair<double, double> ClusterEP(const size_t cluster_index,
81  const size_t mcshower_index) const;
82 
83  /**
84  For a specified MC object, compute the best-matched cluster's efficiency and purity from
85  the specified plane ID. Internally this function calls BestClusters() to find the best
86  cluster on each plane, then calls ClusterEP() to retrieve the efficiency and purity.
87  */
88  std::pair<double, double> BestClusterEP(const size_t mcshower_index,
89  const size_t plane_id) const;
90 
91  /// BTAlgo getter
92  const MCBTAlg&
93  BTAlg() const
94  {
95  return fBTAlgo;
96  }
97 
98  protected:
99  bool BuildMap(detinfo::DetectorClocksData const& clockData,
100  const std::vector<std::vector<art::Ptr<recob::Hit>>>& cluster_v);
101 
102  /// MCBTAlg instance
104 
105  std::vector<size_t> _view_to_plane;
106 
107  std::vector<std::vector<double>> _summed_mcq;
108  std::vector<std::vector<double>> _cluster_mcq_v;
109 
110  std::vector<unsigned char> _cluster_plane_id;
111  std::vector<std::vector<int>> _bmatch_id;
112  };
113 }
114 #endif
115 /** @} */ // end of doxygen group
virtual ~MCMatchAlg()
Default destructor.
Definition: MCMatchAlg.h:43
Class def header for a class MCBTAlg.
const MCBTAlg & BTAlg() const
BTAlgo getter.
Definition: MCMatchAlg.h:93
struct vector vector
std::vector< std::vector< double > > _summed_mcq
Definition: MCMatchAlg.h:107
std::vector< unsigned char > _cluster_plane_id
Definition: MCMatchAlg.h:110
std::vector< std::vector< double > > _cluster_mcq_v
Definition: MCMatchAlg.h:108
MCBTAlg fBTAlgo
MCBTAlg instance.
Definition: MCMatchAlg.h:103
General LArSoft Utilities.
Declaration of signal hit object.
std::vector< size_t > _view_to_plane
Definition: MCMatchAlg.h:105
Contains all timing reference information for the detector.
std::vector< std::vector< int > > _bmatch_id
Definition: MCMatchAlg.h:111