1 void analITSgeom (const char *filename="galice.root",Int_t evNumber=0){
2 /////////////////////////////////////////////////////////////////////////
3 // This macro is a small example of a ROOT macro
4 // illustrating how to read the output of GALICE
5 // and fill some histograms.
7 // Root > .L analITSgeom.C //this loads the macro in memory
8 // Root > analITSgeom(); //by default process first event
9 // Root > analITgeomS(2); //process third event
12 <img src="figures/analITSgeom_ref.gif">
15 <font size=+2 color=red>
16 <p>A reference plot produced by analITSgeom.C.
21 /////////////////////////////////////////////////////////////////////////
24 // Dynamically link some shared libs
25 if (gClassTable->GetID("AliRun") < 0) {
26 gROOT->LoadMacro("loadlibs.C");
28 } // end if gClassTable...
30 // Connect the Root Galice file containing Geometry, Kine and Hits
31 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
32 if (!file) file = new TFile(filename);
34 // Get AliRun object from file or create it if not on file
36 gAlice = (AliRun*)file->Get("gAlice");
37 if (gAlice) printf("AliRun object found on file\n");
38 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
41 // Import the Kine and Hits Trees for the event evNumber in the file
42 Int_t nparticles = gAlice->GetEvent(evNumber);
43 if (nparticles <= 0) return;
44 Float_t x,y,z,mass,e,r,phi,flad;
46 Int_t j,hit,ipart,lay;
52 // Get pointers to Alice detectors and Hits containers
53 AliDetector *ITS = gAlice->GetDetector("ITS");
55 TClonesArray *Particles = gAlice->Particles();
56 TClonesArray *ITShits = ITS->Hits();
57 AliITSgeom *gm = ((AliITS *)ITS)->GetITSgeom();
59 TTree *TH = gAlice->TreeH();
60 Int_t ntracks = TH->GetEntries();
63 Float_t pi2 = 2.0*TMath::Pi();
64 Int_t Nlad = gm->GetNladders(1);
65 TH2F *hITS1 = new TH2F("hITS1","Ladder# vs. angle for Layer 1",
66 Nlad,0.5,(Float_t)Nlad+0.5,100,0.0,pi2);
67 Int_t Nlad = gm->GetNladders(2);
68 TH2F *hITS2 = new TH2F("hITS2","Ladder# vs. angle for Layer 2",
69 Nlad,0.5,(Float_t)Nlad+0.5,100,0.0,pi2);
70 Int_t Nlad = gm->GetNladders(3);
71 TH2F *hITS3 = new TH2F("hITS3","Ladder# vs. angle for Layer 3",
72 Nlad,0.5,(Float_t)Nlad+0.5,100,0.0,pi2);
73 Int_t Nlad = gm->GetNladders(4);
74 TH2F *hITS4 = new TH2F("hITS4","Ladder# vs. angle for Layer 4",
75 Nlad,0.5,(Float_t)Nlad+0.5,100,0.0,pi2);
76 Int_t Nlad = gm->GetNladders(5);
77 TH2F *hITS5 = new TH2F("hITS5","Ladder# vs. angle for Layer 5",
78 Nlad,0.5,(Float_t)Nlad+0.5,100,0.0,pi2);
79 Int_t Nlad = gm->GetNladders(6);
80 TH2F *hITS6 = new TH2F("hITS6","Ladder# vs. angle for Layer 6",
81 Nlad,0.5,(Float_t)Nlad+0.5,100,0.0,pi2);
83 // Start loop on tracks in the hits containers
84 for (Int_t track=0; track<ntracks;track++) {
86 nbytes += TH->GetEvent(track);
88 nhits = ITShits->GetEntriesFast();
89 for (hit=0;hit<nhits;hit++) {
90 itsHit = (AliITShit*)ITShits->UncheckedAt(hit);
91 // With this new version, to be able to do proper detector
92 // simulations, the requirment that a "hit" leave some
93 // energy deposited has been removed.
94 if(itsHit->GetIonization()<=0.0) continue;
95 phi = TMath::ATan2(itsHit->GetYG(),itsHit->GetXG());
96 if(phi<0.0) phi += pi2;
97 lay = itsHit->GetLayer();
98 flad = ((Float_t)itsHit->GetLadder()) + 0.5;
99 if(lay==1) hITS1->Fill(flad,phi,1.0);
100 if(lay==2) hITS2->Fill(flad,phi,1.0);
101 if(lay==3) hITS3->Fill(flad,phi,1.0);
102 if(lay==4) hITS4->Fill(flad,phi,1.0);
103 if(lay==5) hITS5->Fill(flad,phi,1.0);
104 if(lay==6) hITS6->Fill(flad,phi,1.0);
108 //Create a canvas, set the view range, show histograms
109 TCanvas *c1 = new TCanvas("c1"," ITS geometry test",400,10,600,700);
123 c1->Print("analITSgeom.gif");