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 anal.C //this loads the macro in memory
9 // Root > anal(); //by default process first event
10 // Root > anal(2); //process third event
13 <img src="gif/anal.gif">
16 /////////////////////////////////////////////////////////////////////////
19 // Dynamically link some shared libs
20 if (gClassTable->GetID("AliRun") < 0) {
21 gSystem->Load("libGeant3Dummy.so"); // a dummy version of Geant3
22 gSystem->Load("PHOS/libPHOSdummy.so"); // the standard Alice classes
23 gSystem->Load("libgalice.so"); // the standard Alice classes
26 // Connect the Root Galice file containing Geometry, Kine and Hits
27 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
28 if (!file) file = new TFile("galice.root");
30 // Get AliRun object from file or create it if not on file
32 gAlice = (AliRun*)file->Get("gAlice");
33 if (gAlice) printf("AliRun object found on file\n");
34 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
37 // Import the Kine and Hits Trees for the event evNumber in the file
38 Int_t nparticles = gAlice->GetEvent(evNumber);
39 if (nparticles <= 0) return;
40 Float_t x,y,z,mass,e,r;
49 // Get pointers to Alice detectors and Hits containers
50 AliDetector *TPC = gAlice->GetDetector("TPC");
51 AliDetector *ITS = gAlice->GetDetector("ITS");
52 TClonesArray *Particles = gAlice->Particles();
53 if (TPC) TClonesArray *TPChits = TPC->Hits();
54 if (ITS) TClonesArray *ITShits = ITS->Hits();
56 TTree *TH = gAlice->TreeH();
57 Int_t ntracks = TH->GetEntries();
60 TH1F *hITSZ = new TH1F("hITSZ","Z of hits in ITS",100,-50.,50.);
61 TH1F *hITSR = new TH1F("hITSR","R of hits in ITS",100,0.,50.);
62 TH1F *hITSDnum = new TH1F("hITSDnum","JLAY of hits in ITS",20, 0., 20.);
63 TH1F *hITSTr = new TH1F("hITSTr","Track number for hits in ITS",100,0.,50000.);
65 // Start loop on tracks in the hits containers
66 for (Int_t track=0; track<ntracks;track++) {
68 nbytes += TH->GetEvent(track);
71 nhits = ITShits->GetEntriesFast();
72 for (hit=0;hit<nhits;hit++) {
73 itsHit = (AliITShit*)ITShits->UncheckedAt(hit);
74 ipart = itsHit->fTrack;
75 particle = (GParticle*)Particles->UncheckedAt(ipart);
78 r = sqrt(itsHit->fX*itsHit->fX + itsHit->fY*itsHit->fY);
80 hITSDnum->Fill(itsHit->fDnum);
81 hITSTr->Fill(itsHit->fTrack);
87 //Create a canvas, set the view range, show histograms
88 TCanvas *c1 = new TCanvas("c1","Alice TPC and ITS hits",400,10,600,700);
91 gPad->SetFillColor(33);
92 hITSZ->SetFillColor(33);
95 gPad->SetFillColor(33);
96 hITSR->SetFillColor(46);
99 gPad->SetFillColor(33);
100 hITSDnum->SetFillColor(46);
103 gPad->SetFillColor(33);
104 hITSTr->SetFillColor(46);
106 c1->Print("analITS.ps");