CbmRoot
CbmRichRingLight.h
Go to the documentation of this file.
1 /*
2  * CbmRichRingLight.h
3  *
4  * Created on: 09.03.2010
5  * Author: Semen Lebedev
6  */
7 
8 #ifndef CBMRICHRINGLIGHT_H_
9 #define CBMRICHRINGLIGHT_H_
10 
11 #include <cmath>
12 #include <vector>
13 
15 public:
19  CbmRichHitLight() : fX(0.), fY(0.), fId(0) {}
20 
24  virtual ~CbmRichHitLight() {}
25 
31  CbmRichHitLight(float x, float y, unsigned int hitId = 0)
32  : fX(x), fY(y), fId(hitId) {}
33 
34  float fX; // x coordinate of the hit
35  float fY; // y coordinate of the hit
36  unsigned int fId; // hit id
37 };
38 
40 public:
45  : fHits()
46  ,
47 
48  fCenterX(0.f)
49  , fCenterY(0.f)
50  , fRadius(0.f)
51  ,
52 
53  fAaxis(0.f)
54  , fBaxis(0.f)
55  , fPhi(0.f)
56  ,
57 
58  fAPar(0.f)
59  , fBPar(0.f)
60  , fCPar(0.f)
61  , fDPar(0.f)
62  , fEPar(0.f)
63  , fFPar(0.f)
64  ,
65 
66  fRecFlag(0)
67  ,
68 
69  fChi2(0.f)
70  , fAngle(0.f)
71  , fNofHitsOnRing(0)
72  , fSelectionNN(0.f)
73 
74  {
75  fHits.reserve(40);
76  }
77 
81  virtual ~CbmRichRingLight() { fHits.clear(); }
82 
87  void AddHit(CbmRichHitLight hit) { fHits.push_back(hit); }
88 
94  bool RemoveHit(int hitId) {
95  std::vector<CbmRichHitLight>::iterator it;
96  for (it = fHits.begin(); it != fHits.end(); it++) {
97  if (hitId >= 0 && hitId == int(it->fId)) {
98  fHits.erase(it);
99  return true;
100  }
101  }
102  return false;
103  }
104 
108  int GetNofHits() const { return fHits.size(); }
109 
114  CbmRichHitLight GetHit(int ind) { return fHits[ind]; }
115 
120  unsigned int GetHitId(int ind) { return fHits[ind].fId; }
121 
122  void SetCenterX(float x) { fCenterX = x; }
123  void SetCenterY(float y) { fCenterY = y; }
124  void SetRadius(float r) { fRadius = r; }
125 
132  void SetXYR(float x, float y, float r) {
133  fCenterX = x;
134  fCenterY = y;
135  fRadius = r;
136  }
137 
146  void SetXYABP(float x, float y, float a, float b, float p) {
147  fCenterX = x;
148  fCenterY = y;
149  fAaxis = a;
150  fBaxis = b;
151  fPhi = p;
152  }
153 
154  void SetChi2(float chi2) { fChi2 = chi2; }
155  void SetAngle(float angle) { fAngle = angle; }
156  void SetNofHitsOnRing(unsigned short onring) { fNofHitsOnRing = onring; }
157  void SetSelectionNN(float selectionNN) { fSelectionNN = selectionNN; }
158 
159  float GetCenterX() const { return fCenterX; }
160  float GetCenterY() const { return fCenterY; }
161  float GetRadius() const { return fRadius; }
162 
163  float GetAaxis() const { return fAaxis; }
164  float GetBaxis() const { return fBaxis; }
165  float GetPhi() const { return fPhi; }
166  void SetAaxis(double a) { fAaxis = a; }
167  void SetBaxis(double b) { fBaxis = b; }
168  void SetPhi(double phi) { fPhi = phi; }
169 
173  double GetXF1() const {
174  double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
175  double xc = c * cos(fabs(fPhi));
176 
177  return fCenterX + xc;
178  }
179 
183  double GetYF1() const {
184  double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
185  double yc = c * sin(fabs(fPhi));
186  if (fPhi >= 0) {
187  return fCenterY + yc;
188  } else {
189  return fCenterY - yc;
190  }
191  }
192 
196  double GetXF2() const {
197  double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
198  double xc = c * cos(fabs(fPhi));
199 
200  return fCenterX - xc;
201  }
202 
206  double GetYF2() const {
207  double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
208  double yc = c * sin(fabs(fPhi));
209  if (fPhi >= 0) {
210  return fCenterY - yc;
211  } else {
212  return fCenterY + yc;
213  }
214  }
215 
225  void SetABCDEF(float a, float b, float c, float d, float e, float f) {
226  fAPar = a;
227  fBPar = b;
228  fCPar = c;
229  fDPar = d;
230  fEPar = e;
231  fFPar = f;
232  }
233 
234  float GetAPar() const { return fAPar; }
235  float GetBPar() const { return fBPar; }
236  float GetCPar() const { return fCPar; }
237  float GetDPar() const { return fDPar; }
238  float GetEPar() const { return fEPar; }
239  float GetFPar() const { return fFPar; }
240 
241  float GetSelectionNN() const { return fSelectionNN; }
242  float GetChi2() const { return fChi2; }
243 
247  float GetRadialPosition() const {
248  if (fCenterY > 0.f) {
249  return sqrt(fCenterX * fCenterX
250  + (fCenterY - 110.f) * (fCenterY - 110.f));
251  } else {
252  return sqrt(fCenterX * fCenterX
253  + (fCenterY + 110.f) * (fCenterY + 110.f));
254  };
255  return 0.;
256  }
257 
258  float GetAngle() const { return fAngle; }
259 
260  unsigned short GetNofHitsOnRing() const { return fNofHitsOnRing; }
261 
262  int GetRecFlag() const { return fRecFlag; }
263  void SetRecFlag(int r) { fRecFlag = r; }
264 
265 private:
266  std::vector<CbmRichHitLight> fHits; // STL container for CbmRichHitLight
267 
268  float fCenterX;
269  float fCenterY;
270  float fRadius;
271 
272  float fAaxis;
273  float fBaxis;
274  float fPhi;
275 
276  float fAPar; // Axx+Bxy+Cyy+Dx+Ey+F
277  float fBPar;
278  float fCPar;
279  float fDPar;
280  float fEPar;
281  float fFPar;
282 
283  int fRecFlag;
284 
285  float fChi2;
286  float fAngle;
287  unsigned short fNofHitsOnRing;
289 };
290 
291 #endif /* CBMRICHRINGLIGHT_H_ */
CbmRichRingLight::fCenterY
float fCenterY
Definition: CbmRichRingLight.h:269
CbmRichRingLight::fEPar
float fEPar
Definition: CbmRichRingLight.h:280
CbmRichRingLight::fChi2
float fChi2
Definition: CbmRichRingLight.h:285
sin
friend F32vec4 sin(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:136
CbmRichRingLight::GetNofHitsOnRing
unsigned short GetNofHitsOnRing() const
Definition: CbmRichRingLight.h:260
f
float f
Definition: L1/vectors/P4_F32vec4.h:24
CbmRichRingLight::fAPar
float fAPar
Definition: CbmRichRingLight.h:276
CbmRichRingLight::fCenterX
float fCenterX
Definition: CbmRichRingLight.h:268
CbmRichRingLight::GetBPar
float GetBPar() const
Definition: CbmRichRingLight.h:235
CbmRichRingLight::SetSelectionNN
void SetSelectionNN(float selectionNN)
Definition: CbmRichRingLight.h:157
CbmRichHitLight::fId
unsigned int fId
Definition: CbmRichRingLight.h:36
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmRichRingLight::GetDPar
float GetDPar() const
Definition: CbmRichRingLight.h:237
CbmRichRingLight::GetChi2
float GetChi2() const
Definition: CbmRichRingLight.h:242
CbmRichRingLight::fDPar
float fDPar
Definition: CbmRichRingLight.h:279
CbmRichRingLight::fAngle
float fAngle
Definition: CbmRichRingLight.h:286
CbmRichRingLight::fCPar
float fCPar
Definition: CbmRichRingLight.h:278
CbmRichRingLight::SetABCDEF
void SetABCDEF(float a, float b, float c, float d, float e, float f)
Set all 6 parameters of curve equation Axx+Bxy+Cyy+Dx+Ey+F.
Definition: CbmRichRingLight.h:225
CbmRichRingLight::SetAaxis
void SetAaxis(double a)
Definition: CbmRichRingLight.h:166
CbmRichRingLight::fHits
std::vector< CbmRichHitLight > fHits
Definition: CbmRichRingLight.h:266
CbmRichHitLight::fX
float fX
Definition: CbmRichRingLight.h:34
CbmRichRingLight::RemoveHit
bool RemoveHit(int hitId)
Remove hit from the ring.
Definition: CbmRichRingLight.h:94
CbmRichRingLight::GetYF2
double GetYF2() const
Calculate and return Y coordinate of the second focus.
Definition: CbmRichRingLight.h:206
CbmRichRingLight::GetRadialPosition
float GetRadialPosition() const
Return radial position of the ring.
Definition: CbmRichRingLight.h:247
CbmRichRingLight::GetHitId
unsigned int GetHitId(int ind)
Return hit index in TClonesArray.
Definition: CbmRichRingLight.h:120
CbmRichRingLight::SetRadius
void SetRadius(float r)
Definition: CbmRichRingLight.h:124
CbmRichRingLight::GetCPar
float GetCPar() const
Definition: CbmRichRingLight.h:236
CbmRichRingLight::fPhi
float fPhi
Definition: CbmRichRingLight.h:274
CbmRichRingLight::~CbmRichRingLight
virtual ~CbmRichRingLight()
Destructor.
Definition: CbmRichRingLight.h:81
CbmRichRingLight::GetNofHits
int GetNofHits() const
Return number of hits in ring.
Definition: CbmRichRingLight.h:108
CbmRichRingLight::GetXF2
double GetXF2() const
Calculate and return X coordinate of the second focus.
Definition: CbmRichRingLight.h:196
CbmRichRingLight::fNofHitsOnRing
unsigned short fNofHitsOnRing
Definition: CbmRichRingLight.h:287
CbmRichHitLight::~CbmRichHitLight
virtual ~CbmRichHitLight()
Distructor.
Definition: CbmRichRingLight.h:24
CbmRichRingLight::fBaxis
float fBaxis
Definition: CbmRichRingLight.h:273
CbmRichRingLight::SetCenterY
void SetCenterY(float y)
Definition: CbmRichRingLight.h:123
CbmRichRingLight::SetXYABP
void SetXYABP(float x, float y, float a, float b, float p)
Set all 5 ellipse parameters.
Definition: CbmRichRingLight.h:146
CbmRichRingLight::SetXYR
void SetXYR(float x, float y, float r)
Set all 3 circle parameters.
Definition: CbmRichRingLight.h:132
CbmRichRingLight::GetAaxis
float GetAaxis() const
Definition: CbmRichRingLight.h:163
CbmRichRingLight::SetCenterX
void SetCenterX(float x)
Definition: CbmRichRingLight.h:122
CbmRichRingLight::fFPar
float fFPar
Definition: CbmRichRingLight.h:281
CbmRichRingLight::GetXF1
double GetXF1() const
Calculate and return X coordinate of the first focus.
Definition: CbmRichRingLight.h:173
CbmRichRingLight::fAaxis
float fAaxis
Definition: CbmRichRingLight.h:272
d
double d
Definition: P4_F64vec2.h:24
CbmRichRingLight::GetCenterY
float GetCenterY() const
Definition: CbmRichRingLight.h:160
CbmRichRingLight::AddHit
void AddHit(CbmRichHitLight hit)
Add new hit to the ring.
Definition: CbmRichRingLight.h:87
CbmRichRingLight::CbmRichRingLight
CbmRichRingLight()
Standard constructor.
Definition: CbmRichRingLight.h:44
CbmRichRingLight::SetRecFlag
void SetRecFlag(int r)
Definition: CbmRichRingLight.h:263
CbmRichRingLight::fRecFlag
int fRecFlag
Definition: CbmRichRingLight.h:283
CbmRichRingLight::GetBaxis
float GetBaxis() const
Definition: CbmRichRingLight.h:164
CbmRichHitLight
Definition: CbmRichRingLight.h:14
CbmRichHitLight::CbmRichHitLight
CbmRichHitLight()
Default constructor.
Definition: CbmRichRingLight.h:19
CbmRichRingLight::GetRadius
float GetRadius() const
Definition: CbmRichRingLight.h:161
CbmRichRingLight::fRadius
float fRadius
Definition: CbmRichRingLight.h:270
CbmRichRingLight::GetSelectionNN
float GetSelectionNN() const
Definition: CbmRichRingLight.h:241
CbmRichRingLight::fSelectionNN
float fSelectionNN
Definition: CbmRichRingLight.h:288
CbmRichHitLight::fY
float fY
Definition: CbmRichRingLight.h:35
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmRichRingLight::GetHit
CbmRichHitLight GetHit(int ind)
Return hit by the index.
Definition: CbmRichRingLight.h:114
cos
friend F32vec4 cos(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:137
CbmRichRingLight::SetPhi
void SetPhi(double phi)
Definition: CbmRichRingLight.h:168
CbmRichRingLight::GetAPar
float GetAPar() const
Definition: CbmRichRingLight.h:234
CbmRichRingLight::GetYF1
double GetYF1() const
Calculate and return Y coordinate of the first focus.
Definition: CbmRichRingLight.h:183
CbmRichRingLight::SetBaxis
void SetBaxis(double b)
Definition: CbmRichRingLight.h:167
CbmRichRingLight::GetCenterX
float GetCenterX() const
Definition: CbmRichRingLight.h:159
CbmRichRingLight::SetChi2
void SetChi2(float chi2)
Definition: CbmRichRingLight.h:154
CbmRichHitLight::CbmRichHitLight
CbmRichHitLight(float x, float y, unsigned int hitId=0)
Constructor with initialization.
Definition: CbmRichRingLight.h:31
CbmRichRingLight::SetAngle
void SetAngle(float angle)
Definition: CbmRichRingLight.h:155
CbmRichRingLight::SetNofHitsOnRing
void SetNofHitsOnRing(unsigned short onring)
Definition: CbmRichRingLight.h:156
CbmRichRingLight
Definition: CbmRichRingLight.h:39
CbmRichRingLight::fBPar
float fBPar
Definition: CbmRichRingLight.h:277
CbmRichRingLight::GetEPar
float GetEPar() const
Definition: CbmRichRingLight.h:238
CbmRichRingLight::GetAngle
float GetAngle() const
Definition: CbmRichRingLight.h:258
CbmRichRingLight::GetRecFlag
int GetRecFlag() const
Definition: CbmRichRingLight.h:262
CbmRichRingLight::GetPhi
float GetPhi() const
Definition: CbmRichRingLight.h:165
CbmRichRingLight::GetFPar
float GetFPar() const
Definition: CbmRichRingLight.h:239