DirOfGamma.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class:
3 // Module Type:
4 // File: DirOfGamma.h
5 // Authors: dorota.stefan@cern.ch robert.sulej@cern.ch
6 ////////////////////////////////////////////////////////////////////////
7 
8 #ifndef DirOfGamma_h
9 #define DirOfGamma_h
10 
12 namespace detinfo {
13  class DetectorPropertiesData;
14 }
15 
17 
18 #include "TVector2.h"
19 
20 namespace ems {
21  class Hit2D;
22  class Bin2D;
23  class EndPoint;
24  class DirOfGamma;
25  class bDistCentMore2D;
26  class bDistCentLess2D;
27 }
28 
29 class ems::Hit2D {
30 public:
32 
33  TVector2 const&
34  GetPointCm() const
35  {
36  return fPoint;
37  }
38  double
39  GetCharge() const
40  {
41  return fCharge;
42  }
43 
45  GetHitPtr() const
46  {
47  return fHit;
48  }
49 
50 private:
51  double fCharge;
52 
53  TVector2 fPoint;
54 
56 };
57 
58 class ems::Bin2D {
59 public:
60  Bin2D(const TVector2& center);
61 
62  void Add(Hit2D* hit);
63 
64  void Sort();
65 
66  void SortLess();
67 
68  double
69  GetTotCharge() const
70  {
71  return fTotCharge;
72  }
73 
74  unsigned int
75  Size() const
76  {
77  return fSize;
78  }
79 
80  std::vector<Hit2D*> const&
81  GetHits2D() const
82  {
83  return fHits2D;
84  }
85 
86  const TVector2&
87  GetCenter() const
88  {
89  return fCenter2D;
90  }
91 
92  std::vector<art::Ptr<recob::Hit>> GetIniHits(const double radius = 10.0,
93  const unsigned int nhits = 10) const;
94 
95 private:
96  const TVector2& fCenter2D;
97  std::vector<Hit2D*> fHits2D;
98  double fTotCharge;
99  unsigned int fSize;
100 };
101 
103 public:
104  EndPoint(const Hit2D& center, const std::vector<Hit2D*>& hits, unsigned int nbins);
105 
106  TVector2 const&
107  GetPosition() const
108  {
109  return fCenter2D.GetPointCm();
110  }
111 
112  double GetAsymmetry() const;
113 
114  double
115  GetMaxCharge() const
116  {
117  return fMaxCharge;
118  }
119 
120  Bin2D const&
121  MaxChargeBin() const
122  {
123  return fBins[fMaxChargeIdBin];
124  }
125 
126  std::vector<Bin2D> const&
127  GetBins2D() const
128  {
129  return fBins;
130  }
131 
132  art::Ptr<recob::Hit> const&
133  GetHit() const
134  {
135  return fCenter2D.GetHitPtr();
136  }
137 
138  const std::vector<art::Ptr<recob::Hit>>
139  GetIniHits() const
140  {
141  return MaxChargeBin().GetIniHits();
142  }
143 
144  size_t const&
145  GetPlane() const
146  {
147  return fPlane;
148  }
149  size_t const&
150  GetTPC() const
151  {
152  return fTpc;
153  }
154  size_t const&
155  GetCryo() const
156  {
157  return fCryo;
158  }
159 
160 private:
162  std::vector<Hit2D*> fPoints2D;
163  size_t fNbins;
164 
165  double fMaxCharge;
166  double fMeanCharge;
167 
168  std::vector<Bin2D> fBins;
169 
171 
172  void FillBins();
173  void ComputeMaxCharge();
174  void ComputeMeanCharge();
175 
176  size_t fPlane;
177  size_t fTpc;
178  size_t fCryo;
179 };
180 
182 public:
184  const std::vector<art::Ptr<recob::Hit>>& src,
185  unsigned int nbins,
186  unsigned int idcl);
188  {
189  for (unsigned int i = 0; i < fPoints2D.size(); ++i)
190  delete fPoints2D[i];
191  }
192 
193  TVector2 const&
195  {
196  return fBaryCenter;
197  }
198 
199  std::vector<Hit2D*> const&
200  GetHits2D() const
201  {
202  return fPoints2D;
203  }
204 
205  std::vector<EndPoint> const&
207  {
208  return fCandidates;
209  }
210 
211  void
212  SetIdCandidate(size_t id)
213  {
214 
215  fIsCandidateIDset = true;
216  fCandidateID = id;
217  fStartHit = fCandidates[id].GetHit();
218  fStartPoint = fCandidates[id].GetPosition();
219  fIniHits = fCandidates[id].MaxChargeBin().GetIniHits();
220  }
221 
222  const size_t
224  {
225  return fCandidateID;
226  }
227 
228  art::Ptr<recob::Hit> const&
229  GetFirstHit() const
230  {
231  return fStartHit;
232  }
233 
234  std::vector<art::Ptr<recob::Hit>> const&
236  {
237  return fHits;
238  }
239 
240  TVector2 const&
242  {
243  return fStartPoint;
244  }
245 
246  std::vector<art::Ptr<recob::Hit>> const&
247  GetIniHits() const
248  {
249  return fIniHits;
250  }
251 
252  size_t const
253  GetIdCl() const
254  {
255  return fIdCl;
256  }
257 
258 private:
259  size_t fNbins;
260  size_t fIdCl;
261  size_t fCandidateID;
262 
263  std::vector<Hit2D*> fPoints2D;
264  std::vector<Bin2D> fBins;
265  std::vector<EndPoint> fCandidates;
266 
268  TVector2 fStartPoint;
269  std::vector<art::Ptr<recob::Hit>> fIniHits;
270  std::vector<art::Ptr<recob::Hit>> fHits;
271 
272  void FindInitialPart();
273 
274  void FillBins();
275 
276  bool FindCandidates();
277  void ComputeBaryCenter();
278  void ComputeMaxDist();
279  void ComputeMaxCharge();
280  void ComputeFinalValues();
281 
282  TVector2 fBaryCenter;
283 
284  float fNormDist;
285  float fNormCharge;
286 
288 };
289 
290 class ems::bDistCentMore2D : public std::binary_function<Hit2D*, Hit2D*, bool> {
291 public:
292  bDistCentMore2D(const TVector2& c) : center(c) {}
293 
294  bool
296  {
297  double dx = p1->GetPointCm().X() - center.X();
298  double dy = p1->GetPointCm().Y() - center.Y();
299  double b1 = dx * dx + dy * dy;
300  dx = p2->GetPointCm().X() - center.X();
301  dy = p2->GetPointCm().Y() - center.Y();
302  double b2 = dx * dx + dy * dy;
303 
304  return b1 > b2;
305  }
306 
307 private:
308  TVector2 center;
309 };
310 
311 class ems::bDistCentLess2D : public std::binary_function<Hit2D*, Hit2D*, bool> {
312 public:
313  bDistCentLess2D(const TVector2& c) : center(c) {}
314 
315  bool
317  {
318  double dx = p1->GetPointCm().X() - center.X();
319  double dy = p1->GetPointCm().Y() - center.Y();
320  double b1 = dx * dx + dy * dy;
321  dx = p2->GetPointCm().X() - center.X();
322  dy = p2->GetPointCm().Y() - center.Y();
323  double b2 = dx * dx + dy * dy;
324 
325  return b1 < b2;
326  }
327 
328 private:
329  TVector2 center;
330 };
331 
332 #endif
TVector2 const & GetPosition() const
Definition: DirOfGamma.h:107
TVector2 fPoint
Definition: DirOfGamma.h:53
art::Ptr< recob::Hit > const & GetFirstHit() const
Definition: DirOfGamma.h:229
std::vector< art::Ptr< recob::Hit > > fHits
Definition: DirOfGamma.h:270
struct vector vector
std::vector< art::Ptr< recob::Hit > > const & GetHits()
Definition: DirOfGamma.h:235
std::vector< EndPoint > const & GetCandidates() const
Definition: DirOfGamma.h:206
std::vector< Bin2D > const & GetBins2D() const
Definition: DirOfGamma.h:127
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:162
bDistCentMore2D(const TVector2 &c)
Definition: DirOfGamma.h:292
std::vector< Hit2D * > fHits2D
Definition: DirOfGamma.h:97
size_t const & GetPlane() const
Definition: DirOfGamma.h:145
size_t const GetIdCl() const
Definition: DirOfGamma.h:253
art::Ptr< recob::Hit > const & GetHit() const
Definition: DirOfGamma.h:133
unsigned int Size() const
Definition: DirOfGamma.h:75
art::Ptr< recob::Hit > const & GetHitPtr() const
Definition: DirOfGamma.h:45
TVector2 fBaryCenter
Definition: DirOfGamma.h:282
size_t fNbins
Definition: DirOfGamma.h:163
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:264
void SetIdCandidate(size_t id)
Definition: DirOfGamma.h:212
bDistCentLess2D(const TVector2 &c)
Definition: DirOfGamma.h:313
std::vector< Hit2D * > const & GetHits2D() const
Definition: DirOfGamma.h:200
Hit2D fCenter2D
Definition: DirOfGamma.h:161
unsigned int fSize
Definition: DirOfGamma.h:99
const TVector2 & fCenter2D
Definition: DirOfGamma.h:96
std::vector< art::Ptr< recob::Hit > > const & GetIniHits() const
Definition: DirOfGamma.h:247
double fTotCharge
Definition: DirOfGamma.h:98
TVector2 const & GetBaryCenterCm() const
Definition: DirOfGamma.h:194
double GetCharge() const
Definition: DirOfGamma.h:39
size_t fPlane
Definition: DirOfGamma.h:176
General LArSoft Utilities.
double GetTotCharge() const
Definition: DirOfGamma.h:69
Definition: DirOfGamma.h:20
Detector simulation of raw signals on wires.
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:170
double fCharge
Definition: DirOfGamma.h:51
size_t const & GetTPC() const
Definition: DirOfGamma.h:150
size_t fCandidateID
Definition: DirOfGamma.h:261
Declaration of signal hit object.
double GetMaxCharge() const
Definition: DirOfGamma.h:115
const size_t GetIdCandidate()
Definition: DirOfGamma.h:223
art::Ptr< recob::Hit > fHit
Definition: DirOfGamma.h:55
bool fIsCandidateIDset
Definition: DirOfGamma.h:287
const std::vector< art::Ptr< recob::Hit > > GetIniHits() const
Definition: DirOfGamma.h:139
TVector2 fStartPoint
Definition: DirOfGamma.h:268
def center(depos, point)
Definition: depos.py:117
size_t const & GetCryo() const
Definition: DirOfGamma.h:155
const TVector2 & GetCenter() const
Definition: DirOfGamma.h:87
bool operator()(Hit2D *p1, Hit2D *p2)
Definition: DirOfGamma.h:316
std::vector< EndPoint > fCandidates
Definition: DirOfGamma.h:265
TVector2 const & GetPointCm() const
Definition: DirOfGamma.h:34
double fMeanCharge
Definition: DirOfGamma.h:166
Bin2D const & MaxChargeBin() const
Definition: DirOfGamma.h:121
TVector2 const & GetFirstPoint() const
Definition: DirOfGamma.h:241
double fMaxCharge
Definition: DirOfGamma.h:165
std::vector< Hit2D * > const & GetHits2D() const
Definition: DirOfGamma.h:81
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:168
art::Ptr< recob::Hit > fStartHit
Definition: DirOfGamma.h:267
bool operator()(Hit2D *p1, Hit2D *p2)
Definition: DirOfGamma.h:295
std::vector< art::Ptr< recob::Hit > > fIniHits
Definition: DirOfGamma.h:269
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:263
size_t fCryo
Definition: DirOfGamma.h:178