KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVPROOFSelector.h
Go to the documentation of this file.
1 
8 #ifndef KVPROOFSelector_h
9 #define KVPROOFSelector_h
10 
11 #include <KVHashList.h>
12 #include <KVNameValueList.h>
13 #include <KVString.h>
14 #include <TH1.h>
15 #include <TH2.h>
16 #include <TH3.h>
17 #include <TSelector.h>
18 #include "TProofOutputFile.h"
19 
78 class KVPROOFSelector : public TSelector {
79 
80 protected :
83 
86 
88 
91 
93 
94  void FillTH1(TH1* h1, Double_t one, Double_t two);
95  void FillTProfile(TProfile* h1, Double_t one, Double_t two, Double_t three);
96  void FillTH2(TH2* h2, Double_t one, Double_t two, Double_t three);
97  void FillTProfile2D(TProfile2D* h2, Double_t one, Double_t two, Double_t three, Double_t four);
98  void FillTH3(TH3* h3, Double_t one, Double_t two, Double_t three, Double_t four);
99 
100 public:
104  Bool_t CreateTreeFile(const Char_t* filename = "");
105 
106  virtual void ParseOptions();
107 
108  KVPROOFSelector(TTree* /*tree*/ = 0) :
110  {
111  lhisto = new KVHashList();
112  ltree = new KVHashList();
113  }
115  {
116  lhisto->Clear();
117  delete lhisto;
118  lhisto = 0;
119  ltree->Clear();
120  delete ltree;
121  ltree = 0;
122  }
124  {
126  }
127  virtual Int_t Version() const
128  {
129  return 3;
130  }
131  virtual void Begin(TTree* tree);
132  virtual void SlaveBegin(TTree* tree);
133  virtual Bool_t Process(Long64_t entry);
134  virtual void SlaveTerminate();
135  virtual void Terminate();
136 
137  /* user entry points */
138  virtual void InitAnalysis() = 0;
139  virtual Bool_t Analysis() = 0;
140  virtual void EndAnalysis() = 0;
141 
142  void AddHisto(TH1* histo);
143  void AddTree(TTree* tree);
144 
145  void FillHisto(const Char_t* sname, Double_t one, Double_t two = 1, Double_t three = 1, Double_t four = 1);
146  void FillTree(const Char_t* sname = "");
147 
148  KVHashList* GetHistoList() const;
149  KVHashList* GetTreeList() const;
150 
151  TH1* GetHisto(const Char_t* name) const;
152  TTree* GetTree(const Char_t* name) const;
153 
154  virtual void SaveHistos(const Char_t* filename = "", Option_t* option = "recreate", Bool_t onlyfilled = kFALSE);
155 
156  virtual void SetOpt(const Char_t* option, const Char_t* value);
157  virtual Bool_t IsOptGiven(const Char_t* option);
158  virtual TString GetOpt(const Char_t* option) const;
159  virtual void UnsetOpt(const Char_t* opt);
160 
161  void SetCombinedOutputFile(const TString& filename)
162  {
170  fCombinedOutputFile = filename;
171  }
173  {
175  return fEventsRead;
176  }
177  static void Make(const Char_t* classname);
178 
179  ClassDef(KVPROOFSelector, 1)//General purpose class for performing parallel tasks with PROOF
180 };
181 
182 #endif
int Int_t
char Char_t
const Bool_t kFALSE
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
#define N
Extended version of ROOT THashList.
Definition: KVHashList.h:28
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
General purpose class for running parallel tasks with PROOF.
void FillTree(const Char_t *sname="")
void FillTH1(TH1 *h1, Double_t one, Double_t two)
virtual void InitAnalysis()=0
void AddHisto(TH1 *histo)
void FillTProfile2D(TProfile2D *h2, Double_t one, Double_t two, Double_t three, Double_t four)
virtual void UnsetOpt(const Char_t *opt)
Removes the option 'opt' from the internal lists, as if it had never been set.
void AddTree(TTree *tree)
virtual void EndAnalysis()=0
Bool_t fDisableCreateTreeFile
used with PROOF
virtual void Terminate()
virtual Bool_t Analysis()=0
void FillTProfile(TProfile *h1, Double_t one, Double_t two, Double_t three)
KVHashList * GetHistoList() const
return the list of created trees
virtual TString GetOpt(const Char_t *option) const
KVString fCombinedOutputFile
optional name for single results file with trees and histos
void SetEventsReadInterval(Long64_t N)
void FillHisto(const Char_t *sname, Double_t one, Double_t two=1, Double_t three=1, Double_t four=1)
void FillTH2(TH2 *h2, Double_t one, Double_t two, Double_t three)
TTree * GetTree(const Char_t *name) const
return the tree named tree_name
virtual void SaveHistos(const Char_t *filename="", Option_t *option="recreate", Bool_t onlyfilled=kFALSE)
virtual void ParseOptions()
virtual void SlaveBegin(TTree *tree)
virtual void SetOpt(const Char_t *option, const Char_t *value)
Set a value for an option.
KVHashList * lhisto
!
Long64_t GetCycleNumber() const
static void Make(const Char_t *classname)
Generate a new class derived from this one with given name.
TH1 * GetHisto(const Char_t *name) const
TProofOutputFile * mergeFile
for merging with PROOF
Long64_t fEventsReadInterval
interval at which to print number of events read
KVNameValueList fOptionList
parsed list of options given to TTree::Process
void FillTH3(TH3 *h3, Double_t one, Double_t two, Double_t three, Double_t four)
virtual Int_t Version() const
KVPROOFSelector(TTree *=0)
virtual void Begin(TTree *tree)
virtual ~KVPROOFSelector()
void SetCombinedOutputFile(const TString &filename)
Bool_t CreateTreeFile(const Char_t *filename="")
KVHashList * ltree
!
Long64_t fEventsRead
cycle number (argument 'entry' passed to Process(Long64_t))
virtual Bool_t Process(Long64_t entry)
KVHashList * GetTreeList() const
return the list of created trees
virtual Bool_t IsOptGiven(const Char_t *option)
Returns kTRUE if the option 'opt' has been set.
virtual void SlaveTerminate()
virtual void Clear(Option_t *option="")
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
long long Long64_t