]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCtrackerParam.cxx
Some cosmetic changes (A.Dainese)
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackerParam.cxx
CommitLineData
6eb67451 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
70521312 14 **************************************************************************
15 **************************************************************************
6eb67451 16 * *
17 * This class builds AliTPCtrack objects from generated tracks to feed *
18 * ITS tracking (V2). The AliTPCtrack is built from its first hit in *
19 * the TPC. The track is assigned a Kalman-like covariance matrix *
20 * depending on its pT and pseudorapidity and track parameters are *
70521312 21 * smeared according to this covariance matrix. *
6eb67451 22 * Output file contains sorted tracks, ready for matching with ITS *
23 * *
e130146c 24 * For details: *
25 * http://www.pd.infn.it/alipd/talks/soft/adIII02/TPCtrackingParam.htm *
26 * *
27 * Test macro is: AliBarrelRec_TPCparam.C *
6eb67451 28 * *
29 * Origin: Andrea Dainese, Padova - e-mail: andrea.dainese@pd.infn.it *
30 * *
31 **************************************************************************/
32#include "AliTPCtrackerParam.h"
33#include "alles.h"
34#include "AliMagF.h"
35#include "AliTPCtrack.h"
36#include "TMatrixD.h"
37#include "AliKalmanTrack.h"
70521312 38#include "AliMagFCM.h"
39#include "AliGausCorr.h"
40
41
6eb67451 42ClassImp(AliTPCtrackerParam)
43
44//-----------------------------------------------------------------
45AliTPCtrackerParam::AliTPCtrackerParam(const Int_t coll,const Double_t Bz)
46{
e130146c 47//-----------------------------------------------------------------
48// This is the class conctructor
49//-----------------------------------------------------------------
50
6eb67451 51 fColl = coll; // collision code (0: PbPb6000)
52 fBz = Bz; // value of the z component of L3 field (Tesla)
53
54}
55//-----------------------------------------------------------------
56AliTPCtrackerParam::~AliTPCtrackerParam()
57{}
58//-----------------------------------------------------------------
59
60Int_t AliTPCtrackerParam::BuildTPCtracks(const TFile *inp, TFile *out, Int_t n)
61{
e130146c 62//-----------------------------------------------------------------
63// This function creates the TPC parameterized tracks
64//-----------------------------------------------------------------
65
6eb67451 66 if(fColl!=0) {
f3d60f45 67 cerr<<"AliTPCtrackerParam::BuildTPCtracks: Invalid collision!\n";
68 cerr<<" Available: 0 -> PbPb6000"<<endl; return 0;
6eb67451 69 }
70 if(fBz!=0.4) {
f3d60f45 71 cerr<<"AliTPCtrackerParam::BuildTPCtracks: Invalid field!\n";
72 cerr<<" Available: 0.4"<<endl; return 0;
6eb67451 73 }
74
75 TFile *infile=(TFile*)inp;
76
6eb67451 77 // Get gAlice object from file
78 if(!(gAlice=(AliRun*)infile->Get("gAlice"))) {
79 cerr<<"gAlice has not been found on galice.root !\n";
80 return 1;
81 }
82
70521312 83 AliMagFCM *fiel = (AliMagFCM*)gAlice->Field();
84 Double_t fieval=(Double_t)fiel->SolenoidField()/10.;
85 printf("Magnetic field is %6.2f Tesla\n",fieval);
86 if(fBz!=fieval) {
87 cerr<<"AliTPCtrackerParam::BuildTPCtracks: Invalid field!"<<endl;
88 cerr<<"Field selected is: "<<fBz<<" T\n";
89 cerr<<"Field found on file is: "<<fieval<<" T\n";
90 return 0;
91 }
92
93 AliKalmanTrack::SetConvConst(100/0.299792458/fBz);
6eb67451 94
95
96 // loop over first n events in file
97 for(Int_t evt=0; evt<n; evt++){
98 cerr<<"+++\n+++ Processing event "<<evt<<"\n+++\n";
99
100 AliTPCtrack *tpctrack=0;
101
102 // tree for TPC tracks
103 Char_t tname[100];
104 sprintf(tname,"TreeT_TPC_%d",evt);
105 TTree *tracktree = new TTree(tname,"Tree with TPC tracks");
106 tracktree->Branch("tracks","AliTPCtrack",&tpctrack,20000,0);
107
108 // array for TPC tracks
109 TObjArray tarray(20000);
110
111
112 Int_t nparticles=gAlice->GetEvent(evt);
113
114 Bool_t done[500000];
115 for(Int_t l=0; l<500000; l++) { done[l]=kFALSE; }
116
117
118 // Get TPC detector
119 AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC");
120 Int_t ver = TPC->IsVersion();
121 cerr<<"+++ TPC version "<<ver<<" has been found !\n";
122 AliTPCParam *digp=(AliTPCParam*)infile->Get("75x40_100x60");
123 if(!digp) { cerr<<"TPC parameters have not been found !\n"; return 1; }
124 TPC->SetParam(digp);
125
126 // Get TreeH with hits
127 TTree *TH=gAlice->TreeH();
128 Int_t ntracks=(Int_t)TH->GetEntries();
129 cerr<<"+++\n+++ Number of particles in event "<<evt<<": "<<nparticles<<"\n+++\n+++ Number of \"primary tracks\" (entries in TreeH): "<<ntracks<<"\n+++\n\n";
130
131 TParticle* Part;
132 AliTPChit* tpcHit;
133 Double_t hPx,hPy,hPz,hPt,xg,yg,zg,xl,yl,zl;
e130146c 134 Double_t alpha;
6eb67451 135 Float_t cosAlpha,sinAlpha;
e130146c 136 Int_t label,pdg,charge,bin;
6eb67451 137 Int_t tracks=0;
e130146c 138 //Int_t nSel=0,nAcc=0;
6eb67451 139
140 // loop over entries in TreeH
141 for(Int_t i=0; i<ntracks; i++) {
142 if(i%1000==0) cerr<<" --- Processing primary track "<<i<<" of "<<ntracks<<" ---\r";
143 TPC->ResetHits();
144 TH->GetEvent(i);
145 // Get FirstHit
146 tpcHit=(AliTPChit*)TPC->FirstHit(-1);
147 for( ; tpcHit; tpcHit=(AliTPChit*)TPC->NextHit() ) {
148 if(tpcHit->fQ !=0.) continue;
149 // Get particle momentum at hit
150 hPx=tpcHit->X(); hPy=tpcHit->Y(); hPz=tpcHit->Z();
151 hPt=TMath::Sqrt(hPx*hPx+hPy*hPy);
152 // reject hits with Pt<mag*0.45 GeV/c
153 if(hPt<(fBz*0.45)) continue;
154
155 // Get track label
156 label=tpcHit->Track();
157 // check if this track has already been processed
158 if(done[label]) continue;
159 // electric charge
160 Part = gAlice->Particle(label);
e130146c 161 pdg = Part->GetPdgCode();
162 if(pdg>200 || pdg==-11 || pdg==-13) { charge=1; }
163 else if(pdg<-200 || pdg==11 || pdg==13) { charge=-1; }
6eb67451 164 else continue;
165
166
167 if((tpcHit=(AliTPChit*)TPC->NextHit())==0) break;
168 if(tpcHit->fQ != 0.) continue;
169 // Get global coordinates of hit
170 xg=tpcHit->X(); yg=tpcHit->Y(); zg=tpcHit->Z();
171 if(TMath::Sqrt(xg*xg+yg*yg)>90.) continue;
172
173 // Get TPC sector, Alpha angle and local coordinates
174 // printf("Sector %d\n",tpcHit->fSector);
175 digp->AdjustCosSin(tpcHit->fSector,cosAlpha,sinAlpha);
e130146c 176 alpha = TMath::ATan2(sinAlpha,cosAlpha);
6eb67451 177 xl = xg*cosAlpha + yg*sinAlpha;
178 yl =-xg*sinAlpha + yg*cosAlpha;
179 zl = zg;
180 //printf("Alpha %f xl %f yl %f zl %f\n",Alpha,xl,yl,zl);
181
182 // reject tracks which are not in the TPC acceptance
183 if(TMath::Abs(zl+(244.-xl)*hPz/hPt)>252.) continue;
184
185 // Get bin in pT,eta
186 bin = GetBin(hPt,Part->Eta());
187
188 // Apply selection according to TPC efficiency
e130146c 189 //if(TMath::Abs(pdg)==211) nAcc++;
190 if(!SelectedTrack(pdg,hPt,Part->Eta())) continue;
191 //if(TMath::Abs(pdg)==211) nSel++;
6eb67451 192
193 // Mark track as "done"
194 done[label]=kTRUE; tracks++;
195
196 // create AliTPCtrack object
e130146c 197 tpctrack = BuildTrack(alpha,xl,yl,zl,hPx,hPy,hPz,hPt,charge,label);
6eb67451 198
199 // put track in array
200 tarray.AddLast(tpctrack);
201
202 }
203
204 } // loop over entries in TreeH
205
206 TObjArray newtarray(20000);
207
208 // assing covariance matrixes and smear track parameters
209 CookTracks(tarray,newtarray);
210
211 // sort array with TPC tracks (decreasing pT)
212 newtarray.Sort();
213
214
215 Int_t arrentr = newtarray.GetEntriesFast();
216 //printf("\n %d \n\n",arrentr);
217 for(Int_t l=0; l<arrentr; l++) {
218 tpctrack=(AliTPCtrack*)newtarray.UncheckedAt(l);
219 tracktree->Fill();
220 }
221
222 // write the tree with tracks in the output file
223 out->cd();
224 tracktree->Write();
225
226 delete tracktree;
227
228 printf("\n\n+++\n+++ Number of TPC tracks: %d\n+++\n",tracks);
e130146c 229 //printf("Average Eff: %f\n",(Float_t)nSel/nAcc);
6eb67451 230
231 } // loop on events
232
233 return 0;
234}
235
236//-----------------------------------------------------------------
237AliTPCtrack* AliTPCtrackerParam::BuildTrack(Double_t alpha,Double_t x,
e130146c 238 Double_t y,Double_t z,Double_t px,
239 Double_t py,Double_t pz,Double_t pt,
240 Int_t ch,Int_t lab) const
6eb67451 241{
e130146c 242//-----------------------------------------------------------------
243// This function uses GEANT info to set true track parameters
244//-----------------------------------------------------------------
6eb67451 245 Double_t xref = x;
246 Double_t xx[5],cc[15];
247 cc[0]=cc[2]=cc[5]=cc[9]=cc[14]=10.;
248 cc[1]=cc[3]=cc[4]=cc[6]=cc[7]=cc[8]=cc[10]=cc[11]=cc[12]=cc[13]=0.;
249
250 // Magnetic field
e130146c 251 TVector3 bfield(0.,0.,fBz);
6eb67451 252
253
254 // radius [cm] of track projection in (x,y)
e130146c 255 Double_t rho = pt*100./0.299792458/bfield.Z();
6eb67451 256 // center of track projection in local reference frame
e130146c 257 TVector3 hmom,hpos;
6eb67451 258
259
260 // position (local) and momentum (local) at the hit
261 // in the bending plane (z=0)
e130146c 262 hpos.SetXYZ(x,y,0.);
263 hmom.SetXYZ(px*TMath::Cos(alpha)+py*TMath::Sin(alpha),-px*TMath::Sin(alpha)+py*TMath::Cos(alpha),0.);
264 TVector3 vrho = hmom.Cross(bfield);
265 vrho *= ch;
266 vrho.SetMag(rho);
6eb67451 267
e130146c 268 TVector3 vcenter = hpos+vrho;
6eb67451 269
e130146c 270 Double_t x0 = vcenter.X();
6eb67451 271
272 // fX = xref X-coordinate of this track (reference plane)
273 // fAlpha = Alpha Rotation angle the local (TPC sector)
274 // fP0 = YL Y-coordinate of a track
275 // fP1 = ZG Z-coordinate of a track
276 // fP2 = C*x0 x0 is center x in rotated frame
277 // fP3 = Tgl tangent of the track momentum dip angle
278 // fP4 = C track curvature
279 xx[0] = y;
280 xx[1] = z;
e130146c 281 xx[3] = pz/pt;
6eb67451 282 xx[4] = -ch/rho;
283 xx[2] = xx[4]*x0;
284
285 // create the object AliTPCtrack
286 AliTPCtrack* track = new AliTPCtrack(0,xx,cc,xref,alpha);
287 // set the label
288 track->SetLabel(lab);
289
290 return track;
291}
292
293//-----------------------------------------------------------------
294Bool_t AliTPCtrackerParam::SelectedTrack(Int_t pdg,Double_t pt,Double_t eta)
e130146c 295 const {
296//-----------------------------------------------------------------
297// This function makes a selection according to TPC tracking efficiency
298//-----------------------------------------------------------------
299
6eb67451 300 Double_t eff=0.;
301
302 //eff computed with | zl+(244-xl)*pz/pt | < 252
303 Double_t effPi[27] = {0.724587,0.743389,0.619273,0.798477,0.812036,0.823195,0.771437,0.775826,0.784136,0.809071,0.762001,0.774576,0.848834,0.787201,0.792548,0.942089,0.951631,0.951085,0.960885,0.971451,0.969103,0.983245,0.978939,0.988706,0.990852,0.985679,0.993606};
304 Double_t effK[18] = {0.377934,0.363962,0.321721,0.518784,0.547459,0.517878,0.612704,0.619101,0.620894,0.733411,0.732128,0.750373,0.790630,0.806565,0.791353,0.967486,0.970483,0.974527};
305 Double_t effP[15] = {0.131173,0.165114,0.229658,0.365357,0.412989,0.483297,0.454614,0.505173,0.658615,0.694753,0.730661,0.815680,0.873461,0.887227,0.899324};
306 Double_t effEl[15] = {0.835549,0.853746,0.718207,0.835230,0.831489,0.862222,0.757783,0.747301,0.824096,0.867949,0.871891,0.808480,0.890625,0.911765,0.973684};
307 Double_t effMu[15] = {0.553486,0.641392,0.609932,0.591126,0.706729,0.750755,0.747952,0.729051,0.760849,0.898810,0.737500,0.830357,0.735294,0.800000,0.882353};
308
309
310 if(TMath::Abs(pdg)==211) eff = LinearInterpolation(9,effPi,pt,eta);
311 if(TMath::Abs(pdg)==321) eff = LinearInterpolation(6,effK,pt,eta);
312 if(TMath::Abs(pdg)==2212) eff = LinearInterpolation(5,effP,pt,eta);
313 if(TMath::Abs(pdg)==11) eff = LinearInterpolation(5,effEl,pt,eta);
314 if(TMath::Abs(pdg)==13) eff = LinearInterpolation(5,effMu,pt,eta);
315
316 if(gRandom->Rndm() < eff) return kTRUE;
317
318 return kFALSE;
319}
320
321//-----------------------------------------------------------------
322Double_t AliTPCtrackerParam::LinearInterpolation(Int_t ptBins,Double_t *value,
e130146c 323 Double_t trkPt,Double_t trkEta) const
6eb67451 324{
e130146c 325//-----------------------------------------------------------------
326// This function makes a linear interpolation
327//-----------------------------------------------------------------
328 Double_t intValue=0,intValue1=0,intValue2=0;
329 Int_t etaSide = (TMath::Abs(trkEta)<.45 ? 0 : 1);
330 Double_t eta[3]={0.15,0.45,0.75};
331 Double_t pt[9]={0.244,0.390,0.676,1.190,2.36,4.,6.,10.,20.};
332 if(ptBins==6) pt[5]=10.;
6eb67451 333
334 for(Int_t i=0; i<ptBins; i++) {
e130146c 335 if(trkPt<pt[i]) {
6eb67451 336 if(i==0) i=1;
e130146c 337 intValue1 = value[3*i-3+etaSide]+(value[3*i-3+etaSide]-value[3*i+etaSide])/(pt[i-1]-pt[i])*(trkPt-pt[i-1]);
338 intValue2 = value[3*i-3+etaSide+1]+(value[3*i-3+etaSide+1]-value[3*i+etaSide+1])/(pt[i-1]-pt[i])*(trkPt-pt[i-1]);
6eb67451 339
e130146c 340 intValue = intValue1+(intValue1-intValue2)/(eta[etaSide]-eta[etaSide+1])*(trkEta-eta[etaSide]);
6eb67451 341 break;
342 }
343 if(i==ptBins-1) {
344 i=ptBins-2;
e130146c 345 intValue1 = value[3*i-3+etaSide]+(value[3*i-3+etaSide]-value[3*i+etaSide])/(pt[i-1]-pt[i])*(trkPt-pt[i-1]);
346 intValue2 = value[3*i-3+etaSide+1]+(value[3*i-3+etaSide+1]-value[3*i+etaSide+1])/(pt[i-1]-pt[i])*(trkPt-pt[i-1]);
6eb67451 347
e130146c 348 intValue = intValue1+(intValue1-intValue2)/(eta[etaSide]-eta[etaSide+1])*(trkEta-eta[etaSide]);
6eb67451 349 break;
350 }
351 }
352
e130146c 353 return intValue;
6eb67451 354}
355
356//-----------------------------------------------------------------
e130146c 357Int_t AliTPCtrackerParam::GetBin(Double_t pt,Double_t eta) const {
358//-----------------------------------------------------------------
359// This function tells bin number in a grid (pT,eta)
360//-----------------------------------------------------------------
6eb67451 361 if(TMath::Abs(eta)<0.3) {
362 if(pt<0.3) return 0;
363 if(pt>=0.3 && pt<0.5) return 3;
364 if(pt>=0.5 && pt<1.) return 6;
365 if(pt>=1. && pt<1.5) return 9;
366 if(pt>=1.5 && pt<3.) return 12;
367 if(pt>=3. && pt<5.) return 15;
368 if(pt>=5. && pt<7.) return 18;
369 if(pt>=7. && pt<15.) return 21;
370 if(pt>=15.) return 24;
371 }
372 if(TMath::Abs(eta)>=0.3 && TMath::Abs(eta)<0.6) {
373 if(pt<0.3) return 1;
374 if(pt>=0.3 && pt<0.5) return 4;
375 if(pt>=0.5 && pt<1.) return 7;
376 if(pt>=1. && pt<1.5) return 10;
377 if(pt>=1.5 && pt<3.) return 13;
378 if(pt>=3. && pt<5.) return 16;
379 if(pt>=5. && pt<7.) return 19;
380 if(pt>=7. && pt<15.) return 22;
381 if(pt>=15.) return 25;
382 }
383 if(TMath::Abs(eta)>=0.6) {
384 if(pt<0.3) return 2;
385 if(pt>=0.3 && pt<0.5) return 5;
386 if(pt>=0.5 && pt<1.) return 8;
387 if(pt>=1. && pt<1.5) return 11;
388 if(pt>=1.5 && pt<3.) return 14;
389 if(pt>=3. && pt<5.) return 17;
390 if(pt>=5. && pt<7.) return 20;
391 if(pt>=7. && pt<15.) return 23;
392 if(pt>=15.) return 26;
393 }
394
395 return -1;
396
397}
398
399//-----------------------------------------------------------------
e130146c 400TMatrixD AliTPCtrackerParam::GetSmearingMatrix(Double_t* cc,Double_t pt,Double_t eta) const
6eb67451 401{
e130146c 402//-----------------------------------------------------------------
403// This function stretches the covariance matrix according to the pulls
404//-----------------------------------------------------------------
405 TMatrixD covMat(5,5);
406
407 covMat(0,0)=cc[0];
408 covMat(1,0)=cc[1]; covMat(0,1)=covMat(1,0);
409 covMat(1,1)=cc[2];
410 covMat(2,0)=cc[3]; covMat(0,2)=covMat(2,0);
411 covMat(2,1)=cc[4]; covMat(1,2)=covMat(2,1);
412 covMat(2,2)=cc[5];
413 covMat(3,0)=cc[6]; covMat(0,3)=covMat(3,0);
414 covMat(3,1)=cc[7]; covMat(1,3)=covMat(3,1);
415 covMat(3,2)=cc[8]; covMat(2,3)=covMat(3,2);
416 covMat(3,3)=cc[9];
417 covMat(4,0)=cc[10]; covMat(0,4)=covMat(4,0);
418 covMat(4,1)=cc[11]; covMat(1,4)=covMat(4,1);
419 covMat(4,2)=cc[12]; covMat(2,4)=covMat(4,2);
420 covMat(4,3)=cc[13]; covMat(3,4)=covMat(4,3);
421 covMat(4,4)=cc[14];
422
423 TMatrixD stretchMat(5,5);
6eb67451 424 for(Int_t k=0;k<5;k++) {
425 for(Int_t l=0;l<5;l++) {
e130146c 426 stretchMat(k,l)=0.;
6eb67451 427 }
428 }
429
430
431 Double_t s00[27]={1.3553,1.2973,1.2446,1.3428,1.3031,1.2345,1.3244,1.2681,1.2046,1.3046,1.2430,1.1606,1.2462,1.2104,1.1082,1.2207,1.1189,1.0789,1.2079,1.1300,1.0426,1.1502,1.1122,1.0559,1.1419,1.1072,1.0208};
432 Double_t s11[27]={1.0890,1.1463,1.2313,1.1149,1.1597,1.2280,1.1225,1.1584,1.2329,1.1149,1.1550,1.2369,1.1095,1.1353,1.2050,1.0649,1.0858,1.1546,1.0663,1.0672,1.1340,1.0416,1.0738,1.0945,1.0663,1.0654,1.0909};
433 Double_t s22[27]={1.1709,1.1367,1.0932,1.2247,1.1832,1.1247,1.2470,1.2017,1.1441,1.2202,1.1653,1.1050,1.1819,1.1269,1.0583,1.1546,1.0621,0.9928,1.1305,1.0512,0.9576,1.0995,1.0445,0.9884,1.0968,1.0368,0.9574};
434 Double_t s33[27]={0.9720,0.9869,1.0271,1.0030,1.0223,1.0479,1.0164,1.0305,1.0559,1.0339,1.0450,1.0686,1.0450,1.0507,1.0784,1.0334,1.0208,1.0863,1.0252,1.0114,1.0835,0.9854,1.0144,1.0507,1.0124,1.0159,1.0464};
435 Double_t s44[27]={1.1104,1.0789,1.0479,1.1597,1.1234,1.0728,1.2087,1.1602,1.1041,1.1942,1.1428,1.0831,1.1572,1.1036,1.0431,1.1296,1.0498,0.9844,1.1145,1.0266,0.9489,1.0959,1.0450,0.9875,1.0775,1.0266,0.9406};
436
437
e130146c 438 stretchMat(0,0) = LinearInterpolation(9,s00,pt,eta);
439 stretchMat(1,1) = LinearInterpolation(9,s11,pt,eta);
440 stretchMat(2,2) = LinearInterpolation(9,s22,pt,eta);
441 stretchMat(3,3) = LinearInterpolation(9,s33,pt,eta);
442 stretchMat(4,4) = LinearInterpolation(9,s44,pt,eta);
6eb67451 443
e130146c 444 TMatrixD mat(stretchMat,TMatrixD::kMult,covMat);
445 TMatrixD covMatSmear(mat,TMatrixD::kMult,stretchMat);
6eb67451 446
447
e130146c 448 return covMatSmear;
6eb67451 449}
450
451//-----------------------------------------------------------------
e130146c 452void AliTPCtrackerParam::SmearTrack(Double_t* xx,Double_t* xxsm,TMatrixD cov) const {
453//-----------------------------------------------------------------
454// This function smears track parameters according to streched cov. matrix
455//-----------------------------------------------------------------
70521312 456 AliGausCorr *corgen = new AliGausCorr(cov,5);
457 TArrayD corr(5);
458 corgen->GetGaussN(corr);
459 delete corgen;
460 corgen = 0;
6eb67451 461
462 for(Int_t l=0;l<5;l++) {
463 xxsm[l] = xx[l]+corr[l];
464 }
465
466 return;
467}
468
469//-----------------------------------------------------------------
470void AliTPCtrackerParam::CookTracks(TObjArray& tarray,TObjArray& newtarray)
e130146c 471const {
472//-----------------------------------------------------------------
473// This function deals with covariance matrix and smearing
474//-----------------------------------------------------------------
475
476 TString s("$ALICE_ROOT/TPC/CovMatrixDB_");
477 if(fColl==0) s.Append("PbPb6000");
478 if(fBz==0.4) s.Append("_B0.4T.root");
6eb67451 479 // open file with matrixes DB
e130146c 480 TFile* fileDB = TFile::Open(s.Data());
6eb67451 481
70521312 482 AliTPCtrack* track = 0;
e130146c 483 Int_t arrayEntries = (Int_t)tarray.GetEntriesFast();
6eb67451 484
e130146c 485 for(Int_t k=0; k<arrayEntries; k++) {
6eb67451 486 track=(AliTPCtrack*)tarray.UncheckedAt(k);
487
488 Double_t pt = 1/TMath::Abs(track->Get1Pt());
489 Double_t eta = -TMath::Log(TMath::Tan(0.25*TMath::Pi()-0.5*TMath::ATan(track->GetTgl())));
490
491 Int_t bin = GetBin(pt,eta);
492
493 // string with tree name
494 TString str("Tree_bin");
495 str+=bin;
496
497 // get the right tree
e130146c 498 TTree* covTree = (TTree*)fileDB->Get(str.Data());
6eb67451 499 TArrayF* matrix = new TArrayF;
e130146c 500 covTree->SetBranchAddress("matrixes",&matrix);
6eb67451 501
502 // get random entry from the tree
e130146c 503 Int_t treeEntries = (Int_t)covTree->GetEntries();
504 covTree->GetEvent(gRandom->Integer(treeEntries));
6eb67451 505
506 Double_t xref,alpha,xx[5],xxsm[5],cc[15];
507 Int_t lab;
508 // get P and Cosl from track
e130146c 509 Double_t cosl = TMath::Cos(TMath::ATan(track->GetTgl()));
510 Double_t p = 1/TMath::Abs(track->Get1Pt())/cosl;
6eb67451 511
512 // get covariance matrix from regularized matrix
e130146c 513 cc[0]=matrix->At(0)*(1.588e-3+1.911e-4/TMath::Power(p,1.5));
6eb67451 514 cc[1]=matrix->At(1);
e130146c 515 cc[2]=matrix->At(2)*(1.195e-3+0.8102e-3/p);
516 cc[3]=matrix->At(3)*(7.275e-5+1.181e-5/TMath::Power(p,1.5));
6eb67451 517 cc[4]=matrix->At(4);
e130146c 518 cc[5]=matrix->At(5)*(5.163e-6+1.138e-6/TMath::Power(p,2.)/cosl);
6eb67451 519 cc[6]=matrix->At(6);
e130146c 520 cc[7]=matrix->At(7)*(1.176e-5+1.175e-5/TMath::Power(p,1.5)/cosl/cosl/cosl);
6eb67451 521 cc[8]=matrix->At(8);
e130146c 522 cc[9]=matrix->At(9)*(1.289e-7+4.636e-7/TMath::Power(p,1.7)/cosl/cosl/cosl/cosl);
523 cc[10]=matrix->At(10)*(4.056e-7+4.379e-8/TMath::Power(p,1.5));
6eb67451 524 cc[11]=matrix->At(11);
e130146c 525 cc[12]=matrix->At(12)*(3.049e-8+8.244e-9/TMath::Power(p,2.)/cosl);
6eb67451 526 cc[13]=matrix->At(13);
e130146c 527 cc[14]=matrix->At(14)*(1.847e-10+5.822e-11/TMath::Power(p,2.)/cosl/cosl/cosl);
6eb67451 528
e130146c 529 TMatrixD covMatSmear(5,5);
6eb67451 530
e130146c 531 covMatSmear = GetSmearingMatrix(cc,pt,eta);
6eb67451 532
533 // get track original parameters
534 xref=track->GetX();
535 alpha=track->GetAlpha();
536 xx[0]=track->GetY();
537 xx[1]=track->GetZ();
538 xx[2]=track->GetX()*track->GetC()-track->GetSnp();
539 xx[3]=track->GetTgl();
540 xx[4]=track->GetC();
541 lab=track->GetLabel();
542
543 // use smearing matrix to smear the original parameters
e130146c 544 SmearTrack(xx,xxsm,covMatSmear);
6eb67451 545
546 AliTPCtrack* tpctrack = new AliTPCtrack(0,xxsm,cc,xref,alpha);
547 tpctrack->SetLabel(lab);
548
549 // fill the array
550 newtarray.AddLast(tpctrack);
70521312 551
e130146c 552 delete matrix;
70521312 553
6eb67451 554 }
555
e130146c 556 fileDB->Close();
557 delete fileDB;
70521312 558
559
6eb67451 560 return;
561}
562//-----------------------------------------------------------------
563
564
565
566
567
568
569
570
571
572
573
574