LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
HitAnaAlg.h
Go to the documentation of this file.
1 #ifndef HITANAALG_H
2 #define HITANAALG_H
3 
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 
102  virtual const char* what() const throw() { return "HitAnaAlg Exception"; }
104 
105  class HitAnaAlg {
106 
107  typedef std::pair<const std::vector<recob::Hit>&, const std::vector<std::vector<int>>&>
109 
110  public:
111  HitAnaAlg();
112 
113  void SetWireDataTree(TTree*);
114 
115  void SetHitDataTree(std::vector<TTree*>& trees);
116 
117  void AnalyzeWires(std::vector<recob::Wire> const&,
118  std::vector<sim::MCHitCollection> const&,
119  std::vector<std::vector<int>> const&,
121  unsigned int,
122  unsigned int);
123 
124  void LoadHitAssocPair(std::vector<recob::Hit> const&,
125  std::vector<std::vector<int>> const&,
126  std::string const&);
127 
128  void ClearHitModules();
129 
130  private:
131  void InitWireData(unsigned int, unsigned int);
132  void ClearWireDataHitInfo();
133 
134  void FillHitInfo(recob::Hit const&, std::vector<HitInfo>&);
135 
136  void FillWireInfo(recob::Wire const&,
137  int,
138  std::vector<sim::MCHitCollection> const&,
139  std::vector<int> const&,
141 
142  void ProcessROI(lar::sparse_vector<float>::datarange_t const&,
143  int,
144  std::vector<sim::MCHitCollection> const&,
145  std::vector<int> const&,
147 
148  void ROIInfo(lar::sparse_vector<float>::datarange_t const&, float&, float&, float&);
149 
150  void FindAndStoreHitsInRange(std::vector<recob::Hit> const&,
151  std::vector<int> const&,
152  size_t,
153  size_t,
154  size_t);
155  void FindAndStoreMCHitsInRange(std::vector<sim::MCHitCollection> const&,
156  std::vector<int> const&,
157  size_t,
158  size_t,
160 
162  std::vector<recob::Hit*> hitData;
163 
164  std::vector<std::string> HitModuleLabels;
165  std::vector<HitAssocPair> HitProcessingQueue;
166 
167  void SetupWireDataTree();
168  TTree* wireDataTree;
169 
170  std::vector<TTree*> hitDataTree;
171 
172  //this is for unit testing...class has no other purpose
173  friend class HitAnaAlgTest;
174  };
175 
176 } //end namespace hit
177 
178 #endif
std::vector< std::string > HitModuleLabels
Definition: HitAnaAlg.h:164
TTree * wireDataTree
Definition: HitAnaAlg.h:168
unsigned int range_index
Definition: HitAnaAlg.h:75
int starttick
Definition: HitAnaAlg.h:61
unsigned int event
Definition: HitAnaAlg.h:71
float charge
Definition: HitAnaAlg.h:63
float peaktime_sigma
Definition: HitAnaAlg.h:59
WireROIInfo wireData
Definition: HitAnaAlg.h:161
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:162
Declaration of signal hit object.
virtual const char * what() const
Definition: HitAnaAlg.h:102
std::vector< float > Hits_PeakTime
Definition: HitAnaAlg.h:87
float charge_sigma
Definition: HitAnaAlg.h:64
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
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:289
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
TMarker * pt
Definition: egs.C:25
std::vector< float > Hits_AverageCharge
Definition: HitAnaAlg.h:85
std::vector< float > Hits_wAverageTime
Definition: HitAnaAlg.h:89
unsigned int channel
Definition: HitAnaAlg.h:73
General LArSoft Utilities.
float MCHits_PeakCharge
Definition: HitAnaAlg.h:95
Detector simulation of raw signals on wires.
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:108
unsigned int plane
Definition: HitAnaAlg.h:74
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:170
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:116
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:46
Float_t w
Definition: plot.C:20
std::vector< HitAssocPair > HitProcessingQueue
Definition: HitAnaAlg.h:165
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33