renaming function to avoid library conflict (discovered in test/generators/TUHKMgen)
[u/mrichter/AliRoot.git] / ITS / AliITSPrintHits.C
CommitLineData
c108b570 1void AliITSPrintHits(TString hfn="galice.root",Int_t mod=-1,
d2e7afa1 2 Int_t evnt=-1){
3 // Macro to print out the recpoints for all or a specific module
c108b570 4
d2e7afa1 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){
33c3c91a 12 delete AliRunLoader::Instance();
d2e7afa1 13 delete gAlice;
14 gAlice=0;
15 }
16 }
17 gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C");
c108b570 18
d2e7afa1 19 AliRunLoader *rl = AccessFile(hfn); // Set up to read in Data
20 Int_t retval = rl->LoadHeader();
21 if (retval){
22 cerr<<"AliITSPrintHits.C : LoadHeader returned error"<<endl;
23 return;
24 }
c108b570 25
d2e7afa1 26 AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
c108b570 27
d2e7afa1 28 if(!ITSloader){
29 cerr<<"AliITSPrintHits.C : ITS loader not found"<<endl;
30 return;
31 }
32
33 ITSloader->LoadHits("read");
34 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
35 if(!ITS){
36 cout << "Error: no ITS found. Aborting"<<endl;
37 return;
38 } // end if !ITS
39
40 Int_t evNumber1 = 0;
880d6abe 41 Int_t evNumber2 = AliRunLoader::GetNumberOfEvents();
d2e7afa1 42 if(evnt>=0){
43 evNumber1 = evnt;
44 evNumber2 = evnt+1;
45 } // end if evnt>=0
46 Int_t mod1 = 0;
47 Int_t mod2 = ITS->GetITSgeom()->GetIndexMax();
48 if(mod>=0){
49 mod1 = mod;
50 mod2 = mod+1;
51 } // end if mod>=0
52 AliITShit *hp = 0;
53
54 Int_t nmodules,size=-1;
55 Int_t event,m,i,i2,hit,trk;
56 for(event = evNumber1; event < evNumber2; event++){
57 cout<<"Processing event "<<event<<endl;
58 rl->GetEvent(event);
c108b570 59 ITS->InitModules(size,nmodules);
d2e7afa1 60 ITS->FillModules(event,0,-1," "," ");
61 for(m=mod1;m<mod2;m++){
62 i2 = (ITS->GetModule(m))->GetNhits();
63 cout << "Event=" << event << " module=" << m <<
64 " Number of Hits=" << i2 <<endl;
65 for(i=0;i<i2;i++){
66 trk = (ITS->GetModule(m))->GetHitTrackIndex(i);
67 hit = (ITS->GetModule(m))->GetHitHitIndex(i);
68 hp = (ITS->GetModule(m))->GetHit(i);
69 cout << i << " trk#="<<trk<<" hit#="<< hit << " ";
70 hp->Print((ostream*)cout);
71 cout << endl;
72 } // end for i
73 } // end for m
74 ITS->ClearModules();
75 } // end for event
c108b570 76}