Write first all the parent particles to the stack and then the final state particles.
[u/mrichter/AliRoot.git] / RICH / RICHdigit.C
CommitLineData
237c933d 1// 0 = all
2// 1 = pion
3// 2 = kaon
4// 3 = proton
5// 4 = muon
6// 5 = electron
7// 6 = neutron
8
9
10Int_t particle_type=0;
11
ddae0931 12#include "iostream.h"
13
14void RICHdigit (Int_t evNumber1=0,Int_t evNumber2=0)
15{
16/////////////////////////////////////////////////////////////////////////
17// This macro is a small example of a ROOT macro
18// illustrating how to read the output of GALICE
19// and do some analysis.
20//
21/////////////////////////////////////////////////////////////////////////
22
23// Dynamically link some shared libs
24
e480e62b 25
26 if (gClassTable->GetID("AliRun") < 0) {
ddae0931 27 gROOT->LoadMacro("loadlibs.C");
28 loadlibs();
29 }
30
31
32// Connect the Root Galice file containing Geometry, Kine and Hits
33
34 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
35 if (file) file->Close();
36 file = new TFile("galice.root","UPDATE");
e480e62b 37// file->ls();
38// Get AliRun object from file or create it if not on file
ddae0931 39
e480e62b 40
41
42 if (gClassTable->GetID("AliRun") < 0) {
43 gROOT->LoadMacro("loadlibs.C");
44 loadlibs();
45 }
46 else {
47 //delete gAlice;
48 gAlice = 0;
49 }
50
ddae0931 51
ddae0931 52
53 if (!gAlice) {
54 gAlice = (AliRun*)file->Get("gAlice");
55 if (gAlice) printf("AliRun object found on file\n");
56 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
e480e62b 57 } else {
58 delete gAlice;
59 gAlice = (AliRun*)file->Get("gAlice");
60 if (gAlice) printf("AliRun object found on file\n");
61 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
62 }
63
ddae0931 64 AliRICH *RICH = (AliRICH*) gAlice->GetDetector("RICH");
c95f0940 65
66 AliRICHChamber* iChamber;
67
68 printf("Generating tresholds...\n");
69
70 for(Int_t i=0;i<7;i++)
71 {
72 iChamber = &(RICH->Chamber(i));
73 iChamber->GenerateTresholds();
74 }
75
76
ddae0931 77//
78// Event Loop
79//
80 for (int nev=0; nev<= evNumber2; nev++) {
81 Int_t nparticles = gAlice->GetEvent(nev);
e480e62b 82 cout <<endl<< "Processing event:" <<nev<<endl;
83 cout << "Particles :" <<nparticles<<endl;
ddae0931 84 if (nev < evNumber1) continue;
85 if (nparticles <= 0) return;
237c933d 86 if (RICH) RICH->Digitise(nev, particle_type);
c95f0940 87 //char hname[30];
88 //sprintf(hname,"TreeD%d",nev);
89 //gAlice->TreeD()->Write(hname);
90 //gAlice->TreeD()->Reset();
ddae0931 91 } // event loop
92 file->Close();
e480e62b 93
94 //delete gAlice;
95 printf("\nEnd of Macro *************************************\n");
ddae0931 96}
97
98
99
100
101
102
103
104
105
106
107
108
109
110