BOSS 7.1.1
BESIII Offline Software System
|
#include <Metadata.h>
Public Types | |
enum | eRet { RETOk = 0 , RETBadCnfFile = 1 , RETBadHost = 2 , RETNoConnect = 3 , RETWrongState = 4 , RETBadValue = 5 , RETMySQLError = 6 , RETNoSchemaMatch = 7 } |
enum | eLevel { LEVELProd = 1 , LEVELDev = 2 , LEVELTest = 4 , LEVELSuperseded = 8 } |
Used to form bit masks for dbs queries. More... | |
Public Member Functions | |
Metadata (const std::string &host="bes3db2.ihep.ac.cn", const std::string &table="*", const std::string &dbName="calib") | |
Constructor keeps track of table of interest. | |
~Metadata () | |
eRet | findBest (unsigned int *ser, const std::string &calibType, const std::string &sft_ver, const std::string &cal_ver, const std::string &cal_par, const std::string &rec_alg, const std::string &rec_par, const std::string &machine, const std::string &flavor="VANILLA") |
eRet | findSoonAfter (unsigned int *ser, const std::string &calibType, const std::string &sft_ver, const std::string &cal_ver, const std::string &cal_par, const std::string &rec_alg, const std::string &rec_par, const std::string &machine, const std::string &flavor="VANILLA") |
eRet | getInterval (unsigned int serialNo, facilities::Timestamp *&since, facilities::Timestamp *&till) |
Get validity interval for a particular calibration. | |
eRet | getReadInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &dataFmt, std::string &dataIdent) |
eRet | getReadTOFInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadEMCInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadDedxInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadMDCInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadInjSigIntervalInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadInjSigTimeInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadOffEvtFilterInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadCorrectedETSInfo (unsigned int serialNo, int runNo, int FirstEvent, std::string &Version, DatabaseRecordVector &res) |
eRet | getReadMUCInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadEsTimeInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadEstTofInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadMdcAlignInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadMdcDataConstInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadTofQElecInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadTofSimInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
eRet | getReadDedxSimInfo (unsigned int serialNo, int *runFrm, int *runTo, std::string &calParVer, DatabaseRecordVector &res, int runNo, std::string &sftver) |
int | registerCalib (const std::string &inst, const std::string &flavor, const std::string &calib_type, const std::string &data_ident, const std::string &data_format, unsigned int &runfrm, unsigned int &runto, const std::string &input_desc, const std::string ¬es, const std::string &proc_level, const std::string &locale, const std::string &fmt_version="", const std::string &completion="OK") |
bool | connectRead (eRet &err) |
bool | checkValues (const rdbModel::StringVector &cols, const rdbModel::StringVector &vals) const |
bool | checkNulls (const rdbModel::StringVector &cols) const |
rdbModel::Connection * | getReadConnection () |
rdbModel::Rdb * | getRdb () |
const std::string & | getTable () |
void | disconnectRead () |
void | disconnectWrite () |
Provide interface between calibration clients and the MySQL database for calibration metadata. Supported operations include writing a new record, looking for the serial number of a "best match" record (findBest), and a method for retrieving the information necessary to read the data set corresponding to a particular metadata record (getReadInfo). Writing a record is done in stages: open the record (openRecord), add certain fields (addValidInterval, addNotes, etc.), and finally to write the full record to the database (insertRecord).
The class contains definitions for several enumerated types, corresponding to possible entries for columns in a metadata record. Within the MySQL database the values are kept as strings. The enumerated types are provided to insulate clients from these details; enumerations are easier to document and to check for validity.
Definition at line 33 of file Metadata.h.
Used to form bit masks for dbs queries.
Enumerator | |
---|---|
LEVELProd | |
LEVELDev | |
LEVELTest | |
LEVELSuperseded |
Definition at line 46 of file Metadata.h.
Enumerator | |
---|---|
RETOk | |
RETBadCnfFile | |
RETBadHost | |
RETNoConnect | |
RETWrongState | |
RETBadValue | |
RETMySQLError | |
RETNoSchemaMatch |
Definition at line 35 of file Metadata.h.
calibUtil::Metadata::Metadata | ( | const std::string & | host = "bes3db2.ihep.ac.cn", |
const std::string & | table = "*", | ||
const std::string & | dbName = "calib" ) |
Constructor keeps track of table of interest.
Definition at line 39 of file Metadata.cxx.
calibUtil::Metadata::~Metadata | ( | ) |
Definition at line 57 of file Metadata.cxx.
bool calibUtil::Metadata::checkNulls | ( | const rdbModel::StringVector & | cols | ) | const |
Definition at line 1200 of file Metadata.cxx.
Referenced by registerCalib().
bool calibUtil::Metadata::checkValues | ( | const rdbModel::StringVector & | cols, |
const rdbModel::StringVector & | vals ) const |
Definition at line 1183 of file Metadata.cxx.
Referenced by registerCalib().
Definition at line 107 of file Metadata.cxx.
Referenced by findBest(), findSoonAfter(), and getReadInfo().
void calibUtil::Metadata::disconnectRead | ( | ) |
Definition at line 155 of file Metadata.cxx.
Referenced by ~Metadata().
void calibUtil::Metadata::disconnectWrite | ( | ) |
Definition at line 163 of file Metadata.cxx.
Referenced by ~Metadata().
Metadata::eRet calibUtil::Metadata::findBest | ( | unsigned int * | ser, |
const std::string & | calibType, | ||
const std::string & | sft_ver, | ||
const std::string & | cal_ver, | ||
const std::string & | cal_par, | ||
const std::string & | rec_alg, | ||
const std::string & | rec_par, | ||
const std::string & | machine, | ||
const std::string & | flavor = "VANILLA" ) |
Return serial number for calibration which is best match to criteria, using strings for calibType and instrument arguments. This method may be useful for development when a particular instrument or calibration type is not officially supported.
ser | serial number of best match as integer or zero if no matches (output) |
calibType | type of data, must match |
timestamp | must be within validity interval; closer to center is better |
levelMask | acceptable levels ("production" better than "dev" better than "test" better than "superseded") |
instrument | e.g. LAT, EM, CU,... |
flavor | optionally specify non-standard calibration flavor |
If there are multiple calibrations which are not distinguished by the above, pick the one most recently written.
Definition at line 243 of file Metadata.cxx.
Metadata::eRet calibUtil::Metadata::findSoonAfter | ( | unsigned int * | ser, |
const std::string & | calibType, | ||
const std::string & | sft_ver, | ||
const std::string & | cal_ver, | ||
const std::string & | cal_par, | ||
const std::string & | rec_alg, | ||
const std::string & | rec_par, | ||
const std::string & | machine, | ||
const std::string & | flavor = "VANILLA" ) |
Similar to findBest above, but here caller constrains the update_time of the calibration by specifying an earliest and (optional) latest time for it. The serial number of the calibration meeting all other conditions, and with the earliest update_time, will be returned.
ser | serial number of best match as integer or zero if no matches (output) |
calibType | type of data, must match |
update_start | ptr to time; early bound for update_time |
update_end | ptr to late bound for update_time (may be 0) |
levelMask | acceptable levels ("production" better than "dev" better than "test" better than "superseded") |
instrument | e.g. LAT, EM, CU,... |
flavor | optionally specify non-standard calibration flavor |
Definition at line 172 of file Metadata.cxx.
eRet calibUtil::Metadata::getInterval | ( | unsigned int | serialNo, |
facilities::Timestamp *& | since, | ||
facilities::Timestamp *& | till ) |
Get validity interval for a particular calibration.
|
inline |
Definition at line 315 of file Metadata.h.
|
inline |
Definition at line 312 of file Metadata.h.
Metadata::eRet calibUtil::Metadata::getReadCorrectedETSInfo | ( | unsigned int | serialNo, |
int | runNo, | ||
int | FirstEvent, | ||
std::string & | Version, | ||
DatabaseRecordVector & | res ) |
Definition at line 483 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadDedxInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 663 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadDedxSimInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 817 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadEMCInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 624 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadEsTimeInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 702 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadEstTofInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 740 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | dataFmt, | ||
std::string & | dataIdent ) |
Given a calibration serial number, return information needed for caller to read in the data.
serialNo | [input] |
dataFormat | |
fmtVersion | |
filename |
Definition at line 314 of file Metadata.cxx.
Metadata::eRet calibUtil::Metadata::getReadInjSigIntervalInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 377 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadInjSigTimeInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 412 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadMdcAlignInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 855 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadMdcDataConstInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 892 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadMDCInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 583 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadMUCInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 543 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadOffEvtFilterInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 447 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadTOFInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 507 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadTofQElecInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 928 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
Metadata::eRet calibUtil::Metadata::getReadTofSimInfo | ( | unsigned int | serialNo, |
int * | runFrm, | ||
int * | runTo, | ||
std::string & | calParVer, | ||
DatabaseRecordVector & | res, | ||
int | runNo, | ||
std::string & | sftver ) |
Definition at line 778 of file Metadata.cxx.
Referenced by CalibMySQLCnvSvc::createCalib(), and CalibMySQLCnvSvc::updateCalib().
|
inline |
Definition at line 316 of file Metadata.h.
int calibUtil::Metadata::registerCalib | ( | const std::string & | inst, |
const std::string & | flavor, | ||
const std::string & | calib_type, | ||
const std::string & | data_ident, | ||
const std::string & | data_format, | ||
unsigned int & | runfrm, | ||
unsigned int & | runto, | ||
const std::string & | input_desc, | ||
const std::string & | notes, | ||
const std::string & | proc_level, | ||
const std::string & | locale, | ||
const std::string & | fmt_version = "", | ||
const std::string & | completion = "OK" ) |
Definition at line 1049 of file Metadata.cxx.