]>
Commit | Line | Data |
---|---|---|
1 | #ifndef ALIRUN_H | |
2 | #define ALIRUN_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | // | |
9 | // General configuration class for Simulation and Reconstruction | |
10 | // Basic driver for AliRoot runs | |
11 | // Containing pointers to data elements for AliRoot | |
12 | // | |
13 | ||
14 | #include <TError.h> | |
15 | #include <TStopwatch.h> | |
16 | ||
17 | class TGeometry; | |
18 | class TParticle; | |
19 | class TRandom; | |
20 | class TTree; | |
21 | ||
22 | #include "AliRunLoader.h" | |
23 | class AliDisplay; | |
24 | class AliGenEventHeader; | |
25 | class AliGenerator; | |
26 | class AliHeader; | |
27 | class AliLego; | |
28 | class AliLegoGenerator; | |
29 | class AliMC; | |
30 | class AliMagF; | |
31 | class AliStack; | |
32 | ||
33 | enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4}; | |
34 | ||
35 | class AliRun : public TNamed { | |
36 | public: | |
37 | // Creators - distructors | |
38 | AliRun(); | |
39 | AliRun(const char *name, const char *title); | |
40 | AliRun(const AliRun &arun); | |
41 | virtual ~AliRun(); | |
42 | ||
43 | AliRun& operator = (const AliRun &arun) | |
44 | {arun.Copy(*this); return (*this);} | |
45 | virtual void Build(); | |
46 | virtual void BuildSimpleGeometry(); | |
47 | virtual void CleanDetectors(); | |
48 | TObjArray *Detectors() const {return fModules;} | |
49 | TObjArray *Modules() const {return fModules;} | |
50 | AliDisplay *Display() const { return fDisplay;} | |
51 | virtual AliMagF *Field() const {return fField;} | |
52 | virtual void FinishRun(); | |
53 | void AddModule(AliModule* mod); | |
54 | Int_t GetEvNumber() const; | |
55 | Int_t GetRunNumber() const {return fRun;} | |
56 | void SetRunNumber(Int_t run) {fRun=run;} | |
57 | void SetEventNrInRun(Int_t event) {fEventNrInRun=event;} | |
58 | Int_t GetEventNrInRun() const {return fEventNrInRun;} | |
59 | Int_t GetEventsPerRun() const {return fEventsPerRun;} | |
60 | Int_t GetNdets() const {return fNdets;} | |
61 | Int_t GetDebug() const {return fDebug;} | |
62 | AliModule *GetModule(const char *name) const; | |
63 | AliDetector *GetDetector(const char *name) const; | |
64 | Int_t GetModuleID(const char *name) const; | |
65 | virtual const char *GetBaseFile() const | |
66 | {return fBaseFileName.Data();} | |
67 | virtual Int_t GetEvent(Int_t event); | |
68 | virtual void SetEvent(Int_t event) {fEvent=event;} | |
69 | virtual void SetConfigFunction(const char * config="Config();"); | |
70 | virtual const char *GetConfigFunction() const | |
71 | {return fConfigFunction.Data();} | |
72 | TGeometry *GetGeometry(); | |
73 | virtual void SetGenEventHeader(AliGenEventHeader* header); | |
74 | AliMC* GetMCApp() const {return fMCApp;} | |
75 | virtual void Hits2Digits(const char *detector=0); | |
76 | virtual void Hits2SDigits(const char *detector=0) {Tree2Tree("S",detector);} | |
77 | virtual void SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);} | |
78 | virtual void Digits2Reco(const char *detector=0) {Tree2Tree("R",detector);} | |
79 | virtual void InitMC(const char *setup="Config.C"); | |
80 | virtual void Init(const char *setup="Config.C") {InitMC(setup);} | |
81 | Bool_t IsFolder() const {return kTRUE;} | |
82 | virtual AliLego* Lego() const {return fLego;} | |
83 | ||
84 | virtual void ResetDigits(); | |
85 | virtual void ResetSDigits(); | |
86 | virtual void ResetPoints(); | |
87 | virtual void SetBaseFile(const char *filename="galice.root"); | |
88 | virtual void RunMC(Int_t nevent=1, const char *setup="Config.C"); | |
89 | virtual void Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);} | |
90 | virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178, | |
91 | Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0, | |
92 | Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL); | |
93 | virtual Bool_t IsLegoRun() const {return (fLego!=0);} | |
94 | virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0); | |
95 | virtual void SetDebug(Int_t level=0) {fDebug = level;} | |
96 | virtual void SetDisplay(AliDisplay *display) {fDisplay = display;} | |
97 | virtual void SetField(Int_t type=2, Int_t version=1, Float_t scale=1, Float_t maxField=10, const char* filename="$(ALICE_ROOT)/data/field01.dat"); | |
98 | virtual void SetField(AliMagF* magField); | |
99 | virtual TDatabasePDG* PDGDB() const {return fPDGDB;} | |
100 | ||
101 | virtual void Field(const Double_t* x, Double_t* b) const; | |
102 | ||
103 | // Delegations | |
104 | virtual void ResetHits(); | |
105 | virtual AliGenerator* Generator() const; | |
106 | ||
107 | // | |
108 | // End of MC Application | |
109 | ||
110 | TTree *TreeE() {return (fRunLoader)?fRunLoader->TreeE():0x0;} | |
111 | TTree *TreeK() {return (fRunLoader)?fRunLoader->TreeK():0x0;} | |
112 | AliStack *Stack() {return (fRunLoader)?fRunLoader->Stack():0x0;} | |
113 | AliHeader* GetHeader() {return (fRunLoader)?fRunLoader->GetHeader():0x0;} | |
114 | ||
115 | TTree *TreeD() const {MayNotUse("TreeD"); return 0x0;} | |
116 | TTree *TreeS() const {MayNotUse("TreeS"); return 0x0;} | |
117 | TTree *TreeR() const {MayNotUse("TreeR"); return 0x0;} | |
118 | ||
119 | ||
120 | void SetRunLoader(AliRunLoader* rloader); | |
121 | AliRunLoader* GetRunLoader() const {return fRunLoader;} | |
122 | // void SetEventFolderName(const char* eventfoldername); | |
123 | virtual void Announce() const; | |
124 | ||
125 | virtual void InitLoaders(); //prepares run (i.e. creates getters) | |
126 | static void Deprecated(TObject *obj, const char *method, const char *replace) | |
127 | { | |
128 | // | |
129 | // Indicates deprecated method | |
130 | // | |
131 | if (obj) ::Warning(Form("%s::%s", obj->ClassName(), method), | |
132 | "method is depricated\nPlease use: %s", replace); | |
133 | else ::Warning(method, "method is depricated\nPlease use: %s", replace); | |
134 | } | |
135 | ||
136 | ||
137 | protected: | |
138 | virtual void Tree2Tree(Option_t *option, const char *detector=0); | |
139 | Int_t fRun; //! Current run number | |
140 | Int_t fEvent; //! Current event number (from 1) | |
141 | Int_t fEventNrInRun; //! Current unique event number in run | |
142 | Int_t fEventsPerRun; // Number of events per run | |
143 | Int_t fDebug; // Debug flag | |
144 | TObjArray *fModules; // List of Detectors | |
145 | TGeometry *fGeometry; // Pointer to geometry | |
146 | AliMC *fMCApp; // Pointer to virtual MC Application | |
147 | AliDisplay *fDisplay; //! Pointer to event display | |
148 | TStopwatch fTimer; // Timer object | |
149 | AliMagF *fField; // Magnetic Field Map | |
150 | TVirtualMC *fMC; //! Pointer to MonteCarlo object | |
151 | Int_t fNdets; // Number of detectors | |
152 | Bool_t fInitDone; //! True when initialisation done | |
153 | AliLego *fLego; //! Pointer to aliLego object if it exists | |
154 | TDatabasePDG *fPDGDB; // Particle factory object | |
155 | TString fConfigFunction; // Configuration file to be executed | |
156 | TRandom *fRandom; // Pointer to the random number generator | |
157 | TString fBaseFileName; // Name of the base root file | |
158 | ||
159 | AliRunLoader *fRunLoader; //!run getter - written as a separate object | |
160 | private: | |
161 | void Copy(TObject &arun) const; | |
162 | ||
163 | ClassDef(AliRun,8) //Supervisor class for all Alice detectors | |
164 | }; | |
165 | ||
166 | R__EXTERN AliRun *gAlice; | |
167 | ||
168 | #endif |