GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Gw::FrameDispatcher Class Reference

Process a buffer, trigg and dispachs the work to sub-watchers. More...

#include <FrameDispatcher.h>

Inheritance diagram for Gw::FrameDispatcher:

Public Member Functions

virtual void Abort ()
 
template<typename Watcher_T >
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 More...
 
virtual void Add (TTask *)
 add only Watchers to the list of tasks to avoid problems. More...
 
virtual void Add (Watcher *, ADF::DFTrigger *)
 To set a particular watcher to a particular trigger. More...
 
TTreeMasterAddTreeMaster (const Char_t *name, const Char_t *title, Bool_t Overwrite=false, ADF::DFTrigger *t=0x0)
 
virtual Int_t AttachInput (FrameBlock *block, Int_t slot=-1)
 Attach a block as input for a given slot number. More...
 
virtual Int_t AttachOutput (FrameBlock *, Int_t=-1)
 Attach a block as output for a given slot number. More...
 
virtual void CleanTasks ()
 overloaded for efficiency reasons. allocation of TIter is see in Shark (macos) as time consuming More...
 
virtual void Continue ()
 to remove them from the TTask menu More...
 
 FrameDispatcher ()
 
 FrameDispatcher (const char *, const char *, TDirectory *mother_watcher_dir=0x0, TDirectory *mother_tag_watcher_dir=0x0)
 
const std::string & GetConfPath ()
 To get the algo path associated with the current actor. More...
 
virtual Bool_t GetDeletePool () const
 get flag to delete objects in pool More...
 
virtual TDirectory * GetDirectory (Option_t *opt="")
 to each watcher a TDirectory is associated More...
 
FrameIO & GetFrameIO ()
 
Short_t GetLastError () const
 
Short_t GetLastExecStatus () const
 to get the last status More...
 
virtual Int_t GetMaxInput () const
 for this actor, it gives the max number of entry lines it can handle : one for a consumer More...
 
virtual Int_t GetMaxOutput () const
 for this actor, it gives the max number of output lines it can handle (max included). More...
 
virtual Int_t GetNbInput () const
 for this actor, it gives the current number of entry lines attached. More...
 
virtual Int_t GetNbOutput () const
 for this actor, it gives the current number of output lines attached. More...
 
UInt_t GetPID () const
 To get the ID number for that algorithm. More...
 
virtual TObjArray & GetPoolOfObject ()
 
virtual TObjArray & GetReference ()
 
virtual ADF::DFTriggerGetTrigger () const
 To know the trigger in which the frame to be watched is embedded. More...
 
void Pass ()
 force fHasExecuted (recursively) to true More...
 
virtual void Print (Option_t *="") const
 
virtual void process_block (void *input_buffer, UInt_t size_of_input_buffer, UInt_t *error_code)
 Narval interface, Ask the algorithm to process the input data block. More...
 
virtual void process_initialise (UInt_t *)
 do nothing ... not a complete consumer More...
 
virtual void process_pause (UInt_t *error_code)
 This method is called every time the system pauses data acquisition. More...
 
virtual void process_reset (UInt_t *)
 do nothing ... not a complete consumer More...
 
virtual void process_resume (UInt_t *error_code)
 this method is called every time the system resumes data acquisition More...
 
virtual void process_start (UInt_t *error_code)
 This method is called every time the daq starts. More...
 
virtual void process_stop (UInt_t *error_code)
 This method is called every time the daq stops. More...
 
virtual UInt_t ProcessBlock (ADF::FrameBlock &)
 look for a Frame using the Trigger and dispatch it to sustasks More...
 
virtual UInt_t ProcessBlocks ()
 process blocks attached by AttachInput/AttachOutput. No need to overwrite it if ProcessBlock(FrameBlock &). Otherwise both are to be implemented. More...
 
virtual void SetBreakin (Int_t=1)
 
virtual void SetBreakout (Int_t=1)
 
virtual void SetDeletePool (Bool_t d)
 set flag to delete objects in pool More...
 
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 More...
 
void SetLastError (Short_t s=0)
 TMP : migration to TreeWatcher with Cuts : should be removed. More...
 
void SetLastExecStatus (Short_t s=0)
 reset last status. 0 means no error, 0 < means error, > 0 means ok with conditions More...
 
virtual Bool_t SetTrigger (ADF::DFTrigger *)
 This is the default trigger for any added watcher. More...
 
void ShowCanvas (Option_t *option="")
 Display some results. More...
 
virtual UInt_t Snapshot (Option_t *="*")
 change kind of Watcher More...
 
virtual void Tag (Option_t *opt="")
 Tag the current watcher. More...
 
virtual Bool_t TestTag (Option_t *opt)
 Compare the current spectra with the tagged ones using Kolmogorov test. More...
 
virtual void Zero (Option_t *hname="pool", Option_t *binning="")
 call Zero for all the watchers More...
 
virtual ~FrameDispatcher ()
 

Static Public Member Functions

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 asked (system call, time consuming) More...
 
static std::string GetGlobalConfPath ()
 global conf path keep since passed in static method and needed in init method More...
 
static Int_t GetGlobalParameter (const char *name, UShort_t &val)
 to get from narval a parameter () ... IS IT mandatory to have there a static method ???? More...
 
static Int_t GetGlobalParameter (const char *name, Int_t &val)
 
static Int_t GetGlobalParameter (const char *name, std::string &val)
 
static WatcherGetLastRegistered (const Char_t *classname, Option_t *opt="baseclass")
 to retrieve the last registered watcher of one type. More...
 
static const TList * GetListOfWatchers ()
 
static void process_config (const Char_t *, UInt_t *, Short_t do_adf_conf=0)
 Have to be overwritten and called in your implementation. More...
 
static void process_config (const Char_t *, UInt_t *)
 Narval interface. More...
 
static void SetFirst (Watcher *)
 move a watcher on top of the list More...
 
static void SetGlobalDeletePool (Bool_t d)
 set static flag to delete objects in pool More...
 
static Int_t SetGlobalParameter (const char *name, const UShort_t &)
 
static Int_t SetGlobalParameter (const char *name, const std::string &)
 

Protected Member Functions

void AddToDir (TObject *, TDirectory *)
 
TObject * AddToPool (TObject *ob)
 facility for other watchers: keep a list of all histograms (objects) for global operations More...
 
void DirToDir (TDirectory *, TDirectory *, TObjArray &, Bool_t load_objects=true)
 utilities to add/move/remove objects from one dir to another one More...
 
virtual void DoCanvas (TCanvas *c, Option_t *)
 To be overwritten by real implementation if a canvas is produced. More...
 
void DrawTag (TCanvas *, Option_t *)
 To display tagged histograms and their reference. More...
 
virtual ConfAgent * GetConfAgent () const
 
Bool_t GetFromTrigger (ADF::DFTrigger *, const char *, ADF::SharedFP *&)
 Extract from the trigger and given frame pointer (usefull for other watchers) More...
 
Bool_t GetPathOf (TFolder *f, TObject *searched, TString &path)
 in a folder look for the path to an elmement that is not a folder More...
 
TFolder * GetSubFolder (TFolder *topfolder, const Char_t *sub="")
 for a new histogram, it returns the folder it belongs to. It creates sub and all intermediates if required More...
 
void LoadObject (TObject *new_obj, TDirectory *root_dir)
 to specify what kind of watcher More...
 
Bool_t MakeDir (TFolder *f, TDirectory *mother_dir, Bool_t do_top=true)
 in order to save/load, the structure of the top folders should exists in the root dir More...
 
template<typename Histo_T >
Histo_T * MakeTH1 (const Char_t *hname, const Char_t *htitle, Int_t binx, Double_t xmin, Double_t xmax, const Char_t *sub="")
 Build an histogram, set it to sub directories if required and add it to the pool. More...
 
template<typename Histo_T >
Histo_T * MakeTH2 (const Char_t *hname, const Char_t *htitle, Int_t binx, Double_t xmin, Double_t xmax, Int_t biny, Double_t ymin, Double_t ymax, const Char_t *sub="")
 
template<typename Histo_T >
Histo_T * MakeTH3 (const Char_t *hname, const Char_t *htitle, Int_t binx, Double_t xmin, Double_t xmax, Int_t biny, Double_t ymin, Double_t ymax, Int_t binz, Double_t zmin, Double_t zmax, const Char_t *sub="")
 
TCanvas * NewCanvas (Option_t *)
 It creates a new embedded canvas. More...
 
void RemoveFromDir (TObject *, TDirectory *)
 
void TagOn (TObject *)
 Add this histogram to the list of tagged histograms. More...
 

Protected Attributes

TDirectory * fDirectory
 Objects are in folders. They can be saved/load in/from directory. This is the mother in which this watcher directory is set. More...
 
FrameIO fFrameIO
 Frame IO. More...
 
LogMessage fLog
 
TDirectory * fTagDirectory
 Tagged Objects are in folders. They can be saved/load in/from directory. This is the mother in which this watcher directory is set. More...
 
TStopwatch fTimeControl
 Histograms that displays some statistics. More...
 
TFolder * fTopFolder
 Top folder in which ae stored all spectra. More...
 
ADF::DFTriggerfTrigger
 trigger associated to this watcher More...
 
Version fVersion
 Algo version (used to check determine suitable frame version ?) More...
 
LogMessage Log
 to send messages to the log server More...
 

Detailed Description

Process a buffer, trigg and dispachs the work to sub-watchers.

As a Narval consumer, it receives a buffer to be processed through the ProcessBlock methods. The block is processed and look for triggers.

A default trigger HAS to be set using the SetTrigger method. It is owned by FrameDispatcher so will be deleted once this is deleted !!

Only once a (valid) default trigger is set, Watchers could be added to the FrameDispatcher using the Add method. Thus once the trigger fired in the ProcessBlock method, the associated watcher is executed.

As well once can associate a watcher to a particular trigger with the method Add (Watcher *, DFTrigger *). The passed trigger is owned by this so it will be deleted.

On can associate the same trigger to different watchers, the FrameDispacher takes care about deleteing correctly without problems (in principle ..)

AgataFrameTrigger *trig;
Watcher *w1, *w2;
// allocate trig, w1 and w2
// ...
trig = new AgataFrameTrigger( .. )
w1 = new Watcher ( .. );
w2 = new Watcher ( .. );
//
{
FrameDispatcher dispatcher;
dispatcher.SetTrigger( trig );
dispatcher.Add ( w1, trig );
dispatcher.Add ( w2, trig );
} // => OK, dispatcher takes care to delete trig just once !

As triggers are owned by the FrameDispatcher, a given pointer could not be shared between two FrameDispatcher. However one can create two of them with the same conditions.

Author
Olivier Stezowski

Definition at line 76 of file FrameDispatcher.h.


The documentation for this class was generated from the following files: