4 #include "KVRawDataAnalyser.h"
5 #include "KVMultiDetArray.h"
6 #include "KVClassFactory.h"
25 TotalEntriesToRead = 0;
66 void KVRawDataAnalyser::ProcessRun()
94 if ((!fRunFile) || fRunFile->IsZombie()) {
96 if (fRunFile)
delete fRunFile;
111 fCurrentRun = gExpDB->
GetDBRun(fRunNumber.run());
119 Long64_t nevents = GetNbEventToRead();
121 nevents = 1000000000;
122 cout << endl <<
"Reading all events from file " << raw_file.
Data() << endl;
125 cout << endl <<
"Reading " << nevents <<
" events from file " << raw_file.
Data() << endl;
128 cout <<
"Starting analysis of run " << fRunNumber <<
" on : ";
130 cout << now.
AsString() << endl << endl;
132 fCurrentRun->Print();
140 while ((nevents-- ? fRunFile->GetNextEvent() : kFALSE) && !AbortProcessingLoop()) {
145 if (fRustines.HasActivePatches())
146 if (fRustines.SkipEvent(gMultiDetArray))
151 if (!Analysis())
break;
154 if (CheckStatusUpdateInterval(fEventNumber)) DoStatusUpdate(fEventNumber);
159 cout <<
"Ending analysis of run " << fRunNumber <<
" on : ";
161 cout << now2.
AsString() << endl << endl;
162 cout << endl <<
"Finished reading " << fEventNumber - 1 <<
" events from file " << raw_file.
Data() << endl << endl;
206 if (gDataSet != GetDataSet()) GetDataSet()->cd();
209 fOptionList.ParseOptions(GetUserClassOptions());
216 CalculateTotalEventsToRead();
219 for (
auto& run : GetRunList()) {
220 if (AbortProcessingLoop())
break;
222 fRustines.InitializePatchList(gDataSet->
GetName(), fRunNumber);
227 if (fCombinedOutputFile !=
"") {
228 Info(
"Terminate",
"combine = %s", fCombinedOutputFile.Data());
233 if (GetHistoList().GetEntries()) {
235 Info(
"Terminate",
"both");
243 Info(
"Terminate",
"histo");
244 SaveHistos(fCombinedOutputFile);
247 else if (fTreeFile) {
249 Info(
"Terminate",
"tree");
254 else Info(
"Terminate",
"none");
279 TotalEntriesToRead = 0;
280 for (
auto&
r : GetRunList()) {
316 if (!GetHistoList().GetEntries())
return;
336 TIter next(&GetHistoList());
338 while ((obj = next())) {
341 if (((
TH1*)obj)->GetEntries() > 0) {
361 Bool_t KVRawDataAnalyser::CreateTreeFile(
const Char_t* filename)
370 if (!strcmp(filename,
""))
376 fTreeFile =
new TFile(tree_file_name,
"RECREATE");
393 kTRUE,
"RawAnalysisTemplate");
404 void KVRawDataAnalyser::AbortDuringRunProcessing()
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
R__EXTERN TSystem * gSystem
static void CombineFiles(const Char_t *file1, const Char_t *file2, const Char_t *newfilename, Bool_t keep=kTRUE)
Factory class for generating skeleton files for new classes.
void GenerateCode()
Generate header and implementation file for currently-defined class.
void AddImplIncludeFile(const Char_t *filename)
ULong64_t GetEvents() const
TString GetFullPathToRunfile(const KVString &type, const run_index_t &run) const
FileType * OpenRunfile(const KVString &type, const run_index_t &run)
KVDBRun * GetDBRun(Int_t number) const
const KVDBRunFile & GetDBRunFile(const run_index_t &r) const
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray", KVExpDB *db=nullptr)
virtual void InitialiseRawDataReading(KVRawDataReader *)
virtual Bool_t HandleRawDataEvent(KVRawDataReader *)
Abstract base class for user analysis of raw data.
void SubmitTask() override
virtual void SaveHistos(const Char_t *filename="", Option_t *option="recreate", Bool_t onlyfilled=kFALSE)
virtual ~KVRawDataAnalyser()
Destructor.
static void Make(const Char_t *kvsname="MyOwnRawDataAnalyser")
Automatic generation of derived class for raw data analysis.
void CalculateTotalEventsToRead()
loop over runs and calculate total events
Abstract base class for reading raw (DAQ) data.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
const char * AsString() const
const char * GetName() const override
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
virtual Bool_t InheritsFrom(const char *classname) const
const char * Data() const
void Form(const char *fmt,...)
virtual int Rename(const char *from, const char *to)
RooCmdArg ClassName(const char *name)
BinData::ErrorType GetDataType(const TGraph *gr, DataOptions &fitOpt)