]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/RICHoccupancy.C
Update for coding convensions
[u/mrichter/AliRoot.git] / RICH / RICHoccupancy.C
CommitLineData
8e766c6d 1void RICHoccupancy (Int_t evNumber1=0,Int_t evNumber2=0)
2{
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.
7//
8/////////////////////////////////////////////////////////////////////////
9
10
11 // Dynamically link some shared libs
12
13 if (gClassTable->GetID("AliRun") < 0) {
14 gROOT->LoadMacro("loadlibs.C");
15 loadlibs();
16 }
17
18// Connect the Root Galice file containing Geometry, Kine and Hits
19
20TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
21if (!file) file = new TFile("galice.root");
22
23// Get AliRun object from file or create it if not on file
24
25if (!gAlice) {
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");
29}
30
31// Start loop over events
32
33 Float_t occ[7];
34 Float_t sum=0;
35 Float_t mean=0;
36
37 for (int nev=0; nev<= evNumber2; nev++) {
38 Int_t nparticles = gAlice->GetEvent(nev);
39
40
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;
45
46 // Get pointers to RICH detector and Hits containers
47
48 AliRICH *RICH =(AliRICH*) gAlice->GetModule("RICH");
49 Int_t nent=(Int_t)gAlice->TreeD()->GetEntries();
50 gAlice->TreeD()->GetEvent(nent-1);
51
52 for (Int_t ich=0;ich<7;ich++)
53 {
54 TClonesArray *Digits = RICH->DigitsAddress(ich); // Raw clusters branch
55 //printf ("Digits:%p",Digits);
56 Int_t ndigits = Digits->GetEntriesFast();
39ce08ce 57 occ[ich] = Float_t(ndigits)/(160*160);
58 sum += Float_t(ndigits)/(160*160);
8e766c6d 59 printf ("Occupancy in chamber %d: %f, generated by %d digits\n",ich,occ[ich],ndigits);
60 }
61 mean = sum/7;
62 printf("\nMean occupancy: %f\n",mean);
63 }
64}
65