]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSPrintRecPoints.C
replaces AliPHOSAliEnFile: references to AliEn removed
[u/mrichter/AliRoot.git] / ITS / AliITSPrintRecPoints.C
1 void AliITSPrintRecPoints(TString rfn="galice.root",Int_t mod=-1,
2                           Int_t evnt=-1){
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;
57
58   Int_t event,m,i,i2;
59   for(event = evNumber1; event < evNumber2; event++){
60     rl->GetEvent(event);
61     ITS->SetTreeAddress();
62     for(m=mod1;m<mod2;m++){
63       ITS->ResetRecPoints();
64       TTree *TR = ITSloader->TreeR();
65       TR->GetEvent(m);
66       rpa = ITS->RecPoints();
67       i2 = rpa->GetEntriesFast();
68       cout <<  "Event=" << event << " module=" << m <<
69         " Number of Recpoints=" << i2 <<endl;
70       for(i=0;i<i2;i++){
71         rp = (AliITSRecPoint*)(rpa->At(i));
72         cout << i << " ";
73         rp->Print((ostream*)cout);
74         cout << endl;
75       } // end for i
76     } // end for m
77   } // end for event
78
79 }