-void AliITSPrintHits(Int_t track, Int_t hit=-1, Int_t evNumber=0
- ,const char *filename="galice.root"){
-/*
- This macro will print the a specific hit or all of the hits from a give
-track.
-*/
- if(gAlice){
- delete gAlice;
- gAlice=0;
- }else{
- // Dynamically link some shared libs
- if(gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if
+void AliITSPrintHits(TString hfn="galice.root",Int_t mod=-1,
+ Int_t evnt=-1){
+ // Macro to print out the recpoints for all or a specific module
+
+ // Dynamically link some shared libs
+ if (gClassTable->GetID("AliRun") < 0) {
+ gROOT->LoadMacro("loadlibs.C");
+ loadlibs();
+ }
+ else {
+ if(gAlice){
+ delete AliRunLoader::Instance();
+ delete gAlice;
+ gAlice=0;
+ }
}
-// Connect the Root Galice file containing Geometry, Kine and Hits
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
- if(!file) file = new TFile(filename);
-
-// Get AliRun object from file or create it if not on file
- if(!gAlice) {
- gAlice = (AliRun*)file->Get("gAlice");
- if(gAlice) printf("AliRun object found on file\n");
- if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- } // end if !gAlice
-
-// Set event pointer to this event
- Int_t nparticles = gAlice->GetEvent(evNumber);
- if (nparticles <= 0){
- cout << "No particles found for event " << evNumber;
- cout << " in file " << filename << endl;
- return;
- } // end if nparticles <=0
-// Pointer to specific detector hits.
- AliITShit *itsHit;
-// Get pointers to ALL Alice detectors and Hits containers
- AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
- Int_t t,h,ntracks = gAlice->TreeH()->GetEntries();
-// Start loop on tracks in the hits containers
- for(t=0; t<ntracks;t++){
- gAlice->ResetHits();
- gAlice->TreeH()->GetEvent(t);
- h = 0;
- for(itsHit=(AliITShit*)ITS->FirstHit(-1);itsHit;
- itsHit=(AliITShit*)ITS->NextHit()){
- if((track==itsHit->GetTrack())&&(h==hit||hit<0)){
- cout << h << " ";
- itsHit->Print((ostream*)cout);
- cout << endl;
- } // end if
- h++;
- } // end for itsHit
- } // end for t
+ gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C");
+
+ AliRunLoader *rl = AccessFile(hfn); // Set up to read in Data
+ Int_t retval = rl->LoadHeader();
+ if (retval){
+ cerr<<"AliITSPrintHits.C : LoadHeader returned error"<<endl;
+ return;
+ }
+
+ AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader");
+
+ if(!ITSloader){
+ cerr<<"AliITSPrintHits.C : ITS loader not found"<<endl;
+ return;
+ }
+
+ ITSloader->LoadHits("read");
+ AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
+ if(!ITS){
+ cout << "Error: no ITS found. Aborting"<<endl;
+ return;
+ } // end if !ITS
+
+ Int_t evNumber1 = 0;
+ Int_t evNumber2 = AliRunLoader::GetNumberOfEvents();
+ if(evnt>=0){
+ evNumber1 = evnt;
+ evNumber2 = evnt+1;
+ } // end if evnt>=0
+ Int_t mod1 = 0;
+ Int_t mod2 = ITS->GetITSgeom()->GetIndexMax();
+ if(mod>=0){
+ mod1 = mod;
+ mod2 = mod+1;
+ } // end if mod>=0
+ AliITShit *hp = 0;
+
+ Int_t nmodules,size=-1;
+ Int_t event,m,i,i2,hit,trk;
+ for(event = evNumber1; event < evNumber2; event++){
+ cout<<"Processing event "<<event<<endl;
+ rl->GetEvent(event);
+ ITS->InitModules(size,nmodules);
+ ITS->FillModules(event,0,-1," "," ");
+ for(m=mod1;m<mod2;m++){
+ i2 = (ITS->GetModule(m))->GetNhits();
+ cout << "Event=" << event << " module=" << m <<
+ " Number of Hits=" << i2 <<endl;
+ for(i=0;i<i2;i++){
+ trk = (ITS->GetModule(m))->GetHitTrackIndex(i);
+ hit = (ITS->GetModule(m))->GetHitHitIndex(i);
+ hp = (ITS->GetModule(m))->GetHit(i);
+ cout << i << " trk#="<<trk<<" hit#="<< hit << " ";
+ hp->Print((ostream*)cout);
+ cout << endl;
+ } // end for i
+ } // end for m
+ ITS->ClearModules();
+ } // end for event
}