]>
Commit | Line | Data |
---|---|---|
aecdf013 | 1 | // ITS Track Class |
2 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
3 | // It contain all the usefull information for the track and the method to calculate, modify or extract them | |
4 | // The track is mainly caracterized by the state vector of elements (fX0, fX1, fX2, fX3, fX4) and the | |
5 | // corresponding covariance matrix of elements (C00, C10, ..... C44) that is triangular | |
6 | // | |
7 | #include <iostream.h> | |
8 | #include <TMath.h> | |
9 | #include <TVector.h> | |
10 | #include <TObjArray.h> | |
11 | #include "AliRun.h" | |
12 | #include "AliITSRad.h" | |
13 | #include "AliITSTrackV1.h" | |
14 | #include "AliGenerator.h" | |
a3894645 | 15 | #include "AliMagF.h" |
aecdf013 | 16 | |
17 | ||
18 | ClassImp(AliITSTrackV1) | |
19 | ||
20 | AliITSTrackV1::AliITSTrackV1() { | |
21 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
22 | // default constructor | |
23 | ||
24 | fC00=fC10=fC11=fC20=fC21=fC22=fC30=fC31=fC32=fC33=fC40=fC41=fC42=fC43=fC44=0.; | |
25 | flistCluster = new TObjArray; | |
26 | fNumClustInTrack =0; | |
27 | fChi2=-1; | |
28 | flabel =0; | |
29 | fVertex.ResizeTo(3); | |
30 | fErrorVertex.ResizeTo(3); | |
31 | fLayer = -1; | |
32 | fClusterInTrack = new TMatrix(6,9); | |
33 | Int_t i; | |
34 | for(i=0; i<6; i++) (*fClusterInTrack)(i,6)=(*fClusterInTrack)(i,7)= | |
35 | (*fClusterInTrack)(i,8)=-1.; | |
70a9314b | 36 | frtrack=0.; |
37 | fnoclust=0; | |
aecdf013 | 38 | fd2.ResizeTo(6); |
39 | ftgl2.ResizeTo(6); | |
a3894645 | 40 | fdtgl.ResizeTo(6); |
41 | ||
42 | //////////////////////////////////////// gets magnetic field factor //////////////////////////////// | |
43 | ||
44 | AliMagF * fieldPointer = gAlice->Field(); | |
45 | fFieldFactor = (Double_t)fieldPointer->Factor(); | |
46 | //cout<< " field factor = "<<fFieldFactor<<"\n"; getchar(); | |
47 | ||
48 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// | |
49 | ||
aecdf013 | 50 | } |
51 | ||
52 | ||
53 | ||
54 | AliITSTrackV1::AliITSTrackV1(const AliITSTrackV1 &cobj) { | |
55 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
56 | // copy constructor | |
57 | ||
58 | fClusterInTrack = new TMatrix(6,9); | |
59 | Int_t i; | |
60 | for(i=0; i<6; i++) (*fClusterInTrack)(i,6)=(*fClusterInTrack)(i,7)= | |
61 | (*fClusterInTrack)(i,8)=-1.; | |
62 | flistCluster = new TObjArray; | |
63 | fVertex.ResizeTo(3); | |
64 | fErrorVertex.ResizeTo(3); | |
65 | fVertex = cobj.fVertex; | |
66 | fErrorVertex = cobj.fErrorVertex; | |
67 | flabel = cobj.flabel; | |
68 | fLayer=cobj.fLayer; | |
69 | fTPCtrack = cobj.fTPCtrack; | |
70 | fNumClustInTrack = cobj.fNumClustInTrack; | |
71 | fChi2= cobj.fChi2; | |
72 | fX0=cobj.fX0; fX1=cobj.fX1; fX2=cobj.fX2; fX3=cobj.fX3; fX4=cobj.fX4; | |
73 | frtrack=cobj.frtrack; | |
74 | fDv=cobj.fDv; | |
75 | fZv=cobj.fZv; | |
76 | fsigmaDv=cobj.fsigmaDv; | |
77 | fsigmaZv=cobj.fsigmaZv; | |
78 | fd2.ResizeTo(6); | |
79 | ftgl2.ResizeTo(6); | |
80 | fdtgl.ResizeTo(6); | |
81 | fd2=cobj.fd2; | |
82 | ftgl2=cobj.ftgl2; | |
83 | fdtgl=cobj.fdtgl; | |
70a9314b | 84 | fnoclust=cobj.fnoclust; |
aecdf013 | 85 | |
86 | fC00=cobj.fC00; fC10=cobj.fC10; fC11=cobj.fC11; fC20=cobj.fC20; fC21=cobj.fC21; | |
87 | fC22=cobj.fC22; fC30=cobj.fC30; fC31=cobj.fC31; fC32=cobj.fC32; fC33=cobj.fC33; | |
88 | fC40=cobj.fC40; fC41=cobj.fC41; fC42=cobj.fC42; fC43=cobj.fC43; fC44=cobj.fC44; | |
89 | ||
90 | *fClusterInTrack = *cobj.fClusterInTrack; | |
a3894645 | 91 | |
92 | fFieldFactor=cobj.fFieldFactor; | |
aecdf013 | 93 | |
94 | for(i=0; i<cobj.flistCluster->GetSize(); i++) | |
95 | flistCluster->AddLast(cobj.flistCluster->At(i)); | |
96 | ||
97 | } | |
98 | ||
99 | AliITSTrackV1::AliITSTrackV1(AliTPCtrack &obj) | |
100 | { | |
101 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
102 | // special constructor to convert a TPC track into an ITS track | |
103 | ||
a3894645 | 104 | //////////////////////////////////////// gets magnetic field factor //////////////////////////////// |
105 | ||
106 | AliMagF * fieldPointer = gAlice->Field(); | |
107 | fFieldFactor = (Double_t)fieldPointer->Factor(); | |
108 | //cout<< " field factor = "<<fFieldFactor<<"\n"; getchar(); | |
109 | ||
110 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// | |
111 | ||
112 | ||
aecdf013 | 113 | fTPCtrack = &obj; |
114 | fVertex.ResizeTo(3); | |
115 | fErrorVertex.ResizeTo(3); | |
116 | ||
117 | fd2.ResizeTo(6); | |
118 | ftgl2.ResizeTo(6); | |
119 | fdtgl.ResizeTo(6); | |
120 | AliGenerator *gener = gAlice->Generator(); | |
121 | Float_t vxg,vyg,vzg; | |
122 | gener->GetOrigin(vxg,vyg,vzg); | |
123 | ||
124 | ||
125 | fVertex(0)=(Double_t)vxg; | |
126 | fVertex(1)=(Double_t)vyg; | |
127 | fVertex(2)=(Double_t)vzg; | |
128 | ||
129 | fLayer = 7; | |
130 | //fmCovariance = new TMatrix(5,5); | |
131 | fClusterInTrack = new TMatrix(6,9); | |
132 | ||
133 | Int_t i; | |
134 | for(i=0; i<6; i++) (*fClusterInTrack)(i,6)=(*fClusterInTrack)(i,7)= | |
135 | (*fClusterInTrack)(i,8)=-1.; | |
136 | flistCluster = new TObjArray; | |
70a9314b | 137 | fNumClustInTrack = 0; |
138 | fnoclust=0; | |
aecdf013 | 139 | LmTPC(); |
140 | ||
141 | } | |
142 | ||
143 | ||
144 | AliITSTrackV1::~AliITSTrackV1() { | |
145 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
146 | //destructor | |
147 | ||
148 | if(flistCluster) delete flistCluster; | |
149 | if(fClusterInTrack) delete fClusterInTrack; | |
150 | ||
151 | } | |
152 | ||
153 | void AliITSTrackV1::PutCElements(Double_t C00, Double_t C10, Double_t C11, Double_t C20, Double_t C21, | |
154 | Double_t C22, Double_t C30, Double_t C31, Double_t C32, Double_t C33, Double_t C40, | |
155 | Double_t C41, Double_t C42, Double_t C43, Double_t C44){ | |
156 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
157 | // puts elements of covariance matrix | |
158 | ||
159 | fC00=C00; fC10=C10; fC11=C11; fC20=C20; fC21=C21; fC22=C22; fC30=C30; fC31=C31; fC32=C32; fC33=C33; | |
160 | fC40=C40; fC41=C41; fC42=C42; fC43=C43; fC44=C44; | |
161 | } | |
162 | ||
163 | void AliITSTrackV1::GetCElements(Double_t &C00, Double_t &C10, Double_t &C11, Double_t &C20, Double_t &C21, | |
164 | Double_t &C22, Double_t &C30, Double_t &C31, Double_t &C32, Double_t &C33, Double_t &C40, | |
165 | Double_t &C41, Double_t &C42, Double_t &C43, Double_t &C44) const { | |
166 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
167 | // gets elements of covariance matrix | |
168 | ||
169 | ||
170 | C00=fC00; C10=fC10; C11=fC11; C20=fC20; C21=fC21; C22=fC22; C30=fC30; C31=fC31; C32=fC32; C33=fC33; | |
171 | C40=fC40; C41=fC41; C42=fC42; C43=fC43; C44=fC44; | |
172 | ||
173 | } | |
174 | ||
175 | void AliITSTrackV1::GetXElements(Double_t &X0, Double_t &X1, Double_t &X2, Double_t &X3, Double_t &X4) const { | |
176 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
177 | // gets the elements of the state vector | |
178 | X0=fX0; X1=fX1; X2=fX2; X3=fX3; X4=fX4; | |
179 | } | |
180 | ||
181 | void AliITSTrackV1::PutXElements(Double_t X0, Double_t X1, Double_t X2, Double_t X3, Double_t X4){ | |
182 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
183 | // puts the elements of the state vector | |
184 | fX0=X0; fX1=X1; fX2=X2; fX3=X3; fX4=X4; | |
185 | } | |
186 | ||
187 | void AliITSTrackV1::LmTPC() { | |
188 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
189 | // Transform the TPC state vector from TPC-local to master and build a new state vector ITS-type | |
190 | // The covariance matrix is also modified accordingly | |
191 | ||
192 | ||
193 | Double_t alpha = fTPCtrack->GetAlpha(); | |
194 | ||
195 | //printf("LmTPC: alpha %f\n",alpha); | |
196 | ||
197 | Double_t yTPC = fTPCtrack->GetY(); | |
198 | Double_t zTPC = fTPCtrack->GetZ(); | |
199 | Double_t cTPC = fTPCtrack->GetC(); | |
200 | Double_t etaTPC = fTPCtrack->GetEta(); | |
201 | Double_t tglTPC = fTPCtrack->GetTgl(); | |
202 | ||
203 | ||
204 | Double_t xm, ym, zm; | |
205 | Double_t sina = TMath::Sin(alpha); | |
206 | Double_t cosa = TMath::Cos(alpha); | |
207 | Double_t xl= fTPCtrack->GetX(); | |
208 | xm = xl * cosa - yTPC*sina; | |
209 | ym = xl * sina + yTPC*cosa; | |
210 | zm = zTPC; | |
211 | //cout<<" xl e alpha = "<<xl<<" "<<alpha<<"\n"; getchar(); | |
212 | ||
213 | Double_t x0m,y0m; | |
214 | ||
215 | ///////////////////////////////////// determine yo ////////////////////////////////////////////////// | |
216 | ||
217 | Double_t vxl=fVertex(0)*cosa+fVertex(1)*sina; | |
218 | Double_t vyl= -fVertex(0)*sina+fVertex(1)*cosa; | |
219 | Double_t xo,yo, signy; | |
220 | Double_t r = 1./cTPC; | |
221 | xo = etaTPC / cTPC; | |
70a9314b | 222 | //fxoTPC=xo; |
aecdf013 | 223 | Double_t yo1, yo2, diffsq1, diffsq2; |
224 | yo1 = yTPC + TMath::Sqrt(r*r - (xl-xo)*(xl-xo)); | |
225 | yo2 = yTPC - TMath::Sqrt(r*r - (xl-xo)*(xl-xo)); | |
226 | diffsq1=TMath::Abs((yo1-vyl)*(yo1-vyl)+(xo-vxl)*(xo-vxl)-r*r); | |
227 | diffsq2=TMath::Abs((yo2-vyl)*(yo2- vyl)+(xo-vxl)*(xo-vxl)-r*r); | |
228 | if(diffsq1<diffsq2) {yo=yo1; signy=1.;} else {yo=yo2; signy=-1.;}; | |
229 | ||
230 | //////////////////////////////////////////////////////////////////////////////////////////////////// | |
231 | ||
232 | x0m = xo * cosa - yo * sina; | |
233 | y0m = xo * sina + yo * cosa; | |
234 | ||
235 | frtrack=TMath::Sqrt(xm*xm+ym*ym); | |
70a9314b | 236 | /* |
aecdf013 | 237 | Double_t pigre=TMath::Pi(); |
238 | Double_t phi=0.0; | |
239 | if(ym == 0. || xm == 0.) { | |
240 | if(ym == 0. && xm == 0.) {cout << " Error in AliITSTrackV1::LmTPC x=0 and y=0 \n"; getchar();} | |
241 | if(ym ==0. && xm>0.) phi=0.; | |
242 | if(ym==0. && xm<0.) phi=pigre; | |
243 | if(xm==0 && ym>0.) phi=pigre/2.; | |
244 | if(xm==0 && ym<0.) phi=1.5*pigre; | |
245 | } | |
246 | else { | |
247 | if (xm>0. && ym>0.) phi=TMath::ATan(ym/xm); | |
248 | if (xm<0. && ym>0.) phi=pigre+TMath::ATan(ym/xm); | |
249 | if (xm<0. && ym<0.) phi=pigre+TMath::ATan(ym/xm); | |
250 | if (xm>0. && ym<0.) phi=(2*pigre)+TMath::ATan(ym/xm); | |
251 | }; | |
70a9314b | 252 | if(phi<0. || phi>(2*pigre)) {cout<<"attention error on phi in AliITSTrackV1:LmTPC \n"; getchar();} |
253 | */ | |
254 | ||
255 | Double_t phi=TMath::ATan2(ym,xm); if(phi<0) phi=2.*TMath::Pi()+phi; //nuova def phi | |
aecdf013 | 256 | |
257 | fX0=phi; | |
258 | fX1=zm; | |
259 | fX3=tglTPC; | |
260 | fX4=cTPC; | |
261 | ||
262 | ||
263 | Double_t dd=TMath::Sqrt((x0m-fVertex(0))*(x0m-fVertex(0))+(y0m-fVertex(1))*(y0m-fVertex(1))); | |
264 | Double_t signdd; | |
265 | if (r>0) signdd=1.; else signdd=-1.; | |
266 | fX2=signdd*dd-r; | |
267 | //cout<<" fvertex = "<<fVertex(0)<<" "<<fVertex(1)<<" "<<fVertex(2)<<"\n"; | |
268 | ||
269 | Double_t cov[15]; | |
270 | fTPCtrack->GetCovariance(cov); | |
271 | ||
272 | Double_t dfidy, dDdy, dDdC, dDdeta; | |
273 | ||
274 | dfidy=(xm*cosa+ym*sina)/(frtrack*frtrack); | |
275 | dDdy=signdd*((y0m-fVertex(1))*cosa-(x0m-fVertex(0))*sina)/dd; | |
276 | Double_t dyodr=signy*(r+(xl-xo)*etaTPC)/TMath::Sqrt(r*r-(xl-xo)*(xl-xo)); | |
277 | Double_t dyomdr=sina*etaTPC+cosa*dyodr; | |
278 | Double_t dxomdr=cosa*etaTPC-sina*dyodr; | |
279 | Double_t ddddR=((x0m-fVertex(0))*dxomdr+(y0m-fVertex(1))*dyomdr)/dd; | |
280 | dDdC=-r*r*(signdd*ddddR-1.); | |
281 | Double_t dyoldxol=signy*(xl-xo)/TMath::Sqrt(r*r-(xl-xo)*(xl-xo)); | |
282 | Double_t dxomdeta=r*(cosa-sina*dyoldxol); | |
283 | Double_t dyomdeta=r*(sina+cosa*dyoldxol); | |
284 | dDdeta=signdd*((x0m-fVertex(0))*dxomdeta+(y0m-fVertex(1))*dyomdeta)/dd; | |
285 | ||
286 | Double_t f00=dfidy; | |
287 | Double_t f20=dDdy; | |
288 | Double_t f22=dDdC; | |
289 | Double_t f23=dDdeta; | |
290 | ||
291 | Double_t t00=cov[0]*f00; | |
292 | Double_t t02=cov[0]*f20+cov[6]*f22+cov[3]*f23; | |
293 | Double_t t20=cov[6]*f00; | |
294 | Double_t t22=cov[6]*f20+cov[9]*f22+cov[8]*f23; | |
295 | ||
296 | fC00=f00*t00; | |
297 | fC10=cov[1]*f00; | |
298 | fC11=cov[2]; | |
299 | fC20=f20*t00+f22*t20+f23*cov[3]*f00; | |
300 | fC21=f20*cov[1]+f22*cov[7]+f23*cov[4]; | |
301 | fC22=f20*t02+f22*t22+f23*(cov[3]*f20+cov[8]*f22+cov[5]*f23); | |
302 | fC30=cov[10]*f00; | |
303 | fC31=cov[11]; | |
304 | fC32=cov[10]*f20+cov[13]*f22+cov[12]*f23; | |
305 | fC33=cov[14]; | |
306 | fC40=t20; | |
307 | fC41=cov[7]; | |
308 | fC42=t22; | |
309 | fC43=cov[13]; | |
310 | fC44=cov[9]; | |
311 | ||
312 | //cout<<" C32 e C44 = "<<fC32<<" "<<fC44<<"\n"; getchar(); | |
313 | ||
314 | } | |
315 | ||
316 | ||
317 | AliITSTrackV1 &AliITSTrackV1::operator=(AliITSTrackV1 obj) { | |
318 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
319 | // assignement operator | |
320 | ||
321 | delete flistCluster; | |
322 | delete fClusterInTrack; | |
323 | fClusterInTrack = new TMatrix(6,9); | |
324 | flistCluster = new TObjArray; | |
325 | flabel = obj.flabel; | |
326 | fTPCtrack = obj.fTPCtrack; | |
327 | fNumClustInTrack = obj.fNumClustInTrack; | |
328 | fChi2= obj.fChi2; | |
329 | fVertex=obj.fVertex; | |
330 | fErrorVertex=obj.fErrorVertex; | |
331 | fX0=obj.fX0; fX1=obj.fX1; fX2=obj.fX2; fX3=obj.fX3; fX4=obj.fX4; | |
332 | fLayer=obj.fLayer; | |
333 | frtrack=obj.frtrack; | |
334 | fDv=obj.fDv; | |
335 | fZv=obj.fZv; | |
336 | fsigmaDv=obj.fsigmaDv; | |
337 | fsigmaZv=obj.fsigmaZv; | |
338 | fd2=obj.fd2; | |
339 | ftgl2=obj.ftgl2; | |
70a9314b | 340 | fdtgl=obj.fdtgl; |
341 | fnoclust=obj.fnoclust; | |
aecdf013 | 342 | |
343 | fC00=obj.fC00; fC10=obj.fC10; fC11=obj.fC11; fC20=obj.fC20; fC21=obj.fC21; | |
344 | fC22=obj.fC22; fC30=obj.fC30; fC31=obj.fC31; fC32=obj.fC32; fC33=obj.fC33; | |
345 | fC40=obj.fC40; fC41=obj.fC41; fC42=obj.fC42; fC43=obj.fC43; fC44=obj.fC44; | |
346 | ||
347 | ||
348 | *fClusterInTrack = *obj.fClusterInTrack; | |
349 | Int_t i; | |
350 | for(i=0; i<obj.flistCluster->GetSize(); i++) flistCluster->AddLast(obj.flistCluster->At(i)); | |
351 | ||
352 | return *this; | |
353 | ||
354 | } | |
355 | ||
356 | void AliITSTrackV1::PutCluster(Int_t layerc, TVector vecclust) { | |
357 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
358 | // put information for clusters | |
359 | ||
360 | (*fClusterInTrack)(layerc,0) = vecclust(0); | |
361 | (*fClusterInTrack)(layerc,1) = vecclust(1); | |
362 | (*fClusterInTrack)(layerc,2) = vecclust(2); | |
363 | (*fClusterInTrack)(layerc,3) = vecclust(3); | |
364 | (*fClusterInTrack)(layerc,4) = vecclust(4); | |
365 | (*fClusterInTrack)(layerc,5) = vecclust(5); | |
366 | (*fClusterInTrack)(layerc,6) = vecclust(6); | |
367 | (*fClusterInTrack)(layerc,7) = vecclust(7); | |
368 | (*fClusterInTrack)(layerc,8) = vecclust(8); | |
369 | ||
370 | } | |
371 | ||
372 | ||
373 | void AliITSTrackV1::GetClusters() { | |
374 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
375 | // prints the clusters belonging to the current track | |
376 | ||
377 | TMatrix a(*fClusterInTrack); | |
378 | TMatrix b(6,3); | |
379 | Int_t i; | |
380 | for(i=0;i<6; i++){ | |
381 | b(i,0)=a(i,6); b(i,1)=a(i,7); b(i,2)=a(i,8); | |
382 | } | |
383 | a.Print(); | |
384 | // b.Print(); | |
385 | ||
386 | } | |
387 | ||
388 | ||
389 | TVector AliITSTrackV1::GetLabTrack(Int_t lay) { | |
390 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
391 | // gets the label of the track | |
392 | ||
393 | TVector vecLabel(3); | |
394 | vecLabel(0)=( (Float_t) (*fClusterInTrack)(lay,6) ); | |
395 | vecLabel(1)=( (Float_t) (*fClusterInTrack)(lay,7) ); | |
396 | vecLabel(2)=( (Float_t) (*fClusterInTrack)(lay,8) ); | |
397 | return vecLabel; | |
398 | } | |
399 | ||
400 | void AliITSTrackV1::Search(TVector VecTotLabref, Long_t &labref, Int_t &freq){ | |
401 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
402 | // define label | |
403 | ||
404 | Int_t vecfreq[18]; | |
405 | ||
406 | Int_t i,j; | |
407 | for(i=0; i<18; i++) vecfreq[i]=0; | |
408 | ||
409 | for(i=0; i<18; i++) { | |
410 | for(j=0; j<18; j++) { | |
411 | // if(VecTotLabref(i) == 0.) VecTotLabref(i)=-3.; //commentato il 5-3-2001 | |
412 | if( (VecTotLabref(i)>=0.) && (VecTotLabref(i)==VecTotLabref(j)) ) vecfreq[i]++; | |
413 | } | |
414 | } | |
415 | Int_t imax=-1000; | |
416 | Long_t labdefault= (Long_t)1000000.; | |
417 | freq=0; | |
418 | for(i=0; i<18; i++) { | |
419 | if(vecfreq[i]>freq) {freq=vecfreq[i]; imax=i;} | |
420 | } | |
421 | if(imax<0) labref=labdefault; else labref=(Long_t) VecTotLabref(imax); | |
422 | } | |
423 | ||
424 | ||
425 | void AliITSTrackV1::Propagation(Double_t rk) { | |
426 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
427 | //Propagation of track | |
428 | Double_t duepi=2.*TMath::Pi(); | |
429 | Double_t rkm1=frtrack; | |
430 | //cout<<" rk e rkm1 dentro Propagation "<<rk<<" "<<rkm1<<"\n"; | |
431 | ||
432 | // | |
433 | Double_t aAk=ArgA(rk), aAkm1=ArgA(rkm1); | |
434 | Double_t ak=Arga(rk), akm1=Arga(rkm1); | |
435 | fX0+=TMath::ASin(aAk)-TMath::ASin(aAkm1); | |
436 | ||
437 | if(fX0>duepi) fX0-=duepi; | |
438 | if(fX0<0.) fX0+=duepi; | |
439 | ||
440 | Double_t tgl=fX3; | |
441 | Double_t c=fX4; | |
442 | Double_t d=fX2; | |
443 | Double_t cy=c/2; | |
444 | fX1+=tgl/cy*(TMath::ASin(ak)-TMath::ASin(akm1)); | |
445 | frtrack=rk; | |
446 | ||
447 | ||
448 | Double_t bk=ArgB(rk), bkm1=ArgB(rkm1); | |
449 | Double_t ck=ArgC(rk), ckm1=ArgC(rkm1); | |
450 | ||
451 | Double_t f02=ck/TMath::Sqrt(1.-aAk*aAk) - ckm1/TMath::Sqrt(1.-aAkm1*aAkm1); | |
452 | Double_t f04=bk/TMath::Sqrt(1.-aAk*aAk) - bkm1/TMath::Sqrt(1.-aAkm1*aAkm1); | |
453 | Double_t f12=tgl*d*(1./rk - 1./rkm1); | |
454 | Double_t f13=rk - rkm1; | |
455 | ||
456 | ||
457 | Double_t c00=fC00; | |
458 | Double_t c10=fC10; | |
459 | Double_t c11=fC11; | |
460 | Double_t c20=fC20; | |
461 | Double_t c21=fC21; | |
462 | Double_t c22=fC22; | |
463 | Double_t c30=fC30; | |
464 | Double_t c31=fC31; | |
465 | Double_t c32=fC32; | |
466 | Double_t c33=fC33; | |
467 | Double_t c40=fC40; | |
468 | Double_t c41=fC41; | |
469 | Double_t c42=fC42; | |
470 | Double_t c43=fC43; | |
471 | Double_t c44=fC44; | |
472 | ||
473 | Double_t r10=c10+c21*f02+c41*f04; | |
474 | Double_t r20=c20+c22*f02+c42*f04; | |
475 | Double_t r30=c30+c32*f02+c43*f04; | |
476 | Double_t r40=c40+c42*f02+c44*f04; | |
477 | Double_t r21=c21+c22*f12+c32*f13; | |
478 | Double_t r31=c31+c32*f12+c33*f13; | |
479 | Double_t r41=c41+c42*f12+c43*f13; | |
480 | ||
481 | fC00=c00+c20*f02+c40*f04+f02*r20+f04*r40; | |
482 | fC10=r10+f12*r20+f13*r30; | |
483 | fC11=c11+c21*f12+c31*f13+f12*r21+f13*r31; | |
484 | fC20=r20; | |
485 | fC21=r21; | |
486 | fC30=r30; | |
487 | fC31=r31; | |
488 | fC40=r40; | |
489 | fC41=r41; | |
490 | ||
491 | } | |
492 | ||
493 | void AliITSTrackV1::AddEL(AliITSRad *rl, Double_t signdE, Bool_t flagtot, Double_t mass) { | |
494 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
495 | // add energy loss | |
496 | ||
497 | TVector s(6); | |
498 | s(0)=0.0026+0.00283; s(1)=0.018; s(2)=0.0094; s(3)=0.0095; s(4)=0.0091; s(5)=0.0087; | |
499 | //s(0)=0.0026+0.00283*2.; s(1)=0.018*2.; s(2)=0.0094; s(3)=0.0095; s(4)=0.0091; s(5)=0.0087; | |
500 | //0.00277 is added in the first layer to take into account the energy loss in the beam pipe | |
501 | ||
502 | //for(int k=0; k<6; k++) cout<<s(k)<<" "; cout<<"\n"; | |
503 | Int_t k; | |
70a9314b | 504 | //for(k=0; k<6; k++) s(k)=s(k)*1.6; //forint |
505 | for(k=0; k<6; k++) s(k)=s(k)*1.7; //forint | |
aecdf013 | 506 | |
507 | Double_t phi=fX0; | |
508 | ||
509 | if(phi<0.174 ) s(5)=s(5)+0.012; | |
a3894645 | 510 | if(phi>6.1 ) s(5)=s(5)+0.012; // to take into account rail |
511 | if(phi>2.96 && phi<3.31 ) s(5)=s(5)+0.012; | |
aecdf013 | 512 | |
70a9314b | 513 | /* |
aecdf013 | 514 | Double_t tgl=fX3; |
515 | Double_t theta=((TMath::Pi())/2.)-TMath::ATan(tgl); | |
516 | //phi*=180./TMath::Pi(); | |
517 | //theta*=180./TMath::Pi(); | |
518 | //Double_t rad90=(TMath::Pi())/2.; | |
519 | Double_t rad40=(TMath::Pi())*40./180.; | |
520 | Double_t rad100=(TMath::Pi())*100/180; | |
521 | Double_t rad360=(TMath::Pi())*2.; | |
522 | Int_t imax=rl->Getimax(); | |
523 | Int_t jmax=rl->Getjmax(); | |
524 | Int_t i=(Int_t) ( (theta-rad40)/rad100*imax); | |
525 | Int_t j=(Int_t) ( phi/rad360*jmax ); | |
526 | //Int_t i=(Int_t)( ((theta-((TMath::Pi())/4.))/((TMath::Pi())/2.))*imax ); | |
527 | //Int_t j=(Int_t)( (phi/((TMath::Pi())*2.))*jmax ); | |
528 | if(i<0) i=0; | |
529 | if(i>=imax) i=imax-1; | |
530 | if(j<0) j=0; | |
531 | if(j>=jmax) j=jmax-1; | |
70a9314b | 532 | |
aecdf013 | 533 | s(0) = 0.0028/TMath::Sin(theta)+( rl->GetRadMatrix1() )(i,j); // 0.0028 takes into account the beam pipe |
534 | s(1) = ( rl->GetRadMatrix2() )(i,j); | |
535 | s(2) = ( rl->GetRadMatrix3() )(i,j); | |
536 | s(3) = ( rl->GetRadMatrix4() )(i,j); | |
537 | s(4) = ( rl->GetRadMatrix5() )(i,j); | |
538 | s(5) = ( rl->GetRadMatrix6() )(i,j); | |
539 | ||
540 | ||
541 | */ | |
542 | ||
543 | //for(int k=0; k<6; k++) cout<<s(k)<<" "; getchar(); | |
544 | ||
545 | //if(phi>60) {cout<<" phi = "<<phi<<"\n"; getchar();} | |
546 | //if(theta<45 || theta>135) {cout<<" theta = "<<theta<<"\n"; getchar();} | |
547 | //cout<<" dentro AddEl: phi, theta = "<<phi<<" "<<theta<<"\n"; getchar(); | |
548 | ||
70a9314b | 549 | Double_t cl=1.+fX3*fX3; // cl=1/(cosl)**2 = 1 + (tgl)**2 |
aecdf013 | 550 | Double_t sqcl=TMath::Sqrt(cl); |
551 | Double_t pt=GetPt(); | |
552 | ||
553 | Double_t p2=pt*pt*cl; | |
554 | Double_t e=TMath::Sqrt(p2+mass*mass); | |
555 | Double_t beta2=p2/(p2+mass*mass); | |
556 | ||
557 | Double_t dE; | |
558 | if(flagtot) { | |
559 | Double_t stot=s(0)+s(1)+s(2)+s(3)+s(4)+s(5); | |
560 | dE=0.153/beta2*(log(5940*beta2/(1-beta2)) - beta2)*stot*21.82*sqcl; | |
561 | } else { | |
562 | dE=0.153/beta2*(log(5940*beta2/(1-beta2)) - beta2)*s(fLayer-1)*21.82*sqcl; | |
563 | } | |
564 | dE=signdE*dE/1000.; | |
565 | ||
566 | e+=dE; | |
567 | Double_t p=TMath::Sqrt(e*e-mass*mass); | |
568 | Double_t sign=1.; | |
569 | if(fX4 < 0.) sign=-1.; | |
570 | pt=sign*p/sqcl; | |
a3894645 | 571 | Double_t cc=(0.299792458*0.2*fFieldFactor)/(pt*100.); |
aecdf013 | 572 | fX4=cc; |
573 | ||
574 | } | |
575 | ||
576 | void AliITSTrackV1::Correct(Double_t rk) { | |
577 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
578 | // correct track to take into account real geometry detector | |
579 | ||
580 | Double_t duepi=2.*TMath::Pi(); | |
581 | Double_t rkm1=frtrack; | |
582 | Double_t aAk=ArgA(rk), aAkm1=ArgA(rkm1); | |
583 | Double_t ak=Arga(rk), akm1=Arga(rkm1); | |
584 | ||
585 | fX0+=TMath::ASin(aAk)-TMath::ASin(aAkm1); | |
586 | if(fX0>duepi) fX0-=duepi; | |
587 | if(fX0<0.) fX0+=duepi; | |
588 | ||
589 | Double_t tgl=fX3; | |
590 | Double_t c=fX4; | |
591 | Double_t cy=c/2; | |
592 | fX1+=tgl/cy*(TMath::ASin(ak)-TMath::ASin(akm1)); | |
593 | frtrack=rk; | |
594 | ||
595 | } | |
596 | ||
70a9314b | 597 | void AliITSTrackV1::AddMS(AliITSRad *rl, Double_t mass) { |
aecdf013 | 598 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it |
599 | ////////// Modification of the covariance matrix to take into account multiple scattering /////////// | |
600 | ||
601 | TVector s(6); | |
602 | ||
603 | s(0)=0.0026+0.00283; s(1)=0.018; s(2)=0.0094; s(3)=0.0095; s(4)=0.0091; s(5)=0.0087; | |
604 | // s(0)=0.0026+0.00283*2.; s(1)=0.018*2.; s(2)=0.0094; s(3)=0.0095; s(4)=0.0091; s(5)=0.0087; | |
605 | //0.00277 is added in the first layer to take into account the energy loss in the beam pipe | |
606 | ||
607 | Int_t k; | |
70a9314b | 608 | //for(k=0; k<6; k++) s(k)=s(k)*1.6; // forint |
609 | for(k=0; k<6; k++) s(k)=s(k)*1.7; // forint | |
aecdf013 | 610 | |
611 | Double_t phi=fX0; | |
612 | if(phi<0.174 ) s(5)=s(5)+0.012; //aggiunta provvisoria | |
613 | if(phi>6.1 ) s(5)=s(5)+0.012; //aggiunta provvisoria | |
614 | if(phi>2.96 && phi< 3.31) s(5)=s(5)+0.012; //aggiunta provvisoria | |
70a9314b | 615 | |
aecdf013 | 616 | |
617 | Double_t tgl=fX3; | |
70a9314b | 618 | /* |
aecdf013 | 619 | Double_t theta=((TMath::Pi())/2.)-TMath::ATan(tgl); |
620 | Double_t rad40=(TMath::Pi())*40./180.; // rivedere | |
621 | Double_t rad100=(TMath::Pi())*100/180; | |
622 | Double_t rad360=(TMath::Pi())*2.; | |
623 | Int_t imax=rl->Getimax(); | |
624 | Int_t jmax=rl->Getjmax(); | |
625 | Int_t i=(Int_t) ( (theta-rad40)/rad100*imax); | |
626 | Int_t j=(Int_t) ( phi/rad360*jmax); | |
627 | ||
628 | if(i<0) i=0; | |
629 | if(i>=imax) i=imax-1; | |
630 | if(j<0) j=0; | |
631 | if(j>=jmax) j=jmax-1; | |
70a9314b | 632 | |
aecdf013 | 633 | s(0) = 0.0028/TMath::Sin(theta)+( rl->GetRadMatrix1() )(i,j); // 0.0028 takes into account the beam pipe |
634 | s(1) = ( rl->GetRadMatrix2() )(i,j); | |
635 | s(2) = ( rl->GetRadMatrix3() )(i,j); | |
636 | s(3) = ( rl->GetRadMatrix4() )(i,j); | |
637 | s(4) = ( rl->GetRadMatrix5() )(i,j); | |
638 | s(5) = ( rl->GetRadMatrix6() )(i,j); | |
639 | */ | |
70a9314b | 640 | //Double_t mass=0.1396; |
aecdf013 | 641 | Int_t layer=(Int_t)GetLayer(); |
642 | ||
643 | Double_t cosl=TMath::Cos(TMath::ATan(tgl)); | |
644 | Double_t d=fX2; | |
645 | Double_t c=fX4; | |
646 | Double_t cy=c/2.; | |
647 | Double_t q20=1./(cosl*cosl); | |
648 | Double_t q30=c*tgl; | |
649 | ||
650 | Double_t q40=cy*(frtrack*frtrack-d*d)/(1.+ 2.*cy*d); | |
651 | Double_t dd=d+cy*d*d-cy*frtrack*frtrack; | |
652 | Double_t dprova=frtrack*frtrack - dd*dd; | |
653 | Double_t q41=0.; | |
654 | if(dprova>0.) q41=-1./cosl*TMath::Sqrt(dprova)/(1.+ 2.*cy*d); | |
655 | ||
656 | Double_t p2=(GetPt()*GetPt())/(cosl*cosl); | |
657 | Double_t beta2=p2/(p2+mass*mass); | |
658 | Double_t theta2=14.1*14.1/(beta2*p2*1.e6)*(s(layer-1)/cosl); | |
659 | ||
660 | fC22+=theta2*(q40*q40+q41*q41); | |
661 | fC32+=theta2*q20*q40; | |
662 | fC33+=theta2*q20*q20; | |
663 | fC42+=theta2*q30*q40; | |
664 | fC43+=theta2*q30*q20; | |
665 | fC44+=theta2*q30*q30; | |
666 | ||
667 | } | |
668 | void AliITSTrackV1::PrimaryTrack(AliITSRad *rl) { | |
669 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
670 | // calculation of part of covariance matrix for vertex constraint | |
671 | ||
672 | Double_t rlayer[6]; | |
673 | ||
674 | rlayer[0]=4.; rlayer[1]=7.; rlayer[2]=14.9; rlayer[3]=23.8; | |
675 | rlayer[4]=39.1; rlayer[5]=43.6; | |
676 | ||
677 | Double_t cy=fX4/2.; | |
678 | Double_t tgl=(fX1-fZv)*cy/TMath::ASin(cy*frtrack); | |
679 | Double_t frtrack=1.; | |
680 | fX0=0.; | |
681 | fX1=frtrack*tgl; | |
682 | fX2=fDv; | |
683 | fX3=tgl; | |
684 | ||
685 | fC00=fC10=fC11=fC20=fC21=fC22=fC30=fC31=fC32=fC33=fC40=fC41=fC42=fC43=0.; | |
686 | ||
687 | AddEL(rl,1.,1); | |
688 | fLayer=0; | |
689 | Int_t i; | |
690 | for (i=0; i<6; i++) { | |
691 | Propagation(rlayer[i]); | |
692 | fLayer++; | |
693 | fd2(i)=fC22; | |
694 | ftgl2(i)=fC33; | |
695 | fdtgl(i)=fC32; | |
696 | AddMS(rl); | |
697 | AddEL(rl,-1,0); | |
698 | } | |
699 | } | |
700 | ||
701 | ||
702 | Int_t AliITSTrackV1::DoNotCross(Double_t rk) const{ | |
703 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
704 | // determine if the track cross a layer | |
705 | ||
706 | Double_t c=fX4; | |
707 | Double_t d=fX2; | |
708 | Double_t cy=c/2.; | |
709 | return (TMath::Abs((cy*rk+(1.+cy*d)*d/rk)/(1.+2.*cy*d))>=1.)?1:0; | |
710 | } | |
711 | ||
712 | ||
713 | Double_t AliITSTrackV1::ArgA(Double_t rk) const { | |
714 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
715 | // quantity usefull in Propagation | |
716 | Double_t c=fX4; | |
717 | Double_t d=fX2; | |
718 | Double_t cy=c/2.; | |
719 | Double_t arg=(cy*rk + (1 + cy*d)*d/rk)/(1.+ 2.*cy*d); | |
720 | if (TMath::Abs(arg) < 1.) return arg; | |
721 | //cout<<"class AliITSTrack: ArgA out of range !\n";/* getchar();*/ | |
722 | return (arg>0) ? 0.99999999999 : -0.9999999999; | |
723 | } | |
724 | ||
725 | Double_t AliITSTrackV1::Arga(Double_t rk) const { | |
726 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
727 | // quantity usefull in Propagation | |
728 | Double_t c=fX4; | |
729 | Double_t d=fX2; | |
730 | Double_t cy=c/2.; | |
731 | Double_t arg=(rk*rk - d*d)/(1.+ 2.*cy*d); | |
732 | if (arg<0.) {/*cout<<"class AliITSTrack: Arga out of range !\n";*/ arg=0.;} | |
733 | return cy*TMath::Sqrt(arg); | |
734 | } | |
735 | ||
736 | Double_t AliITSTrackV1::ArgB(Double_t rk) const { | |
737 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
738 | // quantity usefull in Propagation | |
739 | Double_t c=fX4; | |
740 | Double_t d=fX2; | |
741 | Double_t cy=c/2.; | |
742 | return (rk*rk - d*d)/(rk*(1.+ 2.*cy*d)*(1.+ 2.*cy*d)); | |
743 | } | |
744 | ||
745 | Double_t AliITSTrackV1::ArgC(Double_t rk) const { | |
746 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
747 | // quantity usefull in Propagation | |
748 | Double_t c=fX4; | |
749 | Double_t d=fX2; | |
750 | Double_t cy=c/2.; | |
751 | return (1./rk - 2.*cy*ArgA(rk)/(1.+ 2.*cy*d)); | |
752 | } | |
753 | ||
754 | ||
70a9314b | 755 | Double_t AliITSTrackV1::GetPredChi2(Double_t m[2], Double_t sigma[2] ) const { |
756 | //Origin A. Badala' and G.S. Pappalardo: e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it | |
757 | // This function calculates a predicted chi2 increment. | |
758 | /* | |
759 | Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); | |
760 | r00+=fC00; r01+=fC10; r11+=fC11; | |
761 | ||
762 | Double_t det=r00*r11 - r01*r01; | |
763 | if (TMath::Abs(det) < 1.e-10) { | |
764 | Int_t n=GetNumberOfClusters(); | |
765 | if (n>4) cerr<<n<<" AliKalmanTrack warning: Singular matrix !\n"; | |
766 | return 1e10; | |
767 | } | |
768 | Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01; | |
769 | ||
770 | Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1; | |
771 | ||
772 | return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det; | |
773 | */ | |
774 | ||
775 | ||
776 | Double_t r00=sigma[0], r01=0., r11=sigma[1]; | |
777 | r00+=fC00; r01+=fC10; r11+=fC11; | |
778 | Double_t det=r00*r11-r01*r01; | |
779 | if(TMath::Abs(det) < 1.e-15) {cout<<" Problems on matrix in GetPredChi2 "<<det<<"\n"; | |
780 | return 1e10;} | |
781 | Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01; | |
782 | Double_t dphi=m[0]-fX0; | |
783 | Double_t dz=m[1]-fX1; | |
784 | Double_t chi2 = (dphi*r00*dphi +2.*r01*dphi*dz + dz*r11*dz)/det; | |
785 | return chi2; | |
786 | ||
787 | ||
788 | ||
aecdf013 | 789 | |
70a9314b | 790 | } |