]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliRun.h
Deleting the list of histograms in the destructor
[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>
98490ea9 10#include <TMCProcess.h>
fe4da5cc 11#include <TStopwatch.h>
98490ea9 12#include <TVirtualMC.h>
b9d0a01d 13#include <TVirtualMCApplication.h>
b8c3b0cc 14#include <TError.h>
116cbefd 15
e2afb3b6 16class TBranch;
17class TBrowser;
18class TDatabasePDG;
19class TFile;
20class TGeometry;
21class TList;
22class TParticle;
23class TRandom;
24class TTree;
1578254f 25
94de3818 26class AliDetector;
94de3818 27class AliDisplay;
e2afb3b6 28class AliGenEventHeader;
65fb704d 29class AliGenerator;
e2afb3b6 30class AliHeader;
31class AliLego;
32class AliLegoGenerator;
65fb704d 33class AliLegoGenerator;
2ab0c725 34class AliMCQA;
e2afb3b6 35class AliMagF;
36class AliModule;
9e1a0ddb 37class AliStack;
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;
37d06d5b 62 AliDisplay *Display() const { return fDisplay;}
116cbefd 63 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) const;
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();
37d06d5b 91 AliHeader* GetHeader() const {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
37d06d5b 106 TObjArray *Particles() const;
107 TParticle *Particle(Int_t i) const;
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;}
eb1b8d29 150 virtual void Announce() const;
b9d0a01d 151
152 // MC Application
153 //
154 virtual void ConstructGeometry();
155 virtual void InitGeometry();
156 virtual void GeneratePrimaries();
157 virtual void BeginEvent();
158 virtual void BeginPrimary();
159 virtual void PreTrack();
160 virtual void Stepping();
161 virtual void PostTrack();
162 virtual void FinishPrimary();
163 virtual void FinishEvent();
164 virtual Double_t TrackingZmax() const {return fTrZmax;}
165 virtual Double_t TrackingRmax() const {return fTrRmax;}
166 virtual void Field(const Double_t* x, Double_t* b) const;
167 //
168 // End of MC Application
fe4da5cc 169
7a16e9cc 170 TFile* InitTreeFile(Option_t *option, TString fileName);
b9d0a01d 171 void PrintTreeFile();
172 void CloseTreeFile(Option_t *option);
7a16e9cc 173 TString GetTreeDFileName() const {return fTreeDFileName;}
174 TString GetTreeSFileName() const {return fTreeSFileName;}
175 TString GetTreeRFileName() const {return fTreeRFileName;}
176 void SetTreeDFileName(TString fileName){fTreeDFileName=fileName;}
177 void SetTreeSFileName(TString fileName){fTreeSFileName=fileName;}
178 void SetTreeRFileName(TString fileName){fTreeRFileName=fileName;}
179 TFile* GetTreeDFile() const {return fTreeDFile;}
180 TFile* GetTreeSFile() const {return fTreeSFile;}
181 TFile* GetTreeRFile() const {return fTreeRFile;}
182
875c717b 183
37d06d5b 184 TTree *TreeD() const {return fTreeD;}
185 TTree *TreeS() const {return fTreeS;}
186 TTree *TreeE() const {return fTreeE;}
187 TTree *TreeH() const {return fTreeH;}
188 TTree *TreeTR() const {return fTreeTR;}
189 TTree *TreeK() const;
190 TTree *TreeR() const {return fTreeR;}
fe4da5cc 191
37d06d5b 192 AliStack *Stack() const {return fStack;}
9e1a0ddb 193
b8c3b0cc 194 static void Deprecated(TObject *obj, const char *method,
195 const char *replacement) {
196 if (obj)
197 ::Warning(Form("%s::%s", obj->ClassName(), method),
198 "method is depricated\nPlease use: %s", replacement);
199 else
200 ::Warning(method, "method is depricated\nPlease use: %s", replacement);
201 }
202
aee8290b 203protected:
9e1a0ddb 204 virtual void Tree2Tree(Option_t *option, const char *detector=0);
7a16e9cc 205 TFile* InitFile(TString fileName="");
2ab0c725 206 Int_t fRun; //! Current run number
207 Int_t fEvent; //! Current event number (from 1)
eef4b160 208 Int_t fEventNrInRun; //! Current unique event number in run
6df200c3 209 Int_t fEventsPerRun; // Number of events per run
2ab0c725 210 Int_t fDebug; // Debug flag
9e1a0ddb 211 AliHeader *fHeader; // Header information
2ab0c725 212 TTree *fTreeD; //! Pointer to Tree for Digits
213 TTree *fTreeS; //! Pointer to Tree for SDigits
2ab0c725 214 TTree *fTreeH; //! Pointer to Tree for Hits
aab9c8d5 215 TTree *fTreeTR; //! Pointer to Tree for TrackRefernces
2ab0c725 216 TTree *fTreeE; //! Pointer to Tree for Header
217 TTree *fTreeR; //! Pointer to Tree for Reconstructed Objects
218 TObjArray *fModules; // List of Detectors
2ab0c725 219 TGeometry *fGeometry; // Pointer to geometry
220 AliDisplay *fDisplay; //! Pointer to event display
221 TStopwatch fTimer; // Timer object
222 AliMagF *fField; // Magnetic Field Map
98490ea9 223 TVirtualMC *fMC; //! Pointer to MonteCarlo object
2ab0c725 224 TArrayI *fImedia; //! Array of correspondence between media and detectors
225 Int_t fNdets; // Number of detectors
226 Float_t fTrRmax; // Maximum radius for tracking
227 Float_t fTrZmax; // Maximu z for tracking
228 AliGenerator *fGenerator; // Generator used in the MC
229 Bool_t fInitDone; //! True when initialisation done
230 AliLego *fLego; //! Pointer to aliLego object if it exists
231 TDatabasePDG *fPDGDB; // Particle factory object
232 TList *fHitLists; //! Lists of hits to be remapped by PurifyKine
233 TArrayF fEventEnergy; //! Energy deposit for current event
234 TArrayF fSummEnergy; //! Energy per event in each volume
235 TArrayF fSum2Energy; //! Energy squared per event in each volume
236 TString fConfigFunction; // Configuration file to be executed
237 TRandom *fRandom; // Pointer to the random number generator
238 AliMCQA *fMCQA; // Pointer to MC Quality assurance class
239 TString fTransParName; // Name of the transport parameters file
240 TString fBaseFileName; // Name of the base root file
c0f4be09 241 AliStack* fStack; //! Particle Stack
b9d0a01d 242
7a16e9cc 243 TString fTreeDFileName; //! name of the file with TreeD
244 TFile* fTreeDFile; //! file with TreeD
245 TString fTreeSFileName; //! name of the file with TreeS
246 TFile* fTreeSFile; //! file with TreeS
247 TString fTreeRFileName; //! name of the file with TreeR
248 TFile* fTreeRFile; //! file with TreeR
b9d0a01d 249
ef42d733 250private:
e2afb3b6 251 void Copy(AliRun &arun) const;
ef42d733 252
e2afb3b6 253 ClassDef(AliRun,7) //Supervisor class for all Alice detectors
fe4da5cc 254};
255
75a25b1b 256R__EXTERN AliRun *gAlice;
fe4da5cc 257
258#endif