4 #include "KVRawDataAnalyser.h"
5 #include "KVMultiDetArray.h"
6 #include "KVClassFactory.h"
25 TotalEntriesToRead = 0;
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 (fHistoList.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()) {
303 if ((
h1 = GetHisto(histo_name))) {
305 FillTH3((
TH3*)
h1, one, two, three, four);
309 FillTH2((
TH2*)
h1, one, two, three);
313 FillTH1(
h1, one, two);
315 Warning(
"FillHisto",
"%s -> Classe non prevue ...", fHistoList.FindObject(histo_name)->ClassName());
318 Warning(
"FillHisto",
"%s introuvable", histo_name);
331 if ((
h1 = GetHisto(histo_name))) {
335 Warning(
"FillHisto",
"%s introuvable", histo_name);
356 fTreeList.Execute(
"Fill",
"");
400 if (!fHistoList.GetEntries())
return;
420 TIter next(GetHistoList());
422 while ((obj = next())) {
425 if (((
TH1*)obj)->GetEntries() > 0) {
457 fTreeFile =
new TFile(tree_file_name,
"RECREATE");
474 kTRUE,
"RawAnalysisTemplate");
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)
Bool_t CreateTreeFile(const Char_t *filename="")
void FillTree(const Char_t *sname="")
void FillHisto(const Char_t *sname, Double_t one, Double_t two=1, Double_t three=1, Double_t four=1)
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
void AbortDuringRunProcessing()
Method called to abort analysis during processing of a run.
Abstract base class for reading raw (DAQ) data.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
const char * AsString() const
virtual Int_t Fill(const char *name, Double_t w)
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)