All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HitAnaAlg.h
Go to the documentation of this file.
1 #ifndef HITANAALG_H
2 #define HITANAALG_H
3 
4 /*!
5  * Title: HitAnaModule
6  * Author: wketchum@lanl.gov.
7  * Inputs: recob::Wire (calibrated), recob::Hit, Assns<recob::Wire, recob::Hit>
8  * Outputs: validation histograms for wire aggregated hits.
9  *
10  * Embellished by echurch@fnal.gov for just Hits
11  *
12  * Description:
13  * This module is intended to be yet another hit analyzer module. Its intention is
14  * (1) to compare hit-finding modules against each other, and eventually
15  * (2) to compare those to truth
16  */
17 
18 #include <exception>
19 #include <string>
20 #include <vector>
21 
25 
26 class TTree;
27 namespace detinfo {
28  class DetectorClocksData;
29 }
30 
31 namespace hit {
32 
33  struct HitInfo {
34 
35  //need a constructor here
36  HitInfo(float pt,
37  float pt_s,
38  float w,
39  int st,
40  int et,
41  float c,
42  float c_s,
43  float mc,
44  float mc_s,
45  float gof)
46  : peaktime(pt)
47  , peaktime_sigma(pt_s)
48  , rms(w)
49  , starttick(st)
50  , endtick(et)
51  , charge(c)
52  , charge_sigma(c_s)
53  , maxcharge(mc)
54  , maxcharge_sigma(mc_s)
55  , goodness_of_fit(gof)
56  {}
57 
58  float peaktime;
60  float rms;
61  int starttick;
62  int endtick;
63  float charge;
64  float charge_sigma;
65  float maxcharge;
68  };
69 
70  struct WireROIInfo {
71  unsigned int event;
72  unsigned int run;
73  unsigned int channel;
74  unsigned int plane;
75  unsigned int range_index;
76  unsigned int range_start;
77  size_t range_size;
79  float peak_charge;
80  float peak_time;
82  std::vector<std::string> HitModuleLabels;
83  std::vector<int> NHits;
84  std::vector<float> Hits_IntegratedCharge;
85  std::vector<float> Hits_AverageCharge;
86  std::vector<float> Hits_PeakCharge;
87  std::vector<float> Hits_PeakTime;
88  std::vector<float> Hits_wAverageCharge;
89  std::vector<float> Hits_wAverageTime;
90  std::vector<float> Hits_MeanMultiplicity;
91  std::vector<std::vector<HitInfo>> Hits;
92  int NMCHits;
99  };
100 
101  class HitAnaAlgException : public std::exception {
102  virtual const char*
103  what() const throw()
104  {
105  return "HitAnaAlg Exception";
106  }
108 
109  class HitAnaAlg {
110 
111  typedef std::pair<const std::vector<recob::Hit>&, const std::vector<std::vector<int>>&>
113 
114  public:
115  HitAnaAlg();
116 
117  void SetWireDataTree(TTree*);
118 
119  void SetHitDataTree(std::vector<TTree*>& trees);
120 
121  void AnalyzeWires(std::vector<recob::Wire> const&,
122  std::vector<sim::MCHitCollection> const&,
123  std::vector<std::vector<int>> const&,
125  unsigned int,
126  unsigned int);
127 
128  void LoadHitAssocPair(std::vector<recob::Hit> const&,
129  std::vector<std::vector<int>> const&,
130  std::string const&);
131 
132  void ClearHitModules();
133 
134  private:
135  void InitWireData(unsigned int, unsigned int);
136  void ClearWireDataHitInfo();
137 
138  void FillHitInfo(recob::Hit const&, std::vector<HitInfo>&);
139 
140  void FillWireInfo(recob::Wire const&,
141  int,
142  std::vector<sim::MCHitCollection> const&,
143  std::vector<int> const&,
145 
147  int,
148  std::vector<sim::MCHitCollection> const&,
149  std::vector<int> const&,
151 
152  void ROIInfo(lar::sparse_vector<float>::datarange_t const&, float&, float&, float&);
153 
154  void FindAndStoreHitsInRange(std::vector<recob::Hit> const&,
155  std::vector<int> const&,
156  size_t,
157  size_t,
158  size_t);
159  void FindAndStoreMCHitsInRange(std::vector<sim::MCHitCollection> const&,
160  std::vector<int> const&,
161  size_t,
162  size_t,
164 
166  std::vector<recob::Hit*> hitData;
167 
168  std::vector<std::string> HitModuleLabels;
169  std::vector<HitAssocPair> HitProcessingQueue;
170 
171  void SetupWireDataTree();
172  TTree* wireDataTree;
173 
174  std::vector<TTree*> hitDataTree;
175 
176  //this is for unit testing...class has no other purpose
177  friend class HitAnaAlgTest;
178  };
179 
180 } //end namespace hit
181 
182 #endif
std::vector< std::string > HitModuleLabels
Definition: HitAnaAlg.h:168
TTree * wireDataTree
Definition: HitAnaAlg.h:172
void SetupWireDataTree()
Definition: HitAnaAlg.cxx:56
unsigned int range_index
Definition: HitAnaAlg.h:75
int starttick
Definition: HitAnaAlg.h:61
void LoadHitAssocPair(std::vector< recob::Hit > const &, std::vector< std::vector< int >> const &, std::string const &)
Definition: HitAnaAlg.cxx:97
void SetHitDataTree(std::vector< TTree * > &trees)
Definition: HitAnaAlg.cxx:34
unsigned int event
Definition: HitAnaAlg.h:71
float charge
Definition: HitAnaAlg.h:63
void ProcessROI(lar::sparse_vector< float >::datarange_t const &, int, std::vector< sim::MCHitCollection > const &, std::vector< int > const &, detinfo::DetectorClocksData const &)
Definition: HitAnaAlg.cxx:203
float peaktime_sigma
Definition: HitAnaAlg.h:59
WireROIInfo wireData
Definition: HitAnaAlg.h:165
void FillHitInfo(recob::Hit const &, std::vector< HitInfo > &)
Definition: HitAnaAlg.cxx:326
std::vector< float > Hits_wAverageCharge
Definition: HitAnaAlg.h:88
std::vector< float > Hits_MeanMultiplicity
Definition: HitAnaAlg.h:90
hit::HitAnaAlgException hitanaalgexception
std::vector< recob::Hit * > hitData
Definition: HitAnaAlg.h:166
Declaration of signal hit object.
virtual const char * what() const
Definition: HitAnaAlg.h:103
void ClearWireDataHitInfo()
Definition: HitAnaAlg.cxx:133
std::vector< float > Hits_PeakTime
Definition: HitAnaAlg.h:87
float charge_sigma
Definition: HitAnaAlg.h:64
process_name hit
Definition: cheaterreco.fcl:51
HitInfo(float pt, float pt_s, float w, int st, int et, float c, float c_s, float mc, float mc_s, float gof)
Definition: HitAnaAlg.h:36
unsigned int range_start
Definition: HitAnaAlg.h:76
void SetWireDataTree(TTree *)
Definition: HitAnaAlg.cxx:27
std::vector< std::string > HitModuleLabels
Definition: HitAnaAlg.h:82
float MCHits_wAverageTime
Definition: HitAnaAlg.h:98
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
unsigned int run
Definition: HitAnaAlg.h:72
std::vector< float > Hits_PeakCharge
Definition: HitAnaAlg.h:86
float peaktime
Definition: HitAnaAlg.h:58
std::vector< int > NHits
Definition: HitAnaAlg.h:83
float MCHits_IntegratedCharge
Definition: HitAnaAlg.h:93
float MCHits_wAverageCharge
Definition: HitAnaAlg.h:97
float peak_charge
Definition: HitAnaAlg.h:79
std::vector< float > Hits_AverageCharge
Definition: HitAnaAlg.h:85
void AnalyzeWires(std::vector< recob::Wire > const &, std::vector< sim::MCHitCollection > const &, std::vector< std::vector< int >> const &, detinfo::DetectorClocksData const &, unsigned int, unsigned int)
Definition: HitAnaAlg.cxx:109
std::vector< float > Hits_wAverageTime
Definition: HitAnaAlg.h:89
unsigned int channel
Definition: HitAnaAlg.h:73
float MCHits_PeakCharge
Definition: HitAnaAlg.h:95
size_t range_size
Definition: HitAnaAlg.h:77
float MCHits_PeakTime
Definition: HitAnaAlg.h:96
std::pair< const std::vector< recob::Hit > &, const std::vector< std::vector< int > > & > HitAssocPair
Definition: HitAnaAlg.h:112
unsigned int plane
Definition: HitAnaAlg.h:74
void InitWireData(unsigned int, unsigned int)
Definition: HitAnaAlg.cxx:123
Contains all timing reference information for the detector.
std::vector< float > Hits_IntegratedCharge
Definition: HitAnaAlg.h:84
float rms
Definition: HitAnaAlg.h:60
float goodness_of_fit
Definition: HitAnaAlg.h:67
std::vector< TTree * > hitDataTree
Definition: HitAnaAlg.h:174
std::vector< std::vector< HitInfo > > Hits
Definition: HitAnaAlg.h:91
float maxcharge
Definition: HitAnaAlg.h:65
Class holding the regions of interest of signal from a channel.
Definition: Wire.h:118
Range class, with range and data.
float integrated_charge
Definition: HitAnaAlg.h:78
float maxcharge_sigma
Definition: HitAnaAlg.h:66
float MCHits_AverageCharge
Definition: HitAnaAlg.h:94
Declaration of basic channel signal object.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:48
void FindAndStoreHitsInRange(std::vector< recob::Hit > const &, std::vector< int > const &, size_t, size_t, size_t)
Definition: HitAnaAlg.cxx:234
void ClearHitModules()
Definition: HitAnaAlg.cxx:89
std::vector< HitAssocPair > HitProcessingQueue
Definition: HitAnaAlg.h:169
void ROIInfo(lar::sparse_vector< float >::datarange_t const &, float &, float &, float &)
Definition: HitAnaAlg.cxx:182
void FindAndStoreMCHitsInRange(std::vector< sim::MCHitCollection > const &, std::vector< int > const &, size_t, size_t, detinfo::DetectorClocksData const &)
Definition: HitAnaAlg.cxx:278
void FillWireInfo(recob::Wire const &, int, std::vector< sim::MCHitCollection > const &, std::vector< int > const &, detinfo::DetectorClocksData const &)
Definition: HitAnaAlg.cxx:156