CbmRoot
Loading...
Searching...
No Matches
CbmRichRingLight.h
Go to the documentation of this file.
1/* Copyright (C) 2010-2019 UGiessen/JINR-LIT, Giessen/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev [committer] */
4
5/*
6 * CbmRichRingLight.h
7 *
8 * Created on: 09.03.2010
9 * Author: Semen Lebedev
10 */
11
12#ifndef CBMRICHRINGLIGHT_H_
13#define CBMRICHRINGLIGHT_H_
14
15#include <vector>
16#include <cmath>
17
19public:
23 CbmRichHitLight() : fX(0.), fY(0.), fId(0) {}
24
28 virtual ~CbmRichHitLight() {}
29
35 CbmRichHitLight(float x, float y, unsigned int hitId = 0) : fX(x), fY(y), fId(hitId) {}
36
37 float fX; // x coordinate of the hit
38 float fY; // y coordinate of the hit
39 unsigned int fId; // hit id
40};
41
43public:
48 : fHits()
49 ,
50
51 fCenterX(0.f)
52 , fCenterY(0.f)
53 , fRadius(0.f)
54 ,
55
56 fAaxis(0.f)
57 , fBaxis(0.f)
58 , fPhi(0.f)
59 ,
60
61 fAPar(0.f)
62 , fBPar(0.f)
63 , fCPar(0.f)
64 , fDPar(0.f)
65 , fEPar(0.f)
66 , fFPar(0.f)
67 ,
68
69 fRecFlag(0)
70 ,
71
72 fChi2(0.f)
73 , fAngle(0.f)
75 , fSelectionNN(0.f)
76
77 {
78 fHits.reserve(40);
79 }
80
84 virtual ~CbmRichRingLight() { fHits.clear(); }
85
90 void AddHit(CbmRichHitLight hit) { fHits.push_back(hit); }
91
97 bool RemoveHit(int hitId)
98 {
99 std::vector<CbmRichHitLight>::iterator it;
100 for (it = fHits.begin(); it != fHits.end(); it++) {
101 if (hitId >= 0 && hitId == int(it->fId)) {
102 fHits.erase(it);
103 return true;
104 }
105 }
106 return false;
107 }
108
112 int GetNofHits() const { return fHits.size(); }
113
118 CbmRichHitLight GetHit(int ind) { return fHits[ind]; }
119
124 unsigned int GetHitId(int ind) { return fHits[ind].fId; }
125
126 void SetCenterX(float x) { fCenterX = x; }
127 void SetCenterY(float y) { fCenterY = y; }
128 void SetRadius(float r) { fRadius = r; }
129
136 void SetXYR(float x, float y, float r)
137 {
138 fCenterX = x;
139 fCenterY = y;
140 fRadius = r;
141 }
142
151 void SetXYABP(float x, float y, float a, float b, float p)
152 {
153 fCenterX = x;
154 fCenterY = y;
155 fAaxis = a;
156 fBaxis = b;
157 fPhi = p;
158 }
159
160 void SetChi2(float chi2) { fChi2 = chi2; }
161 void SetAngle(float angle) { fAngle = angle; }
162 void SetNofHitsOnRing(unsigned short onring) { fNofHitsOnRing = onring; }
163 void SetSelectionNN(float selectionNN) { fSelectionNN = selectionNN; }
164
165 float GetCenterX() const { return fCenterX; }
166 float GetCenterY() const { return fCenterY; }
167 float GetRadius() const { return fRadius; }
168
169 float GetAaxis() const { return fAaxis; }
170 float GetBaxis() const { return fBaxis; }
171 float GetPhi() const { return fPhi; }
172 void SetAaxis(double a) { fAaxis = a; }
173 void SetBaxis(double b) { fBaxis = b; }
174 void SetPhi(double phi) { fPhi = phi; }
175
179 double GetXF1() const
180 {
181 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
182 double xc = c * cos(fabs(fPhi));
183
184 return fCenterX + xc;
185 }
186
190 double GetYF1() const
191 {
192 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
193 double yc = c * sin(fabs(fPhi));
194 if (fPhi >= 0) { return fCenterY + yc; }
195 else {
196 return fCenterY - yc;
197 }
198 }
199
203 double GetXF2() const
204 {
205 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
206 double xc = c * cos(fabs(fPhi));
207
208 return fCenterX - xc;
209 }
210
214 double GetYF2() const
215 {
216 double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
217 double yc = c * sin(fabs(fPhi));
218 if (fPhi >= 0) { return fCenterY - yc; }
219 else {
220 return fCenterY + yc;
221 }
222 }
223
233 void SetABCDEF(float a, float b, float c, float d, float e, float f)
234 {
235 fAPar = a;
236 fBPar = b;
237 fCPar = c;
238 fDPar = d;
239 fEPar = e;
240 fFPar = f;
241 }
242
243 float GetAPar() const { return fAPar; }
244 float GetBPar() const { return fBPar; }
245 float GetCPar() const { return fCPar; }
246 float GetDPar() const { return fDPar; }
247 float GetEPar() const { return fEPar; }
248 float GetFPar() const { return fFPar; }
249
250 float GetSelectionNN() const { return fSelectionNN; }
251 float GetChi2() const { return fChi2; }
252
256 float GetRadialPosition() const
257 {
258 if (fCenterY > 0.f) { return sqrt(fCenterX * fCenterX + (fCenterY - 110.f) * (fCenterY - 110.f)); }
259 else {
260 return sqrt(fCenterX * fCenterX + (fCenterY + 110.f) * (fCenterY + 110.f));
261 };
262 return 0.;
263 }
264
265 float GetAngle() const { return fAngle; }
266
267 unsigned short GetNofHitsOnRing() const { return fNofHitsOnRing; }
268
269 int GetRecFlag() const { return fRecFlag; }
270 void SetRecFlag(int r) { fRecFlag = r; }
271
272private:
273 std::vector<CbmRichHitLight> fHits; // STL container for CbmRichHitLight
274
275 float fCenterX;
276 float fCenterY;
277 float fRadius;
278
279 float fAaxis;
280 float fBaxis;
281 float fPhi;
282
283 float fAPar; // Axx+Bxy+Cyy+Dx+Ey+F
284 float fBPar;
285 float fCPar;
286 float fDPar;
287 float fEPar;
288 float fFPar;
289
291
292 float fChi2;
293 float fAngle;
294 unsigned short fNofHitsOnRing;
296};
297
298#endif /* CBMRICHRINGLIGHT_H_ */
friend fvec sqrt(const fvec &a)
friend fvec cos(const fvec &a)
friend fvec sin(const fvec &a)
CbmRichHitLight()
Default constructor.
CbmRichHitLight(float x, float y, unsigned int hitId=0)
Constructor with initialization.
virtual ~CbmRichHitLight()
Distructor.
double GetXF1() const
Calculate and return X coordinate of the first focus.
float GetBPar() const
virtual ~CbmRichRingLight()
Destructor.
float GetDPar() const
double GetYF1() const
Calculate and return Y coordinate of the first focus.
void SetXYABP(float x, float y, float a, float b, float p)
Set all 5 ellipse parameters.
void SetRadius(float r)
double GetYF2() const
Calculate and return Y coordinate of the second focus.
float GetCenterX() const
double GetXF2() const
Calculate and return X coordinate of the second focus.
float GetAaxis() const
float GetSelectionNN() const
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.
void SetPhi(double phi)
float GetFPar() const
void SetCenterY(float y)
float GetEPar() const
unsigned short fNofHitsOnRing
void SetBaxis(double b)
float GetRadius() const
void SetAngle(float angle)
void SetSelectionNN(float selectionNN)
float GetCenterY() const
float GetAngle() const
void SetNofHitsOnRing(unsigned short onring)
float GetPhi() const
void SetAaxis(double a)
float GetCPar() const
int GetNofHits() const
Return number of hits in ring.
float GetAPar() const
float GetBaxis() const
void SetXYR(float x, float y, float r)
Set all 3 circle parameters.
CbmRichRingLight()
Standard constructor.
CbmRichHitLight GetHit(int ind)
Return hit by the index.
void SetCenterX(float x)
float GetChi2() const
float GetRadialPosition() const
Return radial position of the ring.
unsigned int GetHitId(int ind)
Return hit index in TClonesArray.
bool RemoveHit(int hitId)
Remove hit from the ring.
unsigned short GetNofHitsOnRing() const
std::vector< CbmRichHitLight > fHits
void AddHit(CbmRichHitLight hit)
Add new hit to the ring.
void SetChi2(float chi2)