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