]>
Commit | Line | Data |
---|---|---|
79b921e1 | 1 | //////////////////////////////////////////////////////////// |
2 | // Test macro for AliITSPid class and tracking version V2 // | |
3 | //////////////////////////////////////////////////////////// | |
4 | void | |
5 | save_pidV2(Int_t evNumber1=0,Int_t evNumber2=0) { | |
6 | const char *filename="AliITStracksV2.root"; | |
7 | ||
8 | if (gClassTable->GetID("AliRun") < 0) { | |
9 | gROOT->LoadMacro("loadlibs.C"); loadlibs(); | |
10 | } else { delete gAlice; gAlice=0; | |
11 | } | |
12 | ||
13 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); | |
14 | if (!file) file = new TFile(filename); | |
15 | ||
16 | TFile *fpid = new TFile("AliITStracksV2Pid.root","recreate"); | |
17 | Float_t factor=0; | |
18 | if(gAlice!=0)factor=gAlice->Field()->Factor(); | |
19 | if(factor==0.)factor=1.; | |
20 | AliKalmanTrack::SetConvConst(100/0.299792458/0.2/factor); | |
21 | ||
22 | // | |
23 | // Loop over events | |
24 | // | |
25 | for (int nev=0; nev<= evNumber2; nev++) { | |
26 | char tname[30]; | |
27 | sprintf(tname,"TreeT_ITS_%d;1",nev); | |
28 | TTree *tracktree=(TTree*)file->Get(tname); | |
29 | TBranch *tbranch=tracktree->GetBranch("tracks"); | |
30 | ||
31 | Int_t nentr=tracktree->GetEntries(); | |
32 | cout<<"Found "<<nentr<<" ITS tracks in event No "<<nev<<endl; | |
33 | ||
34 | char tpidname[30]; | |
35 | sprintf(tpidname,"TreeT%d",nev); | |
36 | AliITStrackV2Pid pidtmp; | |
37 | TTree itspidTree(tpidname,"Tree with PID"); | |
38 | AliITStrackV2Pid *outpid=&pidtmp; | |
39 | itspidTree.Branch("pids","AliITStrackV2Pid",&outpid,32000,1); | |
40 | AliITSPid pid; | |
41 | ||
42 | AliITStrackV2 *iotrack=0; | |
43 | for (Int_t i=0; i<nentr; i++) { | |
44 | AliITStrackV2 *iotrack=new AliITStrackV2; | |
45 | tbranch->SetAddress(&iotrack); | |
46 | tracktree->GetEvent(i); | |
47 | Int_t pcode=pid->GetPcode(iotrack); | |
48 | Float_t signal=iotrack->GetdEdx(); | |
49 | //iotrack->Propagate(iotrack->GetAlpha(),3.,0.1/65.19*1.848,0.1*1.848); | |
50 | iotrack->PropagateTo(3.,0.0028,65.19); | |
51 | ||
52 | iotrack->PropagateToVertex(); | |
53 | Double_t xk,par[5]; iotrack->GetExternalParameters(xk,par); | |
54 | Float_t lam=TMath::ATan(par[3]); | |
55 | Float_t pt_1=TMath::Abs(par[4]); | |
56 | Float_t mom=0.; | |
57 | if( (pt_1*TMath::Cos(lam))!=0. ){ mom=1./(pt_1*TMath::Cos(lam)); }else{mom=0.;}; | |
58 | pidtmp.fPcode=pcode; | |
59 | pidtmp.fSignal=signal; | |
60 | pidtmp.fMom=mom; | |
61 | itspidTree.Fill(); | |
62 | delete iotrack; | |
63 | }// End for i (tracks) | |
64 | fpid->Write(); | |
65 | }// End for nev (events) | |
66 | fpid->Close(); | |
67 | file->Close(); | |
68 | cout<<"File AliITStracksV2Pid.root written"<<endl; | |
69 | return; | |
70 | /////////////////////////////////////////////////////// | |
71 | } | |
72 | ||
73 | ||
74 | ||
75 | ||
76 | ||
77 | ||
78 | ||
79 |