Loader of trigger menu configurations from the database.
More...
#include <TrigDBMenuLoader.h>
Loader of trigger menu configurations from the database.
Definition at line 30 of file TrigDBMenuLoader.h.
◆ TrigDBMenuLoader()
TrigConf::TrigDBMenuLoader::TrigDBMenuLoader |
( |
const std::string & |
connection | ) |
|
Constructor.
Definition at line 6 of file TrigDBMenuLoader.cxx.
15 q.addToTableList (
"SUPER_MASTER_TABLE",
"SMT" );
16 q.addToTableList (
"L1_MASTER_TABLE",
"L1MT" );
18 q.extendBinding<
int>(
"smk");
20 q.extendCondition(
"SMT.SMT_ID = :smk");
21 q.extendCondition(
" AND SMT.SMT_L1_MASTER_TABLE_ID = L1MT.L1MT_ID");
23 q.extendOutput<std::string>(
"SMT.SMT_NAME" );
24 q.extendOutput<
int> (
"SMT.SMT_L1_MASTER_TABLE_ID" );
27 q.setDataName(
"L1MT.L1MT_MENU");
32 q.addToTableList (
"SUPER_MASTER_TABLE",
"SMT" );
33 q.addToTableList (
"L1_MENU",
"L1TM" );
35 q.extendBinding<
int>(
"smk");
37 q.extendCondition(
"SMT.SMT_ID = :smk");
38 q.extendCondition(
" AND SMT.SMT_L1_MENU_ID = L1TM.L1TM_ID");
40 q.extendOutput<std::string>(
"SMT.SMT_NAME" );
41 q.extendOutput<
int> (
"SMT.SMT_VERSION" );
42 q.extendOutput<
int> (
"SMT.SMT_L1_MENU_ID" );
45 q.setDataName(
"L1TM.L1TM_DATA");
54 q.addToTableList (
"SUPER_MASTER_TABLE",
"SMT" );
55 q.addToTableList (
"HLT_MASTER_TABLE",
"HMT" );
57 q.extendBinding<
int>(
"smk");
59 q.extendCondition(
"SMT.SMT_ID = :smk");
60 q.extendCondition(
" AND SMT.SMT_HLT_MASTER_TABLE_ID = HMT.HMT_ID");
62 q.extendOutput<std::string>(
"SMT.SMT_NAME" );
63 q.extendOutput<
int> (
"SMT.SMT_HLT_MASTER_TABLE_ID" );
66 q.setDataName(
"HMT.HMT_MENU");
71 q.addToTableList (
"SUPER_MASTER_TABLE",
"SMT" );
72 q.addToTableList (
"HLT_MENU",
"HTM" );
74 q.extendBinding<
int>(
"smk");
76 q.extendCondition(
"SMT.SMT_ID = :smk");
77 q.extendCondition(
" AND SMT.SMT_HLT_MENU_ID = HTM.HTM_ID");
79 q.extendOutput<std::string>(
"SMT.SMT_NAME" );
80 q.extendOutput<
int> (
"SMT.SMT_VERSION" );
81 q.extendOutput<
int> (
"SMT.SMT_HLT_MENU_ID" );
84 q.setDataName(
"HTM.HTM_DATA");
◆ ~TrigDBMenuLoader()
TrigConf::TrigDBMenuLoader::~TrigDBMenuLoader |
( |
| ) |
|
|
overridevirtualdefault |
Destructor - cannot be defined here because QueryDefinition is an incomplete type.
◆ createDBSession()
std::unique_ptr< coral::ISessionProxy > TrigConf::TrigDBLoader::createDBSession |
( |
| ) |
const |
|
protectedinherited |
create (if needed) DB session and return the session proxy
Definition at line 94 of file TrigDBLoader.cxx.
96 coral::ConnectionService connSvc;
97 coral::IConnectionServiceConfiguration& csc = connSvc.configuration();
112 auto proxy = std::unique_ptr<coral::ISessionProxy>( connSvc.connect(
m_connection, coral::AccessMode::ReadOnly) );
◆ getQueryDefinition()
return query for given schemaVersion from possible queries
Definition at line 122 of file TrigDBLoader.cxx.
126 size_t maxDefVersion = 0;
127 for(
auto &
entry : queries) {
128 size_t vkey =
entry.first;
130 maxDefVersion = vkey;
134 if( maxDefVersion==0 ) {
138 return queries.at(maxDefVersion);
◆ loadHLTMenu() [1/2]
Load HLT menu content from the Trigger DB into two ptrees for a given SuperMasterKey (SMK)
- Parameters
-
smk | [in] the SMK that should be loaded |
hltmenu | [out] the loaded HLT menu |
- Returns
- true if loading was successfull
Definition at line 123 of file TrigDBMenuLoader.cxx.
128 session->transaction().start(
true);
132 qdef.setBoundValue<
int>(
"smk",
smk);
133 auto q = qdef.createQuery( session.get() );
136 TRG_MSG_ERROR(
"Tried reading HLT menu, but SuperMasterKey " <<
smk <<
" is not available" );
144 catch(coral::QueryException & ex) {
145 TRG_MSG_ERROR(
"When reading HLT menu for SMK " <<
smk <<
" a coral::QueryException was caught ( " << ex.what() <<
" )" );
◆ loadHLTMenu() [2/2]
bool TrigConf::TrigDBMenuLoader::loadHLTMenu |
( |
unsigned int |
smk, |
|
|
HLTMenu & |
hltmenu, |
|
|
const std::string & |
outFileName = "" |
|
) |
| const |
Load content from the Trigger DB into an HLTMenu for a given SuperMasterKey (SMK)
- Parameters
-
smk | [in] the SMK that should be loaded |
hltmenu | [out] the loaded HLT menu |
outFileName | [in] if set, an outputfile with the raw data blob is written |
- Returns
- true if loading was successfull
Definition at line 172 of file TrigDBMenuLoader.cxx.
178 hltmenu.setData(std::move(pthlt));
183 TRG_MSG_ERROR(
"When reading HLT menu for SMK " <<
smk <<
" a parsing error occured ( " << ex.what() <<
" )" );
◆ loadL1Menu() [1/2]
Load L1 menu content from the Trigger DB into a ptree for a given SuperMasterKey (SMK)
- Parameters
-
smk | [in] the SMK that should be loaded |
l1menu | [out] the loaded L1 menu |
- Returns
- true if loading was successfull
Definition at line 93 of file TrigDBMenuLoader.cxx.
98 session->transaction().start(
true);
102 qdef.setBoundValue<
int>(
"smk",
smk);
103 auto q = qdef.createQuery( session.get() );
106 TRG_MSG_ERROR(
"Tried reading L1 menu, but SuperMasterKey " <<
smk <<
" is not available" );
114 catch(coral::QueryException & ex) {
115 TRG_MSG_ERROR(
"When reading L1 menu for SMK " <<
smk <<
" a coral::QueryException was caught ( " << ex.what() <<
" )" );
◆ loadL1Menu() [2/2]
bool TrigConf::TrigDBMenuLoader::loadL1Menu |
( |
unsigned int |
smk, |
|
|
L1Menu & |
l1menu, |
|
|
const std::string & |
outFileName = "" |
|
) |
| const |
Load content from the Trigger DB into an L1Menu for a given SuperMasterKey (SMK)
- Parameters
-
smk | [in] the SMK that should be loaded |
l1menu | [out] the loaded L1 menu |
outFileName | [in] if set, an outputfile with the raw data blob is written |
- Returns
- true if loading was successfull
Definition at line 153 of file TrigDBMenuLoader.cxx.
159 l1menu.setData(std::move(ptl1));
164 TRG_MSG_ERROR(
"When reading L1 menu for SMK " <<
smk <<
" a parsing error occured ( " << ex.what() <<
" )" );
◆ msg() [1/2]
MsgStreamTC & TrigConf::TrigConfMessaging::msg |
( |
| ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 81 of file TrigConfMessaging.h.
◆ msg() [2/2]
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 91 of file TrigConfMessaging.h.
◆ msgLvl()
Test the output level.
- Parameters
-
lvl | The message level to test against |
- Returns
- boolean Indicting if messages at given level will be printed
- Return values
-
true | Messages at level "lvl" will be printed |
Definition at line 70 of file TrigConfMessaging.h.
◆ outputLevel()
◆ schemaVersion()
size_t TrigConf::TrigDBLoader::schemaVersion |
( |
coral::ISessionProxy * |
session | ) |
const |
|
inherited |
access to TriggerDB schema version
- Returns
- version of the DB schema (0 - no version, >0 - schema version)
Definition at line 38 of file TrigDBLoader.cxx.
40 static const std::string versionTagPrefix(
"Trigger-Run3-Schema-v");
43 if(! session->nominalSchema().existsTable(
"TRIGGER_SCHEMA") ) {
44 throw std::runtime_error(
"Trigger schema has no schema version table" );
56 throw std::runtime_error(
"Trigger schema has schema version table but it is empty" );
60 std::string versionTag =
row[
"TS_TAG"].data<std::string>();
61 if( ! startswith(versionTag, versionTagPrefix)) {
62 throw std::runtime_error(
"Tag format error: Trigger schema version tag " + versionTag +
"does not start with " + versionTagPrefix);
65 std::string vstr = versionTag.substr(versionTagPrefix.size());
70 catch (
const std::invalid_argument& ia) {
71 TRG_MSG_ERROR(
"Invalid argument when interpreting the version part " << vstr <<
" of schema tag " << versionTag <<
". " << ia.what());
◆ setLevel()
◆ writeRawFile()
bool TrigConf::TrigDBLoader::writeRawFile |
( |
const coral::Blob & |
data, |
|
|
const std::string & |
outFileName |
|
) |
| const |
|
inherited |
write data blob into file This can be used to write the DB content to file without going through a ptree
Definition at line 80 of file TrigDBLoader.cxx.
87 outFile.write(
static_cast<const char*
> (
data.startingAddress()),
data.size() );
◆ m_connection
std::string TrigConf::TrigDBLoader::m_connection {"TRIGGERDB"} |
|
privateinherited |
◆ m_connectionTimeout
int TrigConf::TrigDBLoader::m_connectionTimeout {0} |
|
privateinherited |
◆ m_hltqueries
◆ m_l1queries
◆ m_msg_tls
boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls |
|
mutableprivateinherited |
◆ m_name
std::string TrigConf::TrigConfMessaging::m_name |
|
privateinherited |
◆ m_retrialPeriod
int TrigConf::TrigDBLoader::m_retrialPeriod {0} |
|
privateinherited |
◆ m_retrialTimeout
int TrigConf::TrigDBLoader::m_retrialTimeout {0} |
|
privateinherited |
The documentation for this class was generated from the following files:
outFile
Comment Out Those You do not wish to run.