QwAnalysis
|
#include <QwParityDB.h>
Public Member Functions | |
QwParityDB () | |
Simple constructor. More... | |
QwParityDB (QwOptions &options) | |
Constructor with QwOptions object. More... | |
virtual | ~QwParityDB () |
Destructor. More... | |
void | SetupOneRun (QwEventBuffer &qwevt) |
void | FillParameterFiles (QwSubsystemArrayParity &subsys) |
UInt_t | GetMonitorID (const string &name, Bool_t zero_id_is_error=kTRUE) |
UInt_t | GetMainDetectorID (const string &name, Bool_t zero_id_is_error=kTRUE) |
UInt_t | GetLumiDetectorID (const string &name, Bool_t zero_id_is_error=kTRUE) |
const string | GetMeasurementID (const Int_t index) |
UInt_t | GetSlowControlDetectorID (const string &name) |
UInt_t | GetErrorCodeID (const string &name) |
UInt_t | GetRunNumber () |
UInt_t | GetSegmentNumber () |
UInt_t | GetRunID () |
UInt_t | GetRunletID () |
UInt_t | GetAnalysisID () |
UInt_t | GetRunID (QwEventBuffer &qwevt) |
UInt_t | GetRunletID (QwEventBuffer &qwevt) |
UInt_t | GetAnalysisID (QwEventBuffer &qwevt) |
Bool_t | SetRunNumber (const UInt_t runnum) |
Bool_t | SetSegmentNumber (const UInt_t segment) |
void | ProcessAdditionalOptions (QwOptions &options) |
Processes the options contained in the QwOptions object. More... | |
![]() | |
QwDatabase (const string &major="00", const string &minor="00", const string &point="0000") | |
Simple constructor. More... | |
QwDatabase (QwOptions &options, const string &major="00", const string &minor="00", const string &point="0000") | |
Constructor with QwOptions object. More... | |
virtual | ~QwDatabase () |
Destructor. More... | |
void | SetAccessLevel (string accesslevel) |
Sets the access level flag based on string labels: "off", "ro", "rw". More... | |
Bool_t | AllowsReadAccess () |
Bool_t | AllowsWriteAccess () |
Bool_t | Connect () |
Open a connection to the database using the predefined parameters. More... | |
void | Disconnect () |
Bool_t | Connected () |
const string | GetServerVersion () |
void | ProcessOptions (QwOptions &options) |
Processes the options contained in the QwOptions object. More... | |
void | ProcessOptions (const TString &dbname, const TString &username, const TString &passwd, const TString &dbhost="localhost", const Int_t dbport=0, const TString &accesslevel="ro") |
Processes database options. More... | |
mysqlpp::Query | Query (const char *qstr=0) |
mysqlpp::Query | Query (const std::string &qstr) |
const string | GetVersion () |
const string | GetVersionMajor () |
Return a full version string for the DB schema. More... | |
const string | GetVersionMinor () |
const string | GetVersionPoint () |
const string | GetValidVersion () |
void | PrintServerInfo () |
Static Public Member Functions | |
static void | DefineAdditionalOptions (QwOptions &options) |
Defines QwParityDB-specific class options for QwOptions. More... | |
![]() | |
static void | DefineOptions (QwOptions &options) |
Defines available class options for QwOptions. More... | |
Private Member Functions | |
UInt_t | SetRunID (QwEventBuffer &qwevt) |
UInt_t | SetRunletID (QwEventBuffer &qwevt) |
UInt_t | SetAnalysisID (QwEventBuffer &qwevt) |
void | StoreMonitorIDs () |
void | StoreMainDetectorIDs () |
void | StoreLumiDetectorIDs () |
void | StoreMeasurementIDs () |
void | StoreSlowControlDetectorIDs () |
void | StoreErrorCodeIDs () |
Private Attributes | |
UInt_t | fRunNumber |
Run number of current run. More... | |
Int_t | fSegmentNumber |
CODA file segment number of current run. More... | |
UInt_t | fRunID |
run_id of current run More... | |
UInt_t | fRunletID |
runlet_id of current run More... | |
UInt_t | fAnalysisID |
analysis_id of current analysis pass More... | |
bool | fDisableAnalysisCheck |
Flag to disable pre-existing analysis_id check. More... | |
Static Private Attributes | |
static std::map< string, unsigned int > | fMonitorIDs |
Associative array of beam monitor IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously. More... | |
static std::map< string, unsigned int > | fMainDetectorIDs |
Associative array of main detector IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously. More... | |
static std::map< string, unsigned int > | fLumiDetectorIDs |
Associative array of LUMI detector IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously. More... | |
static std::map< string, unsigned int > | fSlowControlDetectorIDs |
Associative array of slow controls data IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously. More... | |
static std::map< string, unsigned char > | fErrorCodeIDs |
Associative array of error code IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously. More... | |
static std::vector< string > | fMeasurementIDs |
Friends | |
class | StoreMonitorID |
class | StoreMainDetectorID |
class | StoreLumiDetectorID |
class | StoreMeasurementID |
class | StoreSlowControlDetectorID |
class | StoreErrorCodeID |
Definition at line 49 of file QwParityDB.h.
QwParityDB::QwParityDB | ( | ) |
Simple constructor.
The simple constructor initializes member fields. This class is not used to establish the database connection. It sets up a mysqlpp::Connection() object that has exception throwing disabled.
Definition at line 90 of file QwParityDB.cc.
References QwLog::endl(), fAnalysisID, fDisableAnalysisCheck, fRunID, fRunletID, fRunNumber, fSegmentNumber, and QwDebug.
QwParityDB::QwParityDB | ( | QwOptions & | options | ) |
Constructor with QwOptions object.
The constructor initializes member fields using the values in the QwOptions object.
options | The QwOptions object. |
Definition at line 108 of file QwParityDB.cc.
References QwLog::endl(), fAnalysisID, fDisableAnalysisCheck, fRunID, fRunletID, fRunNumber, fSegmentNumber, ProcessAdditionalOptions(), and QwDebug.
|
virtual |
Destructor.
The destructor says "Good-bye World!"
Definition at line 126 of file QwParityDB.cc.
References QwDatabase::Connected(), QwDatabase::Disconnect(), QwLog::endl(), and QwDebug.
|
static |
Defines QwParityDB-specific class options for QwOptions.
Defines configuration options for QwParityDB class using QwOptions functionality.
Should apparently by called by QwOptions::DefineOptions() in QwParityOptions.h
Definition at line 877 of file QwParityDB.cc.
References QwOptions::AddOptions(), and default_bool_value.
Referenced by DefineOptionsParity().
void QwParityDB::FillParameterFiles | ( | QwSubsystemArrayParity & | subsys | ) |
Definition at line 563 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), GetAnalysisID(), QwSubsystemArray::GetParamFileNameList(), QwDatabase::Query(), and QwError.
Referenced by main().
|
inline |
Definition at line 71 of file QwParityDB.h.
References fAnalysisID.
Referenced by QwRegression::FillDB(), QwBlinder::FillDB(), QwMainCerenkovDetector::FillDB(), QwBeamLine::FillDB(), QwIntegratedRaster::FillDB(), QwLumi::FillDB(), QwBeamMod::FillDB_MPS(), QwBlinder::FillErrDB(), QwMainCerenkovDetector::FillErrDB(), QwBeamLine::FillErrDB(), QwIntegratedRaster::FillErrDB(), QwLumi::FillErrDB(), FillParameterFiles(), main(), SetupOneRun(), QwBlinder::WriteChecksum(), and QwBlinder::WriteTestValues().
UInt_t QwParityDB::GetAnalysisID | ( | QwEventBuffer & | qwevt | ) |
This is a getter for analysis_id in the analysis table. Required by all queries on cerenkov, beam, etc. tables. Will return 0 if fRunID has not been successfully set. If fAnalysisID is not set, then calls code to insert into analysis table and retrieve analysis_id.
Definition at line 594 of file QwParityDB.cc.
References QwEventBuffer::AreRunletsSplit(), QwLog::endl(), fAnalysisID, fRunletID, fRunNumber, fSegmentNumber, QwEventBuffer::GetRunNumber(), QwEventBuffer::GetSegmentNumber(), QwDebug, QwError, and SetAnalysisID().
UInt_t QwParityDB::GetErrorCodeID | ( | const string & | name | ) |
Definition at line 725 of file QwParityDB.cc.
References QwLog::endl(), fErrorCodeIDs, QwError, and StoreErrorCodeIDs().
UInt_t QwParityDB::GetLumiDetectorID | ( | const string & | name, |
Bool_t | zero_id_is_error = kTRUE |
||
) |
Definition at line 790 of file QwParityDB.cc.
References QwLog::endl(), fLumiDetectorIDs, QwError, and StoreLumiDetectorIDs().
Referenced by main(), QwDBInterface::SetDetectorID(), QwDBInterface::SetLumiDetectorID(), and QwErrDBInterface::SetLumiDetectorID().
UInt_t QwParityDB::GetMainDetectorID | ( | const string & | name, |
Bool_t | zero_id_is_error = kTRUE |
||
) |
Definition at line 661 of file QwParityDB.cc.
References QwLog::endl(), fMainDetectorIDs, QwError, and StoreMainDetectorIDs().
Referenced by main(), QwDBInterface::SetDetectorID(), QwDBInterface::SetMainDetectorID(), and QwErrDBInterface::SetMainDetectorID().
const string QwParityDB::GetMeasurementID | ( | const Int_t | index | ) |
Definition at line 833 of file QwParityDB.cc.
References QwLog::endl(), fMeasurementIDs, QwError, and StoreMeasurementIDs().
UInt_t QwParityDB::GetMonitorID | ( | const string & | name, |
Bool_t | zero_id_is_error = kTRUE |
||
) |
Definition at line 618 of file QwParityDB.cc.
References QwLog::endl(), fMonitorIDs, QwError, and StoreMonitorIDs().
Referenced by QwBeamMod::FillDB_MPS(), main(), QwDBInterface::SetDetectorID(), QwDBInterface::SetMonitorID(), and QwErrDBInterface::SetMonitorID().
|
inline |
Definition at line 69 of file QwParityDB.h.
References fRunID.
Referenced by main(), and SetupOneRun().
UInt_t QwParityDB::GetRunID | ( | QwEventBuffer & | qwevt | ) |
This is a getter for run_id in the run table. Should be used in subsequent queries to retain key relationships between tables.
Definition at line 290 of file QwParityDB.cc.
References QwLog::endl(), fAnalysisID, fRunID, fRunletID, fRunNumber, QwEventBuffer::GetRunNumber(), QwDebug, and SetRunID().
|
inline |
Definition at line 70 of file QwParityDB.h.
References fRunletID.
Referenced by QwEPICSEvent::FillDB(), QwEPICSEvent::FillSlowControlsData(), QwEPICSEvent::FillSlowControlsSettings(), QwEPICSEvent::FillSlowControlsStrigs(), SetAnalysisID(), and SetupOneRun().
UInt_t QwParityDB::GetRunletID | ( | QwEventBuffer & | qwevt | ) |
This is a getter for runlet_id in the runlet table. Should be used in subsequent queries to retain key relationships between tables.
Definition at line 412 of file QwParityDB.cc.
References QwEventBuffer::AreRunletsSplit(), QwLog::endl(), fAnalysisID, fRunletID, fRunNumber, fSegmentNumber, QwEventBuffer::GetRunNumber(), QwEventBuffer::GetSegmentNumber(), QwDebug, and SetRunletID().
|
inline |
Definition at line 67 of file QwParityDB.h.
References fRunNumber.
Referenced by QwBlinder::ReadSeed().
|
inline |
Definition at line 68 of file QwParityDB.h.
References fSegmentNumber.
UInt_t QwParityDB::GetSlowControlDetectorID | ( | const string & | name | ) |
Definition at line 706 of file QwParityDB.cc.
References QwLog::endl(), fSlowControlDetectorIDs, QwError, and StoreSlowControlDetectorIDs().
Referenced by QwEPICSEvent::FillSlowControlsData(), and QwEPICSEvent::FillSlowControlsStrigs().
void QwParityDB::ProcessAdditionalOptions | ( | QwOptions & | options | ) |
Processes the options contained in the QwOptions object.
Loads the configuration options for QwParityDB class into this instance of QwParityDB from the QwOptions object.
options | Options object |
Definition at line 891 of file QwParityDB.cc.
References fDisableAnalysisCheck, and QwOptions::GetValue().
Referenced by QwParityDB().
|
private |
This is used to set the appropriate analysis_id for this run. Must be a valid runlet_id in the runlet table before proceeding. Will insert an entry into the analysis table if necessary.
Definition at line 429 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), fAnalysisID, fDisableAnalysisCheck, QwRunCondition::Get(), QwOptions::GetArgc(), QwOptions::GetArgv(), QwEventBuffer::GetEventRange(), GetRunletID(), gQwOptions, QwDatabase::Query(), QwError, QwMessage, and QwWarning.
Referenced by GetAnalysisID().
|
private |
This function sets the fRunID for the run being replayed as determined by the QwEventBuffer class.
Definition at line 200 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), fRunID, fRunNumber, MQwCodaControlEvent::GetEndUnixTime(), QwEventBuffer::GetRunNumber(), MQwCodaControlEvent::GetStartUnixTime(), QwDatabase::Query(), QwDebug, and QwError.
Referenced by GetRunID().
|
private |
This function sets the fRunletID for the run being replayed as determined by the QwEventBuffer class.
Runlets are differentiated by file segment number at the moment, not by event range or start/stop time. This function will need to be altered if we opt to differentiate between runlets in a different way.
Definition at line 313 of file QwParityDB.cc.
References QwEventBuffer::AreRunletsSplit(), QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), fRunID, fRunletID, fSegmentNumber, QwEventBuffer::GetRunNumber(), QwEventBuffer::GetSegmentNumber(), QwDatabase::Query(), QwDebug, and QwError.
Referenced by GetRunletID().
bool QwParityDB::SetRunNumber | ( | const UInt_t | runnum | ) |
Sets run number for subsequent database interactions. Makes sure correct entry exists in run table and retrieves run_id.
Definition at line 158 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), fRunID, fRunNumber, QwDatabase::Query(), QwDebug, and QwError.
Bool_t QwParityDB::SetSegmentNumber | ( | const UInt_t | segment | ) |
void QwParityDB::SetupOneRun | ( | QwEventBuffer & | qwevt | ) |
Sets run number for subsequent database interactions. Makes sure correct entry exists in run table and retrieves run_id.
Definition at line 136 of file QwParityDB.cc.
References QwDatabase::AllowsReadAccess(), QwLog::endl(), GetAnalysisID(), GetRunID(), GetRunletID(), QwEventBuffer::GetRunNumber(), Qw::kBoldMagenta, Qw::kNormal, and QwMessage.
Referenced by main().
|
private |
Definition at line 767 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), QwDatabase::Query(), QwError, and StoreErrorCodeID.
Referenced by GetErrorCodeID().
|
private |
Definition at line 808 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), QwDatabase::Query(), QwError, and StoreLumiDetectorID.
Referenced by GetLumiDetectorID().
|
private |
Definition at line 682 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), QwDatabase::Query(), QwError, and StoreMainDetectorID.
Referenced by GetMainDetectorID().
|
private |
Definition at line 848 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), QwDatabase::Query(), QwError, and StoreMeasurementID.
Referenced by GetMeasurementID().
|
private |
Definition at line 638 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), QwDatabase::Query(), QwError, and StoreMonitorID.
Referenced by GetMonitorID().
|
private |
Definition at line 744 of file QwParityDB.cc.
References QwDatabase::Connect(), QwDatabase::Disconnect(), QwLog::endl(), QwDatabase::Query(), QwError, and StoreSlowControlDetectorID.
Referenced by GetSlowControlDetectorID().
|
friend |
Definition at line 113 of file QwParityDB.h.
Referenced by StoreErrorCodeIDs().
|
friend |
Definition at line 110 of file QwParityDB.h.
Referenced by StoreLumiDetectorIDs().
|
friend |
Definition at line 109 of file QwParityDB.h.
Referenced by StoreMainDetectorIDs().
|
friend |
Definition at line 111 of file QwParityDB.h.
Referenced by StoreMeasurementIDs().
|
friend |
Definition at line 108 of file QwParityDB.h.
Referenced by StoreMonitorIDs().
|
friend |
Definition at line 112 of file QwParityDB.h.
Referenced by StoreSlowControlDetectorIDs().
|
private |
analysis_id of current analysis pass
Definition at line 98 of file QwParityDB.h.
Referenced by GetAnalysisID(), GetRunID(), GetRunletID(), QwParityDB(), and SetAnalysisID().
|
private |
Flag to disable pre-existing analysis_id check.
Definition at line 99 of file QwParityDB.h.
Referenced by ProcessAdditionalOptions(), QwParityDB(), and SetAnalysisID().
|
staticprivate |
Associative array of error code IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
Definition at line 105 of file QwParityDB.h.
Referenced by GetErrorCodeID(), and StoreErrorCodeID::operator()().
|
staticprivate |
Associative array of LUMI detector IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
Definition at line 103 of file QwParityDB.h.
Referenced by GetLumiDetectorID(), and StoreLumiDetectorID::operator()().
|
staticprivate |
Associative array of main detector IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
Definition at line 102 of file QwParityDB.h.
Referenced by GetMainDetectorID(), and StoreMainDetectorID::operator()().
|
staticprivate |
Definition at line 106 of file QwParityDB.h.
Referenced by GetMeasurementID(), and StoreMeasurementID::operator()().
|
staticprivate |
Associative array of beam monitor IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
Definition at line 101 of file QwParityDB.h.
Referenced by GetMonitorID(), and StoreMonitorID::operator()().
|
private |
run_id of current run
Definition at line 96 of file QwParityDB.h.
Referenced by GetRunID(), QwParityDB(), SetRunID(), SetRunletID(), and SetRunNumber().
|
private |
runlet_id of current run
Definition at line 97 of file QwParityDB.h.
Referenced by GetAnalysisID(), GetRunID(), GetRunletID(), QwParityDB(), and SetRunletID().
|
private |
Run number of current run.
Definition at line 94 of file QwParityDB.h.
Referenced by GetAnalysisID(), GetRunID(), GetRunletID(), GetRunNumber(), QwParityDB(), SetRunID(), and SetRunNumber().
|
private |
CODA file segment number of current run.
Definition at line 95 of file QwParityDB.h.
Referenced by GetAnalysisID(), GetRunletID(), GetSegmentNumber(), QwParityDB(), and SetRunletID().
|
staticprivate |
Associative array of slow controls data IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
Definition at line 104 of file QwParityDB.h.
Referenced by GetSlowControlDetectorID(), and StoreSlowControlDetectorID::operator()().