Added explicit base class declaration
[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
94de3818 8#include <TArrayF.h>
e2afb3b6 9#include <TArrayI.h>
88cb7938 10#include <TClonesArray.h>
98490ea9 11#include <TMCProcess.h>
fe4da5cc 12#include <TStopwatch.h>
b9d0a01d 13#include <TVirtualMCApplication.h>
88cb7938 14#include <TVirtualMC.h>
b8c3b0cc 15#include <TError.h>
116cbefd 16
e2afb3b6 17class TBranch;
18class TBrowser;
19class TDatabasePDG;
20class TFile;
21class TGeometry;
22class TList;
23class TParticle;
24class TRandom;
25class TTree;
1578254f 26
88cb7938 27#include "AliRunLoader.h"
94de3818 28class AliDetector;
94de3818 29class AliDisplay;
e2afb3b6 30class AliGenEventHeader;
65fb704d 31class AliGenerator;
e2afb3b6 32class AliHeader;
33class AliLego;
34class AliLegoGenerator;
65fb704d 35class AliLegoGenerator;
2ab0c725 36class AliMCQA;
e2afb3b6 37class AliMagF;
38class AliModule;
9e1a0ddb 39class AliStack;
2b22f272 40class AliTrackReference;
9e1a0ddb 41
88cb7938 42
aee8290b 43enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4};
1578254f 44
fe4da5cc 45
b9d0a01d 46class AliRun : public TVirtualMCApplication {
fe4da5cc 47public:
48 // Creators - distructors
49 AliRun();
50 AliRun(const char *name, const char *title);
e2afb3b6 51 AliRun(const AliRun &arun);
fe4da5cc 52 virtual ~AliRun();
53
e2afb3b6 54 AliRun& operator = (const AliRun &arun)
55 {arun.Copy(*this); return (*this);}
fe4da5cc 56 virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const;
57 virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const;
1cedd08a 58 virtual void AddHitList(TCollection *hitList) {fHitLists->Add(hitList);}
fe4da5cc 59 virtual void Browse(TBrowser *b);
60 virtual void Build();
61 virtual void BuildSimpleGeometry();
62 virtual void CleanDetectors();
8494b010 63 TObjArray *Detectors() const {return fModules;}
64 TObjArray *Modules() const {return fModules;}
642f15cf 65 Int_t GetCurrentTrackNumber() const;
37d06d5b 66 AliDisplay *Display() const { return fDisplay;}
116cbefd 67 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) const;
94de3818 68 virtual void DumpPart (Int_t i) const;
69 virtual void DumpPStack () const;
fe4da5cc 70 virtual AliMagF *Field() const {return fField;}
fe4da5cc 71 virtual void FinishRun();
72 virtual void FlagTrack(Int_t track);
875c717b 73 void AddEnergyDeposit(Int_t id, Float_t edep)
74 {fEventEnergy[id]+=edep;}
88cb7938 75 void AddModule(AliModule* mod);
76 Int_t GetEvNumber() const;
fe4da5cc 77 Int_t GetRunNumber() const {return fRun;}
8494b010 78 void SetRunNumber(Int_t run) {fRun=run;}
eef4b160 79 void SetEventNrInRun(Int_t event) {fEventNrInRun=event;}
80 Int_t GetEventNrInRun() const {return fEventNrInRun;}
6df200c3 81 Int_t GetEventsPerRun() const {return fEventsPerRun;}
fe4da5cc 82 Int_t GetDebug() const {return fDebug;}
94de3818 83 AliModule *GetModule(const char *name) const;
9e1a0ddb 84 TList* GetHitLists() const {return fHitLists ;}
94de3818 85 AliDetector *GetDetector(const char *name) const;
65fb704d 86 AliMCQA *GetMCQA() const {return fMCQA;}
94de3818 87 Int_t GetModuleID(const char *name) const;
39de14fb 88 virtual const char *GetBaseFile() const
89 {return fBaseFileName.Data();}
fe4da5cc 90 virtual Int_t GetEvent(Int_t event);
45189757 91 virtual void SetEvent(Int_t event) {fEvent=event;}
94de3818 92 virtual void SetConfigFunction(const char * config="Config();");
45189757 93 virtual const char *GetConfigFunction() const
94 {return fConfigFunction.Data();}
fe4da5cc 95 TGeometry *GetGeometry();
42f33748 96 virtual void SetGenEventHeader(AliGenEventHeader* header);
9e1a0ddb 97 Int_t GetNtrack() const;
98 virtual Int_t GetPrimary(Int_t track) const;
d47c658f 99 virtual void Hits2Digits(const char *detector=0);
100 virtual void Hits2SDigits(const char *detector=0) {Tree2Tree("S",detector);}
101 virtual void SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);}
102 virtual void Digits2Reco(const char *detector=0) {Tree2Tree("R",detector);}
875c717b 103 virtual void InitMC(const char *setup="Config.C");
104 virtual void Init(const char *setup="Config.C") {InitMC(setup);}
b21a3d1a 105 Bool_t IsFolder() const {return kTRUE;}
838edcaf 106 virtual AliLego* Lego() const {return fLego;}
2ab0c725 107
37d06d5b 108 TObjArray *Particles() const;
109 TParticle *Particle(Int_t i) const;
fe4da5cc 110 virtual void ResetDigits();
2ab0c725 111 virtual void ResetSDigits();
fe4da5cc 112 virtual void ResetHits();
2b22f272 113// Track reference related
114 virtual void AddTrackReference(Int_t label);
115 TClonesArray *TrackReferences() const {return fTrackReferences;}
116 virtual void RemapTrackReferencesIDs(Int_t *map); //remaping track references MI
117 virtual void ResetTrackReferences();
118
fe4da5cc 119 virtual void ResetPoints();
e2afb3b6 120 virtual void SetTransPar(const char *filename="$(ALICE_ROOT)/data/galice.cuts");
121 virtual void SetBaseFile(const char *filename="galice.root");
65fb704d 122 virtual void ReadTransPar();
875c717b 123 virtual void RunMC(Int_t nevent=1, const char *setup="Config.C");
88cb7938 124 virtual void Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);}
dea76e7a 125 virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178,
88cb7938 126 Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0,
127 Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL);
dffd31ef 128 virtual Bool_t IsLegoRun() const {return (fLego!=0);}
7f6f9ab2 129 virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0);
fe4da5cc 130 virtual void SetCurrentTrack(Int_t track);
9e1a0ddb 131 virtual void SetDebug(const Int_t level=0) {fDebug = level;}
fe4da5cc 132 virtual void SetDisplay(AliDisplay *display) {fDisplay = display;}
fe4da5cc 133 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 134 virtual void SetField(AliMagF* magField);
642f15cf 135 virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
47c8bcbe 136 Float_t *pmom, Float_t *vpos, Float_t *polar,
98490ea9 137 Float_t tof, TMCProcess mech, Int_t &ntr,
47c8bcbe 138 Float_t weight = 1, Int_t is = 0);
642f15cf 139 virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
47c8bcbe 140 Double_t px, Double_t py, Double_t pz, Double_t e,
141 Double_t vx, Double_t vy, Double_t vz, Double_t tof,
142 Double_t polx, Double_t poly, Double_t polz,
98490ea9 143 TMCProcess mech, Int_t &ntr, Float_t weight=1,
47c8bcbe 144 Int_t is = 0);
caaac55b 145 virtual void SetHighWaterMark(const Int_t nt);
4d69d91e 146
147 virtual void KeepTrack(const Int_t itra);
fe4da5cc 148 virtual void MediaTable();
fe4da5cc 149 virtual void TrackingLimits( Float_t rmax=1.e10, Float_t zmax=1.e10) {fTrRmax=rmax; fTrZmax=zmax;}
94de3818 150 virtual Int_t DetFromMate(Int_t i) const { return (*fImedia)[i];}
151 virtual AliGenerator* Generator() const {return fGenerator;}
fe4da5cc 152 virtual void SetGenerator(AliGenerator *generator);
ee1dd322 153 virtual void ResetGenerator(AliGenerator *generator);
fe4da5cc 154 virtual void EnergySummary();
94de3818 155 virtual TDatabasePDG* PDGDB() const {return fPDGDB;}
b9d0a01d 156
157 // MC Application
158 //
159 virtual void ConstructGeometry();
160 virtual void InitGeometry();
161 virtual void GeneratePrimaries();
162 virtual void BeginEvent();
163 virtual void BeginPrimary();
164 virtual void PreTrack();
165 virtual void Stepping();
166 virtual void PostTrack();
167 virtual void FinishPrimary();
168 virtual void FinishEvent();
169 virtual Double_t TrackingZmax() const {return fTrZmax;}
170 virtual Double_t TrackingRmax() const {return fTrRmax;}
171 virtual void Field(const Double_t* x, Double_t* b) const;
88cb7938 172
b9d0a01d 173 //
174 // End of MC Application
fe4da5cc 175
88cb7938 176 TTree *TreeE() {return (fRunLoader)?fRunLoader->TreeE():0x0;}
177 TTree *TreeK() {return (fRunLoader)?fRunLoader->TreeK():0x0;}
178 AliStack *Stack() {return (fRunLoader)?fRunLoader->Stack():0x0;}
179 AliHeader* GetHeader() {return (fRunLoader)?fRunLoader->GetHeader():0x0;}
fe4da5cc 180
88cb7938 181 TTree *TreeD() {MayNotUse("TreeD"); return 0x0;}
182 TTree *TreeS() {MayNotUse("TreeS"); return 0x0;}
183 TTree *TreeR() {MayNotUse("TreeR"); return 0x0;}
b8c3b0cc 184
88cb7938 185
186 void SetRunLoader(AliRunLoader* rloader);
187 AliRunLoader* GetRunLoader() const {return fRunLoader;}
188// void SetEventFolderName(const char* eventfoldername);
189 virtual void Announce() const;
190
191 virtual void InitLoaders(); //prepares run (i.e. creates getters)
192 static void Deprecated(TObject *obj, const char *method,
193 const char *replacement) {
194 if (obj)
195 ::Warning(Form("%s::%s", obj->ClassName(), method),
196 "method is depricated\nPlease use: %s", replacement);
197 else
198 ::Warning(method, "method is depricated\nPlease use: %s", replacement);
199 }
aee8290b 200protected:
9e1a0ddb 201 virtual void Tree2Tree(Option_t *option, const char *detector=0);
2ab0c725 202 Int_t fRun; //! Current run number
203 Int_t fEvent; //! Current event number (from 1)
eef4b160 204 Int_t fEventNrInRun; //! Current unique event number in run
6df200c3 205 Int_t fEventsPerRun; // Number of events per run
2ab0c725 206 Int_t fDebug; // Debug flag
2ab0c725 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
2b22f272 230
231 TClonesArray *fTrackReferences; //!list of track references - for one primary track only -MI
88cb7938 232 AliRunLoader *fRunLoader; //!run getter - written as a separate object
ef42d733 233private:
e2afb3b6 234 void Copy(AliRun &arun) const;
ef42d733 235
88cb7938 236 ClassDef(AliRun,8) //Supervisor class for all Alice detectors
fe4da5cc 237};
238
75a25b1b 239R__EXTERN AliRun *gAlice;
fe4da5cc 240
241#endif