ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfigSvc
src
LVL1ConfigSvc.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LVL1ConfigSvc.h
"
6
#include "
TrigConfMD5.h
"
7
#include "
TrigConfSvcHelper.h
"
8
9
#include "GaudiKernel/ServiceHandle.h"
10
#include "
StoreGate/StoreGateSvc.h
"
11
12
#include "
TrigConfIO/JsonFileLoader.h
"
13
#include "
TrigConfIO/TrigDBL1BunchGroupSetLoader.h
"
14
#include "
TrigConfIO/TrigDBMenuLoader.h
"
15
#include "
TrigConfInterfaces/IJobOptionsSvc.h
"
16
17
#include <memory>
18
19
TrigConf::LVL1ConfigSvc::LVL1ConfigSvc
(
const
std::string&
name
, ISvcLocator* pSvcLocator) :
20
AthService
(
name
, pSvcLocator)
21
{}
22
23
StatusCode
TrigConf::LVL1ConfigSvc::loadRun3StyleMenu
()
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;
44
fileLoader.
setLevel
(
TrigConf::MSGTC::WARNING
);
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
}
77
78
StatusCode
TrigConf::LVL1ConfigSvc::initialize
()
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:"
);
93
ATH_MSG_INFO
(
m_inputType
);
94
if
(
m_inputType
==
"FILE"
) {
95
ATH_MSG_INFO
(
m_l1FileName
);
96
}
97
else
if
(
m_inputType
==
"DB"
) {
98
ATH_MSG_INFO
(
m_dbConnection
);
99
ATH_MSG_INFO
(
m_smk
);
100
}
101
102
ATH_CHECK
(
loadRun3StyleMenu
());
103
104
return
StatusCode::SUCCESS;
105
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IJobOptionsSvc.h
JsonFileLoader.h
Loader class for Trigger configuration from Json.
LVL1ConfigSvc.h
StoreGateSvc.h
TrigConfMD5.h
TrigConfSvcHelper.h
TrigDBL1BunchGroupSetLoader.h
Loader class for Trigger configuration (L1 prescales set) from the Trigger DB.
TrigDBMenuLoader.h
AthService::AthService
AthService()
ServiceHandle
Definition
ClusterMakerTool.h:36
TrigConf::JsonFileLoader
Loader of trigger configurations from Json files.
Definition
JsonFileLoader.h:25
TrigConf::JsonFileLoader::setLevel
void setLevel(MSGTC::Level lvl)
Definition
JsonFileLoader.h:86
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
TrigConf::LVL1ConfigSvc::m_inputType
Gaudi::Property< std::string > m_inputType
Definition
LVL1ConfigSvc.h:28
TrigConf::LVL1ConfigSvc::m_smk
Gaudi::Property< unsigned int > m_smk
Definition
LVL1ConfigSvc.h:40
TrigConf::LVL1ConfigSvc::m_hltFileName
Gaudi::Property< std::string > m_hltFileName
Definition
LVL1ConfigSvc.h:34
TrigConf::LVL1ConfigSvc::m_dbConnection
Gaudi::Property< std::string > m_dbConnection
Definition
LVL1ConfigSvc.h:37
TrigConf::LVL1ConfigSvc::initialize
virtual StatusCode initialize() override
Definition
LVL1ConfigSvc.cxx:78
TrigConf::LVL1ConfigSvc::loadRun3StyleMenu
StatusCode loadRun3StyleMenu()
Definition
LVL1ConfigSvc.cxx:23
TrigConf::LVL1ConfigSvc::m_l1FileName
Gaudi::Property< std::string > m_l1FileName
Definition
LVL1ConfigSvc.h:31
TrigConf::LVL1ConfigSvc::LVL1ConfigSvc
LVL1ConfigSvc(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LVL1ConfigSvc.cxx:19
TrigConf::TrigDBLoader::setLevel
void setLevel(MSGTC::Level lvl)
Definition
TrigDBLoader.h:68
TrigConf::TrigDBLoader::setCrestTrigDB
void setCrestTrigDB(const std::string &crestTrigDB)
set trigger db for the crest connection
Definition
TrigDBLoader.cxx:102
TrigConf::TrigDBLoader::setCrestConnection
void 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
Definition
TrigDBLoader.cxx:80
TrigConf::TrigDBMenuLoader
Loader of trigger menu configurations from the database.
Definition
TrigDBMenuLoader.h:30
TrigConf::TrigDBMenuLoader::loadL1Menu
bool loadL1Menu(unsigned int smk, boost::property_tree::ptree &l1menu, const std::string &outFileName="") const
Load L1 menu content from the Trigger DB into a ptree for a given SuperMasterKey (SMK).
Definition
TrigDBMenuLoader.cxx:93
TrigConf::MSGTC::WARNING
@ WARNING
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:26
TrigConf::truncatedHash
uint32_t truncatedHash(const DataStructure &dataStructure)
Function to compute a truncated MD5 hash for a JSON file.
Definition
TrigConfMD5.cxx:23
TrigConf::isCrestConnection
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...
Definition
TrigConfSvcHelper.cxx:13
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0