Casting to eliminate constructor ambiguity
[u/mrichter/AliRoot.git] / STEER / AliRun.h
CommitLineData
fe4da5cc 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
fe4da5cc 8#include <TROOT.h>
9#include <TBrowser.h>
10#include <TList.h>
11#include <TStopwatch.h>
12#include <TTree.h>
13#include <TGeometry.h>
1578254f 14#include <TDatabasePDG.h>
15
c411211e 16#include "AliDetector.h"
fe4da5cc 17#include "AliHeader.h"
18#include "AliMagF.h"
875c717b 19#include "AliMC.h"
fe4da5cc 20#include "AliGenerator.h"
dffd31ef 21class AliLego;
22//#include "AliLego.h"
fe4da5cc 23
1578254f 24enum {Keep_Bit=1, Daughters_Bit=2, Done_Bit=4};
25
fe4da5cc 26class AliDisplay;
27
28class AliRun : public TNamed {
29
30protected:
31 Int_t fRun; //Current run number
32 Int_t fEvent; //Current event number (from 1)
33 Int_t fNtrack; //Number of tracks
34 Int_t fHgwmk; //Last track purified
35 Int_t fCurrent; //Last track returned from the stack
36 Int_t fDebug; //Debug flag
37 AliHeader fHeader; //Header information
38 TTree *fTreeD; //Pointer to Tree for Digits
39 TTree *fTreeK; //Pointer to Tree for Kinematics
40 TTree *fTreeH; //Pointer to Tree for Hits
41 TTree *fTreeE; //Pointer to Tree for Header
42 TTree *fTreeR; //Pointer to Tree for Reconstructed Objects
02ca2762 43 TObjArray *fModules; //List of Detectors
fe4da5cc 44 TClonesArray *fParticles; //Pointer to list of particles
45 TGeometry *fGeometry; //Pointer to geometry
46 AliDisplay *fDisplay; //Pointer to event display
47 TStopwatch fTimer; //Timer object
48 AliMagF *fField; //Magnetic Field Map
875c717b 49 AliMC *fMC; //pointer to MonteCarlo object
fe4da5cc 50 TArrayI *fImedia; //Array of correspondence between media and detectors
51 Int_t fNdets; //Number of detectors
52 Float_t fTrRmax; //Maximum radius for tracking
53 Float_t fTrZmax; //Maximu z for tracking
54 AliGenerator *fGenerator; //Generator used in the MC
fe4da5cc 55 Bool_t fInitDone; //true when initialisation done
56 AliLego *fLego; //pointer to aliLego object if it exists
1578254f 57 TDatabasePDG *fPDGDB; //Particle factory object!
1cedd08a 58 TList *fHitLists; //Lists of hits to be remapped by PurifyKine
875c717b 59 TArrayF fEventEnergy; //Energy deposit for current event
60 TArrayF fSummEnergy; //Energy per event in each volume
61 TArrayF fSum2Energy; //Energy squared per event in each volume
45189757 62 TString fConfigFunction; //Configuration file to be executed
875c717b 63
fe4da5cc 64
65public:
66 // Creators - distructors
67 AliRun();
68 AliRun(const char *name, const char *title);
69 virtual ~AliRun();
70
71 virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const;
72 virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const;
1cedd08a 73 virtual void AddHitList(TCollection *hitList) {fHitLists->Add(hitList);}
fe4da5cc 74 virtual void Browse(TBrowser *b);
75 virtual void Build();
76 virtual void BuildSimpleGeometry();
77 virtual void CleanDetectors();
78 virtual void CleanParents();
8494b010 79 TObjArray *Detectors() const {return fModules;}
80 TObjArray *Modules() const {return fModules;}
fe4da5cc 81 Int_t CurrentTrack() const {return fCurrent;}
82 AliDisplay *Display() { return fDisplay;}
83 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
84 virtual void DumpPart (Int_t i);
85 virtual void DumpPStack ();
86 virtual AliMagF *Field() const {return fField;}
87 virtual void FillTree();
88 virtual void FinishPrimary();
89 virtual void FinishEvent();
90 virtual void FinishRun();
91 virtual void FlagTrack(Int_t track);
875c717b 92 void AddEnergyDeposit(Int_t id, Float_t edep)
93 {fEventEnergy[id]+=edep;}
fe4da5cc 94 Int_t GetEvNumber() const {return fEvent;}
95 Int_t GetRunNumber() const {return fRun;}
8494b010 96 void SetRunNumber(Int_t run) {fRun=run;}
fe4da5cc 97 Int_t GetDebug() const {return fDebug;}
8494b010 98 AliModule *GetModule(const char *name);
a68348e9 99 AliDetector *GetDetector(const char *name);
8494b010 100 Int_t GetModuleID(const char *name);
fe4da5cc 101 virtual Int_t GetEvent(Int_t event);
45189757 102 virtual void SetEvent(Int_t event) {fEvent=event;}
103 virtual void SetConfigFunction(const char * config="Config();")
104 {fConfigFunction=config;}
105 virtual const char *GetConfigFunction() const
106 {return fConfigFunction.Data();}
fe4da5cc 107 TGeometry *GetGeometry();
108 AliHeader *GetHeader() {return &fHeader;}
45189757 109 virtual void GetNextTrack(Int_t &mtrack, Int_t &ipart, Float_t *pmom,
110 Float_t &e, Float_t *vpos, Float_t *polar,
111 Float_t &tof);
fe4da5cc 112 Int_t GetNtrack() {return fNtrack;}
113 virtual Int_t GetPrimary(Int_t track);
875c717b 114 virtual void InitMC(const char *setup="Config.C");
115 virtual void Init(const char *setup="Config.C") {InitMC(setup);}
fe4da5cc 116 Bool_t IsFolder() {return kTRUE;}
838edcaf 117 virtual AliLego* Lego() const {return fLego;}
fe4da5cc 118 virtual void MakeTree(Option_t *option="KH");
119 TClonesArray *Particles() {return fParticles;};
120 virtual void PurifyKine();
121 virtual Int_t PurifyKine(Int_t lastSavedTrack, Int_t nofTracks);
dffd31ef 122 virtual void BeginEvent();
fe4da5cc 123 virtual void ResetDigits();
124 virtual void ResetHits();
125 virtual void ResetPoints();
126 virtual void SetTransPar(char *filename="$(ALICE_ROOT)/data/galice.cuts");
127 virtual void ResetStack() {fCurrent=-1;fHgwmk=0;fNtrack=0;fParticles->Clear();}
875c717b 128 virtual void RunMC(Int_t nevent=1, const char *setup="Config.C");
129 virtual void Run(Int_t nevent=1, const char *setup="Config.C")
130 {RunMC(nevent,setup);}
fe4da5cc 131 virtual void RunLego(const char *setup="Config.C",Int_t ntheta=60,Float_t themin=2,Float_t themax=178,
132 Int_t nphi=60,Float_t phimin=0,Float_t phimax=360,Float_t rmin=0,
838edcaf 133 Float_t rmax=430,Float_t zmax=10000);
dffd31ef 134 virtual Bool_t IsLegoRun() const {return (fLego!=0);}
fe4da5cc 135 virtual void SetCurrentTrack(Int_t track);
136 virtual void SetDebug(const Int_t level=1) {fDebug = level;}
137 virtual void SetDisplay(AliDisplay *display) {fDisplay = display;}
875c717b 138 virtual void StepManager(Int_t id);
fe4da5cc 139 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");
1578254f 140 virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg,
fe4da5cc 141 Float_t *pmom, Float_t *vpos, Float_t *polar,
142 Float_t tof, const char *mecha, Int_t &ntr,
143 Float_t weight=1);
144 virtual void KeepTrack(const Int_t);
145 virtual void MediaTable();
146 virtual Float_t TrackingZmax() const {return fTrZmax;}
147 virtual Float_t TrackingRmax() const {return fTrRmax;}
148 virtual void TrackingLimits( Float_t rmax=1.e10, Float_t zmax=1.e10) {fTrRmax=rmax; fTrZmax=zmax;}
149 virtual Int_t DetFromMate(Int_t i) { return (*fImedia)[i];}
150 virtual AliGenerator* Generator() {return fGenerator;}
151 virtual void SetGenerator(AliGenerator *generator);
ee1dd322 152 virtual void ResetGenerator(AliGenerator *generator);
fe4da5cc 153 virtual void EnergySummary();
1578254f 154 virtual const TDatabasePDG* PDGDB() const {return fPDGDB;}
fe4da5cc 155
875c717b 156
fe4da5cc 157 TTree *TreeD() {return fTreeD;}
158 TTree *TreeE() {return fTreeE;}
159 TTree *TreeH() {return fTreeH;}
160 TTree *TreeK() {return fTreeK;}
161 TTree *TreeR() {return fTreeR;}
162
163 // --------------------------- commons -------------------------------------
164
45189757 165 ClassDef(AliRun,3) //Supervisor class for all Alice detectors
fe4da5cc 166};
167
75a25b1b 168R__EXTERN AliRun *gAlice;
fe4da5cc 169
170#endif