ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConf::HLTConfigSvc Class Reference

Service storing the HLT menu in the DetectorStore. More...

#include <HLTConfigSvc.h>

Inheritance diagram for TrigConf::HLTConfigSvc:
Collaboration diagram for TrigConf::HLTConfigSvc:

Public Member Functions

 HLTConfigSvc (const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize () override
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Private Member Functions

StatusCode writeConfigToDetectorStore ()

Private Attributes

Gaudi::Property< std::string > m_inputType
Gaudi::Property< std::string > m_hltFileName
Gaudi::Property< std::string > m_l1FileName
Gaudi::Property< std::string > m_monitoringFileName
Gaudi::Property< std::string > m_dbConnection
Gaudi::Property< bool > m_monitoringOptional
Gaudi::Property< unsigned int > m_smk

Detailed Description

Service storing the HLT menu in the DetectorStore.

Definition at line 17 of file HLTConfigSvc.h.

Constructor & Destructor Documentation

◆ HLTConfigSvc()

TrigConf::HLTConfigSvc::HLTConfigSvc ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 20 of file HLTConfigSvc.cxx.

20 :
21 AthService(name, pSvcLocator)
22{}

Member Function Documentation

◆ initialize()

StatusCode TrigConf::HLTConfigSvc::initialize ( )
overridevirtual

Definition at line 98 of file HLTConfigSvc.cxx.

99{
100 // Handle to JobOptionsSvc to retrieve configuration keys
101 if (auto joSvc = serviceLocator()->service<TrigConf::IJobOptionsSvc>("JobOptionsSvc")) {
102 if (joSvc->superMasterKey() > 0) {
103 m_inputType = "DB";
104 m_smk = joSvc->superMasterKey();
105 m_dbConnection = joSvc->server();
106 }
107 }
108 else {
109 ATH_MSG_DEBUG("Did not locate TrigConf::JobOptionsSvc, not running athenaHLT");
110 }
111
112 ATH_MSG_INFO("Loading HLT trigger menu from:");
114 if (m_inputType == "FILE") {
117 }
118 else if (m_inputType == "DB") {
121 }
123
124 return StatusCode::SUCCESS;
125}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Gaudi::Property< std::string > m_dbConnection
Gaudi::Property< unsigned int > m_smk
Gaudi::Property< std::string > m_inputType
Gaudi::Property< std::string > m_hltFileName
Gaudi::Property< std::string > m_monitoringFileName
StatusCode writeConfigToDetectorStore()

◆ msg()

MsgStream & AthCommonMsg< Service >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Service >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ writeConfigToDetectorStore()

StatusCode TrigConf::HLTConfigSvc::writeConfigToDetectorStore ( )
private

Definition at line 24 of file HLTConfigSvc.cxx.

25{
26 std::unique_ptr<TrigConf::HLTMenu> hltmenu = std::make_unique<TrigConf::HLTMenu>();
27 std::unique_ptr<TrigConf::HLTMonitoring> monitoring;
28
29 if (m_inputType == "DB") {
30 // db menu loader
31 TrigConf::TrigDBMenuLoader dbloader(m_dbConnection);
32 std::string crest_server("");
33 std::string crest_api("");
34 std::string dbname("");
35 if(isCrestConnection(m_dbConnection, crest_server, crest_api, dbname)) {
36 dbloader.setCrestTrigDB(dbname);
37 dbloader.setCrestConnection(crest_server, crest_api);
38 }
39 dbloader.setLevel(TrigConf::MSGTC::WARNING);
40 ATH_CHECK( dbloader.loadHLTMenu(m_smk, *hltmenu) );
41 }
42 else if (m_inputType == "FILE") {
43 // load the json file into TrigConf::HLTMenu
44 TrigConf::JsonFileLoader fileLoader;
46
47 ATH_CHECK( fileLoader.loadFile(m_hltFileName, *hltmenu) );
48
49 uint32_t smk = m_smk.value();
50 if (!m_l1FileName.empty() && smk == 0u) {
51 auto l1menu = std::make_unique<TrigConf::L1Menu>();
52 const bool status = fileLoader.loadFile(m_l1FileName, *l1menu);
53 if (status) {
54 smk = TrigConf::truncatedHash(*l1menu, *hltmenu);
55 } else {
56 ATH_MSG_DEBUG("No L1 menu created, cannot compute a MC-SMK in this job");
57 }
58 }
59 ATH_MSG_INFO("Setting file-loaded HLT Menu SMK to:" << smk);
60 hltmenu->setSMK(smk); // allow assigning a specified or hashed SMK when running from FILE
61
62 if (!m_monitoringFileName.empty()) {
63 monitoring.reset( new TrigConf::HLTMonitoring() );
64 const bool success = fileLoader.loadFile(m_monitoringFileName, *monitoring);
65 if (not success) {
67 ATH_MSG_INFO("Unable to read " << m_monitoringFileName
68 << ", but the monitoring collection is flagged as optional. Continuing.");
69 monitoring.reset(); // This smartpointer goes back from having Some to having None.
70 } else {
71 ATH_MSG_ERROR("Unable to read " << m_monitoringFileName
72 << ", the monitoring collection flagged as non-optional in this job.");
73 return StatusCode::FAILURE;
74 }
75 } else { // success
76 monitoring->setSMK(smk);
77 }
78 }
79 }
80 else {
81 ATH_MSG_ERROR("Unknown input type '" << m_inputType
82 << "'. Allowed values: " << m_inputType.documentation());
83 return StatusCode::FAILURE;
84 }
85
86 ServiceHandle<StoreGateSvc> detStore("StoreGateSvc/DetectorStore", name());
87 ATH_CHECK( detStore.retrieve() );
88 if (detStore->record(std::move(hltmenu), "HLTTriggerMenu").isSuccess()) {
89 ATH_MSG_INFO("Recorded HLT menu as 'HLTTriggerMenu' in detector store");
90 }
91 if (monitoring and detStore->record(std::move(monitoring), "HLTMonitoringMenu").isSuccess()) {
92 ATH_MSG_INFO("Recorded HLT monitoring menu as 'HLTMonitoringMenu' in detector store");
93 }
94
95 return StatusCode::SUCCESS;
96}
#define ATH_MSG_ERROR(x)
Gaudi::Property< std::string > m_l1FileName
Gaudi::Property< bool > m_monitoringOptional
void setLevel(MSGTC::Level lvl)
bool loadFile(const std::string &filename, boost::property_tree::ptree &data, const std::string &pathToChild="") const
Load content of json file into a ptree.
uint32_t truncatedHash(const DataStructure &dataStructure)
Function to compute a truncated MD5 hash for a JSON file.
bool isCrestConnection(const std::string &db_connection_string, std::string &crest_server, std::string &crest_api, std::string &dbname)
Function to interpret the trigger connection string for CREST connections Format of the connections s...
status
Definition merge.py:16
setEventNumber uint32_t

Member Data Documentation

◆ m_dbConnection

Gaudi::Property<std::string> TrigConf::HLTConfigSvc::m_dbConnection
private
Initial value:
{this, "TriggerDB", "TRIGGERDB",
"DB connection alias, needed if InputType is DB"}

Definition at line 38 of file HLTConfigSvc.h.

38 {this, "TriggerDB", "TRIGGERDB",
39 "DB connection alias, needed if InputType is DB"};

◆ m_hltFileName

Gaudi::Property<std::string> TrigConf::HLTConfigSvc::m_hltFileName
private
Initial value:
{this, "HLTJsonFileName", "HLTMenu.json",
"file name of HLT json file, needed if InputType is FILE"}

Definition at line 29 of file HLTConfigSvc.h.

29 {this, "HLTJsonFileName", "HLTMenu.json",
30 "file name of HLT json file, needed if InputType is FILE"};

◆ m_inputType

Gaudi::Property<std::string> TrigConf::HLTConfigSvc::m_inputType
private
Initial value:
{this, "InputType", "FILE",
"FILE (json file), DB (Trigger DB)"}

Definition at line 26 of file HLTConfigSvc.h.

26 {this, "InputType", "FILE",
27 "FILE (json file), DB (Trigger DB)"};

◆ m_l1FileName

Gaudi::Property<std::string> TrigConf::HLTConfigSvc::m_l1FileName
private
Initial value:
{this, "L1JsonFileName", "",
"file name of L1 json file, needed if InputType is FILE, and a hashed SMK needs to be computed"}

Definition at line 32 of file HLTConfigSvc.h.

32 {this, "L1JsonFileName", "",
33 "file name of L1 json file, needed if InputType is FILE, and a hashed SMK needs to be computed"};

◆ m_monitoringFileName

Gaudi::Property<std::string> TrigConf::HLTConfigSvc::m_monitoringFileName
private
Initial value:
{this, "MonitoringJsonFileName", "",
"file name of HLT monitoring json file, optional if InputType is FILE"}

Definition at line 35 of file HLTConfigSvc.h.

35 {this, "MonitoringJsonFileName", "",
36 "file name of HLT monitoring json file, optional if InputType is FILE"};

◆ m_monitoringOptional

Gaudi::Property<bool> TrigConf::HLTConfigSvc::m_monitoringOptional
private
Initial value:
{this, "MonitoringJSONOptional", true,
"Flag to control if a JSON is required when MonitoringJsonFileName is supplied and InputType is FILE"}

Definition at line 41 of file HLTConfigSvc.h.

41 {this, "MonitoringJSONOptional", true,
42 "Flag to control if a JSON is required when MonitoringJsonFileName is supplied and InputType is FILE"};

◆ m_smk

Gaudi::Property<unsigned int> TrigConf::HLTConfigSvc::m_smk
private
Initial value:
{this, "SMK", 0,
"DB smk, needed if InputType is DB (optional for file InputType)"}

Definition at line 44 of file HLTConfigSvc.h.

44 {this, "SMK", 0,
45 "DB smk, needed if InputType is DB (optional for file InputType)"};

The documentation for this class was generated from the following files: