Allow reading of multiple events in AliRun, correct the I/O of the header
[u/mrichter/AliRoot.git] / STEER / AliRun.h
fe4da5cc 1#ifndef AliRun_H
2#define AliRun_H
3#include <TROOT.h>
4#include <TBrowser.h>
5#include <TList.h>
6#include <TStopwatch.h>
7#include <TTree.h>
8#include <TGeometry.h>
1578254f 9#include <TDatabasePDG.h>
c411211e 11#include "AliDetector.h"
fe4da5cc 12#include "AliHeader.h"
13#include "AliMagF.h"
14#include "AliMC.h"
15#include "AliGenerator.h"
16#include "AliLego.h"
1578254f 18enum {Keep_Bit=1, Daughters_Bit=2, Done_Bit=4};
fe4da5cc 20class AliDisplay;
22class AliRun : public TNamed {
25 Int_t fRun; //Current run number
26 Int_t fEvent; //Current event number (from 1)
27 Int_t fNtrack; //Number of tracks
28 Int_t fHgwmk; //Last track purified
29 Int_t fCurrent; //Last track returned from the stack
30 Int_t fDebug; //Debug flag
31 AliHeader fHeader; //Header information
32 TTree *fTreeD; //Pointer to Tree for Digits
33 TTree *fTreeK; //Pointer to Tree for Kinematics
34 TTree *fTreeH; //Pointer to Tree for Hits
35 TTree *fTreeE; //Pointer to Tree for Header
36 TTree *fTreeR; //Pointer to Tree for Reconstructed Objects
02ca2762 37 TObjArray *fModules; //List of Detectors
fe4da5cc 38 TClonesArray *fParticles; //Pointer to list of particles
39 TGeometry *fGeometry; //Pointer to geometry
40 AliDisplay *fDisplay; //Pointer to event display
41 TStopwatch fTimer; //Timer object
42 AliMagF *fField; //Magnetic Field Map
43 AliMC *fMC; //pointer to MonteCarlo object
fe4da5cc 44 TArrayI *fImedia; //Array of correspondence between media and detectors
45 Int_t fNdets; //Number of detectors
46 Float_t fTrRmax; //Maximum radius for tracking
47 Float_t fTrZmax; //Maximu z for tracking
48 AliGenerator *fGenerator; //Generator used in the MC
fe4da5cc 49 Bool_t fInitDone; //true when initialisation done
50 AliLego *fLego; //pointer to aliLego object if it exists
1578254f 51 TDatabasePDG *fPDGDB; //Particle factory object!
fe4da5cc 52
54 // Creators - distructors
55 AliRun();
56 AliRun(const char *name, const char *title);
57 virtual ~AliRun();
59 virtual void AddHit(Int_t id, Int_t track, Int_t *vol, Float_t *hits) const;
60 virtual void AddDigit(Int_t id, Int_t *tracks, Int_t *digits) const;
61 virtual void Browse(TBrowser *b);
62 virtual void Build();
63 virtual void BuildSimpleGeometry();
64 virtual void CleanDetectors();
65 virtual void CleanParents();
8494b010 66 TObjArray *Detectors() const {return fModules;}
67 TObjArray *Modules() const {return fModules;}
fe4da5cc 68 Int_t CurrentTrack() const {return fCurrent;}
69 AliDisplay *Display() { return fDisplay;}
70 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
71 virtual void DumpPart (Int_t i);
72 virtual void DumpPStack ();
73 virtual AliMagF *Field() const {return fField;}
74 virtual void FillTree();
75 virtual void FinishPrimary();
76 virtual void FinishEvent();
77 virtual void FinishRun();
78 virtual void FlagTrack(Int_t track);
79 Int_t GetEvNumber() const {return fEvent;}
80 Int_t GetRunNumber() const {return fRun;}
8494b010 81 void SetRunNumber(Int_t run) {fRun=run;}
fe4da5cc 82 Int_t GetDebug() const {return fDebug;}
8494b010 83 AliModule *GetModule(const char *name);
a68348e9 84 AliDetector *GetDetector(const char *name);
8494b010 85 Int_t GetModuleID(const char *name);
fe4da5cc 86 virtual Int_t GetEvent(Int_t event);
87 TGeometry *GetGeometry();
88 AliHeader *GetHeader() {return &fHeader;}
89 virtual void GetNextTrack(Int_t &mtrack, Int_t &ipart, Float_t *pmom, Float_t &e, Float_t *vpos, Float_t *polar, Float_t &tof);
90 Int_t GetNtrack() {return fNtrack;}
91 virtual Int_t GetPrimary(Int_t track);
92 virtual void Init(const char *setup="Config.C");
93 Bool_t IsFolder() {return kTRUE;}
94 virtual void MakeTree(Option_t *option="KH");
95 TClonesArray *Particles() {return fParticles;};
96 virtual void PurifyKine();
97 virtual Int_t PurifyKine(Int_t lastSavedTrack, Int_t nofTracks);
98 virtual void Reset(Int_t run, Int_t idevent);
99 virtual void ResetDigits();
100 virtual void ResetHits();
101 virtual void ResetPoints();
102 virtual void SetTransPar(char *filename="$(ALICE_ROOT)/data/galice.cuts");
103 virtual void ResetStack() {fCurrent=-1;fHgwmk=0;fNtrack=0;fParticles->Clear();}
104 virtual void Run(Int_t nevent=1, const char *setup="Config.C");
105 virtual void RunLego(const char *setup="Config.C",Int_t ntheta=60,Float_t themin=2,Float_t themax=178,
106 Int_t nphi=60,Float_t phimin=0,Float_t phimax=360,Float_t rmin=0,
107 Float_t rmax=570,Float_t zmax=10000);
108 virtual void SetCurrentTrack(Int_t track);
109 virtual void SetDebug(const Int_t level=1) {fDebug = level;}
110 virtual void SetDisplay(AliDisplay *display) {fDisplay = display;}
111 virtual void StepManager(Int_t id) const;
112 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 113 virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg,
fe4da5cc 114 Float_t *pmom, Float_t *vpos, Float_t *polar,
115 Float_t tof, const char *mecha, Int_t &ntr,
116 Float_t weight=1);
117 virtual void KeepTrack(const Int_t);
118 virtual void MediaTable();
119 virtual Float_t TrackingZmax() const {return fTrZmax;}
120 virtual Float_t TrackingRmax() const {return fTrRmax;}
121 virtual void TrackingLimits( Float_t rmax=1.e10, Float_t zmax=1.e10) {fTrRmax=rmax; fTrZmax=zmax;}
122 virtual Int_t DetFromMate(Int_t i) { return (*fImedia)[i];}
123 virtual AliGenerator* Generator() {return fGenerator;}
124 virtual void SetGenerator(AliGenerator *generator);
125 virtual void EnergySummary();
1578254f 126 virtual const TDatabasePDG* PDGDB() const {return fPDGDB;}
fe4da5cc 127
128 // Functions from GEOCAD
129 //_______________________________________________________________________
02ca2762 131 virtual void ReadEuclid(const char*, const AliModule*, const char*);
132 virtual void ReadEuclidMedia(const char*, const AliModule*);
fe4da5cc 133
134 TTree *TreeD() {return fTreeD;}
135 TTree *TreeE() {return fTreeE;}
136 TTree *TreeH() {return fTreeH;}
137 TTree *TreeK() {return fTreeK;}
138 TTree *TreeR() {return fTreeR;}
140 // --------------------------- commons -------------------------------------
59fe9bd2 142 ClassDef(AliRun,2) //Supervisor class for all Alice detectors
fe4da5cc 143};
145EXTERN AliRun *gAlice;