]>
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 | ||
e191bb57 | 8 | // |
2057aecb | 9 | // General configuration class for Simulation and Reconstruction |
10 | // Basic driver for AliRoot runs | |
11 | // Containing pointers to data elements for AliRoot | |
e191bb57 | 12 | // |
13 | ||
b8c3b0cc | 14 | #include <TError.h> |
4d81e5e7 | 15 | #include <TSystem.h> |
116cbefd | 16 | |
e2afb3b6 | 17 | class TGeometry; |
e2afb3b6 | 18 | class TParticle; |
19 | class TRandom; | |
20 | class TTree; | |
1578254f | 21 | |
88cb7938 | 22 | #include "AliRunLoader.h" |
94de3818 | 23 | class AliDisplay; |
e2afb3b6 | 24 | class AliGenEventHeader; |
65fb704d | 25 | class AliGenerator; |
e2afb3b6 | 26 | class AliHeader; |
27 | class AliLego; | |
28 | class AliLegoGenerator; | |
5d12ce38 | 29 | class AliMC; |
e2afb3b6 | 30 | class AliMagF; |
9e1a0ddb | 31 | class AliStack; |
88cb7938 | 32 | |
1578254f | 33 | |
5d12ce38 | 34 | class AliRun : public TNamed { |
3d45e923 | 35 | |
fe4da5cc | 36 | public: |
37 | // Creators - distructors | |
38 | AliRun(); | |
39 | AliRun(const char *name, const char *title); | |
e2afb3b6 | 40 | AliRun(const AliRun &arun); |
fe4da5cc | 41 | virtual ~AliRun(); |
42 | ||
e2afb3b6 | 43 | AliRun& operator = (const AliRun &arun) |
44 | {arun.Copy(*this); return (*this);} | |
fe4da5cc | 45 | virtual void Build(); |
46 | virtual void BuildSimpleGeometry(); | |
47 | virtual void CleanDetectors(); | |
8494b010 | 48 | TObjArray *Detectors() const {return fModules;} |
49 | TObjArray *Modules() const {return fModules;} | |
37d06d5b | 50 | AliDisplay *Display() const { return fDisplay;} |
fe4da5cc | 51 | virtual AliMagF *Field() const {return fField;} |
fe4da5cc | 52 | virtual void FinishRun(); |
88cb7938 | 53 | void AddModule(AliModule* mod); |
54 | Int_t GetEvNumber() const; | |
fe4da5cc | 55 | Int_t GetRunNumber() const {return fRun;} |
eef4b160 | 56 | void SetEventNrInRun(Int_t event) {fEventNrInRun=event;} |
57 | Int_t GetEventNrInRun() const {return fEventNrInRun;} | |
6df200c3 | 58 | Int_t GetEventsPerRun() const {return fEventsPerRun;} |
5d12ce38 | 59 | Int_t GetNdets() const {return fNdets;} |
94de3818 | 60 | AliModule *GetModule(const char *name) const; |
61 | AliDetector *GetDetector(const char *name) const; | |
62 | Int_t GetModuleID(const char *name) const; | |
39de14fb | 63 | virtual const char *GetBaseFile() const |
64 | {return fBaseFileName.Data();} | |
fe4da5cc | 65 | virtual Int_t GetEvent(Int_t event); |
45189757 | 66 | virtual void SetEvent(Int_t event) {fEvent=event;} |
94de3818 | 67 | virtual void SetConfigFunction(const char * config="Config();"); |
45189757 | 68 | virtual const char *GetConfigFunction() const |
69 | {return fConfigFunction.Data();} | |
fe4da5cc | 70 | TGeometry *GetGeometry(); |
42f33748 | 71 | virtual void SetGenEventHeader(AliGenEventHeader* header); |
5d12ce38 | 72 | AliMC* GetMCApp() const {return fMCApp;} |
d47c658f | 73 | virtual void Hits2Digits(const char *detector=0); |
74 | virtual void Hits2SDigits(const char *detector=0) {Tree2Tree("S",detector);} | |
75 | virtual void SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);} | |
76 | virtual void Digits2Reco(const char *detector=0) {Tree2Tree("R",detector);} | |
875c717b | 77 | virtual void InitMC(const char *setup="Config.C"); |
78 | virtual void Init(const char *setup="Config.C") {InitMC(setup);} | |
b21a3d1a | 79 | Bool_t IsFolder() const {return kTRUE;} |
838edcaf | 80 | virtual AliLego* Lego() const {return fLego;} |
4a9de4af | 81 | Bool_t IsRootGeometry() const {return fIsRootGeometry;} |
82 | void SetRootGeometry(Bool_t flag=kTRUE); | |
83 | const char* GetGeometryFileName() const {return fGeometryFileName.Data();} | |
ced249e6 | 84 | void SetGeometryFromFile(const char *filename) { |
85 | SetRootGeometry(); | |
86 | fGeometryFileName = filename; | |
87 | } | |
88 | void SetGeometryFromCDB(); | |
89 | Bool_t IsGeomFromCDB() const {return fGeometryFromCDB;} | |
4539539b | 90 | const char* GetTriggerDescriptor() const {return fTriggerDescriptor.Data();} |
91 | void SetTriggerDescriptor(const char *name) {fTriggerDescriptor = name;} | |
fe4da5cc | 92 | virtual void ResetDigits(); |
2ab0c725 | 93 | virtual void ResetSDigits(); |
fe4da5cc | 94 | virtual void ResetPoints(); |
e2afb3b6 | 95 | virtual void SetBaseFile(const char *filename="galice.root"); |
875c717b | 96 | virtual void RunMC(Int_t nevent=1, const char *setup="Config.C"); |
88cb7938 | 97 | virtual void Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);} |
dea76e7a | 98 | virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178, |
88cb7938 | 99 | Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0, |
93dccc77 | 100 | Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL, Int_t nev = -1); |
dffd31ef | 101 | virtual Bool_t IsLegoRun() const {return (fLego!=0);} |
7f6f9ab2 | 102 | virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0); |
fe4da5cc | 103 | virtual void SetDisplay(AliDisplay *display) {fDisplay = display;} |
07c4aae4 | 104 | 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"); |
d8408e76 | 105 | virtual void SetField(AliMagF* magField); |
94de3818 | 106 | virtual TDatabasePDG* PDGDB() const {return fPDGDB;} |
b9d0a01d | 107 | |
b9d0a01d | 108 | virtual void Field(const Double_t* x, Double_t* b) const; |
5d12ce38 | 109 | |
110 | // Delegations | |
111 | virtual void ResetHits(); | |
112 | virtual AliGenerator* Generator() const; | |
3d45e923 | 113 | |
4d81e5e7 | 114 | Bool_t IsFileAccessible(Char_t* name, EAccessMode mode = kFileExists); |
115 | static Bool_t IsFileAccessible(const char* fnam, EAccessMode mode = kFileExists); | |
3d45e923 | 116 | |
b9d0a01d | 117 | // |
118 | // End of MC Application | |
fe4da5cc | 119 | |
88cb7938 | 120 | TTree *TreeE() {return (fRunLoader)?fRunLoader->TreeE():0x0;} |
121 | TTree *TreeK() {return (fRunLoader)?fRunLoader->TreeK():0x0;} | |
122 | AliStack *Stack() {return (fRunLoader)?fRunLoader->Stack():0x0;} | |
123 | AliHeader* GetHeader() {return (fRunLoader)?fRunLoader->GetHeader():0x0;} | |
fe4da5cc | 124 | |
2057aecb | 125 | TTree *TreeD() const {MayNotUse("TreeD"); return 0x0;} |
126 | TTree *TreeS() const {MayNotUse("TreeS"); return 0x0;} | |
127 | TTree *TreeR() const {MayNotUse("TreeR"); return 0x0;} | |
b8c3b0cc | 128 | |
88cb7938 | 129 | |
130 | void SetRunLoader(AliRunLoader* rloader); | |
131 | AliRunLoader* GetRunLoader() const {return fRunLoader;} | |
132 | // void SetEventFolderName(const char* eventfoldername); | |
133 | virtual void Announce() const; | |
134 | ||
135 | virtual void InitLoaders(); //prepares run (i.e. creates getters) | |
2057aecb | 136 | static void Deprecated(TObject *obj, const char *method, const char *replace) |
8364b0ef | 137 | {// Indicates deprecated method |
2057aecb | 138 | if (obj) ::Warning(Form("%s::%s", obj->ClassName(), method), |
139 | "method is depricated\nPlease use: %s", replace); | |
140 | else ::Warning(method, "method is depricated\nPlease use: %s", replace); | |
141 | } | |
142 | ||
aee8290b | 143 | protected: |
3d45e923 | 144 | void SetRunNumber(Int_t run) {fRun=run;} |
9e1a0ddb | 145 | virtual void Tree2Tree(Option_t *option, const char *detector=0); |
2ab0c725 | 146 | Int_t fRun; //! Current run number |
147 | Int_t fEvent; //! Current event number (from 1) | |
eef4b160 | 148 | Int_t fEventNrInRun; //! Current unique event number in run |
6df200c3 | 149 | Int_t fEventsPerRun; // Number of events per run |
2ab0c725 | 150 | TObjArray *fModules; // List of Detectors |
2ab0c725 | 151 | TGeometry *fGeometry; // Pointer to geometry |
5d12ce38 | 152 | AliMC *fMCApp; // Pointer to virtual MC Application |
2ab0c725 | 153 | AliDisplay *fDisplay; //! Pointer to event display |
2ab0c725 | 154 | AliMagF *fField; // Magnetic Field Map |
2ab0c725 | 155 | Int_t fNdets; // Number of detectors |
2ab0c725 | 156 | Bool_t fInitDone; //! True when initialisation done |
157 | AliLego *fLego; //! Pointer to aliLego object if it exists | |
158 | TDatabasePDG *fPDGDB; // Particle factory object | |
2ab0c725 | 159 | TString fConfigFunction; // Configuration file to be executed |
160 | TRandom *fRandom; // Pointer to the random number generator | |
2ab0c725 | 161 | TString fBaseFileName; // Name of the base root file |
4a9de4af | 162 | Bool_t fIsRootGeometry; //! Flag telling if the geometry is loaded from file |
3d45e923 | 163 | Bool_t fGeometryFromCDB; //! Flag telling if the geometry is to be loaded from OCDB |
4a9de4af | 164 | TString fGeometryFileName; //! Name of the geometry file |
4539539b | 165 | TString fTriggerDescriptor; // Trigger descriptor identifier |
88cb7938 | 166 | AliRunLoader *fRunLoader; //!run getter - written as a separate object |
ef42d733 | 167 | private: |
6c4904c2 | 168 | void Copy(TObject &arun) const; |
ef42d733 | 169 | |
ac810b84 | 170 | ClassDef(AliRun,11) //Supervisor class for all Alice detectors |
fe4da5cc | 171 | }; |
172 | ||
75a25b1b | 173 | R__EXTERN AliRun *gAlice; |
4d81e5e7 | 174 | |
fe4da5cc | 175 | #endif |