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