ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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
 
MsgStream & msg (const MSG::Level lvl) 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 19 of file HLTConfigSvc.cxx.

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

Member Function Documentation

◆ initialize()

StatusCode TrigConf::HLTConfigSvc::initialize ( )
overridevirtual

Definition at line 91 of file HLTConfigSvc.cxx.

92 {
93  // Handle to JobOptionsSvc to retrieve configuration keys
94  if (auto joSvc = serviceLocator()->service<TrigConf::IJobOptionsSvc>("JobOptionsSvc")) {
95  if (joSvc->superMasterKey() > 0) {
96  m_inputType = "DB";
97  m_smk = joSvc->superMasterKey();
98  m_dbConnection = joSvc->server();
99  }
100  }
101  else {
102  ATH_MSG_DEBUG("Did not locate TrigConf::JobOptionsSvc, not running athenaHLT");
103  }
104 
105  ATH_MSG_INFO("Loading HLT trigger menu from:");
107  if (m_inputType == "FILE") {
110  }
111  else if (m_inputType == "DB") {
114  }
116 
117  return StatusCode::SUCCESS;
118 }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ 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 23 of file HLTConfigSvc.cxx.

24 {
25  std::unique_ptr<TrigConf::HLTMenu> hltmenu = std::make_unique<TrigConf::HLTMenu>();
26  std::unique_ptr<TrigConf::HLTMonitoring> monitoring;
27 
28  if (m_inputType == "DB") {
29  // db menu loader
31  dbloader.setLevel(TrigConf::MSGTC::WARNING);
32 
33  ATH_CHECK( dbloader.loadHLTMenu(m_smk, *hltmenu) );
34  }
35  else if (m_inputType == "FILE") {
36  // load the json file into TrigConf::HLTMenu
37  TrigConf::JsonFileLoader fileLoader;
39 
40  ATH_CHECK( fileLoader.loadFile(m_hltFileName, *hltmenu) );
41 
42  uint32_t smk = m_smk.value();
43  if (!m_l1FileName.empty() && smk == 0u) {
44  auto l1menu = std::make_unique<TrigConf::L1Menu>();
45  const bool status = fileLoader.loadFile(m_l1FileName, *l1menu);
46  if (status) {
47  smk = TrigConf::truncatedHash(*l1menu, *hltmenu);
48  } else {
49  ATH_MSG_DEBUG("No L1 menu created, cannot compute a MC-SMK in this job");
50  }
51  }
52  ATH_MSG_INFO("Setting file-loaded HLT Menu SMK to:" << smk);
53  hltmenu->setSMK(smk); // allow assigning a specified or hashed SMK when running from FILE
54 
55  if (!m_monitoringFileName.empty()) {
56  monitoring.reset( new TrigConf::HLTMonitoring() );
57  const bool success = fileLoader.loadFile(m_monitoringFileName, *monitoring);
58  if (not success) {
60  ATH_MSG_INFO("Unable to read " << m_monitoringFileName
61  << ", but the monitoring collection is flagged as optional. Continuing.");
62  monitoring.reset(); // This smartpointer goes back from having Some to having None.
63  } else {
64  ATH_MSG_ERROR("Unable to read " << m_monitoringFileName
65  << ", the monitoring collection flagged as non-optional in this job.");
66  return StatusCode::FAILURE;
67  }
68  } else { // success
69  monitoring->setSMK(smk);
70  }
71  }
72  }
73  else {
74  ATH_MSG_ERROR("Unknown input type '" << m_inputType
75  << "'. Allowed values: " << m_inputType.documentation());
76  return StatusCode::FAILURE;
77  }
78 
79  ServiceHandle<StoreGateSvc> detStore("StoreGateSvc/DetectorStore", name());
80  ATH_CHECK( detStore.retrieve() );
81  if (detStore->record(std::move(hltmenu), "HLTTriggerMenu").isSuccess()) {
82  ATH_MSG_INFO("Recorded HLT menu as 'HLTTriggerMenu' in detector store");
83  }
84  if (monitoring and detStore->record(std::move(monitoring), "HLTMonitoringMenu").isSuccess()) {
85  ATH_MSG_INFO("Recorded HLT monitoring menu as 'HLTMonitoringMenu' in detector store");
86  }
87 
88  return StatusCode::SUCCESS;
89 }

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.

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

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

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

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

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

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


The documentation for this class was generated from the following files:
AthService::AthService
AthService()
TrigConf::HLTMonitoring::setSMK
void setSMK(unsigned int psk)
Definition: HLTMonitoring.cxx:99
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConf::JsonFileLoader::loadFile
bool loadFile(const std::string &filename, boost::property_tree::ptree &data, const std::string &pathToChild="") const
Load content of json file into a ptree.
Definition: JsonFileLoader.cxx:45
RunEBWeightsComputation.smk
smk
Definition: RunEBWeightsComputation.py:87
TrigConf::HLTConfigSvc::m_dbConnection
Gaudi::Property< std::string > m_dbConnection
Definition: HLTConfigSvc.h:38
TrigConf::HLTMenu::setSMK
void setSMK(unsigned int psk)
Definition: HLTMenu.cxx:46
TrigConf::HLTConfigSvc::writeConfigToDetectorStore
StatusCode writeConfigToDetectorStore()
Definition: HLTConfigSvc.cxx:23
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TrigConf::HLTConfigSvc::m_inputType
Gaudi::Property< std::string > m_inputType
Definition: HLTConfigSvc.h:26
TrigConf::HLTConfigSvc::m_l1FileName
Gaudi::Property< std::string > m_l1FileName
Definition: HLTConfigSvc.h:32
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigConf::HLTConfigSvc::m_smk
Gaudi::Property< unsigned int > m_smk
Definition: HLTConfigSvc.h:44
TrigConf::JsonFileLoader::setLevel
void setLevel(MSGTC::Level lvl)
Definition: JsonFileLoader.h:86
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigConf::truncatedHash
uint32_t truncatedHash(const DataStructure &dataStructure)
Function to compute a truncated MD5 hash for a JSON file.
Definition: TrigConfMD5.cxx:23
TrigConf::HLTConfigSvc::m_monitoringOptional
Gaudi::Property< bool > m_monitoringOptional
Definition: HLTConfigSvc.h:41
TrigConf::HLTMonitoring
HLT monitoring configuration.
Definition: HLTMonitoring.h:27
TrigConf::HLTConfigSvc::m_hltFileName
Gaudi::Property< std::string > m_hltFileName
Definition: HLTConfigSvc.h:29
python.XMLReader.l1menu
l1menu
Definition: XMLReader.py:73
TrigConf::HLTConfigSvc::m_monitoringFileName
Gaudi::Property< std::string > m_monitoringFileName
Definition: HLTConfigSvc.h:35
merge.status
status
Definition: merge.py:17
TrigConf::JsonFileLoader
Loader of trigger configurations from Json files.
Definition: JsonFileLoader.h:25
TrigConf::TrigDBMenuLoader
Loader of trigger menu configurations from the database.
Definition: TrigDBMenuLoader.h:30
ServiceHandle< StoreGateSvc >
TrigConf::MSGTC::WARNING
@ WARNING
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:26