4 #include "KVExpSetUpDB.h"
6 #include "KVMultiDetArray.h"
52 void KVExpSetUpDB::ReadScalerInfos()
58 if (runinfos ==
"")
return;
60 Info(
"ReadScalerInfos",
"Reading scaler infos from %s", runinfos.
Data());
61 TFile runinfos_file(runinfos);
64 while ((run = (
KVDBRun*)it_run())) {
66 for (
auto& rf : file_list) {
70 int npar = scalist->GetNpar();
71 for (
int i = 0; i < npar; i += 2) {
72 TString parname = scalist->GetParameter(i)->GetName();
87 void KVExpSetUpDB::ReadParameterFiles()
96 Info(
"ReadParameterFiles",
"Using file %s", path.Data());
129 void KVExpSetUpDB::LoadParameters(
const KVString& filename)
151 Info(
"LoadParameters",
"%s does not exist or not found",
filename.Data());
155 Info(
"LoadParameters",
"file : %s found", fullpath.
Data());
172 while ((rec = (
TEnvRec*)next())) {
175 if (sname.BeginsWith(
"Parameter"))
continue;
181 for (
auto& run : runlist) {
200 void KVExpSetUpDB::make_minimal_database()
209 catch (std::runtime_error& rte) {
213 if (
TString(rte.what()) !=
"run infos file not found")
throw;
215 Info(
"Build",
"No informations on dataset runs available");
216 Info(
"Build",
"Dummy database runs numbered from 1 to 100 will be created");
217 for (
int i = 1; i <= 100; ++i) {
236 void KVExpSetUpDB::extend_minimal_database()
246 ReadParameterFiles();
274 void KVExpSetUpDB::FillRunsTable()
298 throw std::runtime_error(
"run infos file not found");
300 int run_num{-1}, runfile_index{-1};
302 Info(
"FillRunsTable",
"Reading run infos from %s", runinfos.
Data());
303 TFile runinfos_file(runinfos);
304 TIter it(runinfos_file.GetListOfKeys());
308 while ((run_key = (
TKey*)it())) {
311 if (run_key->
GetCycle() == runinfos_file.GetKey(run_key->
GetName())->GetCycle()) {
314 if (with_index_multiplier) {
315 run_num = run->
GetIntValue(
"Run") / index_multiplier;
316 runfile_index = run->
GetIntValue(
"Run") % index_multiplier;
317 if (!runfile_index) run_index =
run_index_t{run_num, std::nullopt};
318 else run_index =
run_index_t{run_num, runfile_index};
329 for (
auto index : index_list) {
338 runfile->SetSize(run->
GetIntValue(
Form(
"Size.%d", index)) / 1024. / 1024.);
363 runfile->SetSize(run->
GetValue64bit(
"Size") / 1024. / 1024.);
365 runfile->SetSize(run->
GetIntValue(
"Size") / 1024. / 1024.);
378 Info(
"FillRunsTable",
"Reading bad runfile infos from %s", badinfos.
Data());
380 badfiles.
ReadFile(badinfos, kEnvLocal);
384 auto br = all.Next();
387 KVError::Error(
this,
"FillRunsTable",
"%s:BadFiles.All contains run number %d which is not in %s",
388 badinfos.
Data(), br, runinfos.
Data());
389 throw std::runtime_error(
Form(
"inconsistency between %s:BadFiles.All and %s",
396 while (!
first.End()) {
397 auto br =
first.Next();
400 KVError::Error(
this,
"FillRunsTable",
"%s:BadFiles.First contains run number %d which is not in %s",
401 badinfos.
Data(), br, runinfos.
Data());
402 throw std::runtime_error(
Form(
"inconsistency between %s:BadFiles.First and %s",
408 for (
auto& ri : singles) {
412 catch (std::exception& e) {
413 KVError::Error(
this,
"FillRunsTable",
"%s:BadFiles.Singles contains run_index %s which is unknown",
414 badinfos.
Data(), ri.as_string().Data());
420 Int_t global_runfile_number = 0;
421 for (
auto run : fListOfRuns) {
423 auto ril =
r->GetRunIndexList();
424 for (
auto& ri : ril) {
426 GetDBRunFile(ri).SetGlobalRunFileNumber(++global_runfile_number);
427 fMapGlobRunFileNumberToRunIndex[global_runfile_number] = ri;
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
char * Form(const char *fmt,...)
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
virtual Int_t GetNumber() const
A single raw data file associated with an experimental run ,,.
void SetScaler64(const Char_t *name, ULong64_t val)
Set value for 64-bit scaler with the given name for this run.
void Set(const Char_t *param, Double_t val)
Set numerical (non-scaler) characteristic of run.
void SetBad(Bool_t is_bad=kTRUE)
Description of an experimental run in database ,,.
void AddRunFile(KVDBRunFile *rf)
void SetNumber(Int_t n) override
const run_index_list & GetRunIndexList() const
KVDBRunFile & GetFirstFile()
KVDBRunFile & GetRunFile(const run_index_t &run_index)
TString GetFullPathToDataSetFile(const Char_t *filename) const
static Bool_t FindDataSetFile(const TString &dataset, const Char_t *filename)
Base class to describe database of an experiment ,,.
KVDBRun * GetDBRun(Int_t number) const
virtual KVSeqCollection * GetRuns() const
const KVDBRunFile & GetDBRunFile(const run_index_t &r) const
run_index_list SetRunIndexListFromString(const TString &, bool interpret_run_number_as_whole_run=false) const
Bool_t HasRawFilesWithIndex() const
Calibration database for experiments using coupled detector arrays.
KVExpSetUpDB()
Default constructor.
Handle reading columns of numeric data in text files.
KVString GetCurrentLine()
ReadStatus ReadLine(const KVString &pattern="")
Bool_t OpenFileToRead(const KVString &filename)
Extended TList class which owns its objects by default.
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray", KVExpDB *db=nullptr)
virtual void MakeCalibrationTables(KVExpDB *)
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Int_t GetIntValue(const Char_t *name) const
Bool_t HasValue64bit(const Char_t *name) const
ULong64_t GetValue64bit(const Char_t *name) const
const Char_t * GetStringValue(const Char_t *name) const
Strings used to represent a set of ranges of values.
void Add(TObject *obj) override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
THashList * GetTable() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
virtual const char * GetClassName() const
virtual TObject * ReadObj()
const char * GetName() const override
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
List of runfiles specified by run number and file index ,.
Specifies a runfile according to run number and file index ,.
void Error(UserClass p, const char *location, const char *va_(fmt),...)