5 #include "KVDBSystem.h"
6 #include "KVNumberList.h"
8 #include <KVFileReader.h>
10 #include "KVUnownedList.h"
25 fRuns = AddTable(
"Runs",
"List of available runs");
26 fRuns->SetDefaultFormat(
"Run %d");
27 fSystems = AddTable(
"Systems",
"List of available systems");
29 with_index_multiplier = index_multiplier != 1;
79 if (gExpDB ==
this) gExpDB =
nullptr;
98 std::map<int,int> one_shot;
99 for (
UInt_t ii = first_run; ii <= last_run; ii++) {
121 std::map<int,int> one_shot;
139 rec->AddLink(
"Runs", run);
163 for (
UInt_t i = 0; i < rr_number; i++) {
179 Error(
"LinkListToRunRanges",
180 "NULL pointer passed for parameter TList");
184 Error(
"LinkListToRunRanges(TList*,UInt_t,UInt_t*)",
185 "The list is empty");
204 Error(
"LinkListToRunRange",
205 "NULL pointer passed for parameter TList");
209 Error(
"LinkListToRunRange(TList*,KVNumberList)",
210 "The list is empty");
278 Info(
"ReadSystemList()",
"Reading Systems parameters ...");
282 char next_char = fin.peek();
283 while (next_char !=
'+' && fin.good()) {
285 next_char = fin.peek();
288 while (fin.good() && !fin.eof() && next_char ==
'+') {
292 next_char = fin.peek();
297 Error(
"ReadSystemList()",
"Could not open file %s",
305 while ((run = (
KVDBRun*)nextRun())) {
341 sysfile <<
"# " <<
GetDBEnv(
"Systems") <<
" file written by "
343 cout <<
GetDBEnv(
"Systems") <<
" file written by "
346 if (strcmp(sys->
GetName(),
"[unknown]")) {
393 rlistf <<
"# " <<
GetDBEnv(
"Runlist") <<
" file written by "
395 cout <<
GetDBEnv(
"Runlist") <<
" file written by "
402 while ((run = (
KVDBRun*) next_run())) {
409 Warning(
"WriteRunListFile()",
"run list is empty !!!");
520 if (cal_file_name.IsNull())
return kFALSE;
523 if (!array_name.
IsNull()) {
524 cal_file_name.Prepend(
Form(
"%s.", array_name.
Data()));
560 printf(
"RUN\tSYSTEM\t\t\t\tTRIGGER\t\tEVENTS\t\tCOMMENTS\n");
561 printf(
"------------------------------------------------------------------------------------------------------------------\n");
566 printf(
"%4d\t%-30s\t%s\t\t%llu\t\t%s\n",
640 while ((dbr = (
KVDBRun*)next())) {
642 if ((last_run > 0 && dbr->
GetNumber() <= last_run)
643 || last_run == -1) total += dbr->
GetEvents();
659 Error(
"GetTotalEvents",
"No system with name : %s", system.
Data());
665 while ((dbr = (
KVDBRun*)it())) {
719 if (comments_file ==
"")
return;
722 Info(
"ReadComments",
"Reading run comments in file %s...", fullpath.
Data());
726 Error(
"ReadComments",
"Problem opening file %s", fullpath.
Data());
746 while (!lruns.
End()) {
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
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 Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Form(const char *fmt,...)
static ValType GetDataSetEnv(const KVString &dataset, const KVString &type, const ValType &defval)
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
static Bool_t SearchAndOpenKVFile(const Char_t *name, KVSQLite::database &dbfile, const Char_t *kvsubdir="")
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Record folder for the database.
virtual Int_t GetNumber() const
Description of an experimental run in database ,,.
ULong64_t GetEvents() const
void SetComments(const KVString &comments)
KVDBSystem * GetSystem() const
virtual void WriteRunListLine(std::ostream &, Char_t delim='|') const
const Char_t * GetTriggerString() const
const Char_t * GetComments() const
Database class used to store information on different colliding systems studied during an experiment....
void Save(std::ostream &) const
void AddRun(KVDBRecord *)
void Load(std::istream &, int=1)
virtual KVDBRecord * GetRecord(const Char_t *rec_name) const
Simple cross-referenced database structure.
Base class to describe database of an experiment ,,.
void AddSystem(KVDBSystem *r)
virtual ~KVExpDB()
Destructor.
virtual KVDBSystem * GetSystem(const Char_t *system) const
virtual void ReadComments()
virtual void ReadSystemList()
KVDBTable * fRuns
table of runs
virtual void LinkRecordToRun(KVDBRecord *rec, Int_t run)
KVDBRun * GetDBRun(Int_t number) const
virtual KVSeqCollection * GetRuns() const
TString GetCalibFileName(const Char_t *type) const
virtual void LinkListToRunRanges(TList *list, UInt_t rr_number, UInt_t run_ranges[][2])
Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
KVDBTable * fSystems
table of systems
virtual void PrintRuns(KVNumberList &) const
ULong64_t GetTotalEvents(int first_run, int last_run=-1) const
virtual KVSeqCollection * GetSystems() const
virtual void Save(const Char_t *)
TString fDBType
used by GetDBEnv
virtual void LinkRecordToRunRanges(KVDBRecord *rec, UInt_t rr_number, UInt_t run_ranges[][2])
virtual void LinkListToRunRange(TList *list, const KVNumberList &nl)
Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
void WriteSystemsFile() const
KVExpDB()
Default constructor.
const Char_t * GetDataSetDir() const
void init()
default initialisations
virtual void LinkRecordToRunRange(KVDBRecord *rec, UInt_t first_run, UInt_t last_run)
void SetDataSetDir(const Char_t *d)
static KVExpDB * MakeDataBase(const Char_t *name, const Char_t *datasetdir)
void WriteRunListFile() const
virtual TString GetDBEnv(const Char_t *) const
Bool_t OpenCalibFile(const Char_t *type, std::ifstream &fs) const
TString fDataSet
the name of the dataset to which this database is associated
Bool_t FindCalibFile(const Char_t *type, TString &fullpath, const TString &array_name="") const
Handle reading columns of numeric data in text files.
KVString GetCurrentLine()
ReadStatus ReadLine(const KVString &pattern="")
Int_t GetNparRead() const
KVString GetReadPar(Int_t pos) const
Bool_t OpenFileToRead(const KVString &filename)
Strings used to represent a set of ranges of values.
TObject * At(Int_t idx) const override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
virtual Int_t GetSize() const
const char * AsString() const
const char * GetName() const override
virtual const char * ClassName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
Longptr_t ExecPlugin(int nargs)
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
unsigned long long ULong64_t