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