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(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 GetRunList().Begin();
190 while (!GetRunList().
End() && !AbortProcessingLoop()) {
191 fRunNumber = GetRunList().Next();
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 GetRunList().Begin();
251 while (!GetRunList().
End()) {
252 Int_t r = GetRunList().Next();
271 Error(
"AddTree",
"You must call CreateTreeFile(const Char_t*) before using this method!");
274 tree->SetDirectory(fTreeFile);
295 if ((
h1 = GetHisto(histo_name))) {
297 FillTH3((
TH3*)
h1, one, two, three, four);
301 FillTH2((
TH2*)
h1, one, two, three);
305 FillTH1(
h1, one, two);
307 Warning(
"FillHisto",
"%s -> Classe non prevue ...", fHistoList.FindObject(histo_name)->ClassName());
310 Warning(
"FillHisto",
"%s introuvable", histo_name);
323 if ((
h1 = GetHisto(histo_name))) {
327 Warning(
"FillHisto",
"%s introuvable", histo_name);
348 fTreeList.Execute(
"Fill",
"");
392 if (!fHistoList.GetEntries())
return;
412 TIter next(GetHistoList());
414 while ((obj = next())) {
417 if (((
TH1*)obj)->GetEntries() > 0) {
449 fTreeFile =
new TFile(tree_file_name,
"RECREATE");
466 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)