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