EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmRichRingLight.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmRichRingLight.h
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 <vector>
12 #include <cmath>
13 
14 using std::vector;
15 
17 {
18 public:
23  fX(0.),
24  fY(0.){}
25 
29  virtual ~CbmRichHitLight(){}
30 
37  float x,
38  float y):
39  fX(x),
40  fY(y) {}
41 
42  float fX; // x coordinate of the hit
43  float fY; // y coordinate of the hit
44 };
45 
47 {
48 public:
49 
54  fHits(),
55  fHitIds(),
56 
57  fCenterX(0.f),
58  fCenterY(0.f),
59  fRadius(0.f),
60 
61  fAaxis(0.f),
62  fBaxis(0.f),
63  fPhi(0.f),
64 
65  fAPar(0.f),
66  fBPar(0.f),
67  fCPar(0.f),
68  fDPar(0.f),
69  fEPar(0.f),
70  fFPar(0.f),
71 
72  fRecFlag(0),
73 
74  fChi2(0.f),
75  fAngle(0.f),
76  fNofHitsOnRing(0),
77  fSelectionNN(0.f)
78 
79  {
80  fHits.reserve(30);
81  fHitIds.reserve(30);
82  }
83 
88  {
89  fHits.clear();
90  fHitIds.clear();
91  }
92 
98  void AddHit(
99  CbmRichHitLight hit,
100  unsigned short id = -1)
101  {
102  fHits.push_back(hit);
103  fHitIds.push_back(id);
104  }
105 
111  bool RemoveHit(
112  int hitId)
113  {
114  vector<unsigned short>::iterator it;
115  for (it = fHitIds.begin(); it!= fHitIds.end(); it++){
116  if (hitId == *it){
117  fHitIds.erase(it);
118  return true;
119  }
120  }
121  return false;
122  }
123 
127  int GetNofHits() const {return fHitIds.size(); }
128 
133  CbmRichHitLight GetHit(int ind) {return fHits[ind];}
134 
139  unsigned short GetHitId(int ind) {return fHitIds[ind];}
140 
141  void SetCenterX(float x) {fCenterX = x;}
142  void SetCenterY(float y) {fCenterY = y;}
143  void SetRadius(float r) {fRadius = r;}
144 
151  void SetXYR(
152  float x,
153  float y,
154  float r)
155  {
156  fCenterX = x;
157  fCenterY = y;
158  fRadius = r;
159  }
160 
169  void SetXYABP(
170  float x,
171  float y,
172  float a,
173  float b,
174  float p)
175  {
176  fCenterX = x;
177  fCenterY = y;
178  fAaxis = a;
179  fBaxis = b;
180  fPhi = p;
181  }
182 
183  void SetChi2(float chi2) {fChi2 = chi2;}
184  void SetAngle( float angle) {fAngle = angle;}
185  void SetNofHitsOnRing(unsigned short onring) {fNofHitsOnRing = onring;}
186  void SetSelectionNN (float selectionNN ) {fSelectionNN = selectionNN;}
187 
188  float GetCenterX() const {return fCenterX;}
189  float GetCenterY() const {return fCenterY;}
190  float GetRadius() const {return fRadius;}
191 
192  float GetAaxis() const {return fAaxis;}
193  float GetBaxis() const {return fBaxis;}
194  float GetPhi() const {return fPhi;}
195  void SetAaxis(double a) {fAaxis = a;}
196  void SetBaxis(double b) {fBaxis = b;}
197  void SetPhi(double phi) {fPhi = phi;}
198 
202  double GetXF1() const
203  {
204  double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
205  double xc = c*cos(fabs(fPhi));
206 
207  return fCenterX+xc;
208  }
209 
213  double GetYF1() const
214  {
215  double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
216  double yc = c * sin(fabs(fPhi));
217  if (fPhi >=0){
218  return fCenterY+yc;
219  }else{
220  return fCenterY-yc;
221  }
222  }
223 
227  double GetXF2() const
228  {
229  double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
230  double xc = c*cos(fabs(fPhi));
231 
232  return fCenterX-xc;
233  }
234 
238  double GetYF2() const
239  {
240  double c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
241  double yc = c * sin(fabs(fPhi));
242  if (fPhi >= 0){
243  return fCenterY - yc;
244  }else{
245  return fCenterY + yc;
246  }
247  }
248 
258  void SetABCDEF(
259  float a,
260  float b,
261  float c,
262  float d,
263  float e,
264  float f)
265  {
266  fAPar = a;
267  fBPar = b;
268  fCPar = c;
269  fDPar = d;
270  fEPar = e;
271  fFPar = f;
272  }
273 
274  float GetAPar() const {return fAPar;}
275  float GetBPar() const {return fBPar;}
276  float GetCPar() const {return fCPar;}
277  float GetDPar() const {return fDPar;}
278  float GetEPar() const {return fEPar;}
279  float GetFPar() const {return fFPar;}
280 
281  float GetSelectionNN() const {return fSelectionNN;}
282  float GetChi2() const {return fChi2;}
283 
287  float GetRadialPosition() const{
288  if (fCenterY > 0.f){
289  return sqrt(fCenterX * fCenterX + (fCenterY - 110.f) * (fCenterY - 110.f));
290  } else {
291  return sqrt(fCenterX * fCenterX + (fCenterY + 110.f) * (fCenterY + 110.f));
292  };
293  return 0.;
294  }
295 
296  float GetAngle() const {return fAngle;}
297 
298  unsigned short GetNofHitsOnRing() const {return fNofHitsOnRing;}
299 
300  int GetRecFlag() const {return fRecFlag;}
301  void SetRecFlag(int r) { fRecFlag = r;}
302 
303 private:
304  vector<CbmRichHitLight> fHits; // STL container for CbmRichHitLight
305  vector<unsigned short> fHitIds; // STL container for hit indexes
306 
307  float fCenterX;
308  float fCenterY;
309  float fRadius;
310 
311  float fAaxis;
312  float fBaxis;
313  float fPhi;
314 
315  float fAPar; // Axx+Bxy+Cyy+Dx+Ey+F
316  float fBPar;
317  float fCPar;
318  float fDPar;
319  float fEPar;
320  float fFPar;
321 
322  int fRecFlag;
323 
324  float fChi2;
325  float fAngle;
326  unsigned short fNofHitsOnRing;
328 };
329 
330 #endif /* CBMRICHRINGLIGHT_H_ */