]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/oldmacros/AliITSPrintHits.C
Updated selection in ReadFromTracks()
[u/mrichter/AliRoot.git] / ITS / oldmacros / AliITSPrintHits.C
CommitLineData
08cb00f2 1void AliITSPrintHits(Int_t track, Int_t hit=-1, Int_t evNumber=0
2 ,const char *filename="galice.root"){
3/*
4 This macro will print the a specific hit or all of the hits from a give
5track.
6*/
7 if(gAlice){
8 delete gAlice;
9 gAlice=0;
10 }else{
11 // Dynamically link some shared libs
12 if(gClassTable->GetID("AliRun") < 0) {
13 gROOT->LoadMacro("loadlibs.C");
14 loadlibs();
15 } // end if
16 }
17// Connect the Root Galice file containing Geometry, Kine and Hits
18 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
19 if(!file) file = new TFile(filename);
20
21// Get AliRun object from file or create it if not on file
22 if(!gAlice) {
23 gAlice = (AliRun*)file->Get("gAlice");
24 if(gAlice) printf("AliRun object found on file\n");
25 if(!gAlice) gAlice = new AliRun("gAlice","Alice test program");
26 } // end if !gAlice
27
28// Set event pointer to this event
29 Int_t nparticles = gAlice->GetEvent(evNumber);
30 if (nparticles <= 0){
31 cout << "No particles found for event " << evNumber;
32 cout << " in file " << filename << endl;
33 return;
34 } // end if nparticles <=0
35// Pointer to specific detector hits.
36 AliITShit *itsHit;
37// Get pointers to ALL Alice detectors and Hits containers
38 AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS");
39 Int_t t,h,ntracks = gAlice->TreeH()->GetEntries();
40// Start loop on tracks in the hits containers
41 for(t=0; t<ntracks;t++){
42 gAlice->ResetHits();
43 gAlice->TreeH()->GetEvent(t);
44 h = 0;
45 for(itsHit=(AliITShit*)ITS->FirstHit(-1);itsHit;
46 itsHit=(AliITShit*)ITS->NextHit()){
47 if((track==itsHit->GetTrack())&&(h==hit||hit<0)){
48 cout << h << " ";
49 itsHit->Print((ostream*)cout);
50 cout << endl;
51 } // end if
52 h++;
53 } // end for itsHit
54 } // end for t
55}