GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FrameDispatcher.h
Go to the documentation of this file.
1 
2 
3 #ifndef Gw_FrameDispatcher
4 #define Gw_FrameDispatcher
5 
6 // Gw includes
7 #ifndef Gw_Watchers
8 #include "Watchers.h"
9 #include "TTreeWatchers.h"
10 #endif
11 
12 // ADF includes
13 #ifndef ADF_Trigger
14 #include "Trigger.h"
15 #endif
16 #ifndef ADF_NarvalInterface
17 #include "NarvalInterface.h"
18 #endif
19 
20 // ROOT includes
21 #include "TH1.h"
22 #include "TStopwatch.h"
23 #include "TROOT.h"
24 
25 // standard includes
26 #include <vector>
27 
28 namespace Gw {
29 
31 
77 {
78 private:
80  static Short_t gDoTimer;
81 
82 private:
84  ADF::PtrStack<ADF::DFTrigger> fListOfTriggers;
85 
86 protected:
88  TStopwatch fTimeControl;
89 
90 private:
91  static const UInt_t kMaxCycle = 1000u;
92  UInt_t fWhichBin;
93 
94 private:
96  TH1D *fTriggerRate;
98  TH1F *fBufferSize;
100  TList *fRealTime;
101  TList *fCPUTime;
102 
104  std::vector< std::pair<Double_t, Double_t> > fCurrentValues;
105 
106 protected:
108  virtual void DoCanvas(TCanvas *c, Option_t *);
109 
111  // void BeginOfBlock();
112  // void EndOfBlock();
113 
114 public:
115  FrameDispatcher();
116  FrameDispatcher(const char *, const char *, TDirectory *mother_watcher_dir = 0x0, TDirectory *mother_tag_watcher_dir = 0x0);
117  virtual ~FrameDispatcher();
118 
120 
125  static Short_t DoTimer(Short_t dotimer)
126  {
127  Short_t old = gDoTimer;
128  switch (dotimer) {
129  case 0:
130  case 1:
131  gDoTimer = dotimer;
132  break;
133  default:
134  gDoTimer = 2;
135  break;
136  }
137  return old;
138  }
139 
141  virtual void process_initialise (UInt_t */*error_code*/)
142  {;}
143 
145  virtual void process_reset (UInt_t */*error_code*/)
146  {;}
147 
149  virtual UInt_t ProcessBlock (ADF::FrameBlock &);
150 
152 
158  virtual Bool_t SetTrigger(ADF::DFTrigger *);
159 
161  template<typename Watcher_T> Watcher_T * Add(const Char_t *name, const Char_t *title, ADF::DFTrigger *t = 0x0)
162  {
163  //set the watcher. Directories are set in Add since no need to have them at construction to load spectra
164  Watcher_T *watcher = new Watcher_T(name,title);
165 
166  if ( t )
167  Add( watcher , t );
168  else
169  Add( watcher );
170 
171  return watcher;
172  }
173 
174  TTreeMaster *AddTreeMaster(const Char_t *name, const Char_t *title, Bool_t Overwrite = false, ADF::DFTrigger *t = 0x0)
175  {
176  //set the watcher. Directories are set in Add since no need to have them at construction to load spectra
177  TTreeMaster *watcher = new TTreeMaster(name,title,2,2,Overwrite);
178 
179  if ( t )
180  Add( watcher , t );
181  else
182  Add( watcher );
183 
184  return watcher;
185  }
186 
187 
189  virtual void SetDirectory(TDirectory *mother_dir_of_watcher, TDirectory *mother_dir_for_tag, Bool_t load_objects = true);
190 
192  virtual void Add(TTask *);
193 
195 
198  virtual void Add(Watcher *, ADF::DFTrigger *);
199 
201  virtual void Zero(Option_t * hname = "pool", Option_t *binning=""); //*MENU*
202 
203  virtual void Print(Option_t * /*option*/ ="") const {;} //*MENU*
204 
205  ClassDef(FrameDispatcher,0) // From a block, dispatchs specific Triggers to other Watchers
206 };
207 
208 } // end namespace
209 
210 #endif
211 
212 
virtual void DoCanvas(TCanvas *c, Option_t *)
To be overwritten by real implementation if a canvas is produced.
virtual UInt_t ProcessBlock(ADF::FrameBlock &)
look for a Frame using the Trigger and dispatch it to sustasks
A Block of Frames.
Definition: FrameBlock.h:43
Process a buffer, trigg and dispachs the work to sub-watchers.
TStopwatch fTimeControl
Histograms that displays some statistics.
virtual Bool_t SetTrigger(ADF::DFTrigger *)
This is the default trigger for any added watcher.
Base class for a Watcher.
Definition: Watchers.h:60
header file for Trigger.cpp
Watcher_T * Add(const Char_t *name, const Char_t *title, ADF::DFTrigger *t=0x0)
allocate a new watcher so that it creates corectly its directory under the dispatcher directory ...
It defines the interface needed to be a consumer.
virtual void Print(Option_t *="") const
TTreeMaster * AddTreeMaster(const Char_t *name, const Char_t *title, Bool_t Overwrite=false, ADF::DFTrigger *t=0x0)
virtual void Zero(Option_t *hname="pool", Option_t *binning="")
call Zero for all the watchers
Base class for a trigger on a data flow.
Definition: Trigger.h:155
Watcher to build a tree with branches processed in several watchers.
virtual void process_initialise(UInt_t *)
do nothing ... not a complete consumer
header file for NarvalInterface.cpp
virtual void process_reset(UInt_t *)
do nothing ... not a complete consumer
static Short_t DoTimer(Short_t dotimer)
To set on/off stopwatch that gives informations about cpu/user time to execute. Switch on only if ask...
virtual void SetDirectory(TDirectory *mother_dir_of_watcher, TDirectory *mother_dir_for_tag, Bool_t load_objects=true)
change directories and Load objects if required