]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRun.h
Virual base classes for AOD and ESD, organized in libSTEERBase (Markus)
[u/mrichter/AliRoot.git] / STEER / AliRun.h
1 #ifndef ALIRUN_H
2 #define ALIRUN_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //
9 // General configuration class for Simulation and Reconstruction
10 // Basic driver for AliRoot runs
11 // Containing pointers to data elements for AliRoot
12 //
13
14 #include <TError.h>
15 #include <TSystem.h>
16
17 class TGeometry;
18 class TParticle;
19 class TRandom;
20 class TTree;
21
22 #include "AliRunLoader.h"
23 class AliDisplay;
24 class AliGenEventHeader;
25 class AliGenerator;
26 class AliHeader;
27 class AliLego;
28 class AliLegoGenerator;
29 class AliMC;
30 class AliMagF;
31 class AliStack;
32
33
34 class AliRun : public TNamed {
35 public:
36    // Creators - distructors
37    AliRun();
38    AliRun(const char *name, const char *title);
39    AliRun(const AliRun &arun);
40    virtual ~AliRun();
41
42    AliRun& operator = (const AliRun &arun) 
43      {arun.Copy(*this); return (*this);}
44    virtual  void  Build();
45    virtual  void  BuildSimpleGeometry();
46    virtual  void  CleanDetectors();
47    TObjArray     *Detectors() const {return fModules;}
48    TObjArray     *Modules() const {return fModules;}
49    AliDisplay    *Display() const { return fDisplay;}
50    virtual AliMagF *Field() const {return fField;}
51    virtual  void  FinishRun();
52    void           AddModule(AliModule* mod);
53    Int_t          GetEvNumber() const;
54    Int_t          GetRunNumber() const {return fRun;}
55    void           SetRunNumber(Int_t run) {fRun=run;}
56    void           SetEventNrInRun(Int_t event) {fEventNrInRun=event;}
57    Int_t          GetEventNrInRun() const {return fEventNrInRun;}
58    Int_t          GetEventsPerRun() const {return fEventsPerRun;}
59    Int_t          GetNdets() const {return fNdets;}
60    AliModule     *GetModule(const char *name) const;
61    AliDetector   *GetDetector(const char *name) const;
62    Int_t          GetModuleID(const char *name) const;
63    virtual  const char *GetBaseFile() const 
64     {return fBaseFileName.Data();}
65    virtual  Int_t GetEvent(Int_t event);
66    virtual  void  SetEvent(Int_t event) {fEvent=event;}
67    virtual  void  SetConfigFunction(const char * config="Config();");
68    virtual  const char *GetConfigFunction() const 
69     {return fConfigFunction.Data();}
70    TGeometry     *GetGeometry();
71    virtual  void  SetGenEventHeader(AliGenEventHeader* header);
72    AliMC*         GetMCApp() const {return fMCApp;}
73    virtual  void  Hits2Digits(const char *detector=0); 
74    virtual  void  Hits2SDigits(const char *detector=0)   {Tree2Tree("S",detector);}
75    virtual  void  SDigits2Digits(const char *detector=0) {Tree2Tree("D",detector);}
76    virtual  void  Digits2Reco(const char *detector=0)    {Tree2Tree("R",detector);}
77    virtual  void  InitMC(const char *setup="Config.C");
78    virtual  void  Init(const char *setup="Config.C") {InitMC(setup);}
79    Bool_t         IsFolder() const {return kTRUE;}
80    virtual AliLego* Lego() const {return fLego;}
81    Bool_t         IsRootGeometry() const {return fIsRootGeometry;}
82    void           SetRootGeometry(Bool_t flag=kTRUE);
83    const char*    GetGeometryFileName() const {return fGeometryFileName.Data();}
84    void           SetGeometryFromFile(const char *filename) {
85      SetRootGeometry();
86      fGeometryFileName = filename;
87    }
88    void           SetGeometryFromCDB();
89    Bool_t         IsGeomFromCDB() const {return fGeometryFromCDB;}
90    const char*    GetTriggerDescriptor() const {return fTriggerDescriptor.Data();}
91    void           SetTriggerDescriptor(const char *name) {fTriggerDescriptor = name;}
92    virtual  void  ResetDigits();
93    virtual  void  ResetSDigits();
94    virtual  void  ResetPoints();
95    virtual  void  SetBaseFile(const char *filename="galice.root");
96    virtual  void  RunMC(Int_t nevent=1, const char *setup="Config.C");
97    virtual  void  Run(Int_t nevent=1, const char *setup="Config.C") {RunMC(nevent,setup);}
98    virtual  void  RunLego(const char *setup="Config.C",Int_t nc1=60,Float_t c1min=2,Float_t c1max=178,
99                           Int_t nc2=60,Float_t c2min=0,Float_t c2max=360,Float_t rmin=0,
100                           Float_t rmax=430,Float_t zmax=10000, AliLegoGenerator* gener=NULL, Int_t nev = -1);
101    virtual  Bool_t IsLegoRun() const {return (fLego!=0);}
102    virtual  void  RunReco(const char *detector=0, Int_t first = 0, Int_t last = 0);
103    virtual  void  SetDisplay(AliDisplay *display) {fDisplay = display;}
104    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");
105    virtual  void  SetField(AliMagF* magField);
106    virtual  TDatabasePDG* PDGDB() const {return fPDGDB;}
107    
108    virtual  void Field(const Double_t* x, Double_t* b) const;
109    
110    // Delegations
111    virtual  void  ResetHits();
112    virtual  AliGenerator* Generator() const;
113
114
115
116 // Added by Alberto Colla
117
118    Bool_t         IsFileAccessible(Char_t* name, EAccessMode mode = kFileExists);
119    static   Bool_t   IsFileAccessible(const char* fnam, EAccessMode mode = kFileExists);
120 // Added by Alberto Colla
121
122    //
123    // End of MC Application
124
125    TTree         *TreeE() {return (fRunLoader)?fRunLoader->TreeE():0x0;}
126    TTree         *TreeK() {return (fRunLoader)?fRunLoader->TreeK():0x0;}
127    AliStack      *Stack() {return (fRunLoader)?fRunLoader->Stack():0x0;}
128    AliHeader*     GetHeader() {return (fRunLoader)?fRunLoader->GetHeader():0x0;}
129
130    TTree         *TreeD() const {MayNotUse("TreeD"); return 0x0;}
131    TTree         *TreeS() const {MayNotUse("TreeS"); return 0x0;}
132    TTree         *TreeR() const {MayNotUse("TreeR"); return 0x0;}
133
134    
135    void SetRunLoader(AliRunLoader* rloader);
136    AliRunLoader* GetRunLoader() const {return fRunLoader;}
137 //   void SetEventFolderName(const char* eventfoldername);
138   virtual  void Announce() const;
139    
140   virtual  void  InitLoaders(); //prepares run (i.e. creates getters)
141   static void Deprecated(TObject *obj, const char *method, const char *replace)
142     {// Indicates deprecated method
143       if (obj) ::Warning(Form("%s::%s", obj->ClassName(), method),
144                   "method is depricated\nPlease use: %s", replace);
145       else ::Warning(method, "method is depricated\nPlease use: %s", replace);
146     }
147
148 protected:
149   virtual  void  Tree2Tree(Option_t *option, const char *detector=0);
150   Int_t          fRun;               //! Current run number
151   Int_t          fEvent;             //! Current event number (from 1)
152   Int_t          fEventNrInRun;      //! Current unique event number in run
153   Int_t          fEventsPerRun;      //  Number of events per run
154   TObjArray     *fModules;           //  List of Detectors
155   TGeometry     *fGeometry;          //  Pointer to geometry
156   AliMC         *fMCApp;             //  Pointer to virtual MC Application
157   AliDisplay    *fDisplay;           //! Pointer to event display
158   AliMagF       *fField;             //  Magnetic Field Map
159   Int_t          fNdets;             //  Number of detectors
160   Bool_t         fInitDone;          //! True when initialisation done
161   AliLego       *fLego;              //! Pointer to aliLego object if it exists
162   TDatabasePDG  *fPDGDB;             //  Particle factory object
163   TString        fConfigFunction;    //  Configuration file to be executed
164   TRandom       *fRandom;            //  Pointer to the random number generator
165   TString        fBaseFileName;      //  Name of the base root file
166   Bool_t         fIsRootGeometry;    //! Flag telling if the geometry is loaded from file
167   Bool_t         fGeometryFromCDB;  //! Flag telling if the geometry is to be loaded from OCDB
168   TString        fGeometryFileName;  //! Name of the geometry file
169   TString        fTriggerDescriptor; //  Trigger descriptor identifier
170   AliRunLoader  *fRunLoader;         //!run getter - written as a separate object
171 private:
172   void Copy(TObject &arun) const;
173
174   ClassDef(AliRun,11)      //Supervisor class for all Alice detectors
175 };
176  
177 R__EXTERN  AliRun *gAlice;
178   
179 #endif