LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
DirOfGamma.h
Go to the documentation of this file.
1 // Class:
3 // Module Type:
4 // File: DirOfGamma.h
5 // Authors: dorota.stefan@cern.ch robert.sulej@cern.ch
7 
8 #ifndef DirOfGamma_h
9 #define DirOfGamma_h
10 
12 
14 
15 #include "TVector2.h"
16 #include "TVector3.h"
17 
18 namespace ems
19 {
20  class Hit2D;
21  class Bin2D;
22  class EndPoint;
23  class DirOfGamma;
24  class bDistCentMore2D;
25  class bDistCentLess2D;
26 }
27 
29 {
30  public:
32 
33  TVector2 const & GetPointCm(void) const { return fPoint; }
34  double GetCharge(void) const {return fCharge;}
35 
36  art::Ptr< recob::Hit > const & GetHitPtr(void) const { return fHit;}
37 
38  private:
39  double fCharge;
40 
41  TVector2 fPoint;
42 
44 };
45 
47 {
48  public:
49  Bin2D(const TVector2 & center);
50 
51  void Add(Hit2D* hit);
52 
53  void Sort();
54 
55  void SortLess();
56 
57  double GetTotCharge(void) const { return fTotCharge;}
58 
59  unsigned int Size() const { return fSize; }
60 
61  std::vector< Hit2D* > const & GetHits2D(void) const { return fHits2D; }
62 
63  const TVector2 & GetCenter(void) const { return fCenter2D; }
64 
65  std::vector< art::Ptr< recob::Hit > > GetIniHits(const double radius = 10.0, const unsigned int nhits = 10) const;
66 
67  private:
68  const TVector2 & fCenter2D;
69  std::vector< Hit2D* > fHits2D;
70  double fTotCharge;
71  unsigned int fSize;
72 };
73 
75 {
76  public:
77  EndPoint(const Hit2D & center, const std::vector< Hit2D* > & hits, unsigned int nbins);
78 
79  TVector2 const & GetPosition(void) const { return fCenter2D.GetPointCm(); }
80 
81  double GetAsymmetry(void) const;
82 
83  double GetMaxCharge(void) const { return fMaxCharge; }
84 
85  Bin2D const & MaxChargeBin(void) const { return fBins[fMaxChargeIdBin]; }
86 
87  std::vector< Bin2D > const & GetBins2D(void) const { return fBins; }
88 
89  art::Ptr< recob::Hit > const & GetHit(void) const { return fCenter2D.GetHitPtr(); }
90 
91  const std::vector< art::Ptr< recob::Hit > > GetIniHits(void) const { return MaxChargeBin().GetIniHits(); }
92 
93  size_t const & GetPlane(void) const { return fPlane; }
94  size_t const & GetTPC(void) const { return fTpc; }
95  size_t const & GetCryo(void) const { return fCryo; }
96 
97  private:
99  std::vector< Hit2D* > fPoints2D;
100  size_t fNbins;
101 
102  double fMaxCharge;
103  double fMeanCharge;
104 
105  std::vector< Bin2D > fBins;
106 
108 
109  void FillBins();
110  void ComputeMaxCharge();
111  void ComputeMeanCharge();
112 
113  size_t fPlane;
114  size_t fTpc;
115  size_t fCryo;
116 };
117 
119 {
120  public:
121  DirOfGamma(const std::vector< art::Ptr< recob::Hit > > & src, unsigned int nbins, unsigned int idcl);
122  ~DirOfGamma() { for (unsigned int i = 0; i < fPoints2D.size(); ++i) delete fPoints2D[i];}
123 
124  TVector2 const & GetBaryCenterCm(void) const { return fBaryCenter; }
125 
126  std::vector< Hit2D* > const & GetHits2D(void) const { return fPoints2D; }
127 
128  std::vector< EndPoint > const & GetCandidates(void) const { return fCandidates; }
129 
130  void SetIdCandidate(size_t id) {
131 
132  fIsCandidateIDset = true; fCandidateID = id;
133  fStartHit = fCandidates[id].GetHit();
134  fStartPoint = fCandidates[id].GetPosition();
135  fIniHits = fCandidates[id].MaxChargeBin().GetIniHits();
136  }
137 
138  const size_t GetIdCandidate(void) { return fCandidateID; }
139 
140  art::Ptr< recob::Hit > const & GetFirstHit(void) const { return fStartHit; }
141 
142  std::vector< art::Ptr< recob::Hit > > const & GetHits(void) { return fHits; }
143 
144  TVector2 const & GetFirstPoint(void) const { return fStartPoint; }
145 
146  std::vector< art::Ptr< recob::Hit > > const & GetIniHits(void) const { return fIniHits;}
147 
148  size_t const GetIdCl(void) const {return fIdCl;}
149 
150  private:
151  size_t fNbins;
152  size_t fIdCl;
153  size_t fCandidateID;
154 
155  std::vector< Hit2D* > fPoints2D;
156  std::vector< Bin2D > fBins;
157  std::vector< EndPoint > fCandidates;
158 
160  TVector2 fStartPoint;
161  std::vector< art::Ptr< recob::Hit > > fIniHits;
162  std::vector< art::Ptr< recob::Hit > > fHits;
163 
164  void FindInitialPart(void);
165 
166  void FillBins(void);
167 
168  bool FindCandidates(void);
169  void ComputeBaryCenter(void);
170  void ComputeMaxDist(void);
171  void ComputeMaxCharge(void);
172  void ComputeFinalValues(void);
173 
174  TVector2 fBaryCenter;
175 
176  float fNormDist;
177  float fNormCharge;
178 
180 };
181 
183  public std::binary_function< Hit2D*, Hit2D*, bool>
184  {
185  public:
186  bDistCentMore2D(const TVector2& c) : center(c) {}
187 
188  bool operator() (Hit2D* p1, Hit2D* p2)
189  {
190  double dx = p1->GetPointCm().X() - center.X();
191  double dy = p1->GetPointCm().Y() - center.Y();
192  double b1 = dx * dx + dy * dy;
193  dx = p2->GetPointCm().X() - center.X();
194  dy = p2->GetPointCm().Y() - center.Y();
195  double b2 = dx * dx + dy * dy;
196 
197  return b1 > b2;
198  }
199 
200  private:
201  TVector2 center;
202 };
203 
205  public std::binary_function< Hit2D*, Hit2D*, bool>
206  {
207  public:
208  bDistCentLess2D(const TVector2& c) : center(c) {}
209 
210  bool operator() (Hit2D* p1, Hit2D* p2)
211  {
212  double dx = p1->GetPointCm().X() - center.X();
213  double dy = p1->GetPointCm().Y() - center.Y();
214  double b1 = dx * dx + dy * dy;
215  dx = p2->GetPointCm().X() - center.X();
216  dy = p2->GetPointCm().Y() - center.Y();
217  double b2 = dx * dx + dy * dy;
218 
219  return b1 < b2;
220  }
221 
222  private:
223  TVector2 center;
224 };
225 
226 #endif
TVector2 fPoint
Definition: DirOfGamma.h:41
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:155
art::Ptr< recob::Hit > const & GetHitPtr(void) const
Definition: DirOfGamma.h:36
Declaration of signal hit object.
std::vector< EndPoint > const & GetCandidates(void) const
Definition: DirOfGamma.h:128
std::vector< Bin2D > const & GetBins2D(void) const
Definition: DirOfGamma.h:87
size_t const & GetCryo(void) const
Definition: DirOfGamma.h:95
bDistCentMore2D(const TVector2 &c)
Definition: DirOfGamma.h:186
std::vector< art::Ptr< recob::Hit > > const & GetHits(void)
Definition: DirOfGamma.h:142
unsigned int Size() const
Definition: DirOfGamma.h:59
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:156
TVector2 fBaryCenter
Definition: DirOfGamma.h:174
size_t fNbins
Definition: DirOfGamma.h:100
void SetIdCandidate(size_t id)
Definition: DirOfGamma.h:130
bDistCentLess2D(const TVector2 &c)
Definition: DirOfGamma.h:208
size_t const GetIdCl(void) const
Definition: DirOfGamma.h:148
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
std::vector< art::Ptr< recob::Hit > > fIniHits
Definition: DirOfGamma.h:161
Hit2D fCenter2D
Definition: DirOfGamma.h:98
unsigned int fSize
Definition: DirOfGamma.h:71
void hits()
Definition: readHits.C:15
art::Ptr< recob::Hit > const & GetFirstHit(void) const
Definition: DirOfGamma.h:140
const size_t GetIdCandidate(void)
Definition: DirOfGamma.h:138
art::Ptr< recob::Hit > const & GetHit(void) const
Definition: DirOfGamma.h:89
std::vector< Hit2D * > fPoints2D
Definition: DirOfGamma.h:99
size_t const & GetTPC(void) const
Definition: DirOfGamma.h:94
const TVector2 & fCenter2D
Definition: DirOfGamma.h:68
art::Ptr< recob::Hit > fHit
Definition: DirOfGamma.h:43
double fTotCharge
Definition: DirOfGamma.h:70
std::vector< Bin2D > fBins
Definition: DirOfGamma.h:105
const std::vector< art::Ptr< recob::Hit > > GetIniHits(void) const
Definition: DirOfGamma.h:91
Double_t radius
size_t fPlane
Definition: DirOfGamma.h:113
size_t const & GetPlane(void) const
Definition: DirOfGamma.h:93
double GetTotCharge(void) const
Definition: DirOfGamma.h:57
Definition: DirOfGamma.h:18
Detector simulation of raw signals on wires.
const TVector2 & GetCenter(void) const
Definition: DirOfGamma.h:63
size_t fMaxChargeIdBin
Definition: DirOfGamma.h:107
TVector2 const & GetPointCm(void) const
Definition: DirOfGamma.h:33
double fCharge
Definition: DirOfGamma.h:39
double GetCharge(void) const
Definition: DirOfGamma.h:34
size_t fCandidateID
Definition: DirOfGamma.h:153
bool fIsCandidateIDset
Definition: DirOfGamma.h:179
TVector2 fStartPoint
Definition: DirOfGamma.h:160
double GetMaxCharge(void) const
Definition: DirOfGamma.h:83
std::vector< Hit2D * > const & GetHits2D(void) const
Definition: DirOfGamma.h:61
std::vector< Hit2D * > fHits2D
Definition: DirOfGamma.h:69
TVector2 const & GetFirstPoint(void) const
Definition: DirOfGamma.h:144
TVector2 const & GetPosition(void) const
Definition: DirOfGamma.h:79
double fMeanCharge
Definition: DirOfGamma.h:103
double fMaxCharge
Definition: DirOfGamma.h:102
Bin2D const & MaxChargeBin(void) const
Definition: DirOfGamma.h:85
std::vector< art::Ptr< recob::Hit > > const & GetIniHits(void) const
Definition: DirOfGamma.h:146
std::vector< Hit2D * > const & GetHits2D(void) const
Definition: DirOfGamma.h:126
std::vector< art::Ptr< recob::Hit > > fHits
Definition: DirOfGamma.h:162
TVector2 const & GetBaryCenterCm(void) const
Definition: DirOfGamma.h:124
art::Ptr< recob::Hit > fStartHit
Definition: DirOfGamma.h:159
std::vector< EndPoint > fCandidates
Definition: DirOfGamma.h:157
size_t fCryo
Definition: DirOfGamma.h:115
Hit2D(art::Ptr< recob::Hit > src)
Definition: DirOfGamma.cxx:19