]>
Commit | Line | Data |
---|---|---|
961d5009 | 1 | #include "iostream.h" |
2 | ||
3 | ||
4 | void ReadITSTracks(Int_t evNumber1=0,Int_t evNumber2=0) { | |
5 | ||
6 | const char *filename="itstracks.root"; | |
7 | ||
8 | ///////////////// Dynamically link some shared libs //////////////////////////////// | |
9 | ||
10 | if (gClassTable->GetID("AliRun") < 0) { | |
11 | gROOT->LoadMacro("loadlibs.C"); | |
12 | loadlibs(); | |
13 | } else { | |
14 | delete gAlice; | |
15 | gAlice=0; | |
16 | } | |
17 | ||
18 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
19 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); | |
20 | if (!file) file = new TFile(filename); | |
21 | ||
22 | // | |
23 | // Loop over events | |
24 | // | |
961d5009 | 25 | char tname[30]; |
39b810a4 | 26 | for (int nev=evNumber1; nev<= evNumber2; nev++) { |
27 | ||
961d5009 | 28 | |
39b810a4 | 29 | // for (int nev=0; nev<= evNumber2; nev++) { |
961d5009 | 30 | |
31 | sprintf(tname,"TreeT%d",nev); | |
32 | TTree *tracktree=(TTree*)file->Get(tname); | |
33 | TBranch *tbranch=tracktree->GetBranch("ITStracks"); | |
39b810a4 | 34 | cout<<" nev = "<<nev<<"\n"; |
961d5009 | 35 | //cout<<" open the file \n"; |
36 | ||
37 | Int_t nentr=tracktree->GetEntries(); | |
38 | ||
39 | TObjArray tarray(nentr); | |
39b810a4 | 40 | // AliITSIOTrack *iotrack=0; |
961d5009 | 41 | printf("nentr %d\n",nentr); |
42 | ||
43 | for (Int_t i=0; i<nentr; i++) { | |
4781713c | 44 | AliITSIOTrack *iotrack=new AliITSIOTrack; |
45 | // tarray.AddAt(new AliITSIOTrack,i); | |
961d5009 | 46 | // iotrack=(AliITSiotrack*)tarray.UncheckedAt(i); |
47 | tbranch->SetAddress(&iotrack); | |
48 | tracktree->GetEvent(i); | |
49 | tarray.AddLast(iotrack); | |
50 | } | |
39b810a4 | 51 | //file->Close(); |
961d5009 | 52 | |
4781713c | 53 | AliITSIOTrack *iotrack; |
39b810a4 | 54 | for (Int_t i=0; i<nentr; i++) { |
55 | AliITSIOTrack *iotrack=new AliITSIOTrack; | |
4781713c | 56 | iotrack=(AliITSIOTrack*)tarray.UncheckedAt(i); |
961d5009 | 57 | if(!iotrack) continue; |
58 | Int_t label=iotrack->GetLabel(); | |
59 | Double_t phistate=iotrack->GetStatePhi(); | |
60 | Double_t tgl=iotrack->GetStateTgl(); | |
61 | Double_t Zstate=iotrack->GetStateZ(); | |
62 | Double_t Dr=iotrack->GetStateD(); | |
63 | Double_t C=iotrack->GetStateC(); | |
64 | ||
39b810a4 | 65 | // cout<<" track label = "<<label<<"\n"; |
66 | // cout<<" phi z D tanl C = "<<phistate<<" "<<Zstate<<" "<<Dr<<" "<<tgl<<" "<<C<<"\n"; | |
961d5009 | 67 | |
68 | ||
69 | ||
70 | ||
71 | /* | |
72 | Int_t label=iotrack->GetLabel(); | |
73 | Float_t x=iotrack->GetX(); | |
74 | Float_t y=iotrack->GetY(); | |
75 | Float_t z=iotrack->GetZ(); | |
76 | printf(" i %d label x y z %d %f %f %f\n",i,label,x,y,z); | |
77 | // delete iotrack; | |
78 | */ | |
39b810a4 | 79 | delete iotrack; |
961d5009 | 80 | } |
81 | ||
39b810a4 | 82 | } // event loop |
83 | file->Close(); | |
961d5009 | 84 | } |
85 |