]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSPrintRecPoints.C
Static data member fgTop replaced with the static function GetTop();
[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   AliITSDetTypeRec* rec = new AliITSDetTypeRec();
58   rec->SetLoader(ITSloader);
59   rec->SetITSgeom(ITS->GetITSgeom());
60   rec->SetDefaults();
61
62   Int_t event,m,i,i2;
63   for(event = evNumber1; event < evNumber2; event++){
64     rl->GetEvent(event);
65     rec->SetTreeAddress();
66     for(m=mod1;m<mod2;m++){
67       rec->ResetRecPoints();
68       TTree *TR = ITSloader->TreeR();
69       TR->GetEvent(m);
70       rpa = rec->RecPoints();
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
82
83 }