 |
ATLAS Offline Software
|
Loader of trigger configurations from Json files.
More...
#include <TrigDBHLTPrescalesSetLoader.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 Json files.
Definition at line 23 of file TrigDBHLTPrescalesSetLoader.h.
◆ TrigDBHLTPrescalesSetLoader()
TrigConf::TrigDBHLTPrescalesSetLoader::TrigDBHLTPrescalesSetLoader |
( |
const std::string & |
connection | ) |
|
Constructor.
Definition at line 6 of file TrigDBHLTPrescalesSetLoader.cxx.
12 q.addToTableList (
"HLT_PRESCALE_SET" );
14 q.extendBinding<
int>(
"key");
16 q.extendCondition(
"HPS_ID = :key");
20 q.setDataName(
"HPS_DATA");
◆ ~TrigDBHLTPrescalesSetLoader()
TrigConf::TrigDBHLTPrescalesSetLoader::~TrigDBHLTPrescalesSetLoader |
( |
| ) |
|
|
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() <<
" )" );
◆ loadHLTPrescales()
bool TrigConf::TrigDBHLTPrescalesSetLoader::loadHLTPrescales |
( |
unsigned int |
hltpsk, |
|
|
TrigConf::HLTPrescalesSet & |
pss, |
|
|
const std::string & |
outFileName = "" |
|
) |
| const |
Load content from the Trigger DB into an HLTPrescalesSet for a given HLTPrescaleKey (HLTPSK)
- Parameters
-
hltpsk | [in] the HLTPSK that should be loaded |
hltpss | [out] the loaded HLTPrescalesSet |
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 28 of file TrigDBHLTPrescalesSetLoader.cxx.
46 TRG_MSG_ERROR(
"When reading HLT prescales for HLT PSK " << psk <<
" 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_msg_tls
boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls |
|
mutableprivateinherited |
◆ m_name
std::string TrigConf::TrigConfMessaging::m_name |
|
privateinherited |
◆ m_queries
std::map<size_t, QueryDefinition> TrigConf::TrigDBHLTPrescalesSetLoader::m_queries |
|
private |
◆ 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:
void setPSK(unsigned int psk)
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 setData(const ptree &data)
Setting the configuration data.
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.
virtual void clear() override
Clearing the configuration data.
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
std::map< size_t, QueryDefinition > m_queries
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.