]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/RICHdigit.C
Minor changes on class names.
[u/mrichter/AliRoot.git] / RICH / RICHdigit.C
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
14    if (gClassTable->GetID("AliRun") < 0) {
15       gROOT->LoadMacro("loadlibs.C");
16       loadlibs();
17    }
18
19
20 // Connect the Root Galice file containing Geometry, Kine and Hits
21
22    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
23    if (file) file->Close(); 
24    file = new TFile("galice.root","UPDATE");
25    file->ls();
26
27    printf ("I'm after Map \n");
28
29 // Get AliRun object from file or create it if not on file
30
31    if (!gAlice) {
32        gAlice = (AliRun*)file->Get("gAlice");
33        if (gAlice) printf("AliRun object found on file\n");
34        if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
35    }
36    printf ("I'm after gAlice \n");
37    
38    AliRICH *RICH  = (AliRICH*) gAlice->GetDetector("RICH");
39 //
40 // Event Loop
41 //
42    for (int nev=0; nev<= evNumber2; nev++) {
43        Int_t nparticles = gAlice->GetEvent(nev);
44        cout << "nev         " <<nev<<endl;
45        cout << "nparticles  " <<nparticles<<endl;
46        if (nev < evNumber1) continue;
47        if (nparticles <= 0) return;
48        if (RICH) RICH->Digitise(nev);
49        char hname[30];
50        sprintf(hname,"TreeD%d",nev);
51        gAlice->TreeD()->Write(hname);
52        gAlice->TreeD()->Reset();
53        file->ls();
54    } // event loop 
55    file->Close();
56 }
57
58
59
60
61
62
63
64
65
66
67
68
69
70