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