]>
Commit | Line | Data |
---|---|---|
38f7c306 | 1 | //////////////////////////////////////////////////////////// |
2 | // Test macro for AliITSPid class and tracking version V2 // | |
7532eb09 | 3 | // Rev. 25 July 2002 v3-08-03 + Root 3.02/07 + RedHat 6.2 // |
38f7c306 | 4 | //////////////////////////////////////////////////////////// |
5 | void | |
6 | AliITSSavePIDV2(Int_t evNumber1=0,Int_t evNumber2=0) { | |
7 | const char *filename="AliITStracksV2.root"; | |
38f7c306 | 8 | |
9 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); | |
10 | if (!file) file = new TFile(filename); | |
11 | ||
12 | TFile *fpid = new TFile("AliITStracksV2Pid.root","recreate"); | |
11b3ae13 | 13 | |
14 | ||
38f7c306 | 15 | Float_t factor=0; |
11b3ae13 | 16 | if(gAlice!=0)factor=gAlice->Field()->SolenoidField(); |
17 | if(factor==0.){ | |
18 | cout<<" ================ WARNING ====================================\n"; | |
19 | cout<<" The default magnetic field value of 0.4 T will be used\n"; | |
20 | cout<<" ==============================================================\n"; | |
21 | factor=4.; // Default mag. field = 0.4T | |
22 | } | |
23 | else { | |
24 | cout<<"AliITSSavePIDV2.C: Magnetic field is "<<factor/10.<<" T\n"; | |
25 | } | |
26 | AliKalmanTrack::SetConvConst(1000/0.299792458/factor); | |
27 | ||
28 | ||
38f7c306 | 29 | |
11b3ae13 | 30 | AliITSPid *pid=new AliITSPid(100); |
38f7c306 | 31 | // |
32 | // Loop over events | |
33 | // | |
34 | for (int nev=0; nev<= evNumber2; nev++) { | |
35 | char tname[30]; | |
36 | sprintf(tname,"TreeT_ITS_%d;1",nev); | |
37 | TTree *tracktree=(TTree*)file->Get(tname); | |
38 | TBranch *tbranch=tracktree->GetBranch("tracks"); | |
39 | ||
40 | Int_t nentr=tracktree->GetEntries(); | |
41 | cout<<"Found "<<nentr<<" ITS tracks in event No "<<nev<<endl; | |
42 | ||
43 | char tpidname[30]; | |
44 | sprintf(tpidname,"TreeT%d",nev); | |
45 | AliITStrackV2Pid pidtmp; | |
46 | TTree itspidTree(tpidname,"Tree with PID"); | |
47 | AliITStrackV2Pid *outpid=&pidtmp; | |
48 | itspidTree.Branch("pids","AliITStrackV2Pid",&outpid,32000,1); | |
38f7c306 | 49 | AliITStrackV2 *iotrack=0; |
50 | for (Int_t i=0; i<nentr; i++) { | |
51 | AliITStrackV2 *iotrack=new AliITStrackV2; | |
52 | tbranch->SetAddress(&iotrack); | |
53 | tracktree->GetEvent(i); | |
11b3ae13 | 54 | iotrack->CookdEdx(); |
38f7c306 | 55 | Float_t signal=iotrack->GetdEdx(); |
38f7c306 | 56 | iotrack->PropagateTo(3.,0.0028,65.19); |
38f7c306 | 57 | iotrack->PropagateToVertex(); |
58 | Double_t xk,par[5]; iotrack->GetExternalParameters(xk,par); | |
59 | Float_t lam=TMath::ATan(par[3]); | |
60 | Float_t pt_1=TMath::Abs(par[4]); | |
61 | Float_t mom=0.; | |
62 | if( (pt_1*TMath::Cos(lam))!=0. ){ mom=1./(pt_1*TMath::Cos(lam)); }else{mom=0.;}; | |
11b3ae13 | 63 | Float_t phi=TMath::ASin(par[2]) + iotrack->GetAlpha(); |
64 | if (phi<-TMath::Pi()) phi+=2*TMath::Pi(); | |
65 | if (phi>=TMath::Pi()) phi-=2*TMath::Pi(); | |
66 | signal=signal/35.; | |
38f7c306 | 67 | pidtmp.fSignal=signal; |
68 | pidtmp.fMom=mom; | |
11b3ae13 | 69 | pidtmp.fPhi=phi; |
70 | pidtmp.fLam=lam; | |
71 | pidtmp.fGlab=TMath::Abs(iotrack->GetLabel()); | |
72 | Int_t pcode=pid->GetPcode(signal,mom); | |
73 | pidtmp.fPcode=pcode; | |
74 | pidtmp.fWpi=pid->GetWpi(); | |
75 | pidtmp.fWk=pid->GetWk(); | |
76 | pidtmp.fWp=pid->GetWp(); | |
77 | //cout<<" pcode,sig,mom="<<pcode<<" "<<signal<<" "<<mom<<endl; | |
78 | //cout<<" wpi,wka,wp="<<pidtmp.fWpi<<" "<<pidtmp.fWk<<" "<<pidtmp.fWp<<endl; | |
38f7c306 | 79 | itspidTree.Fill(); |
80 | delete iotrack; | |
81 | }// End for i (tracks) | |
11b3ae13 | 82 | cout<<"n ev="<<nev<<endl; |
38f7c306 | 83 | fpid->Write(); |
84 | }// End for nev (events) | |
38f7c306 | 85 | file->Close(); |
86 | cout<<"File AliITStracksV2Pid.root written"<<endl; | |
11b3ae13 | 87 | delete file; |
88 | cout<<"end of AliITSSavePIDV2.C "<<endl; | |
89 | //return; | |
38f7c306 | 90 | /////////////////////////////////////////////////////// |
91 | } | |
92 | ||
93 | ||
94 | ||
95 | ||
96 | ||
97 | ||
98 | ||
99 |