4 #include "KVRawDataAnalyser.h"
5 #include "KVMultiDetArray.h"
6 #include "KVClassFactory.h"
25 TotalEntriesToRead = 0;
70 if ((!fRunFile) || fRunFile->IsZombie()) {
72 if (fRunFile)
delete fRunFile;
87 fCurrentRun = gExpDB->
GetDBRun(fRunNumber.run());
95 Long64_t nevents = GetNbEventToRead();
98 cout << endl <<
"Reading all events from file " << raw_file.
Data() << endl;
101 cout << endl <<
"Reading " << nevents <<
" events from file " << raw_file.
Data() << endl;
104 cout <<
"Starting analysis of run " << fRunNumber <<
" on : ";
106 cout << now.
AsString() << endl << endl;
108 fCurrentRun->Print();
116 while ((nevents-- ? fRunFile->GetNextEvent() :
kFALSE) && !AbortProcessingLoop()) {
121 if (fRustines.HasActivePatches())
122 if (fRustines.SkipEvent(gMultiDetArray))
127 if (!Analysis())
break;
130 if (CheckStatusUpdateInterval(fEventNumber)) DoStatusUpdate(fEventNumber);
135 cout <<
"Ending analysis of run " << fRunNumber <<
" on : ";
137 cout << now2.
AsString() << endl << endl;
138 cout << endl <<
"Finished reading " << fEventNumber - 1 <<
" events from file " << raw_file.
Data() << endl << endl;
176 if (gDataSet != GetDataSet()) GetDataSet()->cd();
179 fOptionList.ParseOptions(GetUserClassOptions());
186 CalculateTotalEventsToRead();
189 for (
auto& run : GetRunList()) {
190 if (AbortProcessingLoop())
break;
192 fRustines.InitializePatchList(gDataSet->
GetName(), fRunNumber);
197 if (fCombinedOutputFile !=
"") {
198 Info(
"Terminate",
"combine = %s", fCombinedOutputFile.Data());
203 if (fHistoList.GetEntries()) {
205 Info(
"Terminate",
"both");
213 Info(
"Terminate",
"histo");
214 SaveHistos(fCombinedOutputFile);
217 else if (fTreeFile) {
219 Info(
"Terminate",
"tree");
224 else Info(
"Terminate",
"none");
249 TotalEntriesToRead = 0;
250 for (
auto&
r : GetRunList()) {
269 Error(
"AddTree",
"You must call CreateTreeFile(const Char_t*) before using this method!");
272 tree->SetDirectory(fTreeFile);
293 if ((
h1 = GetHisto(histo_name))) {
295 FillTH3((
TH3*)
h1, one, two, three, four);
299 FillTH2((
TH2*)
h1, one, two, three);
303 FillTH1(
h1, one, two);
305 Warning(
"FillHisto",
"%s -> Classe non prevue ...", fHistoList.FindObject(histo_name)->ClassName());
308 Warning(
"FillHisto",
"%s introuvable", histo_name);
321 if ((
h1 = GetHisto(histo_name))) {
325 Warning(
"FillHisto",
"%s introuvable", histo_name);
346 fTreeList.Execute(
"Fill",
"");
390 if (!fHistoList.GetEntries())
return;
410 TIter next(GetHistoList());
412 while ((obj = next())) {
415 if (((
TH1*)obj)->GetEntries() > 0) {
447 fTreeFile =
new TFile(tree_file_name,
"RECREATE");
464 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
virtual void InitialiseRawDataReading(KVRawDataReader *)
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
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 AddTree(TTree *tree)
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)