CbmRoot
CbmRichRing.cxx
Go to the documentation of this file.
1 /* $Id: CbmRichRing.cxx,v 1.8 2006/09/13 14:51:28 hoehne Exp $*/
2 
3 /* History of CVS commits:
4  *
5  * $Log: CbmRichRing.cxx,v $
6  * Revision 1.8 2006/09/13 14:51:28 hoehne
7  * two variables (Selection2D, SelectionNN) added in which values between 0 and 1 are stored for fake rejection
8  * ReconstructedFlag removed
9  *
10  * Revision 1.7 2006/08/11 14:03:57 hoehne
11  * move SetUncertainty and GetUncertainty to SetChi2 and GetChi2
12  *
13  * Revision 1.6 2006/07/12 06:27:54 hoehne
14  * new functions: SetDistance and GetDistance added which set/ give the distance between ring center and track attached to this
15  * ring
16  *
17  * Revision 1.5 2006/02/23 11:24:10 hoehne
18  * RecFlag added (Simeon Lebedev)
19  *
20  * Revision 1.4 2006/01/23 11:40:13 hoehne
21  * MCMotherID added
22  *
23  * Revision 1.3 2006/01/19 10:40:06 hoehne
24  * restructured according to new RinfFinder Class:
25  * array of hits belonging to a certain ring added
26  *
27  *
28  *
29  */
30 
31 
32 // -------------------------------------------------------------------------
33 // ----- CbmRichRing source file -----
34 // ----- Created 05/07/04 by A. Soloviev <solovjev@cv.jinr.ru> -----
35 // -------------------------------------------------------------------------
36 
37 #include "CbmRichRing.h"
38 
39 #include <FairLogger.h> // for Logger, LOG
40 
41 #include <TMath.h> // for Pi
42 #include <TObject.h> // for TObject
43 
44 #include <cmath> // for fabs, sqrt, atan, cos, sin
45 
46 using std::atan;
47 using std::fabs;
48 using std::sqrt;
49 
50 // ----- Default constructor -------------------------------------------
52  : TObject()
53  , fHitCollection()
54  , fAPar(0.)
55  , fBPar(0.)
56  , fCPar(0.)
57  , fDPar(0.)
58  , fEPar(0.)
59  , fFPar(0.)
60  , fCenterX(0.)
61  , fCenterY(0.)
62  , fRadius(0.)
63  , fAaxis(0.)
64  , fBaxis(0.)
65  , fAaxisCor(0.)
66  , fBaxisCor(0.)
67  , fPhi(0.)
68  , fChi2(0.)
69  , fAngle(0.)
70  , fNofHitsOnRing(-1)
71  , fSelectionNN(-1.)
72  , fRecFlag(0)
73  , fTime(0.) {
74  fHitCollection.reserve(40);
75 }
76 // -------------------------------------------------------------------------
77 
78 
79 // ----- Standard constructor ------------------------------------------
80 CbmRichRing::CbmRichRing(Float_t x, Float_t y, Float_t r)
81  : TObject()
82  , fHitCollection()
83  , fAPar(0.)
84  , fBPar(0.)
85  , fCPar(0.)
86  , fDPar(0.)
87  , fEPar(0.)
88  , fFPar(0.)
89  , fCenterX(x)
90  , fCenterY(y)
91  , fRadius(r)
92  , fAaxis(0.)
93  , fBaxis(0.)
94  , fAaxisCor(0.)
95  , fBaxisCor(0.)
96  , fPhi(0.)
97  , fChi2(0.)
98  , fAngle(0.)
99  , fNofHitsOnRing(-1)
100  , fSelectionNN(-1.)
101  , fRecFlag(0)
102  , fTime(0.) {
103  fHitCollection.reserve(40);
104 }
105 // -------------------------------------------------------------------------
106 
107 
108 // ----- Destructor ----------------------------------------------------
110 // -------------------------------------------------------------------------
111 
113  Double_t y,
114  Double_t a,
115  Double_t b,
116  Double_t phi) {
117  fCenterX = x;
118  fCenterY = y;
119  fAaxis = a;
120  fBaxis = b;
121  fPhi = phi;
122 }
123 
124 Bool_t CbmRichRing::RemoveHit(UInt_t hitId) {
125  //Int_t nofHits = fHitCollection.size();
126  std::vector<UInt_t>::iterator it;
127  for (it = fHitCollection.begin(); it != fHitCollection.end(); it++) {
128  if (hitId == *it) {
129  fHitCollection.erase(it);
130  return true;
131  }
132  }
133  return false;
134 }
135 
136 Double_t CbmRichRing::GetXF1() const {
137  Double_t c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
138  Double_t xc = c * cos(fabs(fPhi));
139 
140  return fCenterX + xc;
141 }
142 
143 Double_t CbmRichRing::GetYF1() const {
144  Double_t c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
145  Double_t yc = c * sin(fabs(fPhi));
146  if (fPhi >= 0) {
147  return fCenterY + yc;
148  } else {
149  return fCenterY - yc;
150  }
151 }
152 
153 Double_t CbmRichRing::GetXF2() const {
154  Double_t c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
155  Double_t xc = c * cos(fabs(fPhi));
156 
157  return fCenterX - xc;
158 }
159 
160 Double_t CbmRichRing::GetYF2() const {
161  Double_t c = sqrt(fAaxis * fAaxis - fBaxis * fBaxis);
162  Double_t yc = c * sin(fabs(fPhi));
163  if (fPhi >= 0) {
164  return fCenterY - yc;
165  } else {
166  return fCenterY + yc;
167  }
168 }
169 
170 void CbmRichRing::Print(Option_t*) const {
171  LOG(info) << " Ring parameters: "
172  << " Aaxis = " << GetAaxis() << ", Baxis = " << GetBaxis()
173  << ", Phi = " << GetPhi() << ", CenterX = " << GetCenterX()
174  << ", CenterY = " << GetCenterY() << ", Radius = " << GetRadius()
175  << ", NofHits = " << GetNofHits()
176  << ", RadialPosition = " << GetRadialPosition()
177  << ", Chi2 = " << GetChi2() << ", Angle() = " << GetAngle()
178  << ", NofHitsOnRing = " << GetNofHitsOnRing();
179 }
180 
182  if (fCenterY > 0.f) {
183  return sqrt(fCenterX * fCenterX + (fCenterY - 110.f) * (fCenterY - 110.f));
184  } else {
185  return sqrt(fCenterX * fCenterX + (fCenterY + 110.f) * (fCenterY + 110.f));
186  }
187 }
188 
189 Double_t CbmRichRing::GetRadialAngle() const {
190  /* if (fCenterY > 0){
191  return atan((100 - fCenterY) / (0 - fCenterX));
192  } else {
193  return atan((-100 - fCenterY) / (0 - fCenterX));
194  }*/
195 
196  if (fCenterX > 0 && fCenterY > 0) {
197  return atan(fabs((100 - fCenterY) / (0 - fCenterX)));
198  }
199  if (fCenterX < 0 && fCenterY > 0) {
200  return TMath::Pi() - atan(fabs((100 - fCenterY) / (0 - fCenterX)));
201  }
202  if (fCenterX < 0 && fCenterY < 0) {
203  return TMath::Pi() + atan(fabs((-100 - fCenterY) / (0 - fCenterX)));
204  }
205  if (fCenterX > 0 && fCenterY < 0) {
206  return 2 * TMath::Pi() - atan(fabs((-100 - fCenterY) / (0 - fCenterX)));
207  }
208 
209  return 999.;
210 }
211 //
212 //CbmRichRingLight* CbmRichRing::toLightRing()
213 //{
214 // CbmRichRingLight* rl = new CbmRichRingLight();
215 //
216 // for (int i = 0; i < this->GetNofHits(); i ++){
217 // rl->AddHit(this->GetHit(i));
218 // }
219 // rl->SetCenterX(this->GetCenterX());
220 // rl->SetCenterY(this->GetCenterY());
221 // rl->SetRadius(this->GetRadius());
222 // rl->SetAngle(this->GetAngle());
223 // rl->SetChi2(this->GetChi2());
224 // rl->SetNofHitsOnRing(this->GetNofHitsOnRing());
225 // rl->SetSelectionNN(this->GetSelectionNN());
226 // rl->SetRecFlag(this->GetRecFlag());
227 //
228 // return rl;
229 //}
230 
CbmRichRing::GetXF2
Double_t GetXF2() const
Definition: CbmRichRing.cxx:153
sin
friend F32vec4 sin(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:136
CbmRichRing::fAaxis
Double_t fAaxis
Definition: CbmRichRing.h:119
CbmRichRing::GetYF2
Double_t GetYF2() const
Definition: CbmRichRing.cxx:160
CbmRichRing::Print
virtual void Print(Option_t *opt="") const
Definition: CbmRichRing.cxx:170
f
float f
Definition: L1/vectors/P4_F32vec4.h:24
CbmRichRing::fBaxis
Double_t fBaxis
Definition: CbmRichRing.h:120
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmRichRing::GetChi2
Double_t GetChi2() const
Definition: CbmRichRing.h:95
CbmRichRing::RemoveHit
Bool_t RemoveHit(UInt_t hitId)
Definition: CbmRichRing.cxx:124
CbmRichRing::GetNofHits
Int_t GetNofHits() const
Definition: CbmRichRing.h:40
CbmRichRing
Definition: CbmRichRing.h:17
CbmRichRing.h
CbmRichRing::GetRadialPosition
Float_t GetRadialPosition() const
Definition: CbmRichRing.cxx:181
CbmRichRing::GetRadialAngle
Double_t GetRadialAngle() const
Definition: CbmRichRing.cxx:189
CbmRichRing::fHitCollection
std::vector< UInt_t > fHitCollection
Definition: CbmRichRing.h:105
CbmRichRing::SetXYABPhi
void SetXYABPhi(Double_t x, Double_t y, Double_t a, Double_t b, Double_t phi)
Definition: CbmRichRing.cxx:112
CbmRichRing::GetYF1
Double_t GetYF1() const
Definition: CbmRichRing.cxx:143
CbmRichRing::fCenterX
Float_t fCenterX
Definition: CbmRichRing.h:115
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
xMath::Pi
double Pi()
Definition: xMath.h:5
CbmRichRing::GetAaxis
Double_t GetAaxis() const
Definition: CbmRichRing.h:83
CbmRichRing::CbmRichRing
CbmRichRing()
Definition: CbmRichRing.cxx:51
CbmRichRing::GetBaxis
Double_t GetBaxis() const
Definition: CbmRichRing.h:84
CbmRichRing::GetPhi
Double_t GetPhi() const
Definition: CbmRichRing.h:87
CbmRichRing::fPhi
Double_t fPhi
Definition: CbmRichRing.h:124
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmRichRing::GetNofHitsOnRing
Int_t GetNofHitsOnRing() const
Definition: CbmRichRing.h:99
fabs
friend F32vec4 fabs(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:60
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmRichRing::GetXF1
Double_t GetXF1() const
Definition: CbmRichRing.cxx:136
cos
friend F32vec4 cos(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:137
CbmRichRing::GetRadius
Float_t GetRadius() const
Definition: CbmRichRing.h:82
CbmRichRing::GetCenterY
Float_t GetCenterY() const
Definition: CbmRichRing.h:81
CbmRichRing::fCenterY
Float_t fCenterY
Definition: CbmRichRing.h:116
CbmRichRing::~CbmRichRing
virtual ~CbmRichRing()
Definition: CbmRichRing.cxx:109
CbmRichRing::GetCenterX
Float_t GetCenterX() const
Definition: CbmRichRing.h:80
CbmRichRing::GetAngle
Double_t GetAngle() const
Definition: CbmRichRing.h:98