KaliVeda
Toolkit for HIC analysis
KVRawDataAnalyser.h
1 
4 #ifndef __KVRAWDATAANALYSER_H
5 #define __KVRAWDATAANALYSER_H
6 
7 #include "KVDataSetAnalyser.h"
8 #include "KVDataAnalysisTreeHistoHandler.h"
9 #include "KVTreeVectorBranchHandler.h"
10 #include "KVHashList.h"
11 #include "KVRawDataReader.h"
12 #include "KVDBRun.h"
13 #include "KVRawDataPatchList.h"
14 #include <KVUserAnalysisOptionList.h>
15 #include <TH2.h>
16 #include <TH3.h>
17 #include <TProfile.h>
18 #include <TProfile2D.h>
19 
20 class KVDetectorEvent;
21 
38  protected KVTreeVectorBranchHandler,
39  public KVDataAnalysisTreeHistoHandler<KVRawDataAnalyser>
40 {
42 protected:
43 
44  KVRawDataReader* fRunFile = nullptr; //currently analysed run file
45  run_index_t fRunNumber;
46  Long64_t fEventNumber;
47  TFile* fTreeFile = nullptr;
48  KVDBRun* fCurrentRun = nullptr; //poiner to current run
49  Long64_t TotalEntriesToRead;
50  KVString fCombinedOutputFile;
51  KVUserAnalysisOptionList fOptionList;
52 
53  KVRawDataPatchList fRustines;
54 
55  void ProcessRun();
56 
57  void AbortDuringRunProcessing();
58 
59  void add_histo(TH1* histo)
60  {
61  GetHistoList().Add(histo);
62  }
63  Bool_t CreateTreeFile(const Char_t* filename = "");
64  void add_tree(TTree* tree)
65  {
66  CreateTreeFile();
67  tree->SetDirectory(fTreeFile);
68  tree->AutoSave();
69  GetTreeList().Add(tree);
70  }
71 
72  void SetCombinedOutputFile(const KVString& filename)
73  {
81  fCombinedOutputFile = filename;
82  }
83 
84 public:
86  {
87  return TotalEntriesToRead;
88  }
89 
91  virtual ~KVRawDataAnalyser();
92 
112  virtual void InitAnalysis() = 0;
122  virtual void InitRun() = 0;
128  virtual Bool_t Analysis() = 0;
129  virtual void EndRun() = 0;
130  virtual void EndAnalysis() = 0;
131 
133  {
134  return fRunNumber.run();
135  }
137  {
140  return fRunNumber;
141  }
143  {
145  return fEventNumber;
146  }
148  {
151  return fCurrentRun;
152  }
154  {
157  return &gExpDB->GetDBRunFile(GetRunIndexNumber());
158  }
159 
160  void SubmitTask() override;
161  static void Make(const Char_t* kvsname = "MyOwnRawDataAnalyser");
162 
164 
166  {
167  return *fRunFile;
168  }
169 
170  virtual void SaveHistos(const Char_t* filename = "", Option_t* option = "recreate", Bool_t onlyfilled = kFALSE);
171 
181  void SetJobOutputFileName(const TString& filename)
182  {
184  SetCombinedOutputFile(Form("%s.root", GetBatchSystem()->GetJobName()));
185  else
186  SetCombinedOutputFile(filename);
187  }
188 
189  void SetOpt(const Char_t* option, const Char_t* value)
190  {
191  fOptionList.SetOpt(option, value);
192  }
193  Bool_t IsOptGiven(const Char_t* option)
194  {
195  return fOptionList.IsOptGiven(option);
196  }
197  TString GetOpt(const Char_t* option) const
198  {
199  return fOptionList.GetOpt(option);
200  }
201  void UnsetOpt(const Char_t* opt)
202  {
203  fOptionList.UnsetOpt(opt);
204  }
205 
206  ClassDefOverride(KVRawDataAnalyser, 1) //Abstract base class for user analysis of raw data
207 };
208 
209 #endif
int Int_t
bool Bool_t
char Char_t
const char Option_t
#define ClassDefOverride(name, id)
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char * Form(const char *fmt,...)
A single raw data file associated with an experimental run ,,.
Definition: KVDBRunFile.h:39
Description of an experimental run in database ,,.
Definition: KVDBRun.h:41
virtual const KVBatchSystem * GetBatchSystem()
static Bool_t IsRunningBatchAnalysis()
Methods to facilitate creation and use of histograms and TTrees in user analysis.
Pilots user analysis of experimental data.
List of hit groups in a multidetector array.
const KVDBRunFile & GetDBRunFile(const run_index_t &r) const
Definition: KVExpDB.h:148
Abstract base class for user analysis of raw data.
virtual Bool_t Analysis()=0
void SubmitTask() override
virtual void InitRun()=0
virtual void SaveHistos(const Char_t *filename="", Option_t *option="recreate", Bool_t onlyfilled=kFALSE)
KVRawDataAnalyser()
Default constructor.
Bool_t IsOptGiven(const Char_t *option)
virtual void EndAnalysis()=0
Long64_t GetEventNumber() const
Int_t GetRunNumber() const
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.
virtual void InitAnalysis()=0
void CalculateTotalEventsToRead()
loop over runs and calculate total events
const KVRawDataReader & GetRunFileReader() const
TString GetOpt(const Char_t *option) const
Long64_t GetTotalEntriesToRead() const override
const run_index_t & GetRunIndexNumber() const
virtual void EndRun()=0
KVDBRunFile * GetCurrentRunFile() const
void SetOpt(const Char_t *option, const Char_t *value)
List of corrections to be applied to raw data.
Abstract base class for reading raw (DAQ) data.
void Add(TObject *obj) override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
Facilitate use of std::vector branches in data analysis.
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)
Specifies a runfile according to run number and file index ,.
Definition: run_index.h:31
int run() const
Definition: run_index.h:50
long long Long64_t