GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
adf/Macros/EmulatorControl.h
Go to the documentation of this file.
1 
2 
3 #ifndef _EmulatorControl
4 #define _EmulatorControl
5 
6 #include "TTask.h"
7 #include "TTimer.h"
8 #include "Rtypes.h"
9 
10 #include "BashColor.h"
11 
12 #include "NarvalInterface.h"
13 
16 {
17 private:
18  // Name of the directory containing the run number
19  TString RunDir;
20  // Run Number
21  Int_t RunNumber;
22 
23 private:
25  TString DoROOTAFPConf(Int_t which_run, const char *path, const char *which_adf_data, const char *run_pat, Option_t *opt_adf_pattern, const char *tmp_rootafp_filename);
26 
27 public:
28  BaseEmulatorChain() : RunDir(""), RunNumber(0)
29  {;}
31  {;}
32 
34  TString GetRunDir() const
35  {
36  return RunDir;
37  }
38 
40  Int_t GetRunNumber() const
41  {
42  return RunNumber;
43  }
44 
46  virtual Bool_t Init()
47  {
48  return false;
49  }
51  virtual Bool_t Init(const Char_t *rootafp);
52  virtual Bool_t Init(Int_t which_run, const char *path, const char *which_adf_data, const char *run_name_pattern, Option_t *opt_adf_pattern);
53 
55  virtual Bool_t Run(UInt_t /* max_loop */ = kMaxUInt)
56  { return true; }
57 
59  {
60  return 0x0;
61  }
63  {
64  return 0x0;
65  }
66 };
67 
68 class EmulatorControl : public TTask
69 {
70 private:
72  BaseEmulatorChain *fEmulator;
74  UInt_t fNbLoop;
75  UInt_t fCurrentLoop;
77  Bool_t fIsRunning;
79  TTimer *fTimer;
80 
81 private:
82  BashColor *fBashColor;
83 
84 private:
85  virtual Bool_t HandleTimer(TTimer* timer);
86 
87 public:
89  TTask("_EmulatorControl","0"),
90  fEmulator(0x0),
91  fNbLoop(0),
92  fCurrentLoop(0),
93  fIsRunning(false),
94  fTimer(new TTimer()),
95  fBashColor(new BashColor())
96  {;}
98  TTask("_EmulatorControl","0"),
99  fEmulator(emulator),
100  fNbLoop(0),
101  fCurrentLoop(0),
102  fIsRunning(false),
103  fTimer(new TTimer()),
104  fBashColor(new BashColor())
105  {;}
107  {
108  if ( fEmulator)
109  delete fEmulator;
110  delete fBashColor;
111  }
112 
114  void Run(UInt_t max_loop = kMaxUInt); //*MENU*
115  void Destroy(); //*MENU*
116 
117  void Stop();
118 
119  virtual void Print(Option_t *option="") const; //*MENU*
120 
121  TTimer *GetTimer(){return fTimer;}
122 
123 
125  void Save(Option_t *opt = "*"); //*MENU*
126 
127  ClassDef(EmulatorControl,0) // to start an emulator from task folder
128 };
129 
130 
131 #endif
TString GetRunDir() const
to get back the RunDirectory
virtual ADF::NarvalProducer * GetBaseProducer()
It defines the interface needed to be a narval actor (producer).
void Save(Option_t *opt="*")
Save the spectra.
Int_t GetRunNumber() const
to get back the run number
virtual void Print(Option_t *option="") const
virtual Bool_t Run(UInt_t=kMaxUInt)
loop
virtual ADF::NarvalConsumer * GetBaseConsumer()
virtual Bool_t Init()
It should be overwritten !
It defines the interface needed to be a consumer.
to have a common base class to be able to control the emulator through a TTask
void Run(UInt_t max_loop=kMaxUInt)
Run the emulator.
EmulatorControl(BaseEmulatorChain *emulator)
header file for NarvalInterface.cpp