33 #include "TStopwatch.h"
34 #include "TObjArray.h"
67 static TList *fgListOfWatchers;
72 static void Register(
Watcher *, Option_t *opt =
"+");
90 static Bool_t fgDeletePool;
97 TObjArray fPoolOfObjects;
101 TObjArray fReference;
113 Short_t fLastExecStatus;
133 void LoadObject(TObject *new_obj, TDirectory *root_dir);
149 void DirToDir(TDirectory *, TDirectory *, TObjArray &, Bool_t load_objects =
true);
151 void AddToDir(TObject *, TDirectory *);
153 Bool_t
MakeDir(TFolder *f, TDirectory *mother_dir, Bool_t do_top =
true);
159 Bool_t
GetPathOf(TFolder *f, TObject *searched, TString &path);
164 TFolder *
GetSubFolder(TFolder *topfolder,
const Char_t *sub =
"");
167 template <
typename Histo_T> Histo_T *
168 MakeTH1(
const Char_t *hname,
const Char_t *htitle, Int_t binx, Double_t xmin, Double_t xmax,
const Char_t *sub =
"")
170 Bool_t def = TH1::AddDirectoryStatus();
171 TH1::AddDirectory(
false);
173 Histo_T *h = 0x0; TString subfolder = sub;
175 h =
new Histo_T(hname,htitle,binx,xmin,xmax);
178 folder->Add((TObject *)h);
183 TH1::AddDirectory(def);
187 template <
typename Histo_T> Histo_T *
188 MakeTH2(
const Char_t *hname,
const Char_t *htitle,
189 Int_t binx, Double_t xmin, Double_t xmax,
190 Int_t biny, Double_t ymin, Double_t ymax,
191 const Char_t *sub =
"")
193 Bool_t def = TH1::AddDirectoryStatus();
194 TH1::AddDirectory(
false);
196 Histo_T *h = 0x0; TString subfolder = sub;
198 h =
new Histo_T(hname,htitle,binx,xmin,xmax,biny,ymin,ymax);
206 TH1::AddDirectory(def);
210 template <
typename Histo_T> Histo_T *
211 MakeTH3(
const Char_t *hname,
const Char_t *htitle,
212 Int_t binx, Double_t xmin, Double_t xmax,
213 Int_t biny, Double_t ymin, Double_t ymax,
214 Int_t binz, Double_t
zmin, Double_t zmax,
215 const Char_t *sub =
"")
217 Bool_t def = TH1::AddDirectoryStatus();
218 TH1::AddDirectory(
false);
220 Histo_T *h = 0x0; TString subfolder = sub;
222 h =
new Histo_T(hname,htitle,binx,xmin,xmax,biny,ymin,ymax,binz,zmin,zmax);
230 TH1::AddDirectory(def);
237 void TagOn(TObject *);
240 void DrawTag(TCanvas *, Option_t *);
256 Watcher(
const char *name,
const char *title, TDirectory *mother_dir_of_watcher = 0x0, TDirectory *mother_dir_tag = 0x0);
285 virtual UInt_t
Snapshot(Option_t * =
"*");
289 { fLastExecStatus = s ; }
291 {
return fLastExecStatus ; }
296 fLastExecStatus = s ;
302 return fLastExecStatus ;
311 if ( o.Contains(
"tag") )
317 {
return fPoolOfObjects; }
319 {
return fReference; }
327 virtual void SetDirectory(TDirectory *mother_dir_of_watcher, TDirectory *mother_dir_tag, Bool_t load_objects =
true);
350 virtual void Add(TTask *);
365 { fgDeletePool = d; }
373 {
return fDeletePool; }
390 virtual void Zero(Option_t *hname=
"pool", Option_t *binning=
"");
396 virtual Bool_t
TestTag(Option_t *opt);
399 virtual void Tag(Option_t *opt =
"");
429 WatcherWithTag(
const char *name,
const char *title, TDirectory *mother_dir_of_watcher, TDirectory *mother_dir_tag);
464 TStopwatch fTimeControl;
470 TDirectory *fMotherDirWatcher;
471 TDirectory *fMotherDirTag;
477 TString fLastSaveArg1;
478 TString fLastSaveArg2;
479 TString fLastSaveArg3;
484 virtual void DoCanvas(TCanvas *, Option_t *);
491 virtual void Zero(Option_t * hname =
"pool", Option_t *binning=
"");
516 void Save(
const Char_t *
main,
const Char_t *tag,
const Char_t *option, Int_t autotime);
524 {
return fLastSaveArg1.Data(); }
526 {
return fLastSaveArg2.Data(); }
528 {
return fLastSaveArg3.Data(); }
530 {
return fLastSaveArg4; }
535 virtual void Exec(Option_t *option);
560 virtual Bool_t HandleTimer(TTimer* timer);
567 TTask(
"LoopOnTask",
"0"),
569 fTimer(new TTimer()),
570 fControl(new
LoopControl(this,dir_watchers,dir_tag)) { Add(fControl); }
587 virtual void SetActive(Bool_t active=kTRUE);
590 virtual void Abort();
595 virtual void Exec(Option_t *option);
virtual ~WatcherWithTag()
void Pass()
force fHasExecuted (recursively) to true
virtual void Add(TTask *)
add only Watchers to the list of tasks to avoid problems.
void DirToDir(TDirectory *, TDirectory *, TObjArray &, Bool_t load_objects=true)
utilities to add/move/remove objects from one dir to another one
TCanvas * NewCanvas(Option_t *)
It creates a new embedded canvas.
virtual void Continue()
to remove them from the menu
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="")
Bool_t GetPathOf(TFolder *f, TObject *searched, TString &path)
in a folder look for the path to an elmement that is not a folder
TDirectory * fTagDirectory
Tagged Objects are in folders. They can be saved/load in/from directory. This is the mother in which ...
virtual void SetActive(Bool_t active=kTRUE)
To set this active/inactive.
virtual void DoCanvas(TCanvas *, Option_t *)
To be overwritten by real implementation if a canvas is produced.
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 req...
Short_t GetLastError() const
virtual void Exec(Option_t *option)
the main loop
Bool_t GetFromTrigger(ADF::DFTrigger *, const char *, ADF::SharedFP *&)
Extract from the trigger and given frame pointer (usefull for other watchers)
virtual TDirectory * GetDirectory(Option_t *opt="")
to each watcher a TDirectory is associated
const Char_t * GetLastSaveArg2()
int main(int argc, char **argv)
const Char_t * GetLastSaveArg3()
static Watcher * GetLastRegistered(const Char_t *classname, Option_t *opt="baseclass")
to retrieve the last registered watcher of one type.
virtual void Continue()
to remove them from the TTask menu
TObject * AddToPool(TObject *ob)
facility for other watchers: keep a list of all histograms (objects) for global operations ...
TFolder * fTopFolder
Top folder in which ae stored all spectra.
virtual TObjArray & GetReference()
virtual void Zero(Option_t *hname="pool", Option_t *binning="")
watch the current frame ... to be overwritten by the watcher
Base class for a Log message.
virtual void SetBreakin(Int_t=1)
virtual void CleanTasks()
overloaded for efficiency reasons. allocation of TIter is see in Shark (macos) as time consuming ...
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="")
void RemoveFromDir(TObject *, TDirectory *)
Base class for a Watcher.
TDirectory * fDirectory
Objects are in folders. They can be saved/load in/from directory. This is the mother in which this wa...
header file for GwLogMessage.cpp
LoopOnTasks(TDirectory *dir_watchers, TDirectory *dir_tag)
void ShowCanvas(Option_t *option="")
Display some results.
void DrawTag(TCanvas *, Option_t *)
To display tagged histograms and their reference.
header file for Trigger.cpp
virtual void SetBreakin(Int_t=1)
void AutoSave()
Auto save in case of timer set. To stop timer, use SetAutoTime(0)
void SetLastExecStatus(Short_t s=0)
reset last status. 0 means no error, 0 < means error, > 0 means ok with conditions ...
virtual Bool_t TestTag(Option_t *opt)
Compare the current spectra with the tagged ones using Kolmogorov test.
virtual void SetBreakout(Int_t=1)
void SetAutoTime(Int_t autotime=0)
change time to autosave
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 ...
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. ...
static void SetGlobalDeletePool(Bool_t d)
set static flag to delete objects in pool
virtual void SetDeletePool(Bool_t d)
set flag to delete objects in pool
static void SetFirst(Watcher *)
move a watcher on top of the list
static const TList * GetListOfWatchers()
virtual void SetBreakout(Int_t=1)
WatcherWithTag()
list of tagged histograms
virtual UInt_t Snapshot(Option_t *="*")
change kind of Watcher
virtual void Tag(Option_t *opt="")
Tag the current watcher.
void AddToDir(TObject *, TDirectory *)
void TagOn(TObject *)
Add this histogram to the list of tagged histograms.
virtual void Abort()
Abort looping if started.
Base class for a trigger on a data flow.
ADF::DFTrigger * fTrigger
trigger associated to this watcher
Short_t GetLastExecStatus() const
to get the last status
header file for NarvalInterface.cpp
To start a loop on tasks.
LoopControl(TTask *, TDirectory *, TDirectory *)
virtual void Exec(Option_t *option)
Display some results.
virtual void DoCanvas(TCanvas *, Option_t *)
To be overwritten by real implementation if a canvas is produced.
virtual TObjArray & GetPoolOfObject()
void LoadObject(TObject *new_obj, TDirectory *root_dir)
to specify what kind of watcher
virtual void SetDirectory(TDirectory *mother_dir_of_watcher, TDirectory *mother_dir_tag, Bool_t load_objects=true)
to change the directory in which watcher's objects are stored
virtual ADF::DFTrigger * GetTrigger() const
To know the trigger in which the frame to be watched is embedded.
virtual Bool_t SetTrigger(ADF::DFTrigger *)
To set the Frames (through a trigger) associated to this watcher.
void Save(const Char_t *main, const Char_t *tag, const Char_t *option, Int_t autotime)
Save the spectra in files.
const Char_t * GetLastSaveArg1()
virtual void ExecuteTask(Option_t *option="l")
virtual Bool_t GetDeletePool() const
get flag to delete objects in pool
virtual void Zero(Option_t *hname="pool", Option_t *binning="")
call Zero for all the watchers
void SetLastError(Short_t s=0)
TMP : migration to TreeWatcher with Cuts : should be removed.