KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVRawDataAnalyser.h
Go to the documentation of this file.
1 
4 #ifndef __KVRAWDATAANALYSER_H
5 #define __KVRAWDATAANALYSER_H
6 
7 #include "KVDataSetAnalyser.h"
8 #include "KVHashList.h"
9 #include "KVRawDataReader.h"
10 #include "KVDBRun.h"
11 
13 #include <TH2.h>
14 #include <TH3.h>
15 #include <TProfile.h>
16 #include <TProfile2D.h>
17 
18 class KVDetectorEvent;
19 
27 protected:
28 
39 
40  void ProcessRun();
41 
43 
44  /*** Methods copied from KVEventSelector ***/
45 
46  void FillTH1(TH1* h1, Double_t one, Double_t two)
47  {
48  h1->Fill(one, two);
49  }
50  void FillTProfile(TProfile* h1, Double_t one, Double_t two, Double_t three)
51  {
52  h1->Fill(one, two, three);
53  }
54  void FillTH2(TH2* h2, Double_t one, Double_t two, Double_t three)
55  {
56  h2->Fill(one, two, three);
57  }
58  void FillTProfile2D(TProfile2D* h2, Double_t one, Double_t two, Double_t three, Double_t four)
59  {
60  h2->Fill(one, two, three, four);
61  }
62  void FillTH3(TH3* h3, Double_t one, Double_t two, Double_t three, Double_t four)
63  {
64  h3->Fill(one, two, three, four);
65  }
66 
67  void SetCombinedOutputFile(const KVString& filename)
68  {
76  fCombinedOutputFile = filename;
77  }
78  /*** END: Methods copied from KVEventSelector ***/
79 
80 public:
82  {
83  return TotalEntriesToRead;
84  }
85 
87  virtual ~KVRawDataAnalyser();
88 
89  KVDetectorEvent* GetDetectorEvent() const
90  {
91  Obsolete("GetDetectorEvent", "1.11", "2.0");
92  return nullptr;
93  }
94 
95  virtual void InitAnalysis() = 0;
96  virtual void InitRun() = 0;
97  virtual Bool_t Analysis() = 0;
98  virtual void EndRun() = 0;
99  virtual void EndAnalysis() = 0;
100 
102  {
103  return fRunNumber;
104  }
106  {
107  return fEventNumber;
108  }
110  {
111  return fCurrentRun;
112  }
113 
114  void SubmitTask();
115  static void Make(const Char_t* kvsname = "MyOwnRawDataAnalyser");
116 
118 
120  {
121  return *fRunFile;
122  }
123 
124  /*** Methods copied from KVEventSelector ***/
125 
126  void AddHisto(TH1* histo)
127  {
128  fHistoList.Add(histo);
129  }
130  void AddTree(TTree* tree);
131 
132  void FillHisto(const Char_t* sname, Double_t one, Double_t two = 1, Double_t three = 1, Double_t four = 1);
133  void FillHisto(const Char_t* sname, const Char_t* label, Double_t weight = 1);
134  void FillTree(const Char_t* sname = "");
135 
136  const KVHashList* GetHistoList() const
137  {
138  return &fHistoList;
139  }
140  const KVHashList* GetTreeList() const
141  {
142  return &fTreeList;
143  }
144 
145  TH1* GetHisto(const Char_t* name) const
146  {
147  return fHistoList.get_object<TH1>(name);
148  }
149  TTree* GetTree(const Char_t* name) const
150  {
151  return fTreeList.get_object<TTree>(name);
152  }
153 
154  virtual void SaveHistos(const Char_t* filename = "", Option_t* option = "recreate", Bool_t onlyfilled = kFALSE);
155  void SetJobOutputFileName(const TString& filename)
156  {
163 
164 #ifdef WITH_CPP11
165  if (IsRunningBatchAnalysis() && (GetProofMode() == KVDataAnalyser::EProofMode::None))
166 #else
168 #endif
169  SetCombinedOutputFile(Form("%s.root", GetBatchSystem()->GetJobName()));
170 
171  else
172  SetCombinedOutputFile(filename);
173  }
174  Bool_t CreateTreeFile(const Char_t* filename = "");
175 
176  void SetOpt(const Char_t* option, const Char_t* value)
177  {
178  fOptionList.SetOpt(option, value);
179  }
180  Bool_t IsOptGiven(const Char_t* option)
181  {
182  return fOptionList.IsOptGiven(option);
183  }
184  TString GetOpt(const Char_t* option) const
185  {
186  return fOptionList.GetOpt(option);
187  }
188  void UnsetOpt(const Char_t* opt)
189  {
190  fOptionList.UnsetOpt(opt);
191  }
192  /*** END: Methods copied from KVEventSelector ***/
193 
194  ClassDef(KVRawDataAnalyser, 1) //Abstract base class for user analysis of raw data
195 };
196 
197 #endif
int Int_t
char Char_t
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
char * Form(const char *fmt,...)
Description of an experimental run in database ,.
Definition: KVDBRun.h:35
virtual const KVBatchSystem * GetBatchSystem()
EProofMode GetProofMode() const
static Bool_t IsRunningBatchAnalysis()
Pilots user analysis of experimental data.
Extended version of ROOT THashList.
Definition: KVHashList.h:28
Abstract base class for user analysis of raw data.
virtual Bool_t Analysis()=0
const KVHashList * GetTreeList() const
KVHashList fHistoList
list of histograms of user analysis
KVDetectorEvent * GetDetectorEvent() const
KVRawDataReader * fRunFile
currently analysed run file
void FillTProfile(TProfile *h1, Double_t one, Double_t two, Double_t three)
Long64_t GetTotalEntriesToRead() const
virtual void InitRun()=0
Int_t fRunNumber
run number of current file
virtual void SaveHistos(const Char_t *filename="", Option_t *option="recreate", Bool_t onlyfilled=kFALSE)
KVRawDataAnalyser()
Default constructor.
void FillTProfile2D(TProfile2D *h2, Double_t one, Double_t two, Double_t three, Double_t four)
KVHashList fTreeList
list of trees of user analysis
Bool_t IsOptGiven(const Char_t *option)
KVString fCombinedOutputFile
optional name for single results file with trees and histos
Long64_t fEventNumber
event number in current run
virtual void EndAnalysis()=0
Bool_t CreateTreeFile(const Char_t *filename="")
Long64_t GetEventNumber() const
void FillTree(const Char_t *sname="")
Int_t GetRunNumber() const
void FillTH3(TH3 *h3, Double_t one, Double_t two, Double_t three, Double_t four)
void FillHisto(const Char_t *sname, Double_t one, Double_t two=1, Double_t three=1, Double_t four=1)
KVDBRun * GetCurrentRun() const
void SetJobOutputFileName(const TString &filename)
void UnsetOpt(const Char_t *opt)
virtual ~KVRawDataAnalyser()
Destructor.
static void Make(const Char_t *kvsname="MyOwnRawDataAnalyser")
Automatic generation of derived class for raw data analysis.
void FillTH1(TH1 *h1, Double_t one, Double_t two)
void AddHisto(TH1 *histo)
virtual void InitAnalysis()=0
void CalculateTotalEventsToRead()
loop over runs and calculate total events
const KVRawDataReader & GetRunFileReader() const
KVDBRun * fCurrentRun
poiner to current run
TString GetOpt(const Char_t *option) const
KVUserAnalysisOptionList fOptionList
list of options set by user for analysis
const KVHashList * GetHistoList() const
void FillTH2(TH2 *h2, Double_t one, Double_t two, Double_t three)
void SetCombinedOutputFile(const KVString &filename)
virtual void EndRun()=0
TTree * GetTree(const Char_t *name) const
void AddTree(TTree *tree)
TH1 * GetHisto(const Char_t *name) const
void AbortDuringRunProcessing()
Method called to abort analysis during processing of a run.
void SetOpt(const Char_t *option, const Char_t *value)
Abstract base class for reading raw (DAQ) data.
T * get_object(const TString &name) const
virtual void Add(TObject *obj)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
Handle list of options and input parameters for user analyis.
void SetOpt(const Char_t *option, const Char_t *value)
TString GetOpt(const Char_t *opt) const
Bool_t IsOptGiven(const Char_t *opt)
void UnsetOpt(const Char_t *opt)
virtual Int_t Fill(const char *name, Double_t w)
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
virtual Int_t Fill(const char *namex, const char *namey, const char *namez, Double_t w)
void Obsolete(const char *method, const char *asOfVers, const char *removedFromVers) const
virtual Int_t Fill(const char *namex, const char *namey, Double_t z, Double_t w=1.)
long long Long64_t
TH1F * h1