Coding conventions (F.Carminati)
[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
e191bb57 8//
9// General configuration class for folders
10//
11
98490ea9 12#include <TMCProcess.h>
fe4da5cc 13#include <TStopwatch.h>
b8c3b0cc 14#include <TError.h>
116cbefd 15
e2afb3b6 16class TGeometry;
e2afb3b6 17class TParticle;
18class TRandom;
19class TTree;
1578254f 20
88cb7938 21#include "AliRunLoader.h"
94de3818 22class AliDisplay;
e2afb3b6 23class AliGenEventHeader;
65fb704d 24class AliGenerator;
e2afb3b6 25class AliHeader;
26class AliLego;
27class AliLegoGenerator;
5d12ce38 28class AliMC;
e2afb3b6 29class AliMagF;
9e1a0ddb 30class AliStack;
88cb7938 31
aee8290b 32enum {kKeepBit=1, kDaughtersBit=2, kDoneBit=4};
1578254f 33
5d12ce38 34class AliRun : public TNamed {
fe4da5cc 35public:
36 // Creators - distructors
37 AliRun();
38 AliRun(const char *name, const char *title);
e2afb3b6 39 AliRun(const AliRun &arun);
fe4da5cc 40 virtual ~AliRun();
41
e2afb3b6 42 AliRun& operator = (const AliRun &arun)
43 {arun.Copy(*this); return (*this);}
fe4da5cc 44 virtual void Build();
45 virtual void BuildSimpleGeometry();
46 virtual void CleanDetectors();
8494b010 47 TObjArray *Detectors() const {return fModules;}
48 TObjArray *Modules() const {return fModules;}
37d06d5b 49 AliDisplay *Display() const { return fDisplay;}
fe4da5cc 50 virtual AliMagF *Field() const {return fField;}
fe4da5cc 51 virtual void FinishRun();
88cb7938 52 void AddModule(AliModule* mod);
53 Int_t GetEvNumber() const;
fe4da5cc 54 Int_t GetRunNumber() const {return fRun;}
8494b010 55 void SetRunNumber(Int_t run) {fRun=run;}
eef4b160 56 void SetEventNrInRun(Int_t event) {fEventNrInRun=event;}
57 Int_t GetEventNrInRun() const {return fEventNrInRun;}
6df200c3 58 Int_t GetEventsPerRun() const {return fEventsPerRun;}
5d12ce38 59 Int_t GetNdets() const {return fNdets;}
fe4da5cc 60 Int_t GetDebug() const {return fDebug;}
94de3818 61 AliModule *GetModule(const char *name) const;
62 AliDetector *GetDetector(const char *name) const;
63 Int_t GetModuleID(const char *name) const;
39de14fb 64 virtual const char *GetBaseFile() const
65 {return fBaseFileName.Data();}
fe4da5cc 66 virtual Int_t GetEvent(Int_t event);
45189757 67 virtual void SetEvent(Int_t event) {fEvent=event;}
94de3818 68 virtual void SetConfigFunction(const char * config="Config();");
45189757 69 virtual const char *GetConfigFunction() const
70 {return fConfigFunction.Data();}
fe4da5cc 71 TGeometry *GetGeometry();
42f33748 72 virtual void SetGenEventHeader(AliGenEventHeader* header);
5d12ce38 73 AliMC* GetMCApp() const {return fMCApp;}
d47c658f 74 virtual void Hits2Digits(const char *detector=0);
75 virtual void Hits2SDigits(const char *detector=0) {Tree2Tree("S",detector);}
76 virtual void SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);}
77 virtual void Digits2Reco(const char *detector=0) {Tree2Tree("R",detector);}
875c717b 78 virtual void InitMC(const char *setup="Config.C");
79 virtual void Init(const char *setup="Config.C") {InitMC(setup);}
b21a3d1a 80 Bool_t IsFolder() const {return kTRUE;}
838edcaf 81 virtual AliLego* Lego() const {return fLego;}
2ab0c725 82
fe4da5cc 83 virtual void ResetDigits();
2ab0c725 84 virtual void ResetSDigits();
fe4da5cc 85 virtual void ResetPoints();
e2afb3b6 86 virtual void SetBaseFile(const char *filename="galice.root");
875c717b 87 virtual void RunMC(Int_t nevent=1, const char *setup="Config.C");
88cb7938 88 virtual void Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);}
dea76e7a 89 virtual void RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178,
88cb7938 90 Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0,
91 Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL);
dffd31ef 92 virtual Bool_t IsLegoRun() const {return (fLego!=0);}
7f6f9ab2 93 virtual void RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0);
d0f1ee3b 94 virtual void SetDebug(Int_t level=0) {fDebug = level;}
fe4da5cc 95 virtual void SetDisplay(AliDisplay *display) {fDisplay = display;}
07c4aae4 96 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");
d8408e76 97 virtual void SetField(AliMagF* magField);
94de3818 98 virtual TDatabasePDG* PDGDB() const {return fPDGDB;}
b9d0a01d 99
b9d0a01d 100 virtual void Field(const Double_t* x, Double_t* b) const;
5d12ce38 101
102 // Delegations
103 virtual void ResetHits();
104 virtual AliGenerator* Generator() const;
88cb7938 105
b9d0a01d 106 //
107 // End of MC Application
fe4da5cc 108
88cb7938 109 TTree *TreeE() {return (fRunLoader)?fRunLoader->TreeE():0x0;}
110 TTree *TreeK() {return (fRunLoader)?fRunLoader->TreeK():0x0;}
111 AliStack *Stack() {return (fRunLoader)?fRunLoader->Stack():0x0;}
112 AliHeader* GetHeader() {return (fRunLoader)?fRunLoader->GetHeader():0x0;}
fe4da5cc 113
88cb7938 114 TTree *TreeD() {MayNotUse("TreeD"); return 0x0;}
115 TTree *TreeS() {MayNotUse("TreeS"); return 0x0;}
116 TTree *TreeR() {MayNotUse("TreeR"); return 0x0;}
b8c3b0cc 117
88cb7938 118
119 void SetRunLoader(AliRunLoader* rloader);
120 AliRunLoader* GetRunLoader() const {return fRunLoader;}
121// void SetEventFolderName(const char* eventfoldername);
122 virtual void Announce() const;
123
124 virtual void InitLoaders(); //prepares run (i.e. creates getters)
125 static void Deprecated(TObject *obj, const char *method,
126 const char *replacement) {
127 if (obj)
128 ::Warning(Form("%s::%s", obj->ClassName(), method),
129 "method is depricated\nPlease use: %s", replacement);
130 else
131 ::Warning(method, "method is depricated\nPlease use: %s", replacement);
132 }
aee8290b 133protected:
9e1a0ddb 134 virtual void Tree2Tree(Option_t *option, const char *detector=0);
2ab0c725 135 Int_t fRun; //! Current run number
136 Int_t fEvent; //! Current event number (from 1)
eef4b160 137 Int_t fEventNrInRun; //! Current unique event number in run
6df200c3 138 Int_t fEventsPerRun; // Number of events per run
2ab0c725 139 Int_t fDebug; // Debug flag
2ab0c725 140 TObjArray *fModules; // List of Detectors
2ab0c725 141 TGeometry *fGeometry; // Pointer to geometry
5d12ce38 142 AliMC *fMCApp; // Pointer to virtual MC Application
2ab0c725 143 AliDisplay *fDisplay; //! Pointer to event display
144 TStopwatch fTimer; // Timer object
145 AliMagF *fField; // Magnetic Field Map
98490ea9 146 TVirtualMC *fMC; //! Pointer to MonteCarlo object
2ab0c725 147 Int_t fNdets; // Number of detectors
2ab0c725 148 Bool_t fInitDone; //! True when initialisation done
149 AliLego *fLego; //! Pointer to aliLego object if it exists
150 TDatabasePDG *fPDGDB; // Particle factory object
2ab0c725 151 TString fConfigFunction; // Configuration file to be executed
152 TRandom *fRandom; // Pointer to the random number generator
2ab0c725 153 TString fBaseFileName; // Name of the base root file
2b22f272 154
88cb7938 155 AliRunLoader *fRunLoader; //!run getter - written as a separate object
ef42d733 156private:
6c4904c2 157 void Copy(TObject &arun) const;
ef42d733 158
88cb7938 159 ClassDef(AliRun,8) //Supervisor class for all Alice detectors
fe4da5cc 160};
161
75a25b1b 162R__EXTERN AliRun *gAlice;
fe4da5cc 163
164#endif