ATLAS Offline Software
Loading...
Searching...
No Matches
xAODConfigSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Gaudi/Athena include(s):
6#include "GaudiKernel/Incident.h"
7#include "GaudiKernel/IIncidentSvc.h"
8#include "GaudiKernel/GaudiException.h"
10
11// Trigger include(s):
14
15// Local include(s):
16#include "xAODConfigSvc.h"
19
20// Boost includes
21#define BOOST_BIND_GLOBAL_PLACEHOLDERS // Needed to silence Boost pragma message
22#include <boost/property_tree/ptree.hpp>
23#include <boost/property_tree/json_parser.hpp>
24
25namespace TrigConf {
26
27 xAODConfigSvc::xAODConfigSvc( const std::string& name, ISvcLocator* svcLoc )
28 : base_class( name, svcLoc ),
29 m_tmcAux( nullptr ), m_tmc( nullptr ), m_menu(),
31
32 }
33
35
36 // Greet the user:
37 ATH_MSG_INFO( "Initialising" );
38
39 // Note this is a service, there is NO scheduler propagation of these read handle keys to clients of this service.
40 // We still however use the ReadHandle mechanism to consume the collection, along with validation checks.
41 // Attempting to use this service when no eventKey is available will cause the service to fail.
42 // Attempting to use this service when no eventBGKey is available will return empty bunch group data.
43 CHECK( m_eventKey.initialize() );
44 CHECK( m_eventBGKey.initialize() );
45
46 CHECK( m_hltMenuKey.initialize() );
47 CHECK( m_l1MenuKey.initialize() );
48
49 // Set up the callbacks for the service:
50 ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
51 CHECK( incSvc.retrieve() );
52 incSvc->addListener( this, IncidentType::BeginEvent, 0,
54
56 // Retrieve the needed service(s):
57 CHECK( m_metaStore.retrieve() );
58
59 // Set up the callbacks for the service:
60 ServiceHandle< IIncidentSvc > incSvc( "IncidentSvc", name() );
61 incSvc->addListener( this, IncidentType::BeginInputFile, 0,
63
64 // Internal holder for R2 payloads
65 m_tmcAux = std::make_unique<xAOD::TriggerMenuAuxContainer>();
66 m_tmc = std::make_unique<xAOD::TriggerMenuContainer>();
67 m_tmc->setStore( m_tmcAux.get() );
68
69 // Internal holders for R3 payloads
70 m_hltJsonAux = std::make_unique<xAOD::TriggerMenuJsonAuxContainer>();
71 m_hltJson = std::make_unique<xAOD::TriggerMenuJsonContainer>();
72 m_hltJson->setStore( m_hltJsonAux.get() );
73
74 m_hltmonitoringJsonAux = std::make_unique<xAOD::TriggerMenuJsonAuxContainer>();
75 m_hltmonitoringJson = std::make_unique<xAOD::TriggerMenuJsonContainer>();
77
78 m_l1JsonAux = std::make_unique<xAOD::TriggerMenuJsonAuxContainer>();
79 m_l1Json = std::make_unique<xAOD::TriggerMenuJsonContainer>();
80 m_l1Json->setStore( m_l1JsonAux.get() );
81
82 m_hltpsJsonAux = std::make_unique<xAOD::TriggerMenuJsonAuxContainer>();
83 m_hltpsJson = std::make_unique<xAOD::TriggerMenuJsonContainer>();
84 m_hltpsJson->setStore( m_hltpsJsonAux.get() );
85
86 m_l1psJsonAux = std::make_unique<xAOD::TriggerMenuJsonAuxContainer>();
87 m_l1psJson = std::make_unique<xAOD::TriggerMenuJsonContainer>();
88 m_l1psJson->setStore( m_l1psJsonAux.get() );
89
90 m_bgJsonAux = std::make_unique<xAOD::TriggerMenuJsonAuxContainer>();
91 m_bgJson = std::make_unique<xAOD::TriggerMenuJsonContainer>();
92 m_bgJson->setStore( m_bgJsonAux.get() );
93 }
94
98
99 // Reset the internal flag:
100 m_isInFailure = false;
101
102 // Return gracefully:
103 return StatusCode::SUCCESS;
104 }
105
107
108 // Return gracefully:
109 return StatusCode::SUCCESS;
110 }
111
113
114 // Long-term-support interface for (including Run 2 AODs)
115 if( m_isInFailure ) {
116 REPORT_MESSAGE( MSG::FATAL )
117 << "Trigger menu not loaded";
118 throw GaudiException( "Service not initialised correctly",
119 "TrigConf::xAODConfigSvc::ctpConfig",
120 StatusCode::FAILURE );
121 }
122
123 // Return the slot-specific pointer:
124 return m_ctpConfig.get();
125 }
126
128
129 // Long-term-support interface (including Run 2 AODs)
130 if( m_isInFailure ) {
131 REPORT_MESSAGE( MSG::FATAL )
132 << "Trigger menu not loaded";
133 throw GaudiException( "Service not initialised correctly",
134 "TrigConf::xAODConfigSvc::bunchGroupSet",
135 StatusCode::FAILURE );
136 }
137
138 // Return the slot-specific pointer:
139 return m_bgSet.get();
140 }
141
142
144
145 // Long-term-support interface (including Run 2 AODs)
146 if( m_isInFailure ) {
147 REPORT_MESSAGE( MSG::FATAL )
148 << "Trigger menu not loaded";
149 throw GaudiException( "Service not initialised correctly",
150 "TrigConf::xAODConfigSvc::chains",
151 StatusCode::FAILURE );
152 }
153
154 // Return the slot-specifc object:
155 return *(m_chainList.get());
156 }
157
159
160 // Long-term-support interface (including Run 2 AODs)
161 if( m_isInFailure ) {
162 REPORT_MESSAGE( MSG::FATAL )
163 << "Trigger menu not loaded";
164 throw GaudiException( "Service not initialised correctly",
165 "TrigConf::xAODConfigSvc::chains",
166 StatusCode::FAILURE );
167 }
168
169 // Return the slot-specific object:
170 return *(m_sequenceList.get());
171 }
172
173 uint32_t xAODConfigSvc::masterKey() const {
174 if (!m_useInFileMetadata) {
175
176 SG::ReadHandle<HLTMenu> hltMenuHandle(m_hltMenuKey); // No context - Detector Store
177 if( !hltMenuHandle.isValid() ) {
178 REPORT_MESSAGE( MSG::WARNING )
179 << "Unable to load " << m_hltMenuKey.key() << " from Detector Store." << endmsg;
180 return std::numeric_limits<uint32_t>::max();
181 } else {
182 return hltMenuHandle->smk();
183 }
184
185 } else if (m_menuJSONContainerAvailable) {
186
187 // Run3: From in-file JSON metadata or JSON from conditions store
188 return m_currentHlt.get()->smk();
189
190 } else {
191
192 // Legacy support for R2 AODs
193 if( ! m_menu.get()->m_ptr ) {
194 REPORT_MESSAGE( MSG::FATAL )
195 << "Trigger menu not yet known. Configuration key not returned.";
196 throw GaudiException( "Service not initialised correctly",
197 "TrigConf::xAODConfigSvc::masterKey",
198 StatusCode::FAILURE );
199 return 0;
200 }
201
202 // Return the key from the slot-specific metadata object:
203 return m_menu.get()->m_ptr->smk();
204
205 }
206 }
207
209 if (!m_useInFileMetadata) {
210
211 const bool firstEvent = !m_currentL1ps.get()->isInitialized();
212 if (firstEvent) {
213 return std::numeric_limits<uint32_t>::max();
214 }
215
217 if( !l1psRCH.isValid() ) {
218 REPORT_MESSAGE( MSG::WARNING )
219 << "Unable to load " << m_L1PrescaleSetKey.key() << " from Conditions Store." << endmsg;
220 return std::numeric_limits<uint32_t>::max();
221 } else {
222 return l1psRCH->psk();
223 }
224
225 } else if (m_menuJSONContainerAvailable) {
226
227 // Run3: From in-file JSON metadata or JSON from conditions store
228 return m_currentL1ps.get()->psk();
229
230 } else {
231
232 // Legacy support for R2 AODs
233 if( ! m_menu.get()->m_ptr ) {
234 REPORT_MESSAGE( MSG::ERROR )
235 << "Trigger menu not yet known. Configuration key not returned.";
236 throw GaudiException( "Service not initialised correctly",
237 "TrigConf::xAODConfigSvc::lvl1PrescaleKey",
238 StatusCode::FAILURE );
239 return 0;
240 }
241
242 // Return the key from the slot-specific metadata object:
243 return m_menu.get()->m_ptr->l1psk();
244 }
245 }
246
248 if (!m_useInFileMetadata) {
249 const bool firstEvent = !m_currentBg.get()->isInitialized();
250 if (firstEvent)
251 return std::numeric_limits<uint32_t>::max();
253 if (!l1BGS.isValid())
254 {
255 REPORT_MESSAGE( MSG::WARNING )
256 << "Unable to load " << m_L1BunchGroupSetKey.key() << " from Conditions Store." << endmsg;
257 return std::numeric_limits<uint32_t>::max();
258 }
259 else
260 return l1BGS->bgsk();
262 return m_currentBg.get()->bgsk();
263 else {
264 REPORT_MESSAGE( MSG::DEBUG )
265 << "There's no way to access the bunch group set key from a legacy AOD!" << endmsg;
266 return std::numeric_limits<uint32_t>::max();
267 }
268 }
269
271 if (!m_useInFileMetadata) {
272
273 const bool firstEvent = !m_currentHltps.get()->isInitialized();
274 if (firstEvent) {
275 return std::numeric_limits<uint32_t>::max();
276 }
277
279 if( !hltpsRCH.isValid() ) {
280 REPORT_MESSAGE( MSG::WARNING )
281 << "Unable to load " << m_HLTPrescaleSetKey.key() << " from Conditions Store." << endmsg;
282 return std::numeric_limits<uint32_t>::max();
283 } else {
284 return hltpsRCH->psk();
285 }
286
287 } else if (m_menuJSONContainerAvailable) {
288
289 // Run3: From in-file JSON metadata or JSON from conditions store
290 return m_currentHltps.get()->psk();
291
292 } else {
293
294 // Legacy support for R2 AODs
295 if( ! m_menu.get()->m_ptr ) {
296 REPORT_MESSAGE( MSG::FATAL )
297 << "Trigger menu not yet known. Configuration key not returned.";
298 throw GaudiException( "Service not initialised correctly",
299 "TrigConf::xAODConfigSvc::hltPrescaleKey",
300 StatusCode::FAILURE );
301 return 0;
302 }
303
304 // Return the key from the slot-specific metadata object:
305 return m_menu.get()->m_ptr->hltpsk();
306
307 }
308 }
309
310 const HLTMenu& xAODConfigSvc::hltMenu(const EventContext& ctx) const {
311 if (!m_useInFileMetadata) {
312 SG::ReadHandle<HLTMenu> hltMenuHandle(m_hltMenuKey, ctx);
313 if( hltMenuHandle.isValid() ) {
314 return *hltMenuHandle;
315 }
316 }
318 REPORT_MESSAGE( MSG::FATAL ) << "Run 3 hltMenu JSON not loaded." << endmsg;
319 throw GaudiException( "Service not initialised correctly",
320 "TrigConf::xAODConfigSvc::hltMenu",
321 StatusCode::FAILURE );
322 }
323 // Run3: From in-file JSON metadata or JSON from detector store
324 return *(m_currentHlt.get(ctx));
325 }
326
327 const HLTMonitoring& xAODConfigSvc::hltMonitoring(const EventContext& ctx) const {
329 REPORT_MESSAGE( MSG::FATAL ) << "Run 3 hltMonitoring JSON not loaded." << endmsg;
330 throw GaudiException( "Service not initialised correctly",
331 "TrigConf::xAODConfigSvc::hltMenu",
332 StatusCode::FAILURE );
333 }
334 // Run3: From in-file JSON metadata
335 return *(m_currentHltmonitoring.get(ctx));
336 }
337
338 const L1Menu& xAODConfigSvc::l1Menu(const EventContext& ctx) const {
339 if (!m_useInFileMetadata) {
340 SG::ReadHandle<L1Menu> l1MenuHandle(m_l1MenuKey, ctx);
341 if( l1MenuHandle.isValid() ) {
342 return *l1MenuHandle;
343 }
344 }
346 REPORT_MESSAGE( MSG::FATAL ) << "Run 3 l1Menu JSON not loaded." << endmsg;
347 throw GaudiException( "Service not initialised correctly",
348 "TrigConf::xAODConfigSvc::l1Menu",
349 StatusCode::FAILURE );
350 }
351 // Run3: From in-file JSON metadata or JSON from detector store
352 return *(m_currentL1.get(ctx));
353 }
354
355 const HLTPrescalesSet& xAODConfigSvc::hltPrescalesSet(const EventContext& ctx) const {
356 if (!m_useInFileMetadata) {
358 if( hltpsRCH.isValid() ) {
359 return **hltpsRCH;
360 }
361 }
363 REPORT_MESSAGE( MSG::FATAL ) << "Run 3 hltPrescalesSet JSON not loaded." << endmsg;
364 throw GaudiException( "Service not initialised correctly",
365 "TrigConf::xAODConfigSvc::hltPrescalesSet",
366 StatusCode::FAILURE );
367 }
368 // Run3: From in-file JSON metadata or JSON from conditions store
369 return *(m_currentHltps.get(ctx));
370 }
371
372 const L1PrescalesSet& xAODConfigSvc::l1PrescalesSet(const EventContext& ctx) const {
373 if (!m_useInFileMetadata) {
375 if( l1psRCH.isValid() ) {
376 return **l1psRCH;
377 }
378 }
380 REPORT_MESSAGE( MSG::FATAL ) << "Run 3 l1PrescalesSet JSON not loaded." << endmsg;
381 throw GaudiException( "Service not initialised correctly",
382 "TrigConf::xAODConfigSvc::l1PrescalesSet",
383 StatusCode::FAILURE );
384 }
385 // Run3: From in-file JSON metadata or JSON from conditions store
386 return *(m_currentL1ps.get(ctx));
387 }
388
389 const L1BunchGroupSet& xAODConfigSvc::l1BunchGroupSet(const EventContext& ctx) const {
390 if (!m_useInFileMetadata) {
392 if( l1BGS.isValid() )
393 return **l1BGS;
394 }
396 REPORT_MESSAGE( MSG::FATAL ) << "Run 3 l1BunchGroupSet JSON not loaded." << endmsg;
397 throw GaudiException( "Service not initialised correctly",
398 "TrigConf::xAODConfigSvc::l1BunchGroupSet",
399 StatusCode::FAILURE );
400 }
401 // Run3: From in-file JSON metadata or JSON from conditions store
402 return *(m_currentBg.get(ctx));
403 }
404
405 void xAODConfigSvc::handle( const Incident& inc ) {
406
407 // Tell the user what we're doing:
408 REPORT_MESSAGE( MSG::DEBUG ) << "Callback received with incident: "
409 << inc.type() << endmsg;
410
411 // If it's a file-beginning incident, let's read in the
412 // metadata object:
413 if( inc.type() == IncidentType::BeginInputFile ) {
414 if( readMetadata().isFailure() && m_stopOnFailure ) {
415 REPORT_MESSAGE( MSG::FATAL )
416 << "Couldn't read in the input file's metadata";
417 throw GaudiException( "Couldn't read in the input file's "
418 "metadata",
419 "TrigConf::xAODConfigSvc::handle",
420 StatusCode::FAILURE );
421 return;
422 }
423 }
424 // If it's an event-beginning incident, let's make sure that the
425 // correct menu is cached:
426 else if( inc.type() == IncidentType::BeginEvent ) {
427 if( prepareEvent(inc.context()).isFailure() && m_stopOnFailure ) {
428 REPORT_MESSAGE( MSG::FATAL )
429 << "Couldn't prepare the trigger configuration for the "
430 << "current event";
431 throw GaudiException( "Couldn't prepare the trigger configuration "
432 "for the current event",
433 "TrigConf::xAODConfigSvc::handle",
434 StatusCode::FAILURE );
435 return;
436 }
437 }
438 // We got some strange incident...
439 else {
440 REPORT_MESSAGE( MSG::WARNING ) << "Unknown incident type received: "
441 << inc.type() << endmsg;
442 return;
443 }
444
445 // Return gracefully:
446 return;
447 }
448
450
451 // Only one thread at a time is allowed to process a new file being opened
452 // and this should only happen when it is not being iterated over
453 // as part of the BeginEvent incident.
454 std::unique_lock lockUnique(m_sharedMutex);
455
458
459 // Read the R2 metadata object...
460 const xAOD::TriggerMenuContainer* input_tmc = nullptr;
462 or m_metaStore->retrieve( input_tmc, m_metaName ).isFailure() )
463 {
465 }
466
467 // Read the R3 metadata object...
468 const xAOD::TriggerMenuJsonContainer* input_hlt = nullptr;
469 const xAOD::TriggerMenuJsonContainer* input_hltmonitoring = nullptr;
470 const xAOD::TriggerMenuJsonContainer* input_l1 = nullptr;
471 const xAOD::TriggerMenuJsonContainer* input_hltps = nullptr;
472 const xAOD::TriggerMenuJsonContainer* input_l1ps = nullptr;
473 const xAOD::TriggerMenuJsonContainer* input_bg = nullptr;
475 or m_metaStore->retrieve( input_hlt, m_metaNameJSON_hlt ).isFailure() )
476 {
478 }
480 or m_metaStore->retrieve( input_hltmonitoring, m_metaNameJSON_hltmonitoring ).isFailure() )
481 {
482 // m_menuJSONContainerAvailable = false;
483 // Currently planning on only storing these data in MC. Hence this has to be an optional input.
484 }
486 or m_metaStore->retrieve( input_l1, m_metaNameJSON_l1 ).isFailure() )
487 {
489 }
491 or m_metaStore->retrieve( input_hltps, m_metaNameJSON_hltps ).isFailure() )
492 {
494 }
496 or m_metaStore->retrieve( input_l1ps, m_metaNameJSON_l1ps ).isFailure() )
497 {
499 }
501 or m_metaStore->retrieve( input_bg, m_metaNameJSON_bg ).isFailure() )
502 {
503 // m_menuJSONContainerAvailable = false;
504 // This was not written up to the end of 2021, we have to make it optional for at least a while
505 }
506
508 // Update the internal flag:
509 m_isInFailure = true;
510 // Decide what to do:
511 if( m_stopOnFailure ) {
512 REPORT_MESSAGE( MSG::FATAL ) << "Couldn't retrieve xAOD::TriggerMenuContainer or xAOD::TriggerMenuJsonContainer(s)" << endmsg;
513 return StatusCode::FAILURE;
514 } else {
515 REPORT_MESSAGE( MSG::WARNING ) << "Couldn't retrieve xAOD::TriggerMenuContainer or xAOD::TriggerMenuJsonContainer(s)" << endmsg;
516 return StatusCode::SUCCESS;
517 }
518 }
519
520 // From file #2 and onward, check for mixed-messages from the input files.
521 // Note from the check just above, we know that we have at least one type of data available on this input file
522 //
523 // We do this as we currently have just two "available" flags, for the two data formats. Not two per slot
525 m_isInFailure = true;
528 if( m_stopOnFailure ) {
529 REPORT_MESSAGE( MSG::FATAL )
530 << "In this input file we found xAOD::TriggerMenuJsonContainer(s), but no xAOD::TriggerMenuContainer. "
531 << "This is inconsistent with previous input files." << endmsg;
532 return StatusCode::FAILURE;
533 } else {
534 REPORT_MESSAGE( MSG::WARNING )
535 << "In this input file we found xAOD::TriggerMenuJsonContainer(s), but no xAOD::TriggerMenuContainer. "
536 << "This is inconsistent with previous input files." << endmsg;
537 return StatusCode::SUCCESS;
538 }
539 }
541 m_isInFailure = true;
544 if( m_stopOnFailure ) {
545 REPORT_MESSAGE( MSG::FATAL )
546 << "In this input file we found xAOD::TriggerMenuContainer, but no xAOD::TriggerMenuJsonContainer. "
547 << "This is inconsistent with previous input files." << endmsg;
548 return StatusCode::FAILURE;
549 } else {
550 REPORT_MESSAGE( MSG::WARNING )
551 << "In this input file we found xAOD::TriggerMenuContainer, but no xAOD::TriggerMenuJsonContainer. "
552 << "This is inconsistent with previous input files." << endmsg;
553 return StatusCode::SUCCESS;
554 }
555 }
556
557 // Let the user know what happened:
558 REPORT_MESSAGE( MSG::DEBUG ) << "Loaded trigger configuration metadata container(s)" << endmsg;
559
560 // If available, give preference to the R3 format
562
563 copyMetadataToPersonalStore(input_hlt, m_hltJson.get());
564 if (input_hltmonitoring) {
565 copyMetadataToPersonalStore(input_hltmonitoring, m_hltmonitoringJson.get());
566 }
567 copyMetadataToPersonalStore(input_l1, m_l1Json.get());
568 copyMetadataToPersonalStore(input_hltps, m_hltpsJson.get());
569 copyMetadataToPersonalStore(input_l1ps, m_l1psJson.get());
570 if (input_bg) {
571 copyMetadataToPersonalStore(input_bg, m_bgJson.get());
572 }
573
574 return StatusCode::SUCCESS;
575
576 } else if (m_triggerMenuContainerAvailable) { // Otherwise load the Run 2 format
577
578 // A little sanity check:
579 if( ! input_tmc->size() ) {
580 REPORT_MESSAGE( MSG::WARNING ) << "No trigger configurations are available on the input" << endmsg;
581 return StatusCode::SUCCESS;
582 }
583
584 // Copy in new menus
585 for ( const xAOD::TriggerMenu* inputMenu : *input_tmc ) {
586 bool alreadyHave = false;
587 for( const xAOD::TriggerMenu* existingMenu : *m_tmc ) {
588 if (xAODKeysMatch(inputMenu, existingMenu)) {
589 alreadyHave = true;
590 break;
591 }
592 }
593 if (alreadyHave) {
594 continue;
595 }
596 // Copy this menu into the service's internal cache of all menus
597 xAOD::TriggerMenu* newMenu = new xAOD::TriggerMenu();
598 m_tmc->push_back( newMenu ); // Note: 'newMenu' is now memory managed by m_tmc
599 *newMenu = *inputMenu;
600 REPORT_MESSAGE( MSG::DEBUG ) << "Imported new configuration: SMK = " << newMenu->smk()
601 << ", L1PSK = " << newMenu->l1psk()
602 << ", HLTPSK = " << newMenu->hltpsk() << endmsg;
603 }
604
605 return StatusCode::SUCCESS;
606
607 } // m_menuJSONContainerAvailable or m_triggerMenuContainerAvailable
608
609 //Should never get here (due to check above)
610 ATH_MSG_ERROR( "Both m_menuJSONContainerAvailable and m_triggerMenuContainerAvailable are false" );
611 return StatusCode::FAILURE;
612 }
613
615 for ( const xAOD::TriggerMenuJson* inputTriggerMenuJson : *input ) {
616 bool alreadyHave = false;
617 for( const xAOD::TriggerMenuJson* existingTriggerMenuJson : *existing ) {
618 if (inputTriggerMenuJson->key() == existingTriggerMenuJson->key()) {
619 alreadyHave = true;
620 break;
621 }
622 }
623 if (alreadyHave) {
624 continue;
625 }
626 // Copy this menu JSON into the service's internal cache of all menus
627 xAOD::TriggerMenuJson* newTriggerMenuJson = new xAOD::TriggerMenuJson();
628 existing->push_back( newTriggerMenuJson ); // Note: 'newTriggerMenuJson' is now memory managed by 'existing'
629 *newTriggerMenuJson = *inputTriggerMenuJson; // Perform xAOD copy
630 REPORT_MESSAGE( MSG::DEBUG ) << "Imported new configuration: Name = " << newTriggerMenuJson->name() << " Key = " << newTriggerMenuJson->key() << endmsg;
631 }
632 }
633
634 StatusCode xAODConfigSvc::prepareEvent(const EventContext& context) {
635
636 if (!m_useInFileMetadata) { // Run 3 RAWtoALL decoding mode
637 return prepareEventRun3Athena(context);
638 }
639
640 // Otherwise we're dealing with in-file data
641 // Read the current event's trigger keys:
643 const xAOD::TrigConfKeys* keys = nullptr;
644 if( keysRH.isValid() ) {
645 keys = keysRH.cptr();
646 } else {
647 // Update the internal flag:
648 m_isInFailure = true;
649 // Decide what to do:
650 if( m_stopOnFailure ) {
651 REPORT_MESSAGE( MSG::FATAL )
652 << "Coudln't retrieve xAOD::TrigConfKeys";
653 return StatusCode::FAILURE;
654 } else {
655 REPORT_MESSAGE( MSG::DEBUG ) << "Coudln't retrieve xAOD::TrigConfKeys" << endmsg;
656 return StatusCode::SUCCESS;
657 }
658 }
659
661 const xAOD::BunchConfKey* bgKey = nullptr;
662 if (bgKeyRH.isValid()) {
663 bgKey = bgKeyRH.cptr();
664 } // Note: This is optional, no errors if it cannot be found
665
666 if (m_menuJSONContainerAvailable) { // Run 3 AOD decoding mode
667 return prepareEventxAODTriggerMenuJson(keys, bgKey, context);
668 } else if (m_triggerMenuContainerAvailable) { // Run 2 AOD decoding mode
669 return prepareEventxAODTriggerMenu(keys, context);
670 }
671 ATH_MSG_ERROR( "Both m_menuJSONContainerAvailable and m_triggerMenuContainerAvailable are false" );
672 return StatusCode::FAILURE;
673 }
674
675
676 StatusCode xAODConfigSvc::prepareEventxAODTriggerMenu(const xAOD::TrigConfKeys* keys, const EventContext& context) {
677 const xAOD::TriggerMenu* loadedMenuInSlot = m_menu.get(context)->m_ptr;
678
679 // Check if we have the correct menu already:
680 if( loadedMenuInSlot != nullptr && xAODKeysMatch( keys, loadedMenuInSlot ) ) {
681 REPORT_MESSAGE( MSG::DEBUG )
682 << "Configuration matches the loaded one, nothing to do." << endmsg;
683 return StatusCode::SUCCESS;
684 }
685
686 // If not, let's look for the correct configuration:
687 // Open a shared lock. OK for multiple events to search at the same time,
688 // but prevent the extension of m_tmc from a BeginInputFile incident.
689 std::shared_lock lockShared(m_sharedMutex);
690
693 for( ; menu_itr != menu_end; ++menu_itr ) {
694 // Check if this is the menu we're looking for:
695 if( ! xAODKeysMatch( keys, *menu_itr ) ) continue;
696 // Remember it's pointer:
697 loadedMenuInSlot = *menu_itr;
698 m_menu.get(context)->m_ptr = loadedMenuInSlot;
699 // Cache the menu's configuration.
700 CTPConfig& ctpConfig = *(m_ctpConfig.get(context));
701 HLTChainList& chainList = *(m_chainList.get(context));
702 HLTSequenceList& sequenceList = *(m_sequenceList.get(context));
703 BunchGroupSet& bgSet = *(m_bgSet.get(context));
704 CHECK( prepareTriggerMenu( loadedMenuInSlot, ctpConfig,
705 chainList, sequenceList,
706 bgSet, msg() ) );
707 REPORT_MESSAGE( MSG::DEBUG ) << "ctpConfig.menu().size() = " << ctpConfig.menu().size()
708 << " chainList.size() = " << chainList.size()
709 << " sequenceList.size() = " << sequenceList.size()
710 << " bgSet.bunchGroups().size() = " << bgSet.bunchGroups().size() << endmsg;
711 // We're done:
712 return StatusCode::SUCCESS;
713 }
714
715 // Apparently we didn't find the correct menu!
716 REPORT_MESSAGE( MSG::FATAL )
717 << "Couldn't find configuration for current event (SMK:"
718 << keys->smk() << ", L1PSK:" << keys->l1psk()
719 << ", HLTPSK:" << keys->hltpsk() << ")";
720 return StatusCode::FAILURE;
721 }
722
723
724 StatusCode xAODConfigSvc::prepareEventRun3Athena(const EventContext& context) {
725 HLTMenu& currentHlt = *(m_currentHlt.get(context));
726 L1Menu& currentL1 = *(m_currentL1.get(context));
727 HLTPrescalesSet& currentHltps = *(m_currentHltps.get(context));
728 L1PrescalesSet& currentL1ps = *(m_currentL1ps.get(context));
729 L1BunchGroupSet& currentBg = *(m_currentBg.get(context));
730
731 // There is only the beginEvent incident when reading the data from the Detector and Conditions stores.
732 // So only one thread may be active at one time on these (slot-specific) objects. Hence we do not need to lock like
733 // we do when we also have to deal with the possibility of concurrent beginFile incidents.
734
735 bool validConfig = true;
736
737 // In the beginEvent incident _before_ the first event, we cannot read the prescales (conditions) but we can still
738 // read the menu (detector store).
739 const bool firstEvent = (!currentHlt.isInitialized() and !currentHltps.isInitialized());
740
741 SG::ReadHandle<HLTMenu> hltMenuHandle(m_hltMenuKey, context);
742 if( !hltMenuHandle.isValid() ) {
743 REPORT_MESSAGE( MSG::WARNING )
744 << "Unable to load " << m_hltMenuKey.key() << " from Detector Store." << endmsg;
745 } else {
746 if (!currentHlt.isInitialized() or currentHlt.smk() != hltMenuHandle->smk()) {
747 validConfig = false;
748 currentHlt.clear();
749 currentHlt.setData( hltMenuHandle->data() );
750 currentHlt.setSMK( hltMenuHandle->smk() );
751 }
752 }
753
754 SG::ReadHandle<L1Menu> l1MenuHandle(m_l1MenuKey, context);
755 if( !l1MenuHandle.isValid() ) {
756 REPORT_MESSAGE( MSG::WARNING )
757 << "Unable to load " << m_l1MenuKey.key() << " from Detector Store." << endmsg;
758 } else {
759 if (!currentL1.isInitialized() or currentL1.smk() != l1MenuHandle->smk()) {
760 validConfig = false;
761 currentL1.clear();
762 currentL1.setData( l1MenuHandle->data() );
763 currentL1.setSMK( l1MenuHandle->smk() );
764 }
765 }
766
767 if (firstEvent) {
768
769 REPORT_MESSAGE( MSG::DEBUG )
770 << "L1 and HLT prescales will not be available via the TrigConf::xAODConfigSvc in the first "
771 << "event when running with UseInFileMetadata=False" << endmsg;
772
773 } else {
774
776 if( !l1psRCH.isValid() ) {
777 REPORT_MESSAGE( MSG::WARNING )
778 << "Unable to load " << m_L1PrescaleSetKey.key() << " from Conditions Store." << endmsg;
779 } else {
780 if (!currentL1ps.isInitialized() or currentL1ps.psk() != l1psRCH->psk()) {
781 validConfig = false;
782 currentL1ps.clear();
783 currentL1ps.setData( l1psRCH->data() );
784 currentL1ps.setPSK( l1psRCH->psk() );
785 }
786 }
787
789 if( !hltpsRCH.isValid() ) {
790 REPORT_MESSAGE( MSG::WARNING )
791 << "Unable to load " << m_HLTPrescaleSetKey.key() << " from Conditions Store." << endmsg;
792 } else {
793 if (!currentHltps.isInitialized() or currentHltps.psk() != hltpsRCH->psk()) {
794 validConfig = false;
795 currentHltps.clear();
796 currentHltps.setData( hltpsRCH->data() );
797 currentHltps.setPSK( hltpsRCH->psk() );
798 }
799 }
800
801 // Bunchgroup data are not accessible via this service in this mode as the conditions alg uses a different
802 // format to the JSON interface used by the trigger.
803
804 }
805
806 if (validConfig) {
807 REPORT_MESSAGE( MSG::DEBUG )
808 << "Configuration matches the loaded one, nothing to do." << endmsg;
809 return StatusCode::SUCCESS;
810 }
811
812 CTPConfig& ctpConfig = *(m_ctpConfig.get(context));
813 HLTChainList& chainList = *(m_chainList.get(context));
814 HLTSequenceList& sequenceList = *(m_sequenceList.get(context));
815 BunchGroupSet& bgSet = *(m_bgSet.get(context));
816
817 // Copy data into legacy long-term-support interfaces
818 CHECK( prepareTriggerMenu( currentHlt,
819 currentL1,
820 currentHltps,
821 currentL1ps,
822 currentBg,
823 ctpConfig,
824 chainList,
825 sequenceList,
826 bgSet,
827 msg() ) );
828
829 REPORT_MESSAGE( MSG::INFO ) << "Loaded Trigger configuration from Conditions Store and Detector Store:"
830 << " SMK = " << (currentHlt.isInitialized() ? std::to_string(currentHlt.smk()) : std::string("UNKNOWN"))
831 << ", L1PSK = " << (currentL1ps.isInitialized() ? std::to_string(currentL1ps.psk()) : std::string("UNKNOWN"))
832 << ", HLTPSK = " << (currentHltps.isInitialized() ? std::to_string(currentHltps.psk()) : std::string("UNKNOWN"))
833 << ", BGSK = " << (currentBg.isInitialized() ? std::to_string(currentBg.bgsk()) : std::string("UNKNOWN")) << endmsg;
834
835 REPORT_MESSAGE( MSG::DEBUG ) << "ctpConfig.menu().size() = " << ctpConfig.menu().size()
836 << " chainList.size() = " << chainList.size()
837 << " sequenceList.size() = " << sequenceList.size()
838 << " bgSet.bunchGroups().size() = " << bgSet.bunchGroups().size() << endmsg;
839
840 return StatusCode::SUCCESS;
841 }
842
843
844
845 StatusCode xAODConfigSvc::prepareEventxAODTriggerMenuJson(const xAOD::TrigConfKeys* keys, const xAOD::BunchConfKey* bgKey, const EventContext& context) {
846 const xAOD::TriggerMenuJson* loadedHltJson = m_currentHltJson.get(context)->m_ptr;
847 const xAOD::TriggerMenuJson* loadedL1Json = m_currentL1Json.get(context)->m_ptr;
848 const xAOD::TriggerMenuJson* loadedHltpsJson = m_currentHltpsJson.get(context)->m_ptr;
849 const xAOD::TriggerMenuJson* loadedL1psJson = m_currentL1psJson.get(context)->m_ptr;
850 const xAOD::TriggerMenuJson* loadedBgJson = m_currentBgJson.get(context)->m_ptr;
851
852 bool validConfig = true;
853 if (loadedHltJson == nullptr || loadedHltJson->key() != keys->smk()) {
854 validConfig = false;
855 }
856 // The check on loadedHltJson is good also for loadedHltmonitoringJson
857 if (loadedL1Json == nullptr || loadedL1Json->key() != keys->smk()) {
858 validConfig = false;
859 }
860 if (loadedHltpsJson == nullptr || loadedHltpsJson->key() != keys->hltpsk()) {
861 validConfig = false;
862 }
863 if (loadedL1psJson == nullptr || loadedL1psJson->key() != keys->l1psk()) {
864 validConfig = false;
865 }
866 if (bgKey) {
867 if (loadedBgJson == nullptr || loadedBgJson->key() != static_cast<unsigned int>(bgKey->id())) {
868 validConfig = false;
869 }
870 }
871
872 if (validConfig) {
873 REPORT_MESSAGE( MSG::DEBUG )
874 << "Configuration matches the loaded one, nothing to do." << endmsg;
875 return StatusCode::SUCCESS;
876 }
877
878 // If not, let's look for the correct configuration:
879 // Open a shared lock. OK for multiple events to search at the same time,
880 // but prevent the extension of m_hltJson et. al. from a BeginInputFile incident.
881 std::shared_lock lockShared(m_sharedMutex);
882
883 TriggerMenuJsonPtrWrapper& currentHltJson = *(m_currentHltJson.get(context));
884 TriggerMenuJsonPtrWrapper& currentHltmonitoringJson = *(m_currentHltmonitoringJson.get(context));
885 TriggerMenuJsonPtrWrapper& currentL1Json = *(m_currentL1Json.get(context));
886 TriggerMenuJsonPtrWrapper& currentHltpsJson = *(m_currentHltpsJson.get(context));
887 TriggerMenuJsonPtrWrapper& currentL1psJson = *(m_currentL1psJson.get(context));
888 TriggerMenuJsonPtrWrapper& currentBgJson = *(m_currentBgJson.get(context));
889
890 TrigConf::HLTMenu& currentHlt = *(m_currentHlt.get(context));
891 TrigConf::HLTMonitoring& currentHltmonitoring = *(m_currentHltmonitoring.get(context));
892 TrigConf::L1Menu& currentL1 = *(m_currentL1.get(context));
893 TrigConf::HLTPrescalesSet& currentHltps = *(m_currentHltps.get(context));
894 TrigConf::L1PrescalesSet& currentL1ps = *(m_currentL1ps.get(context));
895 TrigConf::L1BunchGroupSet& currentBg = *(m_currentBg.get(context));
896
897 ATH_CHECK( loadPtree("HLT Menu", m_hltJson.get(), keys->smk(), currentHltJson, currentHlt) );
898 ATH_CHECK( loadPtree("HLT Monitoring", m_hltmonitoringJson.get(), keys->smk(), currentHltmonitoringJson, currentHltmonitoring, /*optional=*/true) );
899 ATH_CHECK( loadPtree("L1 Menu", m_l1Json.get(), keys->smk(), currentL1Json, currentL1) );
900 ATH_CHECK( loadPtree("HLT Prescales", m_hltpsJson.get(), keys->hltpsk(), currentHltpsJson, currentHltps) );
901 ATH_CHECK( loadPtree("L1 Prescales", m_l1psJson.get(), keys->l1psk(), currentL1psJson, currentL1ps) );
902 if (bgKey) {
903 ATH_CHECK( loadPtree("Bunchgroups", m_bgJson.get(), bgKey->id(), currentBgJson, currentBg) );
904 }
905
906 // Loading the payload doesn't additionally let the object know about its own key. We can load this in now too.
907 // The current*Json objects were updated by loadPtree to point to the entry with the correct key.
908 // We don't set this in loadPtree as the poperties are on the derived objects, not the base DataStructure.
909 currentHlt.setSMK( currentHltJson.m_ptr->key() );
910 if (currentHltmonitoringJson.m_ptr) {
911 currentHltmonitoring.setSMK( currentHltmonitoringJson.m_ptr->key() );
912 }
913 currentL1.setSMK( currentL1Json.m_ptr->key() );
914 currentHltps.setPSK( currentHltpsJson.m_ptr->key() );
915 currentL1ps.setPSK( currentL1psJson.m_ptr->key() );
916 if (bgKey) {
917 currentBg.setBGSK( currentBgJson.m_ptr->key() );
918 }
919
920 CTPConfig& ctpConfig = *(m_ctpConfig.get(context));
921 HLTChainList& chainList = *(m_chainList.get(context));
922 HLTSequenceList& sequenceList = *(m_sequenceList.get(context));
923 BunchGroupSet& bgSet = *(m_bgSet.get(context));
924
925 // Copy data into legacy long-term-support interfaces
926 CHECK( prepareTriggerMenu( currentHlt,
927 currentL1,
928 currentHltps,
929 currentL1ps,
930 currentBg,
931 ctpConfig,
932 chainList,
933 sequenceList,
934 bgSet,
935 msg() ) );
936
937 REPORT_MESSAGE( MSG::INFO ) << "Loaded xAOD::TriggerMenuJson configuration:"
938 << " SMK = " << keys->smk()
939 << ", L1PSK = " << keys->l1psk()
940 << ", HLTPSK = " << keys->hltpsk()
941 << ", BGSK = " << (bgKey ? std::to_string(bgKey->id()) : std::string("UNKNOWN")) << endmsg;
942
943 REPORT_MESSAGE( MSG::DEBUG ) << "ctpConfig.menu().size() = " << ctpConfig.menu().size()
944 << " chainList.size() = " << chainList.size()
945 << " sequenceList.size() = " << sequenceList.size()
946 << " bgSet.bunchGroups().size() = " << bgSet.bunchGroups().size() << endmsg;
947
948 return StatusCode::SUCCESS;
949
950 }
951
952 StatusCode xAODConfigSvc::loadPtree(const std::string& humanName,
953 const xAOD::TriggerMenuJsonContainer* metaContainer,
954 const uint32_t keyToCheck,
955 TriggerMenuJsonPtrWrapper& cacheOfLoadedMenuPtr,
956 DataStructure& dataStructure,
957 const bool optional) {
958 xAOD::TriggerMenuJsonContainer::const_iterator menu_itr = metaContainer->begin();
959 xAOD::TriggerMenuJsonContainer::const_iterator menu_end = metaContainer->end();
960 const xAOD::TriggerMenuJson* ptrToLocatedMenu = nullptr;
961 cacheOfLoadedMenuPtr.m_ptr = nullptr;
962 for( ; menu_itr != menu_end; ++menu_itr ) {
963 // Check if this is the menu we're looking for:
964 if( keyToCheck != (*menu_itr)->key() ) continue;
965 // Remember its pointer:
966 ptrToLocatedMenu = *menu_itr;
967 cacheOfLoadedMenuPtr.m_ptr = ptrToLocatedMenu;
968 std::stringstream rawData;
969 rawData << ptrToLocatedMenu->payload();
970 dataStructure.clear();
971 try {
972 boost::property_tree::ptree pt;
973 boost::property_tree::read_json(rawData, pt);
974 dataStructure.setData(std::move(pt));
975 } catch (const boost::property_tree::json_parser_error& e) {
976 REPORT_MESSAGE( MSG::FATAL ) << "Unable to decode a JSON trigger menu metadata payload for " << humanName << " with key " << keyToCheck << endmsg;
977 REPORT_MESSAGE( MSG::FATAL ) << e.what();
978 return StatusCode::FAILURE;
979 }
980 break;
981 }
982
983 if (not optional and ptrToLocatedMenu == nullptr) {
984 REPORT_MESSAGE( MSG::FATAL )
985 << "Couldn't find configuration for current event"
986 << ", Requested key=" << keyToCheck
987 << ", Requested menu=" << humanName
988 << endmsg;
989 return StatusCode::FAILURE;
990 }
991 return StatusCode::SUCCESS;
992 }
993
994} // namespace TrigConf
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE(LVL)
Report a message.
#define CHECK(...)
Evaluate an expression and check for errors.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
const std::vector< BunchGroup > & bunchGroups() const
Base class for Trigger configuration data and wrapper around underlying representation.
void setData(const ptree &data)
Setting the configuration data.
virtual void clear()
Clearing the configuration data.
list of all HLT chains in a trigger menu
HLT menu configuration.
Definition HLTMenu.h:21
void setSMK(unsigned int psk)
Definition HLTMenu.cxx:46
virtual void clear() override
Clearing the configuration data.
Definition HLTMenu.cxx:29
unsigned int smk() const
setter and getter for the supermasterkey
Definition HLTMenu.cxx:41
HLT monitoring configuration.
void setSMK(unsigned int psk)
HLT menu configuration.
void setPSK(unsigned int psk)
unsigned int psk() const
setter and getter for the HLT prescale key
virtual void clear() override
Clearing the configuration data.
list of HLT sequences
L1 board configuration.
void setBGSK(unsigned int bgsk)
unsigned int bgsk() const
setter and getter for the bunch group key
L1 menu configuration.
Definition L1Menu.h:28
unsigned int smk() const
setter and getter for the supermasterkey
Definition L1Menu.cxx:191
virtual void clear() override
Clearing the configuration data.
Definition L1Menu.cxx:150
void setSMK(unsigned int psk)
Definition L1Menu.cxx:196
L1 menu configuration.
virtual void clear() override
Clearing the configuration data.
unsigned int psk() const
setter and getter for the L1 prescale key
void setPSK(unsigned int psk)
SG::ReadCondHandleKey< TrigConf::HLTPrescalesSet > m_HLTPrescaleSetKey
StatusCode prepareEvent(const EventContext &context)
Function setting up the service for a new event.
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?
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
virtual const L1BunchGroupSet & l1BunchGroupSet(const EventContext &ctx) const override
Returns the JSON configured bunchgroup ptree.
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
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.
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.
std::unique_ptr< xAOD::TriggerMenuJsonAuxContainer > m_l1psJsonAux
virtual const L1Menu & l1Menu(const EventContext &ctx) const override
Returns the JSON configured L1 ptree.
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
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 HLTMonitoring & hltMonitoring(const EventContext &ctx) const override
Returns the JSON configured HLTMonitoring ptree.
virtual const HLTChainList & chains() const override
Get the HLT chains.
std::unique_ptr< xAOD::TriggerMenuJsonAuxContainer > m_hltmonitoringJsonAux
virtual const HLTPrescalesSet & hltPrescalesSet(const EventContext &ctx) const override
Returns the JSON configured HLT prescales ptree.
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.
virtual const HLTMenu & hltMenu(const EventContext &ctx) const override
Returns the JSON configured HLTMenu ptree.
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,...
Gaudi::Property< std::string > m_metaNameJSON_bg
virtual const L1PrescalesSet & l1PrescalesSet(const EventContext &ctx) const override
Returns the JSON configured L1 prescales 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.
uint32_t id() const
Get the 32-bit identifier of the bunch configuration.
const std::string & payload() const
Get the JSON payload.
uint32_t key() const
Get the key of this configuration.
const std::string & name() const
Get the name of this configuration.
uint32_t smk() const
Get the Super Master Key of this configuration.
uint32_t hltpsk() const
Get the HLT prescale key of this configuration.
uint32_t l1psk() const
Get the LVL1 prescale key of this configuration.
Forward iterator to traverse the main components of the trigger configuration.
Definition Config.h:22
StatusCode prepareTriggerMenu(const xAOD::TriggerMenu *menu, CTPConfig &ctpConfig, HLTChainList &chainList, HLTSequenceList &sequenceList, BunchGroupSet &bgSet, MsgStream &msg)
In order to avoid duplicating code between how the dual-use and the Athena-only code translates the x...
bool xAODKeysMatch(const xAOD::TrigConfKeys *keys, const xAOD::TriggerMenu *menu)
Since this is used in a couple of places, it seemed to make sense to put this simple code into a cent...
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
TriggerMenuContainer_v1 TriggerMenuContainer
Define the latest version of the trigger menu container class.
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.
Small utility class to wrap a pointer to a const xAOD::TriggerMenuJson.
const xAOD::TriggerMenuJson * m_ptr
MsgStream & msg
Definition testRead.cxx:32