EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairRun.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairRun.h
1 #ifndef FAIRRUN_H
2 #define FAIRRUN_H
3 
4 #include "TNamed.h"
5 #include "FairLogger.h"
6 class FairTask;
7 class TFile;
8 class FairFileHeader;
9 class FairRuntimeDb;
10 class FairRootManager;
11 class FairEventHeader;
12 
20 class FairRun : public TNamed
21 {
22  public:
26  FairRun();
30  virtual ~FairRun();
34  static FairRun* Instance();
38  virtual void AddTask(FairTask* t);
39  virtual void SetTask(FairTask* t);
43  virtual void Init()=0;
47  virtual void Run(Int_t NStart =0,Int_t NStop=0)=0;
51  virtual void SetOutputFile(const char* fname);
55  void SetOutputFile(TFile* f);
60  void SetEventHeader(FairEventHeader* EvHeader) {
61  fEvHead=EvHeader;
62  }
67  return fRtdb;
68  }
72  TFile* GetOutputFile() {
73  return fOutFile;
74  }
78  Int_t GetRunId() {
79  return ((Int_t) fRunId);
80  }
81 
87  Bool_t IsAna() {
88  return fAna;
89  }
94  FairTask* GetTask(const char* taskName);
99  return fTask;
100  }
104  Int_t GetNTasks() {
105  return fNTasks;
106  }
107 
109  void CreateGeometryFile(const char* geofile);
110 
111  //** Set if RunInfo file should be written */
113 
114  //** Get info if RunInfo file is written */
115  Bool_t GetWriteRunInfoFile() { return fWriteRunInfo;}
116 
117  static void JanaPluginMode(bool what) { mJanaPluginMode = what; };
118  static bool JanaPluginMode( void ) { return mJanaPluginMode; }
119 
120  private:
121  FairRun(const FairRun& M);
123  return *this;
124  }
126  Int_t fNTasks;
127 
128  protected:
131 
138  const char* fOutname;
142  TFile* fOutFile;
144  UInt_t fRunId;
145 
146  Bool_t fAna;
147 
149 
152  Bool_t fWriteRunInfo;
153 
154  static bool mJanaPluginMode; // is 'true' if running in Jana plugin mode
156 
157  public:
158  // Make default calls in such a way that FairRunSim feels good;
159  virtual void RunCoreStart(Int_t NStart = 0, Int_t NStop = 0) {};//Run(NStart, NStop); };
160  virtual void RunCoreFinish( void ) {};
161  virtual bool RunCoreImportNextEvent( void ) { return false; };
162  virtual void RunCoreProcessNextEvent( void ) {};
163  // FIXME: this call is a clear cludge; need to arrange per-event processor in MC mode;
164  virtual bool JanaLoopPossible( void ) const { return true; }
165  int GetCurrentEventIndex( void ) const { return mEvCurrent; }
166 
167  ClassDef(FairRun ,2)
168 };
169 #endif //FAIRRUN_H