void RICHoccupancy (Int_t evNumber1=0,Int_t evNumber2=0) { ///////////////////////////////////////////////////////////////////////// // This macro is a small example of a ROOT macro // illustrating how to read the output of GALICE // and do some analysis. // ///////////////////////////////////////////////////////////////////////// // Dynamically link some shared libs if (gClassTable->GetID("AliRun") < 0) { gROOT->LoadMacro("loadlibs.C"); loadlibs(); } else { //delete gAlice; gAlice = 0; } gAlice=0; // Connect the Root Galice file containing Geometry, Kine and Hits TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); if (!file) file = new TFile("galice.root","UPDATE"); // Get AliRun object from file or create it if not on file if (!gAlice) { gAlice = (AliRun*)file->Get("gAlice"); if (gAlice) printf("AliRun object found on file\n"); if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); } else { delete gAlice; gAlice = (AliRun*)file->Get("gAlice"); if (gAlice) printf("AliRun object found on file\n"); if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); } // Start loop over events Float_t occ[7]; Float_t sum=0; Float_t mean=0; for (int nev=0; nev<= evNumber2; nev++) { Int_t nparticles = gAlice->GetEvent(nev); printf ("Number of Events : %d\n",nev); printf ("Number of particles: %d\n\n",nparticles); //if (nev < evNumber1) continue; //if (nparticles <= 0) return; // Get pointers to RICH detector and Hits containers AliRICH *RICH =(AliRICH*) gAlice->GetModule("RICH"); Int_t nent=(Int_t)gAlice->TreeD()->GetEntries(); gAlice->TreeD()->GetEvent(0); for (Int_t ich=0;ich<7;ich++) { TClonesArray *Digits = RICH->DigitsAddress(ich); // Raw clusters branch //printf ("Digits:%p",Digits); Int_t ndigits = Digits->GetEntriesFast(); occ[ich] = Float_t(ndigits)/(160*144); sum += Float_t(ndigits)/(160*144); printf ("Occupancy in chamber %d: %f, generated by %d digits\n",ich,occ[ich],ndigits); } mean = sum/7; printf("\nMean occupancy: %f\n",mean); } }