Loader of trigger configurations from the Trigger database.
More...
#include <TrigDBLoader.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 configurations from the Trigger database.
Definition at line 39 of file TrigDBLoader.h.
◆ TrigDBLoader()
TrigConf::TrigDBLoader::TrigDBLoader |
( |
const std::string & |
loaderName, |
|
|
const std::string & |
connection |
|
) |
| |
◆ ~TrigDBLoader()
TrigConf::TrigDBLoader::~TrigDBLoader |
( |
| ) |
|
|
virtualdefault |
Destructor - cannot be defined here because QueryDefinition is an incomplete type.
◆ createDBSession()
std::unique_ptr< coral::ISessionProxy > TrigConf::TrigDBLoader::createDBSession |
( |
| ) |
const |
|
protected |
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 |
|
protected |
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() <<
" )" );
◆ 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 |
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 = "" |
|
) |
| |
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 | ) |
|
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 |
|
inlineprotected |
◆ m_connection
std::string TrigConf::TrigDBLoader::m_connection {""} |
|
private |
◆ m_connectionTimeout
int TrigConf::TrigDBLoader::m_connectionTimeout {0} |
|
private |
◆ m_crestServer
std::string TrigConf::TrigDBLoader::m_crestServer {""} |
|
private |
◆ m_crestTrigDb
std::string TrigConf::TrigDBLoader::m_crestTrigDb {""} |
|
private |
◆ m_crestVersion
std::string TrigConf::TrigDBLoader::m_crestVersion {""} |
|
private |
◆ 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} |
|
private |
◆ m_retrialTimeout
int TrigConf::TrigDBLoader::m_retrialTimeout {0} |
|
private |
◆ m_useCrest
bool TrigConf::TrigDBLoader::m_useCrest {false} |
|
private |
The documentation for this class was generated from the following files: