]>
Commit | Line | Data |
---|---|---|
ddae0931 | 1 | #include "iostream.h" |
2 | ||
3 | void RICHdigit (Int_t evNumber1=0,Int_t evNumber2=0) | |
4 | { | |
5 | ///////////////////////////////////////////////////////////////////////// | |
6 | // This macro is a small example of a ROOT macro | |
7 | // illustrating how to read the output of GALICE | |
8 | // and do some analysis. | |
9 | // | |
10 | ///////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // Dynamically link some shared libs | |
13 | ||
e480e62b | 14 | |
15 | if (gClassTable->GetID("AliRun") < 0) { | |
ddae0931 | 16 | gROOT->LoadMacro("loadlibs.C"); |
17 | loadlibs(); | |
18 | } | |
19 | ||
20 | ||
21 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
22 | ||
23 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); | |
24 | if (file) file->Close(); | |
25 | file = new TFile("galice.root","UPDATE"); | |
e480e62b | 26 | // file->ls(); |
27 | // Get AliRun object from file or create it if not on file | |
ddae0931 | 28 | |
e480e62b | 29 | |
30 | ||
31 | if (gClassTable->GetID("AliRun") < 0) { | |
32 | gROOT->LoadMacro("loadlibs.C"); | |
33 | loadlibs(); | |
34 | } | |
35 | else { | |
36 | //delete gAlice; | |
37 | gAlice = 0; | |
38 | } | |
39 | ||
ddae0931 | 40 | |
ddae0931 | 41 | |
42 | if (!gAlice) { | |
43 | gAlice = (AliRun*)file->Get("gAlice"); | |
44 | if (gAlice) printf("AliRun object found on file\n"); | |
45 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); | |
e480e62b | 46 | } else { |
47 | delete gAlice; | |
48 | gAlice = (AliRun*)file->Get("gAlice"); | |
49 | if (gAlice) printf("AliRun object found on file\n"); | |
50 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); | |
51 | } | |
52 | ||
ddae0931 | 53 | AliRICH *RICH = (AliRICH*) gAlice->GetDetector("RICH"); |
54 | // | |
55 | // Event Loop | |
56 | // | |
57 | for (int nev=0; nev<= evNumber2; nev++) { | |
58 | Int_t nparticles = gAlice->GetEvent(nev); | |
e480e62b | 59 | cout <<endl<< "Processing event:" <<nev<<endl; |
60 | cout << "Particles :" <<nparticles<<endl; | |
ddae0931 | 61 | if (nev < evNumber1) continue; |
62 | if (nparticles <= 0) return; | |
63 | if (RICH) RICH->Digitise(nev); | |
64 | char hname[30]; | |
65 | sprintf(hname,"TreeD%d",nev); | |
66 | gAlice->TreeD()->Write(hname); | |
67 | gAlice->TreeD()->Reset(); | |
ddae0931 | 68 | } // event loop |
69 | file->Close(); | |
e480e62b | 70 | |
71 | //delete gAlice; | |
72 | printf("\nEnd of Macro *************************************\n"); | |
ddae0931 | 73 | } |
74 | ||
75 | ||
76 | ||
77 | ||
78 | ||
79 | ||
80 | ||
81 | ||
82 | ||
83 | ||
84 | ||
85 | ||
86 | ||
87 |