6#include "KVNumberList.h"
7#include "KVDataSetManager.h"
8#include "KVRunListLine.h"
10#include "KVDBParameterList.h"
11#include "KVDBParameterSet.h"
14#include "KVMultiDetArray.h"
39 fExceptions = AddTable(
"Exceptions",
"List signals with different PSA parameters");
40 fCalibrations = AddTable(
"Calibrations",
"Available calibration for FAZIA detectors");
43 fDONEfile =
"FromKVFAZIADB_transferdone.list";
44 fFAILEDfile =
"FromKVFAZIADB_transferfailed.list";
46 Info(
"init",
"file names for tranfert:\n%s\n%s", fDONEfile.Data(), fFAILEDfile.Data());
54 "FAZIA experiment parameter database")
65 "FAZIA experiment parameter database")
138 Error(
"ReadNewRunList()",
"Could not open file %s",
142 Info(
"ReadNewRunList()",
"Reading run list ...");
144 while (fin.good() && !fin.eof()) {
146 if (
line.Length() > 1 && !
line.BeginsWith(
"#") && !
line.BeginsWith(
"Version")) {
149 toks =
line.Tokenize(
"|");
163 else if (
name ==
"read events") {
166 else if (
name ==
"good events") {
169 else if (
name ==
"starting date") {
172 else if (
name ==
"stopping date") {
175 else if (
name ==
"aqcuisition status") {
178 else if (
name ==
"wrong number of blocks") {
181 else if (
name ==
"block errors") {
184 else if (
name ==
"nfiles") {
187 else if (
name ==
"duration") {
190 else if (
name ==
"frequency") {
193 else if (
name ==
"triggerrate") {
196 else if (
name ==
"mtrigger") {
199 else if (
name ==
"deadtime") {
202 else if (
name ==
"trig info") {
205 else if (
name ==
"size(GB)") {
226 Error(
"ReadNewRunList()",
"Could not open file %s",
230 Info(
"ReadNewRunList()",
"Reading run sheets ...");
233 while (ffin.good() && !ffin.eof()) {
235 if (
line.Length() > 1 && !
line.BeginsWith(
"#") && !
line.BeginsWith(
"Version")) {
237 toks =
line.Tokenize(
"|");
251 if (!(run =
GetRun(number))) {
257 else if (
name ==
"read events") {
260 else if (
name ==
"good events") {
263 else if (
name ==
"starting date") {
266 else if (
name ==
"stopping date") {
269 else if (
name ==
"aqcuisition status") {
272 else if (
name ==
"wrong number of blocks") {
275 else if (
name ==
"block errors") {
278 else if (
name ==
"nfiles") {
281 else if (
name ==
"duration") {
284 else if (
name ==
"frequency") {
287 else if (
name ==
"triggerrate") {
290 else if (
name ==
"mtrigger") {
293 else if (
name ==
"deadtime") {
296 else if (
name ==
"trig info") {
339 return (retour == 0);
366 fprintf(ff,
"%d\n", run);
371 fprintf(ff,
"%d\n", run);
398 while (!lrun.
End()) {
465 line.ReplaceAll(
"#",
"");
466 line =
line.StripAllExtraWhiteSpace();
469 if (!
line.End() &&
name ==
"--dir") {
470 datadir =
line.Next();
471 Info(
"ReadDBFile",
"acquisition file directory: %s", datadir.
Data());
477 Warning(
"ReadDBFile",
"no data directory has been found ...");
508 Info(
"StartTransfer",
"no runs to tranfer ...");
521 if (basic_name ==
"") {
522 Info(meth,
"No name found for \"%s\" file", keyw);
525 Info(meth,
"Search for %s for dataset %s ...", basic_name.
Data(), gDataSet->
GetName());
529 Info(meth,
"\tNo file found ...");
549 Error(meth,
"Error in opening file %s", fp.
Data());
554 Info(meth,
"Reading %s file", fp.
Data());
570 Info(meth,
"Reading %s file", fp.
Data());
609 if (sig ==
"QH1" || sig ==
"QL1" || sig ==
"I1") sdet.
Prepend(
"SI1-");
610 else if (sig ==
"Q2" || sig ==
"I2") sdet.
Prepend(
"SI2-");
611 else if (sig ==
"Q3") sdet.
Prepend(
"CSI-");
616 dbp->
AddKey(
"Runs",
"List of Runs");
664 while (!lruns.
End()) {
684 TEnv* env =
GetFileTEnv(
"ReadRutherfordCounting()",
"RutherfordCounting");
781 Info(
"ReadCalibFile",
"%s does not exist or not found",
filename);
785 Info(
"ReadCalibFile",
"file : %s found", fullpath.
Data());
798 if (sname ==
"Signal") {
799 ssignal =
rec->GetValue();
801 else if (sname ==
"CalibType") {
802 stype =
rec->GetValue();
804 else if (sname ==
"RunList") {
805 default_run_list.
Set(
rec->GetValue());
811 while (!lval.
End()) {
819 while (!lval.
End()) {
827 if (ssignal ==
"")
Error(
"ReadCalibFile",
"No signal defined");
828 if (stype ==
"")
Error(
"ReadCalibFile",
"No calibration type defined");
859 while (!srec.
End()) {
861 dbrec->
AddKey(
"Runs",
"List of Runs");
868 dbrec->
AddKey(
"Runs",
"List of Runs");
916 Error(
"BuildQuickAndDirtyDataBase",
"%s is not an existing directory", acqfiles_dir.
Data());
921 FILE* fout = fopen(sfout.
Data(),
"w");
922 fprintf(fout,
"# DataSet %s\n", gDataSet->
GetName());
923 fprintf(fout,
"# Runlist generated by KVFAZIADB::BuildQuickAndDirtyDataBase from files located at:\n");
924 fprintf(fout,
"# --dir=%s\n", acqfiles_dir.
Data());
927 FILE* flog = fopen(sflog.
Data(),
"w");
928 fprintf(flog,
"# DataSet %s\n", gDataSet->
GetName());
929 fprintf(flog,
"# Log generated by KVFAZIADB::BuildQuickAndDirtyDataBase from files located at:\n");
930 fprintf(flog,
"# --dir=%s\n", acqfiles_dir.
Data());
940 Int_t numberofruns = 0;
943 while (!ldir.
End()) {
948 if (sscanf(sdir.
Data(),
"run%d", &run) == 1) {
955 while (!lfile.
End()) {
958 if (sscanf(sfile.
Data(),
"FzEventSet-%d-%d.pb", &date, &idx) == 2) {
963 if (date < dmin) dmin = date;
964 if (date > dmax) dmax = date;
969 if (nfiles == 0 ||
size == 0) {
970 Warning(
"BuildQuickAndDirtyDataBase",
"%d -> empty run", run);
973 fprintf(fout,
"run=%d | starting date=%s | nfiles=%d | size(GB)=%1.2lf\n", run, kvdate.
AsString(), nfiles,
size *
TMath::Power(2., -20));
979 fprintf(flog,
"total size %lld - %lld\n",
size, totalsize);
980 fprintf(flog,
"total size (TB) %1.2lf - %1.2lf\n",
size * conv, totalsize * conv);
981 fprintf(flog,
"number of runs %d\n", numberofruns);
982 fprintf(flog,
"last run %d done at %s\n", lruns.
Last(), kvdate.
AsString());
size_t size(const MatrixT &matrix)
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 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 np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
Interface to IRODS (Integrated Rule-Oriented Data System) DMS client.
virtual Int_t put(const Char_t *source, const Char_t *target=".")
put a new file into IRODS space.
To store calibration parameters in a database ,.
KVNameValueList * GetParameters()
To store calibration parameters in a database ,.
void SetParameter(UShort_t i, Double_t val)
Record folder for the database.
virtual Bool_t AddKey(KVDBKey *key, Bool_t check=kTRUE)
virtual Int_t GetNumber() const
void SetEvents(ULong64_t evt_number)
void SetComments(const KVString &comments)
void SetStartDate(const KVString &date)
void SetEndDate(const KVString &d)
void SetTrigger(Int_t trig)
Database class used to store information on different colliding systems studied during an experiment....
KVUnownedList * GetRuns() const
Returns a sorted list of all the runs associated with this system.
virtual Bool_t AddRecord(KVDBRecord *add)
virtual Bool_t AddTable(KVDBTable *table)
virtual const Char_t * GetDataPathSubdir() const
Returns name of top-level directory in data repository used to store data files for this dataset.
TString GetFullPathToDataSetFile(const Char_t *filename)
const Char_t * GetDataTypeSubdir(const Char_t *type) const
Extension of TDatime to handle various useful date formats.
Base class to describe database of an experiment ,,.
virtual void ReadSystemList()
TString GetCalibFileName(const Char_t *type) const
const KVNumberList & GetRunList() const
virtual void LinkListToRunRange(TList *list, const KVNumberList &nl)
Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
const Char_t * GetDataSetDir() const
virtual void LinkRecordToRunRange(KVDBRecord *rec, UInt_t first_run, UInt_t last_run)
virtual KVDBSystem * GetSystem(const Char_t *system) 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
Database entry for a run in a FAZIA experiment.
void SetNumberOfAcqFiles(Int_t)
void SetDuration(Double_t)
void SetGoodEvents(Int_t)
void SetError_InternalBlockError(Int_t)
void SetError_WrongNumberOfBlocks(Int_t)
void SetRutherfordCrossSection(Double_t)
void SetRutherfordCount(Int_t)
void SetACQStatus(const KVString &status)
void SetFrequency(Double_t)
void SetTriggerRate(Double_t)
void SetDeadTime(Double_t)
void SetNumberOfTriggerBlocks(Double_t)
Experiment database for FAZIA.
const Char_t * GetFileName(const Char_t *meth, const Char_t *keyw)
Bool_t TransferRunToCcali(Int_t run, TString path, TString ccali_rep="/fazia", TString option="frv")
void ReadRutherfordCrossSection()
Bool_t TransferAcquisitionFileToCcali(TString file, TString ccali_rep="/fazia", TString option="frv")
void TransferRunListToCcali(KVNumberList lrun, TString path, TString ccali_rep="/fazia", TString option="frv")
void init()
default initialisations
void BuildQuickAndDirtyDataBase(TString)
KVDBTable * fExceptions
table of exceptions
KVFileReader * GetKVFileReader(const Char_t *meth, const Char_t *keyw)
KVDBTable * fCalibrations
table for calibrations
void ReadRutherfordCounting()
KVFAZIADBRun * GetRun(Int_t run) const
void ReadCalibrationFiles()
void StartTransfer(TString filename="runlist.dat", TString ccali_rep="/fazia", TString option="frv")
virtual ~KVFAZIADB()
reset global pointer gFaziaDB if it was pointing to this database
KVDBTable * fOoODets
(optional) Liste les detecteurs hors service
TEnv * GetFileTEnv(const Char_t *meth, const Char_t *keyw)
virtual void ReadOoODetectors()
void ReadCalibFile(const Char_t *filename)
Handle reading columns of numeric data in text files.
KVString GetCurrentLine()
ReadStatus ReadLine(const KVString &pattern="")
Double_t GetDoubleReadPar(Int_t pos) const
void Clear(Option_t *="")
Int_t GetNparRead() const
KVString GetReadPar(Int_t pos) const
Bool_t OpenFileToRead(const KVString &filename)
virtual void MakeCalibrationTables(KVExpDB *)
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
void SetValue(const Char_t *name, value_type value)
Strings used to represent a set of ranges of values.
Bool_t Contains(Int_t val) const
returns kTRUE if the value 'val' is contained in the ranges defined by the number list
const Char_t * AsString(Int_t maxchars=0) const
void SetList(const TString &)
void Add(Int_t)
Add value 'n' to the list.
void Set(const TString &l)
Int_t Last() const
Returns largest number included in list.
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 GetEntries() const
virtual void SetOwner(Bool_t enable=kTRUE)
const char * AsString() const
THashList * GetTable() const
virtual Int_t ReadFile(const char *fname, EEnvLevel level)
void Clear(Option_t *option="") override
TObject * FindObject(const char *name) const override
void Add(TObject *obj) override
const char * GetName() const override
Int_t GetEntries() const override
TObject * At(Int_t idx) const override
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
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
TString & Prepend(char c, Ssiz_t rep=1)
void Form(const char *fmt,...)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Int_t Exec(const char *shellcmd)
virtual const char * BaseName(const char *pathname)
virtual TString GetFromPipe(const char *command)
Double_t Power(Double_t x, Double_t y)