ATLAS Offline Software
Loading...
Searching...
No Matches
xAODConfigSvc.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef TRIGCONFXAOD_XAODCONFIGSVC_H
8#define TRIGCONFXAOD_XAODCONFIGSVC_H
9
10// Gaudi/Athena include(s):
13#include "GaudiKernel/IIncidentListener.h"
14#include "GaudiKernel/ServiceHandle.h"
16
17// Trigger include(s):
23
26#include "TrigConfData/L1Menu.h"
30
31// xAOD include(s):
40
41#include <shared_mutex>
42
43namespace TrigConf {
44
54 MenuPtrWrapper() : m_ptr(nullptr) {}
56 };
57
65
75 class xAODConfigSvc : public extends<AthService, ITrigConfigSvc, IIncidentListener> {
76
77 public:
79 xAODConfigSvc( const std::string& name, ISvcLocator* svcLoc );
80
82 virtual StatusCode initialize() override;
84 virtual StatusCode finalize() override;
85
88
90 virtual const CTPConfig* ctpConfig() const override;
91
93 virtual const ThresholdConfig* thresholdConfig() const override {
94 return 0;
95 }
96
98 virtual const BunchGroupSet* bunchGroupSet() const override;
99
101 virtual uint32_t lvl1PrescaleKey() const override;
102
104 virtual uint32_t bunchGroupSetKey() const override;
105
107
110
112 virtual const HLTChainList& chains() const override;
113
115 virtual const HLTSequenceList& sequences() const override;
116
118 virtual uint32_t masterKey() const override;
119
121 virtual uint32_t hltPrescaleKey() const override;
122
124
127
129 virtual const Muctpi* muctpiConfig() const override {
130 return 0;
131 }
132
134
137
139 virtual const HLTMenu& hltMenu(const EventContext& ctx = Gaudi::Hive::currentContext()) const override;
140
142 virtual const HLTMonitoring& hltMonitoring(const EventContext& ctx = Gaudi::Hive::currentContext()) const override;
143
145 virtual const L1Menu& l1Menu(const EventContext& ctx = Gaudi::Hive::currentContext()) const override;
146
148 virtual const HLTPrescalesSet& hltPrescalesSet(const EventContext& ctx = Gaudi::Hive::currentContext()) const override;
149
151 virtual const L1PrescalesSet& l1PrescalesSet(const EventContext& ctx = Gaudi::Hive::currentContext()) const override;
152
154 virtual const L1BunchGroupSet& l1BunchGroupSet(const EventContext& ctx = Gaudi::Hive::currentContext()) const override;
155
157
159 virtual void handle( const Incident& inc ) override;
160
161 std::string configurationSource() const override {
162 return "";
163 }
164
165 private:
167 StatusCode readMetadata();
169 StatusCode prepareEvent();
170
173
175 StatusCode prepareEventRun3Athena(const EventContext& context);
176
178 StatusCode prepareEventxAODTriggerMenuJson(const xAOD::TrigConfKeys* keys, const xAOD::BunchConfKey* bgKey, const EventContext& context);
179
181 StatusCode prepareEventxAODTriggerMenu(const xAOD::TrigConfKeys* keys, const EventContext& context);
182
190 StatusCode loadPtree(const std::string& humanName,
191 const xAOD::TriggerMenuJsonContainer* metaContainer,
192 const uint32_t keyToCheck,
193 TriggerMenuJsonPtrWrapper& cacheOfLoadedMenuPtr,
194 DataStructure& dataStructure,
195 const bool optional = false);
196
197 SG::ReadHandleKey<xAOD::TrigConfKeys> m_eventKey{this, "EventObjectName", "TrigConfKeys",
198 "Key for the event-level configuration identifier object"};
199
200 SG::ReadHandleKey<xAOD::BunchConfKey> m_eventBGKey{this, "BGKeysObjectName", "BunchConfKey",
201 "Key for the event-level bunchgroup configuration identifier object. Only written from late 2021, optional input."};
202
205 Gaudi::Property<std::string> m_metaName{this, "MetaObjectName", "TriggerMenu",
206 "Key for the trigger configuration metadata object"};
207
208
211 Gaudi::Property< std::string > m_metaNameJSON_hlt {this, "JSONMetaObjectNameHLT", "TriggerMenuJson_HLT",
212 "StoreGate key for the xAOD::TriggerMenuJson HLT configuration object"};
213
214 Gaudi::Property< std::string > m_metaNameJSON_hltmonitoring {this, "JSONMetaObjectNameHLTMonitoring", "TriggerMenuJson_HLTMonitoring",
215 "StoreGate key for the xAOD::TriggerMenuJson HLT monitoring configuration object"};
216
217 Gaudi::Property< std::string > m_metaNameJSON_l1 {this, "JSONMetaObjectNameL1", "TriggerMenuJson_L1",
218 "StoreGate key for the xAOD::TriggerMenuJson L1 configuration object"};
219
220 Gaudi::Property< std::string > m_metaNameJSON_hltps {this, "JSONMetaObjectNameHLTPS", "TriggerMenuJson_HLTPS",
221 "StoreGate key for the xAOD::TriggerMenuJson HLT prescales configuration object"};
222
223 Gaudi::Property< std::string > m_metaNameJSON_l1ps {this, "JSONMetaObjectNameL1PS", "TriggerMenuJson_L1PS",
224 "StoreGate key for the xAOD::TriggerMenuJson L1 prescales configuration object"};
225
226 Gaudi::Property< std::string > m_metaNameJSON_bg {this, "JSONMetaObjectNameBunchgroup", "TriggerMenuJson_BG",
227 "StoreGate key for the xAOD::TriggerMenuJson BunchGroup configuration object"};
228
229
232
233 SG::ReadHandleKey<HLTMenu> m_hltMenuKey{this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu",
234 "HLT Menu Key, for when UseInFileMetadata=False. From the DetectorStore."};
235
236 SG::ReadHandleKey<L1Menu> m_l1MenuKey{this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu",
237 "L1 Menu Key, for when UseInFileMetadata=False. From the DetectorStore"};
238
240 "HLT prescales set condition handle, for when UseInFileMetadata=False"};
241
243 "L1 prescales set condition handle, for when UseInFileMetadata=False"};
244
245 SG::ReadCondHandleKey<TrigConf::L1BunchGroupSet> m_L1BunchGroupSetKey{this, "L1BunchGroup", "L1BunchGroup", "L1 Bunch groups"};
247
248 Gaudi::Property<bool> m_useInFileMetadata{this, "UseInFileMetadata", true, "Flag for reading all configuration from the input POOL file(s). "
249 "This mode should be used everywhere except for: RAWtoALL from bytestream. "
250 "If set to false, only the R3 configuration is supported."};
251
252 Gaudi::Property<bool> m_stopOnFailure{this, "StopOnFailure", true, "Flag for stopping the job in case of a failure"};
254 bool m_isInFailure{false};
255
259 std::unique_ptr<xAOD::TriggerMenuAuxContainer> m_tmcAux;
260 std::unique_ptr<xAOD::TriggerMenuContainer> m_tmc;
261
262 // The menu currently being used by each slot (wrapped 'const xAOD::TriggerMenu' ptr)
265
269 std::unique_ptr<xAOD::TriggerMenuJsonAuxContainer> m_hltJsonAux;
270 std::unique_ptr<xAOD::TriggerMenuJsonContainer> m_hltJson;
271 std::unique_ptr<xAOD::TriggerMenuJsonAuxContainer> m_hltmonitoringJsonAux;
272 std::unique_ptr<xAOD::TriggerMenuJsonContainer> m_hltmonitoringJson;
273 std::unique_ptr<xAOD::TriggerMenuJsonAuxContainer> m_l1JsonAux;
274 std::unique_ptr<xAOD::TriggerMenuJsonContainer> m_l1Json;
275 std::unique_ptr<xAOD::TriggerMenuJsonAuxContainer> m_hltpsJsonAux;
276 std::unique_ptr<xAOD::TriggerMenuJsonContainer> m_hltpsJson;
277 std::unique_ptr<xAOD::TriggerMenuJsonAuxContainer> m_l1psJsonAux;
278 std::unique_ptr<xAOD::TriggerMenuJsonContainer> m_l1psJson;
279 std::unique_ptr<xAOD::TriggerMenuJsonAuxContainer> m_bgJsonAux;
280 std::unique_ptr<xAOD::TriggerMenuJsonContainer> m_bgJson;
281
282 // The menu JSONs being used in the current event by each slot (wrapped 'const xAOD::TriggerMenuJson' ptr)
289
290 // The decoded menu JSON data stored in ptree objects
298
300 std::shared_mutex m_sharedMutex;
301
302
315
317 ServiceHandle< StoreGateSvc > m_metaStore{this, "MetaDataStore", "StoreGateSvc/InputMetaDataStore"};
318
323
324 }; // class xAODConfigSvc
325
326} // namespace TrigConf
327
328
329
330#endif // TRIGCONFXAOD_XAODCONFIGSVC_H
Maintain a set of objects, one per slot.
Property holding a SG store/key/clid from which a ReadHandle is made.
Maintain a set of objects, one per slot.
Base class for Trigger configuration data and wrapper around underlying representation.
list of all HLT chains in a trigger menu
HLT menu configuration.
Definition HLTMenu.h:21
HLT monitoring configuration.
HLT menu configuration.
list of HLT sequences
L1 board configuration.
L1 menu configuration.
Definition L1Menu.h:28
L1 menu configuration.
SG::ReadCondHandleKey< TrigConf::HLTPrescalesSet > m_HLTPrescaleSetKey
xAODConfigSvc(const std::string &name, ISvcLocator *svcLoc)
Standard service constructor.
SG::SlotSpecificObj< TriggerMenuJsonPtrWrapper > m_currentHltpsJson
virtual uint32_t lvl1PrescaleKey() const override
Get the LVL1 prescale key.
Gaudi::Property< std::string > m_metaNameJSON_l1ps
bool m_menuJSONContainerAvailable
Is decoded R3 format data available?
virtual const L1PrescalesSet & l1PrescalesSet(const EventContext &ctx=Gaudi::Hive::currentContext()) const override
Returns the JSON configured L1 prescales ptree.
Gaudi::Property< std::string > m_metaNameJSON_hlt
SG::SlotSpecificObj< TriggerMenuJsonPtrWrapper > m_currentBgJson
bool m_triggerMenuContainerAvailable
Is decoded R2 format data available?
Gaudi::Property< std::string > m_metaName
virtual StatusCode finalize() override
Function finalising the service.
SG::SlotSpecificObj< HLTMenu > m_currentHlt
std::string configurationSource() const override
std::unique_ptr< xAOD::TriggerMenuJsonContainer > m_hltpsJson
virtual const HLTSequenceList & sequences() const override
Get the HLT sequences.
StatusCode prepareEventRun3Athena(const EventContext &context)
Do per-event updating of R3 JSON-based metadata, reading the data direct from the Conditions and Dete...
virtual void handle(const Incident &inc) override
Function handling the incoming incidents.
SG::SlotSpecificObj< HLTChainList > m_chainList
The "translated" HLT configuration object.
std::unique_ptr< xAOD::TriggerMenuJsonContainer > m_hltmonitoringJson
Gaudi::Property< std::string > m_metaNameJSON_l1
virtual const Muctpi * muctpiConfig() const override
Get the MuCTPI's online configuration.
SG::SlotSpecificObj< TriggerMenuJsonPtrWrapper > m_currentHltmonitoringJson
SG::SlotSpecificObj< L1PrescalesSet > m_currentL1ps
SG::SlotSpecificObj< TriggerMenuJsonPtrWrapper > m_currentHltJson
std::unique_ptr< xAOD::TriggerMenuJsonContainer > m_l1psJson
SG::ReadHandleKey< xAOD::BunchConfKey > m_eventBGKey
SG::SlotSpecificObj< CTPConfig > m_ctpConfig
std::unique_ptr< xAOD::TriggerMenuContainer > m_tmc
SG::ReadHandleKey< HLTMenu > m_hltMenuKey
SG::SlotSpecificObj< BunchGroupSet > m_bgSet
The "translated" bunch group set object.
StatusCode prepareEvent()
Function setting up the service for a new event.
SG::ReadHandleKey< L1Menu > m_l1MenuKey
Gaudi::Property< bool > m_stopOnFailure
std::unique_ptr< xAOD::TriggerMenuJsonAuxContainer > m_hltJsonAux
virtual uint32_t bunchGroupSetKey() const override
Get the LVL1 bunch group set key.
virtual const HLTMonitoring & hltMonitoring(const EventContext &ctx=Gaudi::Hive::currentContext()) const override
Returns the JSON configured HLTMonitoring ptree.
std::unique_ptr< xAOD::TriggerMenuJsonAuxContainer > m_l1psJsonAux
SG::SlotSpecificObj< HLTSequenceList > m_sequenceList
The "translated" HLT configuration object.
std::unique_ptr< xAOD::TriggerMenuJsonContainer > m_l1Json
Gaudi::Property< bool > m_useInFileMetadata
StatusCode prepareEventxAODTriggerMenuJson(const xAOD::TrigConfKeys *keys, const xAOD::BunchConfKey *bgKey, const EventContext &context)
Do per-event decoding for R3 in-file serialised xAOD::TriggerMenuJson metadata.
std::unique_ptr< xAOD::TriggerMenuJsonAuxContainer > m_bgJsonAux
virtual const CTPConfig * ctpConfig() const override
Get the LVL1 trigger menu.
SG::ReadCondHandleKey< TrigConf::L1BunchGroupSet > m_L1BunchGroupSetKey
virtual const L1Menu & l1Menu(const EventContext &ctx=Gaudi::Hive::currentContext()) const override
Returns the JSON configured L1 ptree.
std::unique_ptr< xAOD::TriggerMenuJsonContainer > m_hltJson
SG::SlotSpecificObj< MenuPtrWrapper > m_menu
SG::SlotSpecificObj< TriggerMenuJsonPtrWrapper > m_currentL1Json
SG::SlotSpecificObj< L1BunchGroupSet > m_currentBg
SG::ReadHandleKey< xAOD::TrigConfKeys > m_eventKey
virtual const BunchGroupSet * bunchGroupSet() const override
Get the LVL1 bunch group set.
Gaudi::Property< std::string > m_metaNameJSON_hltmonitoring
virtual const HLTChainList & chains() const override
Get the HLT chains.
virtual const ThresholdConfig * thresholdConfig() const override
Get the LVL1 threshold configuruation (not available from xAOD)
std::unique_ptr< xAOD::TriggerMenuJsonAuxContainer > m_hltmonitoringJsonAux
SG::SlotSpecificObj< HLTMonitoring > m_currentHltmonitoring
std::shared_mutex m_sharedMutex
The mutex used to to restrict access to m_tmc when it is being written to.
std::unique_ptr< xAOD::TriggerMenuAuxContainer > m_tmcAux
std::unique_ptr< xAOD::TriggerMenuJsonAuxContainer > m_hltpsJsonAux
SG::SlotSpecificObj< TriggerMenuJsonPtrWrapper > m_currentL1psJson
StatusCode prepareEventxAODTriggerMenu(const xAOD::TrigConfKeys *keys, const EventContext &context)
Do per-event decoding for R2 in-file serialised xAOD::TriggerMenu metadata.
StatusCode readMetadata()
Function reading in a new metadata object from the input.
std::unique_ptr< xAOD::TriggerMenuJsonContainer > m_bgJson
std::unique_ptr< xAOD::TriggerMenuJsonAuxContainer > m_l1JsonAux
virtual uint32_t hltPrescaleKey() const override
Get the HLT prescale key.
virtual StatusCode initialize() override
Function initialising the service.
Gaudi::Property< std::string > m_metaNameJSON_hltps
SG::SlotSpecificObj< HLTPrescalesSet > m_currentHltps
SG::SlotSpecificObj< L1Menu > m_currentL1
StatusCode loadPtree(const std::string &humanName, const xAOD::TriggerMenuJsonContainer *metaContainer, const uint32_t keyToCheck, TriggerMenuJsonPtrWrapper &cacheOfLoadedMenuPtr, DataStructure &dataStructure, const bool optional=false)
Helper function to find a JSON in a given TriggerMenuJsonContainer using a given key,...
virtual const HLTMenu & hltMenu(const EventContext &ctx=Gaudi::Hive::currentContext()) const override
Returns the JSON configured HLTMenu ptree.
Gaudi::Property< std::string > m_metaNameJSON_bg
virtual const HLTPrescalesSet & hltPrescalesSet(const EventContext &ctx=Gaudi::Hive::currentContext()) const override
Returns the JSON configured HLT prescales ptree.
virtual const L1BunchGroupSet & l1BunchGroupSet(const EventContext &ctx=Gaudi::Hive::currentContext()) const override
Returns the JSON configured bunchgroup ptree.
bool m_isInFailure
Internal state of the service.
ServiceHandle< StoreGateSvc > m_metaStore
Connection to the metadata store.
SG::ReadCondHandleKey< TrigConf::L1PrescalesSet > m_L1PrescaleSetKey
virtual uint32_t masterKey() const override
Get the Super Master Key.
void copyMetadataToPersonalStore(const xAOD::TriggerMenuJsonContainer *input, xAOD::TriggerMenuJsonContainer *existing)
Helper function for copying into the service's private data store.
Forward iterator to traverse the main components of the trigger configuration.
Definition Config.h:22
TriggerMenuJson_v1 TriggerMenuJson
Define the latest version of the trigger menu JSON class.
TriggerMenu_v1 TriggerMenu
Define the latest version of the trigger menu class.
Definition TriggerMenu.h:16
BunchConfKey_v1 BunchConfKey
Declare the current version of the bunch configuration key type.
TriggerMenuJsonContainer_v1 TriggerMenuJsonContainer
TrigConfKeys_v1 TrigConfKeys
Declare the current version of the trigger configuration keys type.
const xAOD::TriggerMenu * m_ptr
Small utility class to wrap a pointer to a const xAOD::TriggerMenuJson.
const xAOD::TriggerMenuJson * m_ptr