]>
Commit | Line | Data |
---|---|---|
108615fc | 1 | //Author: Anders Strand Vestbo |
2 | //Author: Uli Frankenfeld | |
3 | //Last Modified: 06.03.2001 | |
4 | ||
5 | //____________________________________ | |
6 | // AliL3Track | |
7 | // | |
8 | // Base track class for L3 | |
9 | ||
10 | //Changes: | |
11 | ||
12 | //14.03.01: Moved fHitNumbers from protected to private.-ASV | |
13 | // Set memory to zero in ctor. | |
14 | // Moved fNHits 2 private. Protected data members not a good idea after all. | |
15 | //19.03.01: Made the method void Set(AliL3Track) virtual. | |
16 | ||
17 | #include "AliL3RootTypes.h" | |
18 | ||
19 | #include "AliL3Logging.h" | |
20 | #include "AliL3Track.h" | |
21 | #include <math.h> | |
22 | ||
23 | ClassImp(AliL3Track) | |
24 | ||
25 | Float_t AliL3Track::BFACT = 0.0029980; | |
26 | Float_t AliL3Track::bField = 0.2; | |
27 | Double_t AliL3Track::pi=3.14159265358979323846; | |
28 | ||
29 | AliL3Track::AliL3Track() | |
30 | { | |
31 | //Constructor | |
32 | ||
33 | fNHits = 0; | |
34 | fMCid = -1; | |
35 | fKappa=0; | |
36 | fRadius=0; | |
37 | fCenterX=0; | |
38 | fCenterY=0; | |
39 | ComesFromMainVertex(false); | |
40 | fQ = 0; | |
41 | fPhi0=0; | |
42 | fPsi=0; | |
43 | fR0=0; | |
44 | fTanl=0; | |
45 | fZ0=0; | |
46 | fPt=0; | |
47 | fLength=0; | |
48 | fIsLocal=true; | |
49 | fRowRange[0]=0; | |
50 | fRowRange[1]=0; | |
51 | memset(fHitNumbers,0,174*sizeof(UInt_t)); | |
52 | } | |
53 | ||
54 | void AliL3Track::Set(AliL3Track *tpt){ | |
55 | ||
56 | SetRowRange(tpt->GetFirstRow(),tpt->GetLastRow()); | |
57 | SetPhi0(tpt->GetPhi0()); | |
58 | SetKappa(tpt->GetKappa()); | |
59 | SetNHits(tpt->GetNHits()); | |
60 | ||
61 | SetFirstPoint(tpt->GetFirstPointX(),tpt->GetFirstPointY(),tpt->GetFirstPointZ()); | |
62 | ||
63 | SetLastPoint(tpt->GetLastPointX(),tpt->GetLastPointY(),tpt->GetLastPointZ()); | |
64 | SetPt(tpt->GetPt()); | |
65 | SetPsi(tpt->GetPsi()); | |
66 | SetTgl(tpt->GetTgl()); | |
67 | SetCharge(tpt->GetCharge()); | |
68 | ||
69 | SetHits(tpt->GetNHits(),(UInt_t *)tpt->GetHitNumbers()); | |
70 | ||
71 | /* | |
72 | fPhi0 = track->GetPhi0(); | |
73 | fKappa = track->GetKappa(); | |
74 | ||
75 | fRowRange[0] = track->GetFirstRow(); | |
76 | fRowRange[1] = track->GetLastRow(); | |
77 | fQ = track->GetCharge(); | |
78 | fFirstPoint[0] = track->GetFirstPointX(); | |
79 | fFirstPoint[1] = track->GetFirstPointY(); | |
80 | fFirstPoint[2] = track->GetFirstPointZ(); | |
81 | fLastPoint[0] = track->GetLastPointX(); | |
82 | fLastPoint[1] = track->GetLastPointY(); | |
83 | fLastPoint[2] = track->GetLastPointZ(); | |
84 | fPt = track->GetPt(); | |
85 | fTanl = track->GetTgl(); | |
86 | fPsi = track->GetPsi(); | |
87 | fQ = track->GetCharge(); | |
88 | fNHits = track->GetNHits(); | |
89 | memcpy(fHitNumbers,track->GetHitNumbers(),fNHits*sizeof(UInt_t)); | |
90 | */ | |
91 | } | |
92 | ||
93 | ||
94 | AliL3Track::~AliL3Track() | |
95 | { | |
96 | ||
97 | } | |
98 | ||
99 | Double_t AliL3Track::GetP() const | |
100 | { | |
101 | // Returns total momentum. | |
102 | ||
103 | return fabs(GetPt())*sqrt(1. + GetTgl()*GetTgl()); | |
104 | ||
105 | } | |
106 | ||
107 | Double_t AliL3Track::GetPseudoRapidity() const | |
108 | { | |
109 | return 0.5 * log((GetP() + GetPz()) / (GetP() - GetPz())); | |
110 | } | |
111 | ||
112 | Double_t AliL3Track::GetEta() const | |
113 | { | |
114 | return GetPseudoRapidity(); | |
115 | } | |
116 | ||
117 | Double_t AliL3Track::GetRapidity() const | |
118 | { | |
119 | Double_t m_pi = 0.13957; | |
120 | return 0.5 * log((m_pi + GetPz()) / (m_pi - GetPz())); | |
121 | } | |
122 | ||
123 | void AliL3Track::CalculateHelix(){ | |
124 | //Calculate Radius, CenterX and Centery from Psi, X0, Y0 | |
125 | // | |
126 | ||
127 | fRadius = fPt / (BFACT*bField); | |
128 | if(fRadius) fKappa = 1./fRadius; | |
129 | else fRadius = 999999; //just zero | |
130 | Double_t trackPhi0 = fPsi + fQ *0.5 * pi; | |
131 | ||
132 | fCenterX = fFirstPoint[0] - fRadius * cos(trackPhi0); | |
133 | fCenterY = fFirstPoint[1] - fRadius * sin(trackPhi0); | |
134 | } | |
135 | ||
136 | Bool_t AliL3Track::CalculateReferencePoint(Double_t angle){ | |
137 | // Global coordinate: crossing point with y = ax+ b; a=tan(angle-Pi/2); | |
138 | // | |
139 | const Double_t rr=132; //position of referece plane | |
140 | const Double_t xr = cos(angle) *rr; | |
141 | const Double_t yr = sin(angle) *rr; | |
142 | ||
143 | Double_t a = tan(angle-pi/2); | |
144 | Double_t b = yr - a * xr; | |
145 | ||
146 | Double_t pp=(fCenterX+a*fCenterY-a*b)/(1+pow(a,2)); | |
147 | Double_t qq=(pow(fCenterX,2)+pow(fCenterY,2)-2*fCenterY*b+pow(b,2)-pow(fRadius,2))/(1+pow(a,2)); | |
148 | ||
149 | Double_t racine = pp*pp-qq; | |
150 | if(racine<0) return IsPoint(kFALSE); //no Point | |
151 | ||
152 | Double_t rootRacine = sqrt(racine); | |
153 | Double_t x0 = pp+rootRacine; | |
154 | Double_t x1 = pp-rootRacine; | |
155 | Double_t y0 = a*x0 + b; | |
156 | Double_t y1 = a*x1 + b; | |
157 | ||
158 | Double_t diff0 = sqrt(pow(x0-xr,2)+pow(y0-yr,2)); | |
159 | Double_t diff1 = sqrt(pow(x1-xr,2)+pow(y1-yr,2)); | |
160 | ||
161 | if(diff0<diff1){ | |
162 | fPoint[0]=x0; | |
163 | fPoint[1]=y0; | |
164 | } | |
165 | else{ | |
166 | fPoint[0]=x1; | |
167 | fPoint[1]=y1; | |
168 | } | |
169 | ||
170 | Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX); | |
171 | Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX); | |
172 | if(fabs(trackPhi0-pointPhi0)>pi){ | |
173 | if(trackPhi0<pointPhi0) trackPhi0 += 2*pi; | |
174 | else pointPhi0 += 2*pi; | |
175 | } | |
176 | Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ; | |
177 | fPoint[2] = fFirstPoint[2] + stot * fTanl; | |
178 | ||
179 | fPointPsi = pointPhi0 - fQ * 0.5 * pi; | |
180 | if(fPointPsi<0.) fPointPsi+= 2*pi; | |
181 | fPointPsi = fmod(fPointPsi, 2*pi); | |
182 | ||
183 | return IsPoint(kTRUE); | |
184 | } | |
185 | ||
186 | Bool_t AliL3Track::CalculateEdgePoint(Double_t angle){ | |
187 | // Global coordinate: crossing point with y = ax; a=tan(angle); | |
188 | // | |
189 | Double_t rmin=80; //min Radius of TPC | |
190 | Double_t rmax=260; //max Radius of TPC | |
191 | ||
192 | Double_t a = tan(angle); | |
193 | Double_t pp=(fCenterX+a*fCenterY)/(1+pow(a,2)); | |
194 | Double_t qq=(pow(fCenterX,2)+pow(fCenterY,2)-pow(fRadius,2))/(1+pow(a,2)); | |
195 | Double_t racine = pp*pp-qq; | |
196 | if(racine<0) return IsPoint(kFALSE); //no Point | |
197 | Double_t rootRacine = sqrt(racine); | |
198 | Double_t x0 = pp+rootRacine; | |
199 | Double_t x1 = pp-rootRacine; | |
200 | Double_t y0 = a*x0; | |
201 | Double_t y1 = a*x1; | |
202 | ||
203 | Double_t r0 = sqrt(pow(x0,2)+pow(y0,2)); | |
204 | Double_t r1 = sqrt(pow(x1,2)+pow(y1,2)); | |
205 | //find the right crossing point: | |
206 | //inside the TPC modules | |
207 | Bool_t ok0 = kFALSE; | |
208 | Bool_t ok1 = kFALSE; | |
209 | if(r0>rmin&&r0<rmax){ | |
210 | Double_t da=atan2(y0,x0); | |
211 | if(da<0) da+=pi; | |
212 | if(fabs(da-angle)<0.5) | |
213 | ok0 = kTRUE; | |
214 | } | |
215 | if(r1>rmin&&r1<rmax){ | |
216 | Double_t da=atan2(y1,y1); | |
217 | if(da<0) da+=pi; | |
218 | if(fabs(da-angle)<0.5) | |
219 | ok1 = kTRUE; | |
220 | } | |
221 | if(!(ok0||ok1)) return IsPoint(kFALSE); //no Point | |
222 | ||
223 | if(ok0&&ok1){ | |
224 | Double_t diff0 = sqrt(pow(fFirstPoint[0]-x0,2)+pow(fFirstPoint[1]-y0,2)); | |
225 | Double_t diff1 = sqrt(pow(fFirstPoint[0]-x1,2)+pow(fFirstPoint[1]-y1,2)); | |
226 | if(diff0<diff1) ok1 = kFALSE; //use ok0 | |
227 | else ok0 = kFALSE; //use ok1 | |
228 | } | |
229 | if(ok0){fPoint[0]=x0; fPoint[1]=y0;} | |
230 | else {fPoint[0]=x1; fPoint[1]=y1;} | |
231 | ||
232 | Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX); | |
233 | Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX); | |
234 | if(fabs(trackPhi0-pointPhi0)>pi){ | |
235 | if(trackPhi0<pointPhi0) trackPhi0 += 2*pi; | |
236 | else pointPhi0 += 2*pi; | |
237 | } | |
238 | Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ; | |
239 | fPoint[2] = fFirstPoint[2] + stot * fTanl; | |
240 | ||
241 | fPointPsi = pointPhi0 - fQ * 0.5 * pi; | |
242 | if(fPointPsi<0.) fPointPsi+= 2*pi; | |
243 | fPointPsi = fmod(fPointPsi, 2*pi); | |
244 | ||
245 | return IsPoint(kTRUE); | |
246 | } | |
247 | ||
248 | Bool_t AliL3Track::CalculatePoint(Double_t xplane){ | |
249 | // Local coordinate: crossing point with x plane | |
250 | // | |
251 | Double_t racine = pow(fRadius,2)-pow(xplane-fCenterX,2); | |
252 | if(racine<0) return IsPoint(kFALSE); | |
253 | Double_t rootRacine = sqrt(racine); | |
254 | ||
255 | Double_t y0 = fCenterY + rootRacine; | |
256 | Double_t y1 = fCenterY - rootRacine; | |
257 | //Double_t diff0 = sqrt(pow(fFirstPoint[0]-xplane)+pow(fFirstPoint[1]-y0)); | |
258 | //Double_t diff1 = sqrt(pow(fFirstPoint[0]-xplane)+pow(fFirstPoint[1]-y1)); | |
259 | Double_t diff0 = fabs(y0-fFirstPoint[1]); | |
260 | Double_t diff1 = fabs(y1-fFirstPoint[1]); | |
261 | ||
262 | fPoint[0]=xplane; | |
263 | if(diff0<diff1) fPoint[1]=y0; | |
264 | else fPoint[1]=y1; | |
265 | ||
266 | Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX); | |
267 | Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX); | |
268 | if(fabs(trackPhi0-pointPhi0)>pi){ | |
269 | if(trackPhi0<pointPhi0) trackPhi0 += 2*pi; | |
270 | else pointPhi0 += 2*pi; | |
271 | } | |
272 | Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ; | |
273 | fPoint[2] = fFirstPoint[2] + stot * fTanl; | |
274 | ||
275 | fPointPsi = pointPhi0 - fQ * 0.5 * pi; | |
276 | if(fPointPsi<0.) fPointPsi+= 2*pi; | |
277 | fPointPsi = fmod(fPointPsi, 2*pi); | |
278 | ||
279 | return IsPoint(kTRUE); | |
280 | } | |
281 |