]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/RICHdigit.C
New diagnostics on particle flux.
[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    
15   if (gClassTable->GetID("AliRun") < 0) {
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");
26 //   file->ls();
27 // Get AliRun object from file or create it if not on file
28
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    
40
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");
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       
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);
59        cout <<endl<< "Processing event:" <<nev<<endl;
60        cout << "Particles       :" <<nparticles<<endl;
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();
68    } // event loop 
69    file->Close();
70
71    //delete gAlice;
72    printf("\nEnd of Macro  *************************************\n");
73 }
74
75
76
77
78
79
80
81
82
83
84
85
86
87