Temporary reverting the changes introduced earlier to store the TGeo geometry. New...
[u/mrichter/AliRoot.git] / STEER / AliRun.h
CommitLineData
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 17class TGeometry;
e2afb3b6 18class TParticle;
19class TRandom;
20class TTree;
1578254f 21
88cb7938 22#include "AliRunLoader.h"
94de3818 23class AliDisplay;
e2afb3b6 24class AliGenEventHeader;
65fb704d 25class AliGenerator;
e2afb3b6 26class AliHeader;
27class AliLego;
28class AliLegoGenerator;
5d12ce38 29class AliMC;
e2afb3b6 30class AliMagF;
9e1a0ddb 31class AliStack;
88cb7938 32
aee8290b 33enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4};
1578254f 34
5d12ce38 35class AliRun : public TNamed {
fe4da5cc 36public:
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;}
8494b010 56 void SetRunNumber(Int_t run) {fRun=run;}
eef4b160 57 void SetEventNrInRun(Int_t event) {fEventNrInRun=event;}
58 Int_t GetEventNrInRun() const {return fEventNrInRun;}
6df200c3 59 Int_t GetEventsPerRun() const {return fEventsPerRun;}
5d12ce38 60 Int_t GetNdets() const {return fNdets;}
21bf7095 61 Int_t GetDebug() const;
94de3818 62 AliModule *GetModule(const char *name) const;
63 AliDetector *GetDetector(const char *name) const;
64 Int_t GetModuleID(const char *name) const;
39de14fb 65 virtual const char *GetBaseFile() const
66 {return fBaseFileName.Data();}
fe4da5cc 67 virtual Int_t GetEvent(Int_t event);
45189757 68 virtual void SetEvent(Int_t event) {fEvent=event;}
94de3818 69 virtual void SetConfigFunction(const char * config="Config();");
45189757 70 virtual const char *GetConfigFunction() const
71 {return fConfigFunction.Data();}
fe4da5cc 72 TGeometry *GetGeometry();
42f33748 73 virtual void SetGenEventHeader(AliGenEventHeader* header);
5d12ce38 74 AliMC* GetMCApp() const {return fMCApp;}
d47c658f 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);}
875c717b 79 virtual void InitMC(const char *setup="Config.C");
80 virtual void Init(const char *setup="Config.C") {InitMC(setup);}
b21a3d1a 81 Bool_t IsFolder() const {return kTRUE;}
838edcaf 82 virtual AliLego* Lego() const {return fLego;}
2ab0c725 83
fe4da5cc 84 virtual void ResetDigits();
2ab0c725 85 virtual void ResetSDigits();
fe4da5cc 86 virtual void ResetPoints();
e2afb3b6 87 virtual void SetBaseFile(const char *filename="galice.root");
875c717b 88 virtual void RunMC(Int_t nevent=1, const char *setup="Config.C");
88cb7938 89 virtual void Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);}
dea76e7a 90 virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178,
88cb7938 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);
dffd31ef 93 virtual Bool_t IsLegoRun() const {return (fLego!=0);}
7f6f9ab2 94 virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0);
21bf7095 95 virtual void SetDebug(Int_t level=0);
fe4da5cc 96 virtual void SetDisplay(AliDisplay *display) {fDisplay = display;}
07c4aae4 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");
d8408e76 98 virtual void SetField(AliMagF* magField);
94de3818 99 virtual TDatabasePDG* PDGDB() const {return fPDGDB;}
b9d0a01d 100
b9d0a01d 101 virtual void Field(const Double_t* x, Double_t* b) const;
5d12ce38 102
103 // Delegations
104 virtual void ResetHits();
105 virtual AliGenerator* Generator() const;
88cb7938 106
4d81e5e7 107
108
109// Added by Alberto Colla
110
111 Bool_t IsFileAccessible(Char_t* name, EAccessMode mode = kFileExists);
112 static Bool_t IsFileAccessible(const char* fnam, EAccessMode mode = kFileExists);
113// Added by Alberto Colla
114
b9d0a01d 115 //
116 // End of MC Application
fe4da5cc 117
88cb7938 118 TTree *TreeE() {return (fRunLoader)?fRunLoader->TreeE():0x0;}
119 TTree *TreeK() {return (fRunLoader)?fRunLoader->TreeK():0x0;}
120 AliStack *Stack() {return (fRunLoader)?fRunLoader->Stack():0x0;}
121 AliHeader* GetHeader() {return (fRunLoader)?fRunLoader->GetHeader():0x0;}
fe4da5cc 122
2057aecb 123 TTree *TreeD() const {MayNotUse("TreeD"); return 0x0;}
124 TTree *TreeS() const {MayNotUse("TreeS"); return 0x0;}
125 TTree *TreeR() const {MayNotUse("TreeR"); return 0x0;}
b8c3b0cc 126
88cb7938 127
128 void SetRunLoader(AliRunLoader* rloader);
129 AliRunLoader* GetRunLoader() const {return fRunLoader;}
130// void SetEventFolderName(const char* eventfoldername);
131 virtual void Announce() const;
132
133 virtual void InitLoaders(); //prepares run (i.e. creates getters)
2057aecb 134 static void Deprecated(TObject *obj, const char *method, const char *replace)
8364b0ef 135 {// Indicates deprecated method
2057aecb 136 if (obj) ::Warning(Form("%s::%s", obj->ClassName(), method),
137 "method is depricated\nPlease use: %s", replace);
138 else ::Warning(method, "method is depricated\nPlease use: %s", replace);
139 }
140
141
aee8290b 142protected:
9e1a0ddb 143 virtual void Tree2Tree(Option_t *option, const char *detector=0);
2ab0c725 144 Int_t fRun; //! Current run number
145 Int_t fEvent; //! Current event number (from 1)
eef4b160 146 Int_t fEventNrInRun; //! Current unique event number in run
6df200c3 147 Int_t fEventsPerRun; // Number of events per run
2ab0c725 148 TObjArray *fModules; // List of Detectors
2ab0c725 149 TGeometry *fGeometry; // Pointer to geometry
5d12ce38 150 AliMC *fMCApp; // Pointer to virtual MC Application
2ab0c725 151 AliDisplay *fDisplay; //! Pointer to event display
2ab0c725 152 AliMagF *fField; // Magnetic Field Map
98490ea9 153 TVirtualMC *fMC; //! Pointer to MonteCarlo object
2ab0c725 154 Int_t fNdets; // Number of detectors
2ab0c725 155 Bool_t fInitDone; //! True when initialisation done
156 AliLego *fLego; //! Pointer to aliLego object if it exists
157 TDatabasePDG *fPDGDB; // Particle factory object
2ab0c725 158 TString fConfigFunction; // Configuration file to be executed
159 TRandom *fRandom; // Pointer to the random number generator
2ab0c725 160 TString fBaseFileName; // Name of the base root file
2b22f272 161
88cb7938 162 AliRunLoader *fRunLoader; //!run getter - written as a separate object
ef42d733 163private:
6c4904c2 164 void Copy(TObject &arun) const;
ef42d733 165
21bf7095 166 ClassDef(AliRun,10) //Supervisor class for all Alice detectors
fe4da5cc 167};
168
75a25b1b 169R__EXTERN AliRun *gAlice;
4d81e5e7 170
fe4da5cc 171#endif