aee8290b |
1 | #ifndef ALIRUN_H |
2 | #define ALIRUN_H |
3da30618 |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
4 | * See cxx source for full Copyright notice */ |
5 | |
6 | /* $Id$ */ |
7 | |
94de3818 |
8 | class TBrowser; |
9 | class TList; |
10 | class TTree; |
02a02c36 |
11 | class TBranch; |
94de3818 |
12 | class TGeometry; |
13 | class TDatabasePDG; |
65fb704d |
14 | class TRandom; |
2ab0c725 |
15 | class TParticle; |
7a16e9cc |
16 | class TFile; |
94de3818 |
17 | #include <TArrayI.h> |
65fb704d |
18 | #include "TClonesArray.h" |
94de3818 |
19 | #include <TArrayF.h> |
fe4da5cc |
20 | #include <TStopwatch.h> |
b9d0a01d |
21 | #include <TVirtualMCApplication.h> |
1578254f |
22 | |
b9d0a01d |
23 | #include "AliMC.h" |
94de3818 |
24 | class AliDetector; |
25 | class AliModule; |
26 | class AliMagF; |
b9d0a01d |
27 | //class AliMC; |
94de3818 |
28 | class AliLego; |
29 | class AliDisplay; |
0a520a66 |
30 | class AliLegoGenerator; |
9e1a0ddb |
31 | class AliHeader; |
65fb704d |
32 | class AliGenerator; |
33 | class AliLegoGenerator; |
34 | #include "AliMCProcess.h" |
2ab0c725 |
35 | class AliMCQA; |
9e1a0ddb |
36 | class AliStack; |
42f33748 |
37 | class AliGenEventHeader; |
9e1a0ddb |
38 | |
fe4da5cc |
39 | |
aee8290b |
40 | enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4}; |
1578254f |
41 | |
fe4da5cc |
42 | |
b9d0a01d |
43 | class AliRun : public TVirtualMCApplication { |
fe4da5cc |
44 | public: |
45 | // Creators - distructors |
46 | AliRun(); |
47 | AliRun(const char *name, const char *title); |
48 | virtual ~AliRun(); |
49 | |
50 | virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const; |
51 | virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const; |
1cedd08a |
52 | virtual void AddHitList(TCollection *hitList) {fHitLists->Add(hitList);} |
fe4da5cc |
53 | virtual void Browse(TBrowser *b); |
54 | virtual void Build(); |
55 | virtual void BuildSimpleGeometry(); |
56 | virtual void CleanDetectors(); |
8494b010 |
57 | TObjArray *Detectors() const {return fModules;} |
58 | TObjArray *Modules() const {return fModules;} |
9e1a0ddb |
59 | Int_t CurrentTrack() const; |
fe4da5cc |
60 | AliDisplay *Display() { return fDisplay;} |
61 | virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); |
94de3818 |
62 | virtual void DumpPart (Int_t i) const; |
63 | virtual void DumpPStack () const; |
fe4da5cc |
64 | virtual AliMagF *Field() const {return fField;} |
fe4da5cc |
65 | virtual void FinishRun(); |
66 | virtual void FlagTrack(Int_t track); |
875c717b |
67 | void AddEnergyDeposit(Int_t id, Float_t edep) |
68 | {fEventEnergy[id]+=edep;} |
fe4da5cc |
69 | Int_t GetEvNumber() const {return fEvent;} |
70 | Int_t GetRunNumber() const {return fRun;} |
8494b010 |
71 | void SetRunNumber(Int_t run) {fRun=run;} |
eef4b160 |
72 | void SetEventNrInRun(Int_t event) {fEventNrInRun=event;} |
73 | Int_t GetEventNrInRun() const {return fEventNrInRun;} |
6df200c3 |
74 | Int_t GetEventsPerRun() const {return fEventsPerRun;} |
fe4da5cc |
75 | Int_t GetDebug() const {return fDebug;} |
94de3818 |
76 | AliModule *GetModule(const char *name) const; |
9e1a0ddb |
77 | TList* GetHitLists() const {return fHitLists ;} |
94de3818 |
78 | AliDetector *GetDetector(const char *name) const; |
65fb704d |
79 | AliMCQA *GetMCQA() const {return fMCQA;} |
94de3818 |
80 | Int_t GetModuleID(const char *name) const; |
39de14fb |
81 | virtual const char *GetBaseFile() const |
82 | {return fBaseFileName.Data();} |
fe4da5cc |
83 | virtual Int_t GetEvent(Int_t event); |
45189757 |
84 | virtual void SetEvent(Int_t event) {fEvent=event;} |
94de3818 |
85 | virtual void SetConfigFunction(const char * config="Config();"); |
45189757 |
86 | virtual const char *GetConfigFunction() const |
87 | {return fConfigFunction.Data();} |
fe4da5cc |
88 | TGeometry *GetGeometry(); |
9e1a0ddb |
89 | AliHeader* GetHeader() {return fHeader;} |
42f33748 |
90 | virtual void SetGenEventHeader(AliGenEventHeader* header); |
9e1a0ddb |
91 | Int_t GetNtrack() const; |
92 | virtual Int_t GetPrimary(Int_t track) const; |
d47c658f |
93 | virtual void Hits2Digits(const char *detector=0); |
94 | virtual void Hits2SDigits(const char *detector=0) {Tree2Tree("S",detector);} |
95 | virtual void SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);} |
96 | virtual void Digits2Reco(const char *detector=0) {Tree2Tree("R",detector);} |
875c717b |
97 | virtual void InitMC(const char *setup="Config.C"); |
98 | virtual void Init(const char *setup="Config.C") {InitMC(setup);} |
b21a3d1a |
99 | Bool_t IsFolder() const {return kTRUE;} |
838edcaf |
100 | virtual AliLego* Lego() const {return fLego;} |
9e1a0ddb |
101 | virtual void MakeTree(Option_t *option="KH", const char *file = 0); |
7a16e9cc |
102 | void MakeTree(Option_t *option, TFile *file); |
2ab0c725 |
103 | |
9e1a0ddb |
104 | TObjArray *Particles(); |
2ab0c725 |
105 | TParticle *Particle(Int_t i); |
fe4da5cc |
106 | virtual void ResetDigits(); |
2ab0c725 |
107 | virtual void ResetSDigits(); |
fe4da5cc |
108 | virtual void ResetHits(); |
aab9c8d5 |
109 | virtual void ResetTrackReferences(); |
fe4da5cc |
110 | virtual void ResetPoints(); |
111 | virtual void SetTransPar(char *filename="$(ALICE_ROOT)/data/galice.cuts"); |
2ab0c725 |
112 | virtual void SetBaseFile(char *filename="galice.root"); |
65fb704d |
113 | virtual void ReadTransPar(); |
875c717b |
114 | virtual void RunMC(Int_t nevent=1, const char *setup="Config.C"); |
115 | virtual void Run(Int_t nevent=1, const char *setup="Config.C") |
116 | {RunMC(nevent,setup);} |
dea76e7a |
117 | virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178, |
118 | Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0, |
0a520a66 |
119 | Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL); |
dffd31ef |
120 | virtual Bool_t IsLegoRun() const {return (fLego!=0);} |
7f6f9ab2 |
121 | virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0); |
fe4da5cc |
122 | virtual void SetCurrentTrack(Int_t track); |
9e1a0ddb |
123 | virtual void SetDebug(const Int_t level=0) {fDebug = level;} |
fe4da5cc |
124 | virtual void SetDisplay(AliDisplay *display) {fDisplay = display;} |
fe4da5cc |
125 | virtual void SetField(Int_t type=2, Int_t version=1, Float_t scale=1, Float_t maxField=10, char*filename="$(ALICE_ROOT)/data/field01.dat"); |
d8408e76 |
126 | virtual void SetField(AliMagF* magField); |
1578254f |
127 | virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg, |
47c8bcbe |
128 | Float_t *pmom, Float_t *vpos, Float_t *polar, |
129 | Float_t tof, AliMCProcess mech, Int_t &ntr, |
130 | Float_t weight = 1, Int_t is = 0); |
89bbad6f |
131 | virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg, |
47c8bcbe |
132 | Double_t px, Double_t py, Double_t pz, Double_t e, |
133 | Double_t vx, Double_t vy, Double_t vz, Double_t tof, |
134 | Double_t polx, Double_t poly, Double_t polz, |
135 | AliMCProcess mech, Int_t &ntr, Float_t weight=1, |
136 | Int_t is = 0); |
caaac55b |
137 | virtual void SetHighWaterMark(const Int_t nt); |
4d69d91e |
138 | |
139 | virtual void KeepTrack(const Int_t itra); |
fe4da5cc |
140 | virtual void MediaTable(); |
fe4da5cc |
141 | virtual void TrackingLimits( Float_t rmax=1.e10, Float_t zmax=1.e10) {fTrRmax=rmax; fTrZmax=zmax;} |
94de3818 |
142 | virtual Int_t DetFromMate(Int_t i) const { return (*fImedia)[i];} |
143 | virtual AliGenerator* Generator() const {return fGenerator;} |
fe4da5cc |
144 | virtual void SetGenerator(AliGenerator *generator); |
ee1dd322 |
145 | virtual void ResetGenerator(AliGenerator *generator); |
fe4da5cc |
146 | virtual void EnergySummary(); |
94de3818 |
147 | virtual TDatabasePDG* PDGDB() const {return fPDGDB;} |
b9d0a01d |
148 | |
149 | // MC Application |
150 | // |
151 | virtual void ConstructGeometry(); |
152 | virtual void InitGeometry(); |
153 | virtual void GeneratePrimaries(); |
154 | virtual void BeginEvent(); |
155 | virtual void BeginPrimary(); |
156 | virtual void PreTrack(); |
157 | virtual void Stepping(); |
158 | virtual void PostTrack(); |
159 | virtual void FinishPrimary(); |
160 | virtual void FinishEvent(); |
161 | virtual Double_t TrackingZmax() const {return fTrZmax;} |
162 | virtual Double_t TrackingRmax() const {return fTrRmax;} |
163 | virtual void Field(const Double_t* x, Double_t* b) const; |
164 | // |
165 | // End of MC Application |
fe4da5cc |
166 | |
7a16e9cc |
167 | TFile* InitTreeFile(Option_t *option, TString fileName); |
b9d0a01d |
168 | void PrintTreeFile(); |
169 | void CloseTreeFile(Option_t *option); |
7a16e9cc |
170 | TString GetTreeDFileName() const {return fTreeDFileName;} |
171 | TString GetTreeSFileName() const {return fTreeSFileName;} |
172 | TString GetTreeRFileName() const {return fTreeRFileName;} |
173 | void SetTreeDFileName(TString fileName){fTreeDFileName=fileName;} |
174 | void SetTreeSFileName(TString fileName){fTreeSFileName=fileName;} |
175 | void SetTreeRFileName(TString fileName){fTreeRFileName=fileName;} |
176 | TFile* GetTreeDFile() const {return fTreeDFile;} |
177 | TFile* GetTreeSFile() const {return fTreeSFile;} |
178 | TFile* GetTreeRFile() const {return fTreeRFile;} |
179 | |
875c717b |
180 | |
fe4da5cc |
181 | TTree *TreeD() {return fTreeD;} |
2ab0c725 |
182 | TTree *TreeS() {return fTreeS;} |
fe4da5cc |
183 | TTree *TreeE() {return fTreeE;} |
184 | TTree *TreeH() {return fTreeH;} |
aab9c8d5 |
185 | TTree *TreeTR() {return fTreeTR;} |
9e1a0ddb |
186 | TTree *TreeK() ; |
fe4da5cc |
187 | TTree *TreeR() {return fTreeR;} |
188 | |
9e1a0ddb |
189 | AliStack *Stack() {return fStack;} |
190 | |
aee8290b |
191 | protected: |
9e1a0ddb |
192 | virtual void Tree2Tree(Option_t *option, const char *detector=0); |
7a16e9cc |
193 | TFile* InitFile(TString fileName=""); |
2ab0c725 |
194 | Int_t fRun; //! Current run number |
195 | Int_t fEvent; //! Current event number (from 1) |
eef4b160 |
196 | Int_t fEventNrInRun; //! Current unique event number in run |
6df200c3 |
197 | Int_t fEventsPerRun; // Number of events per run |
2ab0c725 |
198 | Int_t fDebug; // Debug flag |
9e1a0ddb |
199 | AliHeader *fHeader; // Header information |
2ab0c725 |
200 | TTree *fTreeD; //! Pointer to Tree for Digits |
201 | TTree *fTreeS; //! Pointer to Tree for SDigits |
2ab0c725 |
202 | TTree *fTreeH; //! Pointer to Tree for Hits |
aab9c8d5 |
203 | TTree *fTreeTR; //! Pointer to Tree for TrackRefernces |
2ab0c725 |
204 | TTree *fTreeE; //! Pointer to Tree for Header |
205 | TTree *fTreeR; //! Pointer to Tree for Reconstructed Objects |
206 | TObjArray *fModules; // List of Detectors |
2ab0c725 |
207 | TGeometry *fGeometry; // Pointer to geometry |
208 | AliDisplay *fDisplay; //! Pointer to event display |
209 | TStopwatch fTimer; // Timer object |
210 | AliMagF *fField; // Magnetic Field Map |
211 | AliMC *fMC; //! Pointer to MonteCarlo object |
212 | TArrayI *fImedia; //! Array of correspondence between media and detectors |
213 | Int_t fNdets; // Number of detectors |
214 | Float_t fTrRmax; // Maximum radius for tracking |
215 | Float_t fTrZmax; // Maximu z for tracking |
216 | AliGenerator *fGenerator; // Generator used in the MC |
217 | Bool_t fInitDone; //! True when initialisation done |
218 | AliLego *fLego; //! Pointer to aliLego object if it exists |
219 | TDatabasePDG *fPDGDB; // Particle factory object |
220 | TList *fHitLists; //! Lists of hits to be remapped by PurifyKine |
221 | TArrayF fEventEnergy; //! Energy deposit for current event |
222 | TArrayF fSummEnergy; //! Energy per event in each volume |
223 | TArrayF fSum2Energy; //! Energy squared per event in each volume |
224 | TString fConfigFunction; // Configuration file to be executed |
225 | TRandom *fRandom; // Pointer to the random number generator |
226 | AliMCQA *fMCQA; // Pointer to MC Quality assurance class |
227 | TString fTransParName; // Name of the transport parameters file |
228 | TString fBaseFileName; // Name of the base root file |
c0f4be09 |
229 | AliStack* fStack; //! Particle Stack |
b9d0a01d |
230 | |
7a16e9cc |
231 | TString fTreeDFileName; //! name of the file with TreeD |
232 | TFile* fTreeDFile; //! file with TreeD |
233 | TString fTreeSFileName; //! name of the file with TreeS |
234 | TFile* fTreeSFile; //! file with TreeS |
235 | TString fTreeRFileName; //! name of the file with TreeR |
236 | TFile* fTreeRFile; //! file with TreeR |
b9d0a01d |
237 | |
ef42d733 |
238 | private: |
239 | |
02a02c36 |
240 | AliRun(const AliRun &right) |
9e1a0ddb |
241 | {} |
242 | AliRun& operator = (const AliRun &) {return *this;} |
8c54627e |
243 | ClassDef(AliRun,7) //Supervisor class for all Alice detectors |
fe4da5cc |
244 | }; |
245 | |
75a25b1b |
246 | R__EXTERN AliRun *gAlice; |
fe4da5cc |
247 | |
248 | #endif |