 |
ATLAS Offline Software
|
Loader of trigger menu configurations from the database.
More...
#include <TrigDBMenuLoader.h>
|
| bool | useCrest () const |
| |
| std::string | getTrigDataCrest (const std::string &type, int key) const |
| | Get trigger configuration from the TriggerDB through Crest. More...
|
| |
| std::unique_ptr< coral::ISessionProxy > | createDBSession () const |
| | create (if needed) DB session and return the session proxy More...
|
| |
| QueryDefinition | getQueryDefinition (size_t schemaVersion, const std::map< size_t, QueryDefinition > &queries) const |
| | return query for given schemaVersion from possible queries More...
|
| |
| void | loadFromCrest (unsigned int key, boost::property_tree::ptree &pt, const std::string &outFileName, const std::string &description, const std::string &query_type) const |
| |
| void | loadFromOracle (unsigned int key, boost::property_tree::ptree &pt, const std::string &outFileName, const std::string &description, const std::map< size_t, QueryDefinition > &queries) const |
| |
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>(
"key");
20 q.extendCondition(
"SMT.SMT_ID = :key");
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>(
"key");
37 q.extendCondition(
"SMT.SMT_ID = :key");
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>(
"key");
59 q.extendCondition(
"SMT.SMT_ID = :key");
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>(
"key");
76 q.extendCondition(
"SMT.SMT_ID = :key");
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 107 of file TrigDBLoader.cxx.
109 coral::ConnectionService connSvc;
110 coral::IConnectionServiceConfiguration& csc = connSvc.configuration();
125 auto proxy = std::unique_ptr<coral::ISessionProxy>( connSvc.connect(
m_connection, coral::AccessMode::ReadOnly) );
◆ getName()
| const std::string & TrigConf::TrigConfMessaging::getName |
( |
| ) |
const |
|
inlineinherited |
◆ getQueryDefinition()
return query for given schemaVersion from possible queries
Definition at line 174 of file TrigDBLoader.cxx.
178 size_t maxDefVersion = 0;
179 for(
auto &
entry : queries) {
180 size_t vkey =
entry.first;
182 maxDefVersion = vkey;
186 if( maxDefVersion==0 ) {
190 return queries.at(maxDefVersion);
◆ getTrigDataCrest()
| std::string TrigConf::TrigDBLoader::getTrigDataCrest |
( |
const std::string & |
type, |
|
|
int |
key |
|
) |
| const |
|
protectedinherited |
Get trigger configuration from the TriggerDB through Crest.
- Parameters
-
| type | The type of trigger configuration data to access
- L1PS => L1 prescale (with L1PS key)
- HLTPS => HLT prescale (with HLTPS key)
- L1M => L1 menu (with SMK)
- HLTM => HLT menu (with SMK)
- JO => Job options (with SMK)
- BGS => bunch group set (with BGS key)
- MGS => monitoring group (with SMK)
|
| key | The trigger key |
Definition at line 134 of file TrigDBLoader.cxx.
155 Crest::CrestApi capi = Crest::CrestApi(
url);
163 Crest::CrestRequest request = Crest::CrestRequest();
165 std::string current_path =
"payloads/data?format=BLOB&hash=" +
query;
◆ loadFromCrest()
Definition at line 194 of file TrigDBLoader.cxx.
202 catch(Crest::CrestException & ex) {
203 TRG_MSG_ERROR(
"When reading " <<
description <<
" for key " <<
key <<
" from crest a CrestException was caught ( " << ex.what() <<
" )" );
213 catch(boost::property_tree::json_parser_error & ex) {
214 TRG_MSG_ERROR(
"When reading " <<
description <<
" for key " <<
key <<
" from crest a ptree json parser error was caught ( " << ex.what() <<
" )" );
◆ loadFromOracle()
Definition at line 220 of file TrigDBLoader.cxx.
225 session->transaction().start(
true);
229 qdef.setBoundValue<
int>(
"key",
key);
230 auto q = qdef.createQuery( session.get() );
245 catch(coral::QueryException & ex) {
246 TRG_MSG_ERROR(
"When reading " <<
description <<
" for key " <<
key <<
" a coral::QueryException was caught ( " << ex.what() <<
" )" );
249 catch(boost::property_tree::json_parser_error & ex) {
250 TRG_MSG_ERROR(
"When reading " <<
description <<
" for key " <<
key <<
" a ptree json parser error was caught ( " << ex.what() <<
" )" );
◆ 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 |
| outFileName | [in] name of file to write out the loaded data (optional, by default no file will be written) |
- Returns
- true if loading (and optional writing) was successfull
Definition at line 106 of file TrigDBMenuLoader.cxx.
◆ 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] name of file to write out the loaded data (optional, by default no file will be written) |
- Returns
- true if loading (and optional writing) was successfull
Definition at line 138 of file TrigDBMenuLoader.cxx.
144 hltmenu.setData(std::move(pthlt));
149 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 |
| outFileName | [in] name of file to write out the loaded data (optional, by default no file will be written) |
- Returns
- true if loading (and optional writing) was successfull
Definition at line 93 of file TrigDBMenuLoader.cxx.
◆ 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] name of file to write out the loaded data (optional, by default no file will be written) |
- Returns
- true if loading (and optional writing) was successfull
Definition at line 119 of file TrigDBMenuLoader.cxx.
125 l1menu.setData(std::move(ptl1));
130 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 86 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 96 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 75 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( ! versionTag.starts_with(versionTagPrefix)) {
62 throw std::runtime_error(
std::format(
"Tag format error: Trigger schema version tag {} does not start with {}", versionTag, 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());
◆ setCrestConnection()
| void TrigConf::TrigDBLoader::setCrestConnection |
( |
const std::string & |
server, |
|
|
const std::string & |
version = "" |
|
) |
| |
|
inherited |
declare CREST as the source of the configuration An empty crest server makes it use Oracle
- Parameters
-
| server | The crest server. An empty string disables Crest and enables Oracle (the default) |
| version | The version of the crest api. Usually not needed. If not given, it defaults to the default API version (see CrestApi/CrestApiBase.h) |
Definition at line 80 of file TrigDBLoader.cxx.
◆ setCrestTrigDB()
| void TrigConf::TrigDBLoader::setCrestTrigDB |
( |
const std::string & |
crestTrigDB | ) |
|
|
inherited |
set trigger db for the crest connection
- Parameters
-
| crestTrigDB | the source trigger DB. Possible values currently
- CONF_DATA_RUN3 => ATLAS_CONF_TRIGGER_RUN3
- CONF_MC_RUN3 => ATLAS_CONF_TRIGGER_MC_RUN3
- CONF_REPR_RUN3 => ATLAS_CONF_TRIGGER_REPR_RUN3
|
Definition at line 102 of file TrigDBLoader.cxx.
◆ setLevel()
◆ useCrest()
| bool TrigConf::TrigDBLoader::useCrest |
( |
| ) |
const |
|
inlineprotectedinherited |
◆ m_connection
| std::string TrigConf::TrigDBLoader::m_connection {""} |
|
privateinherited |
◆ m_connectionTimeout
| int TrigConf::TrigDBLoader::m_connectionTimeout {0} |
|
privateinherited |
◆ m_crestServer
| std::string TrigConf::TrigDBLoader::m_crestServer {""} |
|
privateinherited |
◆ m_crestTrigDb
| std::string TrigConf::TrigDBLoader::m_crestTrigDb {""} |
|
privateinherited |
◆ m_crestVersion
| std::string TrigConf::TrigDBLoader::m_crestVersion {""} |
|
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 |
◆ m_useCrest
| bool TrigConf::TrigDBLoader::m_useCrest {false} |
|
privateinherited |
The documentation for this class was generated from the following files:
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)
size_t schemaVersion(coral::ISessionProxy *session) const
access to TriggerDB schema version
void loadFromCrest(unsigned int key, boost::property_tree::ptree &pt, const std::string &outFileName, const std::string &description, const std::string &query_type) const
void extendOutput(const std::string &fieldName)
void writeRawFile(const coral::Blob &data, const std::string &outFileName)
write coral data blob to file
std::string m_crestTrigDb
void loadFromOracle(unsigned int key, boost::property_tree::ptree &pt, const std::string &outFileName, const std::string &description, const std::map< size_t, QueryDefinition > &queries) const
const std::string & getName() const
name accessor
MsgStreamTC & msg() const
The standard message stream.
MSGTC::Level level()
Return message level of stream.
std::unique_ptr< coral::IQuery > createQuery(coral::ISessionProxy *session)
boost::property_tree::ptree ptree
void stringToPtree(const std::string &json_string, boost::property_tree::ptree &pt)
std::string m_crestVersion
std::string getTrigDataCrest(const std::string &type, int key) const
Get trigger configuration from the TriggerDB through Crest.
void blobToPtree(const coral::Blob &blob, boost::property_tree::ptree &pt)
std::string m_crestServer
void setLevel(MSGTC::Level lvl)
Set message level of stream.
std::unique_ptr< coral::ISessionProxy > createDBSession() const
create (if needed) DB session and return the session proxy
void addToTableList(const std::string &table, const std::string &table_short="")
std::string description
glabal timer - how long have I taken so far?
QueryDefinition getQueryDefinition(size_t schemaVersion, const std::map< size_t, QueryDefinition > &queries) const
return query for given schemaVersion from possible queries
TrigDBLoader(const std::string &loaderName, const std::string &connection)
Constructor.