23 #ifndef Gw_TTreeWatchers
24 #define Gw_TTreeWatchers
81 TTreeBuilder(
const char *name,
const char *title, TTree *tree = 0x0, Short_t do_spectra = 2, Short_t do_tree = 2, Bool_t Overwrite =
false);
125 TList fListOfWatchers;
137 TTreeMaster(
const char *name,
const char *title, Short_t do_spectra = 2, Short_t do_tree = 2, Bool_t Overwrite =
false);
141 static void SetDefaultPathAndName(
const char *new_path =
"./Out",
const char *treename =
"TreeMaster");
160 virtual UInt_t
Snapshot(Option_t * =
"*");
163 template<
typename Watcher_T> Watcher_T *
Add(
const Char_t *name,
const Char_t *title, Short_t do_spectra, Short_t do_tree)
165 Watcher_T *watcher =
new Watcher_T(name,title,
GetTree(),do_spectra,do_tree);
171 template<
typename Watcher_T> Watcher_T *
Add(
const Char_t *name,
const Char_t *title)
173 Watcher_T *watcher =
new Watcher_T(name,title,
GetTree());
180 template<
typename Watcher_T> Watcher_T *
AddWatcher(
const Char_t *name,
const Char_t *title)
182 Watcher_T *watcher =
new Watcher_T(name,title);
196 virtual void Add(TTask *);
205 virtual void Exec(Option_t *option=
"");
207 virtual void Print(Option_t *)
const;
227 virtual Bool_t
Check();
230 for (Int_t i = 0; i < fData->GetLen(); i++) {
231 fHisto->Fill(fData->GetValue(i));
253 Bool_t is_passed =
false;
255 for (Int_t i = 0; i < fData1->GetLen(); i++) {
256 for (Int_t j = 0; j < fData2->GetLen(); j++) {
257 if (
fCond->
IsPassed(fData1->GetValue(i),fData2->GetValue(j)) )
265 for (Int_t i = 0; i < fData1->GetLen(); i++) {
266 for (Int_t j = 0; j < fData2->GetLen(); j++) {
267 fHisto->Fill(fData1->GetValue(i),fData2->GetValue(j));
298 virtual void Clear(Option_t* =
"") = 0;
324 const Char_t *name_cond,
const Char_t *title_cond,
const Char_t *name_leaf,
325 const Char_t *name_hist,
const Char_t *title_hist , Int_t bin, Double_t min, Double_t max,
327 const Char_t *sub =
"");
333 const Char_t *name_cond,
const Char_t *title_cond,
const Char_t *name_leaf,
334 const Char_t *name_hist,
const Char_t *title_hist, Int_t binx, Double_t xmin, Double_t xmax, Int_t biny, Double_t ymin, Double_t ymax,
336 const Char_t *sub =
"");
349 TTreeWithConditions(
const char *name,
const char *title, TTree *tree = 0x0, Short_t do_spectra = 2, Short_t do_tree = 2);
355 virtual UInt_t
Snapshot(Option_t * =
"*");
368 virtual void SetDirectory(TDirectory *mother_dir_of_watcher, TDirectory *mother_dir_tag = 0x0, Bool_t load_objects =
true);
387 virtual void Exec(Option_t *option=
"");
virtual void AddBranches(TTree *tree)=0
Add the specific branches filled by this watcher to the given tree.
void SetDoTree(Short_t do_tree)
to know spectra mode for this watcher
virtual void SetBranches()=0
virtual Int_t CheckCond()
to be overwitten in case you add your own conditions but TTreeWithConditions::CheckCond() should be c...
virtual Bool_t IsPassed(Double_t, Double_t=0.0) const
returns true if the condition is passed with success
Base for a Graphical condition 2D.
virtual Int_t CheckCondByHandler()
std::vector< TTreeFormula * > fUserTFCond
list of formula defined by the user to apply conditions
Watcher_T * AddWatcher(const Char_t *name, const Char_t *title)
Allocate a standard watcher i.e. not a tree builder.
const std::vector< GCondition * > & GetListOfGConditions() const
std::list< GCondition * > fUserGCond
list of conditions defined by the user. spectra are built/filled by the user
virtual void FillBranches()=0
Should be used fill the current event.
To handle a simple branch.
virtual void Exec(Option_t *option="")
watch the current frame
std::vector< GCondition * > fAllGCond
list of all conditions. Used for external and to delete them
virtual UInt_t Snapshot(Option_t *="*")
Save all histograms belonging to this watcher. Should be overloaded in case of spectra not registered...
virtual void FillSpectraByUser()
Fill user spectra ... to be implementted by user only if it defines its ones spectra without conditio...
virtual void BuildSpectraByUser()
define user spectra ... to be implementted by user only if it defines its ones spectra without condit...
Watcher_T * Add(const Char_t *name, const Char_t *title, Short_t do_spectra, Short_t do_tree)
Allocate a watcher in charge of filling one part of the tree ==> Should inherits from TreeBuilder...
Short_t GetDoSpectra() const
to know spectra mode for this watcher
virtual Int_t GetNbConditions() const
return the number of conditions registered in case this tree/branch has some
virtual void SetBranches()
Base class for a Watcher.
virtual void SetDirectory(TDirectory *mother_dir_of_watcher, TDirectory *mother_dir_tag=0x0, Bool_t load_objects=true)
to change the directory in which watcher's objects are stored
SimpleGCondHandler1D(GCondition *cond, TLeaf *data, TH1 *h)
virtual ~SimpleGCondHandler1D()
virtual std::pair< GCond2D *, TH2 * > MakeGCond2D(const Char_t *name_cond, const Char_t *title_cond, const Char_t *name_leaf, const Char_t *name_hist, const Char_t *title_hist, Int_t binx, Double_t xmin, Double_t xmax, Int_t biny, Double_t ymin, Double_t ymax, Option_t *opt="F", const Char_t *sub="")
Build a 2D condition using the given leaves. It allocates also the spectrum.
TTree * fClone
Clone of the tree part filled by this watcher with only one entry. Used to test Formulas.
std::list< GCondHandler * > fCondHandler
conditions and spectra are automaticaly handled by the base class
virtual void FillTree()
Fill the tree if it is the owner of the tree.
static TString gDefaultPathOfOut
some global strings to fix the Output directory where the Tree is to be written and its default name ...
TTreeBuilder(const char *name, const char *title, TTree *tree=0x0, Short_t do_spectra=2, Short_t do_tree=2, Bool_t Overwrite=false)
virtual std::pair< GCond1D *, TH1 * > MakeGCond1D(const Char_t *name_cond, const Char_t *title_cond, const Char_t *name_leaf, const Char_t *name_hist, const Char_t *title_hist, Int_t bin, Double_t min, Double_t max, Option_t *opt="F", const Char_t *sub="")
Build a 1D condition using the given leaf. It allocates also the spectrum.
virtual ~SimpleGCondHandler2D()
Base class for a Watcher that fill a TTree or some branches of a TTree.
Watcher_T * Add(const Char_t *name, const Char_t *title)
Allocate a watcher in charge of filling one part of the tree ==> Should inherits from TreeBuilder...
TTreeMaster(const char *name, const char *title, Short_t do_spectra=2, Short_t do_tree=2, Bool_t Overwrite=false)
TTreeWithConditions(const char *name, const char *title, TTree *tree=0x0, Short_t do_spectra=2, Short_t do_tree=2)
virtual void FillTree()
Fill the tree if it is the owner of the tree.
Base for a Graphical condition 1D.
Base class for a trigger on a data flow.
Watcher to build a tree with branches processed in several watchers.
virtual ~TTreeWithConditions()
SimpleGCondHandler2D(GCondition *cond, TLeaf *data1, TLeaf *data2, TH1 *h)
virtual void Clear(Option_t *="")=0
Should be used to reset a various data filled by this watcher.
void SetDoSpectra(Short_t do_spectra)
to know spectra mode for this watcher
virtual Int_t AddTreeFormula(const Char_t *, const Char_t *)
Add a general condition (see TTree::Draw()). Return the total number of expression in this watcher on...
virtual void FillSpectra()
to be overwitten in case you add your own conditions/spectra
A watcher filling TTree, Spectra under conditions.
static TString gDefaultTTreeName
virtual UInt_t Snapshot(Option_t *="*")
Save all histograms belonging to this watcher + conditions unless !cond is added. ...
Link between the leaf, the condition and the histogram.
Short_t GetDoTree() const
to know spectra mode for this watcher
virtual void Exec(Option_t *option="")
In principle works for any watchers that inherits from it.
TH1 * fErrors
to get errors while filling the different branches
static void SetDefaultPathAndName(const char *new_path="./Out", const char *treename="TreeMaster")
to change the default value of path for output. It returns the old one
virtual void Print(Option_t *) const
virtual void SetBranches()
add branches to the tree and the ciruclar tree
Base for a Graphical condition on a spectrum (1D, 2D)
virtual Int_t CheckTreeFormula()
TTree * GetTree()
to get the current Tree