3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 #include <TMCProcess.h>
9 #include <TStopwatch.h>
17 #include "AliRunLoader.h"
19 class AliGenEventHeader;
23 class AliLegoGenerator;
28 enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4};
30 class AliRun : public TNamed {
32 // Creators - distructors
34 AliRun(const char *name, const char *title);
35 AliRun(const AliRun &arun);
38 AliRun& operator = (const AliRun &arun)
39 {arun.Copy(*this); return (*this);}
41 virtual void BuildSimpleGeometry();
42 virtual void CleanDetectors();
43 TObjArray *Detectors() const {return fModules;}
44 TObjArray *Modules() const {return fModules;}
45 AliDisplay *Display() const { return fDisplay;}
46 virtual AliMagF *Field() const {return fField;}
47 virtual void FinishRun();
48 void AddModule(AliModule* mod);
49 Int_t GetEvNumber() const;
50 Int_t GetRunNumber() const {return fRun;}
51 void SetRunNumber(Int_t run) {fRun=run;}
52 void SetEventNrInRun(Int_t event) {fEventNrInRun=event;}
53 Int_t GetEventNrInRun() const {return fEventNrInRun;}
54 Int_t GetEventsPerRun() const {return fEventsPerRun;}
55 Int_t GetNdets() const {return fNdets;}
56 Int_t GetDebug() const {return fDebug;}
57 AliModule *GetModule(const char *name) const;
58 AliDetector *GetDetector(const char *name) const;
59 Int_t GetModuleID(const char *name) const;
60 virtual const char *GetBaseFile() const
61 {return fBaseFileName.Data();}
62 virtual Int_t GetEvent(Int_t event);
63 virtual void SetEvent(Int_t event) {fEvent=event;}
64 virtual void SetConfigFunction(const char * config="Config();");
65 virtual const char *GetConfigFunction() const
66 {return fConfigFunction.Data();}
67 TGeometry *GetGeometry();
68 virtual void SetGenEventHeader(AliGenEventHeader* header);
69 AliMC* GetMCApp() const {return fMCApp;}
70 virtual void Hits2Digits(const char *detector=0);
71 virtual void Hits2SDigits(const char *detector=0) {Tree2Tree("S",detector);}
72 virtual void SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);}
73 virtual void Digits2Reco(const char *detector=0) {Tree2Tree("R",detector);}
74 virtual void InitMC(const char *setup="Config.C");
75 virtual void Init(const char *setup="Config.C") {InitMC(setup);}
76 Bool_t IsFolder() const {return kTRUE;}
77 virtual AliLego* Lego() const {return fLego;}
79 virtual void ResetDigits();
80 virtual void ResetSDigits();
81 virtual void ResetPoints();
82 virtual void SetBaseFile(const char *filename="galice.root");
83 virtual void RunMC(Int_t nevent=1, const char *setup="Config.C");
84 virtual void Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);}
85 virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178,
86 Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0,
87 Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL);
88 virtual Bool_t IsLegoRun() const {return (fLego!=0);}
89 virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0);
90 virtual void SetDebug(Int_t level=0) {fDebug = level;}
91 virtual void SetDisplay(AliDisplay *display) {fDisplay = display;}
92 virtual void SetField(Int_t type=2, Int_t version=1, Float_t scale=1, Float_t maxField=10, const char* filename="$(ALICE_ROOT)/data/field01.dat");
93 virtual void SetField(AliMagF* magField);
94 virtual TDatabasePDG* PDGDB() const {return fPDGDB;}
96 virtual void Field(const Double_t* x, Double_t* b) const;
99 virtual void ResetHits();
100 virtual AliGenerator* Generator() const;
103 // End of MC Application
105 TTree *TreeE() {return (fRunLoader)?fRunLoader->TreeE():0x0;}
106 TTree *TreeK() {return (fRunLoader)?fRunLoader->TreeK():0x0;}
107 AliStack *Stack() {return (fRunLoader)?fRunLoader->Stack():0x0;}
108 AliHeader* GetHeader() {return (fRunLoader)?fRunLoader->GetHeader():0x0;}
110 TTree *TreeD() {MayNotUse("TreeD"); return 0x0;}
111 TTree *TreeS() {MayNotUse("TreeS"); return 0x0;}
112 TTree *TreeR() {MayNotUse("TreeR"); return 0x0;}
115 void SetRunLoader(AliRunLoader* rloader);
116 AliRunLoader* GetRunLoader() const {return fRunLoader;}
117 // void SetEventFolderName(const char* eventfoldername);
118 virtual void Announce() const;
120 virtual void InitLoaders(); //prepares run (i.e. creates getters)
121 static void Deprecated(TObject *obj, const char *method,
122 const char *replacement) {
124 ::Warning(Form("%s::%s", obj->ClassName(), method),
125 "method is depricated\nPlease use: %s", replacement);
127 ::Warning(method, "method is depricated\nPlease use: %s", replacement);
130 virtual void Tree2Tree(Option_t *option, const char *detector=0);
131 Int_t fRun; //! Current run number
132 Int_t fEvent; //! Current event number (from 1)
133 Int_t fEventNrInRun; //! Current unique event number in run
134 Int_t fEventsPerRun; // Number of events per run
135 Int_t fDebug; // Debug flag
136 TObjArray *fModules; // List of Detectors
137 TGeometry *fGeometry; // Pointer to geometry
138 AliMC *fMCApp; // Pointer to virtual MC Application
139 AliDisplay *fDisplay; //! Pointer to event display
140 TStopwatch fTimer; // Timer object
141 AliMagF *fField; // Magnetic Field Map
142 TVirtualMC *fMC; //! Pointer to MonteCarlo object
143 Int_t fNdets; // Number of detectors
144 Bool_t fInitDone; //! True when initialisation done
145 AliLego *fLego; //! Pointer to aliLego object if it exists
146 TDatabasePDG *fPDGDB; // Particle factory object
147 TString fConfigFunction; // Configuration file to be executed
148 TRandom *fRandom; // Pointer to the random number generator
149 TString fBaseFileName; // Name of the base root file
151 AliRunLoader *fRunLoader; //!run getter - written as a separate object
153 void Copy(TObject &arun) const;
155 ClassDef(AliRun,8) //Supervisor class for all Alice detectors
158 R__EXTERN AliRun *gAlice;