LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
HitAnaAlg.h
Go to the documentation of this file.
1 #ifndef HITANAALG_H
2 #define HITANAALG_H
3 
18 #include <vector>
19 #include <string>
20 #include <exception>
21 
26 
27 #include "TTree.h"
28 
29 namespace hit{
30 
31  struct HitInfo{
32 
33  //need a constructor here
34  HitInfo(float pt, float pt_s,
35  float w,
36  int st, int et,
37  float c, float c_s,
38  float mc, float mc_s,
39  float gof)
40  : peaktime(pt)
41  , peaktime_sigma(pt_s)
42  , rms(w)
43  , starttick(st)
44  , endtick(et)
45  , charge(c)
46  , charge_sigma(c_s)
47  , maxcharge(mc)
48  , maxcharge_sigma(mc_s)
49  , goodness_of_fit(gof)
50  {}
51 
52  float peaktime;
54  float rms;
55  int starttick;
56  int endtick;
57  float charge;
58  float charge_sigma;
59  float maxcharge;
62  };
63 
64  struct WireROIInfo{
65  unsigned int event;
66  unsigned int run;
67  unsigned int channel;
68  unsigned int plane;
69  unsigned int range_index;
70  unsigned int range_start;
71  size_t range_size;
73  float peak_charge;
74  float peak_time;
76  std::vector<std::string> HitModuleLabels;
77  std::vector<int> NHits;
78  std::vector<float> Hits_IntegratedCharge;
79  std::vector<float> Hits_AverageCharge;
80  std::vector<float> Hits_PeakCharge;
81  std::vector<float> Hits_PeakTime;
82  std::vector<float> Hits_wAverageCharge;
83  std::vector<float> Hits_wAverageTime;
84  std::vector<float> Hits_MeanMultiplicity;
85  std::vector< std::vector<HitInfo> > Hits;
86  int NMCHits;
93  };
94 
95 
97  virtual const char* what() const throw(){
98  return "HitAnaAlg Exception";
99  }
101 
102  class HitAnaAlg{
103 
104  typedef std::pair< const std::vector<recob::Hit>& , const std::vector< std::vector<int> >& > HitAssocPair;
105 
106  public:
107 
108  HitAnaAlg();
109 
110  void SetWireDataTree(TTree*);
111 
112  void SetHitDataTree(std::vector<TTree*>& trees);
113 
114  void AnalyzeWires(std::vector<recob::Wire> const&,
115  std::vector<sim::MCHitCollection> const&,
116  std::vector< std::vector<int> > const&,
117  const detinfo::DetectorClocks *,
118  unsigned int,
119  unsigned int);
120 
121  void LoadHitAssocPair( std::vector<recob::Hit> const&,
122  std::vector< std::vector<int> > const&,
123  std::string const&);
124 
125  void ClearHitModules();
126 
127  private:
128 
129  void InitWireData(unsigned int, unsigned int);
130  void ClearWireDataHitInfo();
131 
132  void FillHitInfo(recob::Hit const&, std::vector<HitInfo>&);
133 
134  void FillWireInfo(recob::Wire const&,
135  int,
136  std::vector<sim::MCHitCollection> const&,
137  std::vector<int> const&,
138  const detinfo::DetectorClocks *);
139 
140  void ProcessROI(lar::sparse_vector<float>::datarange_t const&, int,
141  std::vector<sim::MCHitCollection> const&,
142  std::vector<int> const&,
143  const detinfo::DetectorClocks *);
144 
145  void ROIInfo(lar::sparse_vector<float>::datarange_t const&,
146  float&,float&,float&);
147 
148  void FindAndStoreHitsInRange(std::vector<recob::Hit> const&,
149  std::vector<int> const&,
150  size_t,size_t,size_t);
151  void FindAndStoreMCHitsInRange(std::vector<sim::MCHitCollection> const&,
152  std::vector<int> const&,
153  size_t,size_t,
154  const detinfo::DetectorClocks *);
155 
157  std::vector<recob::Hit*> hitData;
158 
159  std::vector<std::string> HitModuleLabels;
160  std::vector< HitAssocPair > HitProcessingQueue;
161 
162 
163  void SetupWireDataTree();
164  TTree* wireDataTree;
165 
166  std::vector<TTree*> hitDataTree;
167 
168  //this is for unit testing...class has no other purpose
169  friend class HitAnaAlgTest;
170 
171  };
172 
173 }//end namespace hit
174 
175 
176 #endif
std::vector< std::string > HitModuleLabels
Definition: HitAnaAlg.h:159
TTree * wireDataTree
Definition: HitAnaAlg.h:164
unsigned int range_index
Definition: HitAnaAlg.h:69
int starttick
Definition: HitAnaAlg.h:55
unsigned int event
Definition: HitAnaAlg.h:65
float charge
Definition: HitAnaAlg.h:57
float peaktime_sigma
Definition: HitAnaAlg.h:53
std::vector< std::vector< HitInfo > > Hits
Definition: HitAnaAlg.h:85
WireROIInfo wireData
Definition: HitAnaAlg.h:156
std::vector< float > Hits_wAverageCharge
Definition: HitAnaAlg.h:82
std::vector< float > Hits_MeanMultiplicity
Definition: HitAnaAlg.h:84
hit::HitAnaAlgException hitanaalgexception
std::vector< recob::Hit * > hitData
Definition: HitAnaAlg.h:157
Declaration of signal hit object.
virtual const char * what() const
Definition: HitAnaAlg.h:97
std::vector< HitAssocPair > HitProcessingQueue
Definition: HitAnaAlg.h:160
std::vector< float > Hits_PeakTime
Definition: HitAnaAlg.h:81
float charge_sigma
Definition: HitAnaAlg.h:58
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:34
unsigned int range_start
Definition: HitAnaAlg.h:70
std::vector< std::string > HitModuleLabels
Definition: HitAnaAlg.h:76
float MCHits_wAverageTime
Definition: HitAnaAlg.h:92
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
unsigned int run
Definition: HitAnaAlg.h:66
std::vector< float > Hits_PeakCharge
Definition: HitAnaAlg.h:80
float peaktime
Definition: HitAnaAlg.h:52
std::vector< int > NHits
Definition: HitAnaAlg.h:77
float MCHits_IntegratedCharge
Definition: HitAnaAlg.h:87
float MCHits_wAverageCharge
Definition: HitAnaAlg.h:91
float peak_charge
Definition: HitAnaAlg.h:73
TMarker * pt
Definition: egs.C:25
std::vector< float > Hits_AverageCharge
Definition: HitAnaAlg.h:79
std::vector< float > Hits_wAverageTime
Definition: HitAnaAlg.h:83
unsigned int channel
Definition: HitAnaAlg.h:67
float MCHits_PeakCharge
Definition: HitAnaAlg.h:89
Detector simulation of raw signals on wires.
Conversion of times between different formats and references.
size_t range_size
Definition: HitAnaAlg.h:71
float MCHits_PeakTime
Definition: HitAnaAlg.h:90
unsigned int plane
Definition: HitAnaAlg.h:68
std::pair< const std::vector< recob::Hit > &, const std::vector< std::vector< int > > & > HitAssocPair
Definition: HitAnaAlg.h:104
std::vector< float > Hits_IntegratedCharge
Definition: HitAnaAlg.h:78
float rms
Definition: HitAnaAlg.h:54
float goodness_of_fit
Definition: HitAnaAlg.h:61
std::vector< TTree * > hitDataTree
Definition: HitAnaAlg.h:166
float maxcharge
Definition: HitAnaAlg.h:59
Class holding the deconvoluted signals from a channel.
Definition: Wire.h:80
Range class, with range and data.
float integrated_charge
Definition: HitAnaAlg.h:72
float maxcharge_sigma
Definition: HitAnaAlg.h:60
float MCHits_AverageCharge
Definition: HitAnaAlg.h:88
Declaration of basic channel signal object.
2D representation of charge deposited in the TDC/wire plane
Definition: Hit.h:49
Float_t w
Definition: plot.C:23
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33