]>
Commit | Line | Data |
---|---|---|
23efe5f1 | 1 | { |
2 | TObjArray tarray(2000); | |
3 | TObjArray parray(2000); | |
4 | //{ | |
5 | TFile *cf=TFile::Open("AliITSclustersV2.root"); assert(cf); | |
6 | AliITSgeom *geom=(AliITSgeom*)cf->Get("AliITSgeom"); assert(geom); | |
7 | AliITStrackerV2 tracker(geom); | |
8 | cf->Close(); | |
9 | TFile *tf=TFile::Open("AliITStracksV2.root"); | |
10 | if (!tf->IsOpen()) {cerr<<"Can't open AliITStracksV2.root !\n"; return 3;} | |
11 | // TObjArray tarray(2000); | |
12 | TTree *tracktree=(TTree*)tf->Get("TreeT_ITS_0;1"); | |
13 | if (!tracktree) {cerr<<"Can't get a tree with ITS tracks !\n"; return 4;} | |
14 | TBranch *tbranch=tracktree->GetBranch("tracks"); | |
15 | Int_t nentr=(Int_t)tracktree->GetEntries(),i; | |
16 | for (i=0; i<nentr; i++) { | |
17 | AliITStrackV2 *iotrack=new AliITStrackV2; | |
18 | tbranch->SetAddress(&iotrack); | |
19 | tracktree->GetEvent(i); | |
20 | ||
21 | Int_t tpcLabel=iotrack->GetLabel(); | |
22 | // tracker.CookLabel(iotrack,0.); | |
23 | Int_t itsLabel=iotrack->GetLabel(); | |
24 | if (itsLabel != tpcLabel) iotrack->SetLabel(-TMath::Abs(itsLabel)); | |
25 | if (tpcLabel < 0) iotrack->SetLabel(-TMath::Abs(itsLabel)); | |
26 | tarray.AddLast(iotrack); | |
27 | } | |
28 | cout<<" N rec. tracks="<<nentr<<endl; | |
29 | tf->Close(); | |
30 | //---------------------------------------- | |
31 | TFile *fpid = new TFile("AliITStracksV2Pid.root","recreate"); | |
32 | AliITStrackV2Pid pidtmp; | |
33 | AliITSPid* pid = new AliITSPid(1000); | |
34 | TTree itsTree("ITSf","Tree with PID"); | |
35 | AliITStrackV2Pid *outpid=&pidtmp; | |
563a204b | 36 | itsTree.Branch("pids","AliITStrackV2Pid",&outpid,32000,1); |
23efe5f1 | 37 | Float_t signal,pmom; |
38 | Double_t xv,par[5]; | |
39 | AliITStrackV2* track; | |
40 | Float_t lam,pt_1; | |
41 | Int_t pcode; | |
42 | for(Int_t ii=0;ii<nentr;ii++) | |
43 | { | |
44 | track = (AliITStrackV2*)tarray[ii]; | |
45 | track->Propagate(track->GetAlpha(),3.,0.1/65.19*1.848,0.1*1.848); | |
46 | track->PropagateToVertex(); | |
47 | signal=track->GetdEdx(); | |
48 | track->GetExternalParameters(xv,par); | |
49 | lam=TMath::ATan(par[3]); | |
50 | pt_1=TMath::Abs(par[4]); | |
51 | //cout<<"lam,pt_1="<<lam<<" " <<pt_1<<endl; | |
52 | if(TMath::Abs(pt_1)>0)pmom=1.*(1./(pt_1*TMath::Cos(lam))); | |
53 | pidtmp.fSignal=signal; | |
54 | pcode=pid->GetPcode(signal,pmom); | |
55 | pidtmp.fPcode=pcode; | |
56 | pidtmp.fWpi=pidtmp.fWk=pidtmp.fWp=-1; | |
57 | if(pcode==211)pidtmp.fWpi=1; | |
58 | if(pcode==321)pidtmp.fWk=1; | |
59 | if(pcode==2212)pidtmp.fWp=1; | |
60 | ||
61 | pidtmp.fMom=pmom; | |
62 | itsTree.Fill(); | |
63 | } | |
64 | itsTree.Write(); | |
65 | fpid->Close(); | |
66 | cout<<"File AliITStracksV2Pid.root written"<<endl; | |
67 | //---------------------------------------- | |
68 | ||
69 | TFile *fpid = new TFile("AliITStracksV2Pid.root"); | |
70 | fpid->ls(); | |
71 | fpid->Close(); | |
72 | //------------------------------------------------- | |
73 | TFile *tfpid=TFile::Open("AliITStracksV2Pid.root"); | |
74 | if (!tfpid->IsOpen()) {cerr<<"Can't open AliITStracksV2Pid.root !\n"; return 3;} | |
75 | // TObjArray parray(2000); | |
76 | TTree *pidtree=(TTree*)tfpid->Get("ITSf"); | |
77 | if (!pidtree) {cerr<<"Can't get a tree with ITS pid !\n"; return 4;} | |
78 | TBranch *tbranch=pidtree->GetBranch("pids"); | |
79 | Int_t nentr=(Int_t)pidtree->GetEntries(),i; | |
80 | for (i=0; i<nentr; i++) { | |
81 | AliITStrackV2Pid *iopid=new AliITStrackV2Pid; | |
82 | tbranch->SetAddress(&iopid); | |
83 | pidtree->GetEvent(i); | |
84 | parray.AddLast(iopid); | |
85 | //cout<<" fWpi,k,p, Signal = "<<iopid->fWpi<<","<<iopid->fWk<<","<<iopid->fWp<<","<<iopid->fSignal <<endl; | |
86 | //cout<<" Pcode,pmom="<<iopid->fPcode<<" "<<iopid->fMom<<endl; | |
87 | } | |
88 | cout<<" N rec. pids="<<nentr<<endl; | |
89 | tfpid->Close(); | |
90 | ||
91 | //------------------------------------------------- | |
92 | } | |
93 | ||
94 | ||
95 | ||
96 | ||
97 | ||
98 | ||
99 | ||
100 | ||
101 | ||
102 | ||
103 | ||
104 | ||
105 | ||
106 | ||
107 | ||
108 | ||
109 | ||
110 | ||
111 | ||
112 | ||
113 | ||
114 | ||
115 |