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

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

#include <LVL1ConfigSvc.h>

Inheritance diagram for TrigConf::LVL1ConfigSvc:
Collaboration diagram for TrigConf::LVL1ConfigSvc:

Public Member Functions

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

Private Member Functions

StatusCode loadRun3StyleMenu ()

Private Attributes

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

Detailed Description

Service storing the LVL1 menu in the DetectorStore.

Definition at line 17 of file LVL1ConfigSvc.h.

Constructor & Destructor Documentation

◆ LVL1ConfigSvc()

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

Definition at line 19 of file LVL1ConfigSvc.cxx.

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

Member Function Documentation

◆ initialize()

StatusCode TrigConf::LVL1ConfigSvc::initialize ( )
overridevirtual

Definition at line 78 of file LVL1ConfigSvc.cxx.

79{
80 // Handle to JobOptionsSvc to retrieve configuration keys
81 if (auto joSvc = serviceLocator()->service<TrigConf::IJobOptionsSvc>("JobOptionsSvc")) {
82 if (joSvc->superMasterKey() > 0) {
83 m_inputType = "DB";
84 m_smk = joSvc->superMasterKey();
85 m_dbConnection = joSvc->server();
86 }
87 }
88 else {
89 ATH_MSG_DEBUG("Did not locate TrigConf::JobOptionsSvc, not running athenaHLT");
90 }
91
92 ATH_MSG_INFO("Loading L1 trigger menu from:");
94 if (m_inputType == "FILE") {
96 }
97 else if (m_inputType == "DB") {
100 }
101
103
104 return StatusCode::SUCCESS;
105}
#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_inputType
Gaudi::Property< unsigned int > m_smk
Gaudi::Property< std::string > m_dbConnection
Gaudi::Property< std::string > m_l1FileName

◆ loadRun3StyleMenu()

StatusCode TrigConf::LVL1ConfigSvc::loadRun3StyleMenu ( )
private

Definition at line 23 of file LVL1ConfigSvc.cxx.

24{
25 auto l1menu = std::make_unique<TrigConf::L1Menu>();
26
27 if (m_inputType == "DB") {
28 // load l1menu
29 TrigConf::TrigDBMenuLoader dbmenuloader(m_dbConnection);
30 std::string crest_server("");
31 std::string crest_api("");
32 std::string dbname("");
33 if(isCrestConnection(m_dbConnection, crest_server, crest_api, dbname)) {
34 dbmenuloader.setCrestTrigDB(dbname);
35 dbmenuloader.setCrestConnection(crest_server, crest_api);
36 }
37 dbmenuloader.setLevel(TrigConf::MSGTC::WARNING);
38 ATH_CHECK( dbmenuloader.loadL1Menu(m_smk, *l1menu) );
39
40 }
41 else if (m_inputType == "FILE") {
42 // json file menu loader
43 TrigConf::JsonFileLoader fileLoader;
45
46 ATH_CHECK( fileLoader.loadFile(m_l1FileName, *l1menu) );
47
48 uint32_t smk = m_smk.value();
49 if (!m_hltFileName.empty() && smk == 0u) {
50 auto hltmenu = std::make_unique<TrigConf::HLTMenu>();
51 const bool status = fileLoader.loadFile(m_hltFileName, *hltmenu);
52 if (status) {
53 smk = TrigConf::truncatedHash(*l1menu, *hltmenu);
54 } else {
55 ATH_MSG_DEBUG("No HLT menu created, cannot compute a MC-SMK in this job");
56 }
57 }
58 ATH_MSG_INFO("Setting file-loaded L1 Menu SMK to:" << smk);
59 l1menu->setSMK(smk); // allow assigning a specified or hashed SMK when running from FILE
60
61
62 }
63 else {
64 ATH_MSG_ERROR("Unknown input type '" << m_inputType
65 << "'. Allowed values: " << m_inputType.documentation());
66 return StatusCode::FAILURE;
67 }
68
69 ServiceHandle<StoreGateSvc> detStore("StoreGateSvc/DetectorStore", name());
70 ATH_CHECK(detStore.retrieve());
71 if (detStore->record(std::move(l1menu), "L1TriggerMenu").isSuccess()) {
72 ATH_MSG_INFO("Recorded L1 menu as 'L1TriggerMenu' in detector store");
73 }
74
75 return StatusCode::SUCCESS;
76}
#define ATH_MSG_ERROR(x)
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.
Gaudi::Property< std::string > m_hltFileName
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

◆ 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 }

Member Data Documentation

◆ m_dbConnection

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

Definition at line 37 of file LVL1ConfigSvc.h.

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

◆ m_hltFileName

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

Definition at line 34 of file LVL1ConfigSvc.h.

34 {this, "HLTJsonFileName", "",
35 "file name of HLT json file, needed if InputType is FILE and a hashed SMK needs to be computed"};

◆ m_inputType

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

Definition at line 28 of file LVL1ConfigSvc.h.

28 {this, "InputType", "FILE",
29 "FILE (json file), DB (Trigger DB)"};

◆ m_l1FileName

Gaudi::Property<std::string> TrigConf::LVL1ConfigSvc::m_l1FileName
private
Initial value:
{this, "L1JsonFileName", "",
"file name of L1 json file, needed if InputType is FILE"}

Definition at line 31 of file LVL1ConfigSvc.h.

31 {this, "L1JsonFileName", "",
32 "file name of L1 json file, needed if InputType is FILE"};

◆ m_smk

Gaudi::Property<unsigned int> TrigConf::LVL1ConfigSvc::m_smk
private
Initial value:
{this, "SMK", 0,
"DB smk, needed if InputType is DB"}

Definition at line 40 of file LVL1ConfigSvc.h.

40 {this, "SMK", 0,
41 "DB smk, needed if InputType is DB"};

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