KaliVeda  1.12/06
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 
12 #include <TH2.h>
13 #include <TH3.h>
14 #include <TProfile.h>
15 #include <TProfile2D.h>
16 
17 class KVDetectorEvent;
18 
26 protected:
27 
37 
38  void ProcessRun();
39 
41 
42  /*** Methods copied from KVEventSelector ***/
43 
44  void FillTH1(TH1* h1, Double_t one, Double_t two)
45  {
46  h1->Fill(one, two);
47  }
48  void FillTProfile(TProfile* h1, Double_t one, Double_t two, Double_t three)
49  {
50  h1->Fill(one, two, three);
51  }
52  void FillTH2(TH2* h2, Double_t one, Double_t two, Double_t three)
53  {
54  h2->Fill(one, two, three);
55  }
56  void FillTProfile2D(TProfile2D* h2, Double_t one, Double_t two, Double_t three, Double_t four)
57  {
58  h2->Fill(one, two, three, four);
59  }
60  void FillTH3(TH3* h3, Double_t one, Double_t two, Double_t three, Double_t four)
61  {
62  h3->Fill(one, two, three, four);
63  }
64 
65  void SetCombinedOutputFile(const KVString& filename)
66  {
74  fCombinedOutputFile = filename;
75  }
76  /*** END: Methods copied from KVEventSelector ***/
77 
78 public:
80  {
81  return TotalEntriesToRead;
82  }
83 
85  virtual ~KVRawDataAnalyser();
86 
87  KVDetectorEvent* GetDetectorEvent() const
88  {
89  Obsolete("GetDetectorEvent", "1.11", "2.0");
90  return nullptr;
91  }
92 
93  virtual void InitAnalysis() = 0;
94  virtual void InitRun() = 0;
95  virtual Bool_t Analysis() = 0;
96  virtual void EndRun() = 0;
97  virtual void EndAnalysis() = 0;
98 
100  {
101  return fRunNumber;
102  }
104  {
105  return fEventNumber;
106  }
108  {
109  return fCurrentRun;
110  }
111 
113  {
114  return (fRunFile->GetUnknownParameters()->GetSize() > 0);
115  }
116  void SubmitTask();
117  static void Make(const Char_t* kvsname = "MyOwnRawDataAnalyser");
118 
120 
122  {
123  return *fRunFile;
124  }
125 
126  /*** Methods copied from KVEventSelector ***/
127 
128  void AddHisto(TH1* histo)
129  {
130  fHistoList.Add(histo);
131  }
132  void AddTree(TTree* tree);
133 
134  void FillHisto(const Char_t* sname, Double_t one, Double_t two = 1, Double_t three = 1, Double_t four = 1);
135  void FillHisto(const Char_t* sname, const Char_t* label, Double_t weight = 1);
136  void FillTree(const Char_t* sname = "");
137 
138  const KVHashList* GetHistoList() const
139  {
140  return &fHistoList;
141  }
142  const KVHashList* GetTreeList() const
143  {
144  return &fTreeList;
145  }
146 
147  TH1* GetHisto(const Char_t* name) const
148  {
149  return fHistoList.get_object<TH1>(name);
150  }
151  TTree* GetTree(const Char_t* name) const
152  {
153  return fTreeList.get_object<TTree>(name);
154  }
155 
156  virtual void SaveHistos(const Char_t* filename = "", Option_t* option = "recreate", Bool_t onlyfilled = kFALSE);
157  void SetJobOutputFileName(const TString& filename)
158  {
165 
166 #ifdef WITH_CPP11
167  if (IsRunningBatchAnalysis() && (GetProofMode() == KVDataAnalyser::EProofMode::None))
168 #else
170 #endif
171  SetCombinedOutputFile(Form("%s.root", GetBatchSystem()->GetJobName()));
172 
173  else
174  SetCombinedOutputFile(filename);
175  }
176  Bool_t CreateTreeFile(const Char_t* filename = "");
177 
178  /*** END: Methods copied from KVEventSelector ***/
179 
180  ClassDef(KVRawDataAnalyser, 1) //Abstract base class for user analysis of raw data
181 };
182 
183 #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
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)
virtual ~KVRawDataAnalyser()
Destructor.
static void Make(const Char_t *kvsname="MyOwnRawDataAnalyser")
Automatic generation of derived class for raw data analysis.
virtual Bool_t FileHasUnknownParameters() const
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
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.
Abstract base class for reading raw (DAQ) data.
virtual const KVSeqCollection * GetUnknownParameters() const
virtual Int_t GetSize() const
T * get_object(const char *name) const
virtual void Add(TObject *obj)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
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