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 class CbmRichHitLight
15 {
16 public:
17  float fX;
18  float fY;
19 };
20 
21 class CbmRichRingLight
22 {
23 public:
25  fHitCollection.reserve(30);
26  fHitIdCollection.reserve(30);
27  }
28 
30  fHitCollection.clear();
31  }
32 
33  void AddHit(CbmRichHitLight pHit, unsigned short id) {
34  fHitCollection.push_back(pHit);
35  fHitIdCollection.push_back(id);
36 
37  }
38  bool RemoveHit(int hitId){
39  //Int_t nofHits = fHitCollection.size();
40  std::vector<unsigned short>::iterator it;
41  for (it = fHitIdCollection.begin(); it!=fHitIdCollection.end(); it++){
42  if (hitId == *it){
43  fHitIdCollection.erase(it);
44  return true;
45  }
46  }
47  return false;
48  }
49 
50  int GetNofHits() const {return fHitIdCollection.size(); }
52  unsigned short GetHitId(int i) {return fHitIdCollection[i];}
53 
54  void SetCenterX(float x) {fCenterX = x;}
55  void SetCenterY(float y) {fCenterY = y;}
56  void SetRadius(float r) {fRadius = r;}
57  void SetChi2(float chi2) {fChi2 = chi2;}
58  void SetAngle( float angle) {fAngle = angle;}
59  void SetNofHitsOnRing(unsigned short onring) {fNofHitsOnRing = onring;}
61  void SetSelectionNN (float selectionNN ) {fSelectionNN = selectionNN;}
62  void SetRecFlag(short recFlag){fRecFlag = recFlag;}
63 
64  float GetCenterX() const {return fCenterX;}
65  float GetCenterY() const {return fCenterY;}
66  float GetRadius() const {return fRadius;}
67  float GetSelectionNN() const {return fSelectionNN;}
68  float GetChi2() const {return fChi2;}
69  float GetNDF() const {return (float)(GetNofHits()-5);}
70  float GetRadialPosition() const{
71  if (fCenterY > 0.f){
72  return sqrt(fCenterX*fCenterX +(fCenterY - 110.f)*(fCenterY - 110.f));
73  } else {
74  return sqrt(fCenterX*fCenterX+(fCenterY + 110.f)*(fCenterY + 110.f));
75  };
76  }
77 
78  float GetAngle() const {return fAngle;}
79  unsigned short GetNofHitsOnRing() const {return fNofHitsOnRing;}
80  short GetRecFlag(){return fRecFlag;}
81 
82 private:
83  std::vector<CbmRichHitLight> fHitCollection;
84  std::vector<unsigned short> fHitIdCollection;
85 protected:
86  float fCenterX;
87  float fCenterY;
88  float fRadius;
89  float fChi2;
90  float fAngle;
91  unsigned short fNofHitsOnRing;
92  short fRecFlag;
93  float fSelectionNN;
94 };
95 
96 #endif /* CBMRICHRINGLIGHT_H_ */