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