1 void RICHoccupancy (Int_t evNumber1=0,Int_t evNumber2=0)
3 /////////////////////////////////////////////////////////////////////////
4 // This macro is a small example of a ROOT macro
5 // illustrating how to read the output of GALICE
6 // and do some analysis.
8 /////////////////////////////////////////////////////////////////////////
11 // Dynamically link some shared libs
13 if (gClassTable->GetID("AliRun") < 0) {
14 gROOT->LoadMacro("loadlibs.C");
18 // Connect the Root Galice file containing Geometry, Kine and Hits
20 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
21 if (!file) file = new TFile("galice.root");
23 // Get AliRun object from file or create it if not on file
26 gAlice = (AliRun*)file->Get("gAlice");
27 if (gAlice) printf("AliRun object found on file\n");
28 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
31 // Start loop over events
37 for (int nev=0; nev<= evNumber2; nev++) {
38 Int_t nparticles = gAlice->GetEvent(nev);
41 printf ("Number of Events : %d\n",nev);
42 printf ("Number of particles: %d\n\n",nparticles);
43 //if (nev < evNumber1) continue;
44 //if (nparticles <= 0) return;
46 // Get pointers to RICH detector and Hits containers
48 AliRICH *RICH =(AliRICH*) gAlice->GetModule("RICH");
49 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
50 gAlice->TreeD()->GetEvent(nent-1);
52 for (Int_t ich=0;ich<7;ich++)
54 TClonesArray *Digits = RICH->DigitsAddress(ich); // Raw clusters branch
55 //printf ("Digits:%p",Digits);
56 Int_t ndigits = Digits->GetEntriesFast();
57 occ[ich] = Float_t(ndigits)/(160*144);
59 printf ("Occupancy in chamber %d: %f, generated by %d digits\n",ich,occ[ich],ndigits);
62 printf("\nMean occupancy: %f\n",mean);