1 void analITS (Int_t evNumber=0)
3 /////////////////////////////////////////////////////////////////////////
4 // This macro is a small example of a ROOT macro
5 // illustrating how to read the output of GALICE
6 // and fill some histograms.
8 // Root > .L analITS.C //this loads the macro in memory
9 // Root > analITS(); //by default process first event
10 // Root > analITS(2); //process third event
13 <img src="figures/analITS_ref.gif">
16 <font size=+2 color=red>
17 <p>A reference plot produced by analITS.C.
22 /////////////////////////////////////////////////////////////////////////
25 // Dynamically link some shared libs
26 if (gClassTable->GetID("AliRun") < 0) {
27 gROOT->LoadMacro("loadlibs.C");
29 } // end if gClassTable...
31 // Connect the Root Galice file containing Geometry, Kine and Hits
32 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
33 if (!file) file = new TFile("galice.root");
35 // Get AliRun object from file or create it if not on file
37 gAlice = (AliRun*)file->Get("gAlice");
38 if (gAlice) printf("AliRun object found on file\n");
39 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
42 // Import the Kine and Hits Trees for the event evNumber in the file
43 Int_t nparticles = gAlice->GetEvent(evNumber);
44 if (nparticles <= 0) return;
45 Float_t x,y,z,mass,e,r;
54 // Get pointers to Alice detectors and Hits containers
55 AliDetector *TPC = gAlice->GetDetector("TPC");
56 AliDetector *ITS = gAlice->GetDetector("ITS");
57 TClonesArray *Particles = gAlice->Particles();
58 if (TPC) TClonesArray *TPChits = TPC->Hits();
59 if (ITS) TClonesArray *ITShits = ITS->Hits();
61 TTree *TH = gAlice->TreeH();
62 Int_t ntracks = TH->GetEntries();
65 TH1F *hITSZ = new TH1F("hITSZ","Z of hits in ITS",100,-50.,50.);
66 TH1F *hITSR = new TH1F("hITSR","R of hits in ITS",100,0.,50.);
67 TH1F *hITSlayer= new TH1F("hITSlayer","JLAY of hits in ITS",6, 0., 6.);
68 TH1F *hITSTr = new TH1F("hITSTr","Track number for hits in ITS",100,0.,50000.);
70 // Start loop on tracks in the hits containers
71 for (Int_t track=0; track<ntracks;track++) {
73 nbytes += TH->GetEvent(track);
76 nhits = ITShits->GetEntriesFast();
77 for (hit=0;hit<nhits;hit++) {
78 itsHit = (AliITShit*)ITShits->UncheckedAt(hit);
79 // With this new version, to be able to do proper detector
80 // simulations, the requirment that a "hit" leave some
81 // energy deposited has been removed.
82 if(itsHit->GetIonization()<=0.0) continue;
83 ipart = itsHit->fTrack;
84 particle = (TParticle*)Particles->UncheckedAt(ipart);
87 r = sqrt(itsHit->GetXG()*itsHit->GetXG() +
88 itsHit->GetYG()*itsHit->GetYG());
90 hITSlayer->Fill((Float_t)itsHit->GetLayer());
91 hITSTr->Fill(itsHit->fTrack);
97 //Create a canvas, set the view range, show histograms
98 TCanvas *c1 = new TCanvas("c1","Alice TPC and ITS hits",400,10,600,700);
101 gPad->SetFillColor(33);
102 hITSZ->SetFillColor(33);
105 gPad->SetFillColor(33);
106 hITSR->SetFillColor(46);
109 gPad->SetFillColor(33);
110 hITSlayer->SetFillColor(46);
113 gPad->SetFillColor(33);
114 hITSTr->SetFillColor(46);
116 c1->Print("analITS.gif");