]>
Commit | Line | Data |
---|---|---|
c108b570 | 1 | void AliITSPrintRecPoints(TString rfn="galice.root",Int_t mod=-1, |
2 | Int_t evnt=-1){ | |
d2e7afa1 | 3 | // Macro to print out the recpoints for all or a specific module |
4 | ||
5 | // Dynamically link some shared libs | |
6 | if (gClassTable->GetID("AliRun") < 0) { | |
7 | gROOT->LoadMacro("loadlibs.C"); | |
8 | loadlibs(); | |
9 | } | |
10 | else { | |
11 | if(gAlice){ | |
12 | delete gAlice->GetRunLoader(); | |
13 | delete gAlice; | |
14 | gAlice=0; | |
15 | } | |
16 | } | |
17 | ||
18 | gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C"); | |
19 | ||
20 | AliRunLoader *rl = AccessFile(rfn); // Set up to read in Data | |
21 | Int_t retval = rl->LoadHeader(); | |
22 | if (retval){ | |
23 | cerr<<"AliITSPrintRecPoints.C : LoadHeader returned error"<<endl; | |
24 | return; | |
25 | } | |
26 | ||
27 | AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); | |
28 | ||
29 | if(!ITSloader){ | |
30 | cerr<<"AliITSPrintRecPoints.C : ITS loader not found"<<endl; | |
31 | return; | |
32 | } | |
33 | ||
34 | ITSloader->LoadHits("read"); | |
35 | ITSloader->LoadDigits("read"); | |
36 | ITSloader->LoadRecPoints("read"); | |
37 | AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); | |
38 | if(!ITS){ | |
39 | cout << "Error: no ITS found. Aborting"<<endl; | |
40 | return; | |
41 | } // end if !ITS | |
42 | ||
43 | Int_t evNumber1 = 0; | |
44 | Int_t evNumber2 = gAlice->GetEventsPerRun(); | |
45 | if(evnt>=0){ | |
46 | evNumber1 = evnt; | |
47 | evNumber2 = evnt+1; | |
48 | } // end if evnt>=0 | |
49 | Int_t mod1 = 0; | |
50 | Int_t mod2 = ITS->GetITSgeom()->GetIndexMax(); | |
51 | if(mod>=0){ | |
52 | mod1 = mod; | |
53 | mod2 = mod+1; | |
54 | } // end if mod>=0 | |
55 | TClonesArray *rpa; | |
56 | AliITSRecPoint *rp = 0; | |
7d62fb64 | 57 | AliITSDetTypeRec* rec = new AliITSDetTypeRec(); |
58 | rec->SetLoader(ITSloader); | |
59 | rec->SetITSgeom(ITS->GetITSgeom()); | |
60 | rec->SetDefaults(); | |
d2e7afa1 | 61 | |
62 | Int_t event,m,i,i2; | |
63 | for(event = evNumber1; event < evNumber2; event++){ | |
64 | rl->GetEvent(event); | |
7d62fb64 | 65 | rec->SetTreeAddress(); |
d2e7afa1 | 66 | for(m=mod1;m<mod2;m++){ |
7d62fb64 | 67 | rec->ResetRecPoints(); |
d2e7afa1 | 68 | TTree *TR = ITSloader->TreeR(); |
69 | TR->GetEvent(m); | |
7d62fb64 | 70 | rpa = rec->RecPoints(); |
d2e7afa1 | 71 | i2 = rpa->GetEntriesFast(); |
72 | cout << "Event=" << event << " module=" << m << | |
73 | " Number of Recpoints=" << i2 <<endl; | |
74 | for(i=0;i<i2;i++){ | |
75 | rp = (AliITSRecPoint*)(rpa->At(i)); | |
76 | cout << i << " "; | |
77 | rp->Print((ostream*)cout); | |
78 | cout << endl; | |
79 | } // end for i | |
80 | } // end for m | |
81 | } // end for event | |
c108b570 | 82 | |
83 | } |