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);
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 (!Analysis())
break;
124 if (CheckStatusUpdateInterval(fEventNumber)) DoStatusUpdate(fEventNumber);
129 cout <<
"Ending analysis of run " << fRunNumber <<
" on : ";
131 cout << now2.
AsString() << endl << endl;
132 cout << endl <<
"Finished reading " << fEventNumber - 1 <<
" events from file " << raw_file.
Data() << endl << endl;
170 if (gDataSet != GetDataSet()) GetDataSet()->cd();
173 fOptionList.ParseOptions(GetUserClassOptions());
180 CalculateTotalEventsToRead();
183 GetRunList().Begin();
184 while (!GetRunList().
End() && !AbortProcessingLoop()) {
185 fRunNumber = GetRunList().Next();
189 if (fCombinedOutputFile !=
"") {
190 Info(
"Terminate",
"combine = %s", fCombinedOutputFile.Data());
195 if (fHistoList.GetEntries()) {
197 Info(
"Terminate",
"both");
205 Info(
"Terminate",
"histo");
206 SaveHistos(fCombinedOutputFile);
209 else if (fTreeFile) {
211 Info(
"Terminate",
"tree");
216 else Info(
"Terminate",
"none");
241 TotalEntriesToRead = 0;
242 GetRunList().Begin();
243 while (!GetRunList().
End()) {
244 Int_t r = GetRunList().Next();
263 Error(
"AddTree",
"You must call CreateTreeFile(const Char_t*) before using this method!");
266 tree->SetDirectory(fTreeFile);
287 if ((
h1 = GetHisto(histo_name))) {
289 FillTH3((
TH3*)
h1, one, two, three, four);
293 FillTH2((
TH2*)
h1, one, two, three);
297 FillTH1(
h1, one, two);
299 Warning(
"FillHisto",
"%s -> Classe non prevue ...", fHistoList.FindObject(histo_name)->ClassName());
302 Warning(
"FillHisto",
"%s introuvable", histo_name);
315 if ((
h1 = GetHisto(histo_name))) {
319 Warning(
"FillHisto",
"%s introuvable", histo_name);
340 fTreeList.Execute(
"Fill",
"");
384 if (!fHistoList.GetEntries())
return;
404 TIter next(GetHistoList());
406 while ((obj = next())) {
409 if (((
TH1*)obj)->GetEntries() > 0) {
441 fTreeFile =
new TFile(tree_file_name,
"RECREATE");
458 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
FileType * OpenRunfile(const Char_t *type, Int_t run)
TString GetFullPathToRunfile(const Char_t *type, Int_t run) const
KVDBRun * GetDBRun(Int_t number) 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.
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)