diff --git a/Tools/PyUtils/python/MetaReader.py b/Tools/PyUtils/python/MetaReader.py index 3a032537ad23b7ea88dc3364c39281f7fb872dd9..867a4d530c16aee5f960f787d08acccb3782d6eb 100644 --- a/Tools/PyUtils/python/MetaReader.py +++ b/Tools/PyUtils/python/MetaReader.py @@ -15,6 +15,8 @@ regexByteStreamMetadataContainer = re.compile(r'^ByteStreamMetadataContainer(_p\ regexXAODEventFormat = re.compile(r'^xAOD::EventFormat(_v\d+)?$') regexXAODTriggerMenu = re.compile(r'^DataVector<xAOD::TriggerMenu(_v\d+)?>$') regexXAODTriggerMenuAux = re.compile(r'^xAOD::TriggerMenuAuxContainer(_v\d+)?$') +regexXAODTriggerMenuJson = re.compile(r'^DataVector<xAOD::TriggerMenuJson(_v\d+)?>$') +regexXAODTriggerMenuJsonAux = re.compile(r'^xAOD::TriggerMenuJsonAuxContainer(_v\d+)?$') regex_cppname = re.compile(r'^([\w:]+)(<.*>)?$') # regex_persistent_class = re.compile(r'^([a-zA-Z]+_p\d+::)*[a-zA-Z]+_p\d+$') regex_persistent_class = re.compile(r'^([a-zA-Z]+(_[pv]\d+)?::)*[a-zA-Z]+_[pv]\d+$') @@ -148,8 +150,18 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me '/Simulation/Parameters': 'IOVMetaDataContainer_p1', '/Digitization/Parameters': 'IOVMetaDataContainer_p1', '/EXT/DCS/MAGNETS/SENSORDATA': 'IOVMetaDataContainer_p1', - 'TriggerMenu': 'DataVector<xAOD::TriggerMenu_v1>', + 'TriggerMenu': 'DataVector<xAOD::TriggerMenu_v1>', # R2 trigger metadata format AOD (deprecated) 'TriggerMenuAux.': 'xAOD::TriggerMenuAuxContainer_v1', + 'DataVector<xAOD::TriggerMenu_v1>_TriggerMenu': 'DataVector<xAOD::TriggerMenu_v1>', # R2 trigger metadata format ESD (deprecated) + 'xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.': 'xAOD::TriggerMenuAuxContainer_v1', + 'TriggerMenuJson_HLT': 'DataVector<xAOD::TriggerMenuJson_v1>', # R3 trigger metadata format AOD + 'TriggerMenuJson_HLTAux.': 'xAOD::TriggerMenuJsonAuxContainer_v1', + 'TriggerMenuJson_L1': 'DataVector<xAOD::TriggerMenuJson_v1>', + 'TriggerMenuJson_L1Aux.': 'xAOD::TriggerMenuJsonAuxContainer_v1', + 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_HLT': 'DataVector<xAOD::TriggerMenuJson_v1>', # R3 trigger metadata format ESD + 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_HLTAux.': 'xAOD::TriggerMenuJsonAuxContainer_v1', + 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_L1': 'DataVector<xAOD::TriggerMenuJson_v1>', + 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_L1Aux.': 'xAOD::TriggerMenuJsonAuxContainer_v1', '*': 'EventStreamInfo_p*' } @@ -162,7 +174,6 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me branch = metadata_branches.At(i) name = branch.GetName() - class_name = branch.GetClassName() if regexIOVMetaDataContainer.match(class_name): @@ -203,6 +214,10 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me persistent_instances[name] = ROOT.xAOD.TriggerMenuContainer_v1() elif regexXAODTriggerMenuAux.match(class_name) and _check_project() not in ['AthGeneration']: persistent_instances[name] = ROOT.xAOD.TriggerMenuAuxContainer_v1() + elif regexXAODTriggerMenuJson.match(class_name) and _check_project() not in ['AthGeneration']: + persistent_instances[name] = ROOT.xAOD.TriggerMenuJsonContainer_v1() + elif regexXAODTriggerMenuJsonAux.match(class_name) and _check_project() not in ['AthGeneration']: + persistent_instances[name] = ROOT.xAOD.TriggerMenuJsonAuxContainer_v1() if name in persistent_instances: branch.SetAddress(ROOT.AddressOf(persistent_instances[name])) @@ -220,17 +235,37 @@ def read_metadata(filenames, file_type = None, mode = 'lite', promote = None, me if hasattr(content, 'm_folderName'): key = getattr(content, 'm_folderName') + # Some transition AODs contain both the Run2 and Run3 metadata formats. We only wish to read the Run3 format if such a file is encountered. + has_r3_trig_meta = ('TriggerMenuJson_HLT' in persistent_instances or 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_HLT' in persistent_instances) + aux = None - if key == 'TriggerMenu' and 'TriggerMenuAux.' in persistent_instances: + if key == 'TriggerMenuJson_HLT' and 'TriggerMenuJson_HLTAux.' in persistent_instances: # AOD case (HLT menu) + aux = persistent_instances['TriggerMenuJson_HLTAux.'] + elif key == 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_HLT' and 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_HLTAux.' in persistent_instances: # ESD case (HLT menu) + aux = persistent_instances['xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_HLTAux.'] + elif key == 'TriggerMenuJson_L1' and 'TriggerMenuJson_L1Aux.' in persistent_instances: # AOD case (L1 menu) + aux = persistent_instances['TriggerMenuJson_L1Aux.'] + elif key == 'DataVector<xAOD::TriggerMenuJson_v1>_TriggerMenuJson_L1' and 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_L1Aux.' in persistent_instances: # ESD case (L1 menu) + aux = persistent_instances['xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_L1Aux.'] + elif key == 'TriggerMenu' and 'TriggerMenuAux.' in persistent_instances and not has_r3_trig_meta: # AOD case (legacy support, HLT and L1 menus) aux = persistent_instances['TriggerMenuAux.'] - elif key == 'DataVector<xAOD::TriggerMenu_v1>_TriggerMenu' and 'xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.' in persistent_instances: + elif key == 'DataVector<xAOD::TriggerMenu_v1>_TriggerMenu' and 'xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.' in persistent_instances and not has_r3_trig_meta: # ESD case (legacy support, HLT and L1 menus) aux = persistent_instances['xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.'] - elif key == 'TriggerMenuAux.': - continue - elif key == 'xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.': - continue - - meta_dict[filename][key] = _convert_value(content, aux) + elif key == 'TriggerMenuAux.' or key == 'xAOD::TriggerMenuAuxContainer_v1_TriggerMenuAux.': + continue # Extracted using the interface object + elif key == 'TriggerMenuJson_HLTAux.' or key == 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_HLTAux.': + continue # Extracted using the interface object + elif key == 'TriggerMenuJson_L1Aux.' or key == 'xAOD::TriggerMenuJsonAuxContainer_v1_TriggerMenuJson_L1Aux.': + continue # Extracted using the interface object + + return_obj = _convert_value(content, aux) + + if 'TriggerMenuJson_HLT' in key or 'TriggerMenuJson_L1' in key or ('TriggerMenu' in key and not has_r3_trig_meta): + if 'TriggerMenu' not in meta_dict[filename]: + meta_dict[filename]['TriggerMenu'] = {} + meta_dict[filename]['TriggerMenu'].update(return_obj) + else: + meta_dict[filename][key] = return_obj # This is a required workaround which will temporarily be fixing ATEAM-560 originated from ATEAM-531 @@ -489,6 +524,9 @@ def _convert_value(value, aux = None): elif cl.__cpp_name__ == 'DataVector<xAOD::TriggerMenu_v1>' : return _extract_fields_triggermenu(interface=value, aux=aux) + elif cl.__cpp_name__ == 'DataVector<xAOD::TriggerMenuJson_v1>' : + return _extract_fields_triggermenujson(interface=value, aux=aux) + elif (cl.__cpp_name__ == 'EventStreamInfo_p1' or cl.__cpp_name__ == 'EventStreamInfo_p2' or cl.__cpp_name__ == 'EventStreamInfo_p3'): @@ -615,8 +653,12 @@ def _extract_fields_ef(value): return result - +""" Note: Deprecated. Legacy support for Run 2 AODs produced in release 21 or in release 22 prior to April 2021 +""" def _extract_fields_triggermenu(interface, aux): + if aux is None: + return {} + L1Items = [] HLTChains = [] @@ -637,6 +679,30 @@ def _extract_fields_triggermenu(interface, aux): return result +def _extract_fields_triggermenujson(interface, aux): + result = {} + + try: + interface.setStore( aux ) + if interface.size() > 0: + # We make the assumption that the first stored SMK is + # representative of all events in the input collection. + firstMenu = interface.at(0) + import json + decoded = json.loads(firstMenu.payload()) + if decoded['filetype'] == 'hltmenu': + result['HLTChains'] = [ _convert_value(chain) for chain in decoded['chains'] ] + elif decoded['filetype'] == 'l1menu': + result['L1Items'] = [ _convert_value(item) for item in decoded['items'] ] + else: + msg.warn('Got an xAOD::TriggerMenuJson called {0} but only expecting hltmenu or l1menu'.format(decoded['filetype'])) + return {} + + except Exception as err: # noqa: F841 + msg.warn('Problem reading xAOD::TriggerMenuJson') + + return result + def _convert_event_type_user_type(value): if 'user_type' in value: items = value['user_type'].split('#')[3:] diff --git a/Trigger/TrigConfiguration/TrigConfxAOD/src/xAODMenuWriterMT.cxx b/Trigger/TrigConfiguration/TrigConfxAOD/src/xAODMenuWriterMT.cxx index cdf3d4753d51005ca2eb59b2cd6a4f5aaa2b8f6a..f6649cd08ce80288ced362cd9b86538b9b90c2d0 100644 --- a/Trigger/TrigConfiguration/TrigConfxAOD/src/xAODMenuWriterMT.cxx +++ b/Trigger/TrigConfiguration/TrigConfxAOD/src/xAODMenuWriterMT.cxx @@ -38,8 +38,7 @@ namespace TrigConf xAODMenuWriterMT::xAODMenuWriterMT(const std::string &name, ISvcLocator *svcLoc) : AthReentrantAlgorithm(name, svcLoc), - m_metaStore("MetaDataStore", name), - m_tmc(nullptr) + m_metaStore("MetaDataStore", name) { } @@ -52,103 +51,61 @@ namespace TrigConf // Greet the user: ATH_MSG_INFO("Initialising - Package version: " << PACKAGE_VERSION); - ATH_MSG_DEBUG(" EventObjectName = " << m_eventName); - ATH_MSG_INFO("LVL1ConfigSvc = " << m_l1TrigConf); - ATH_MSG_INFO("HLTConfigSvc = " << m_hltTrigConf); ATH_MSG_VERBOSE("MetaDataStore = " << m_metaStore); // Retrieve the necessary service(s): - ATH_CHECK(m_l1TrigConf.retrieve()); - ATH_CHECK(m_hltTrigConf.retrieve()); ATH_CHECK(m_metaStore.retrieve()); - const bool writeKeysWithTool = (m_isHLTJSONConfig && m_isL1JSONConfig); - if (writeKeysWithTool) - { - ATH_CHECK(m_keyWriterTool.retrieve()); - } - ATH_CHECK(m_eventName.initialize(!writeKeysWithTool)); // WriteHandleKey + ATH_CHECK(m_keyWriterTool.retrieve()); - CHECK(m_HLTMenuKey.initialize(m_isHLTJSONConfig)); // ReadHandleKey - CHECK(m_HLTPrescaleSetInputKey.initialize(m_isHLTJSONConfig)); // ReadCondHandleKey + ATH_CHECK(m_HLTMenuKey.initialize()); // ReadHandleKey, but DetStore (so renounce) + renounce(m_HLTMenuKey); + ATH_CHECK(m_HLTPrescaleSetInputKey.initialize()); // ReadCondHandleKey - CHECK(m_L1MenuKey.initialize(m_isL1JSONConfig)); // ReadHandleKey - CHECK(m_L1PrescaleSetInputKey.initialize(m_isL1JSONConfig)); // ReadCondHandleKey + ATH_CHECK(m_L1MenuKey.initialize()); // ReadHandleKey, but DetStore (so renounce) + renounce(m_L1MenuKey); + ATH_CHECK(m_L1PrescaleSetInputKey.initialize()); // ReadCondHandleKey - // Clear the internal cache variable: - m_convertedKeys.clear(); + // HLT JSON object - contains HLT menus + xAOD::TriggerMenuJsonAuxContainer *aux_hlt = new xAOD::TriggerMenuJsonAuxContainer(); + m_menuJSON_hlt = new xAOD::TriggerMenuJsonContainer(); + m_menuJSON_hlt->setStore(aux_hlt); - // Create an empty trigger menu container: - if (m_writexAODTriggerMenu) - { + ATH_CHECK(m_metaStore->record(aux_hlt, m_metaNameJSON_hlt + "Aux.")); + ATH_CHECK(m_metaStore->record(m_menuJSON_hlt, m_metaNameJSON_hlt)); - ATH_MSG_DEBUG("xAOD::TriggerMenuAuxContainer MetaObjectName = " << m_metaName); + // L1 JSON object - contains L1 menus + xAOD::TriggerMenuJsonAuxContainer *aux_l1 = new xAOD::TriggerMenuJsonAuxContainer(); + m_menuJSON_l1 = new xAOD::TriggerMenuJsonContainer(); + m_menuJSON_l1->setStore(aux_l1); - xAOD::TriggerMenuAuxContainer *aux = new xAOD::TriggerMenuAuxContainer(); - m_tmc = new xAOD::TriggerMenuContainer(); - m_tmc->setStore(aux); + ATH_CHECK(m_metaStore->record(aux_l1, m_metaNameJSON_l1 + "Aux.")); + ATH_CHECK(m_metaStore->record(m_menuJSON_l1, m_metaNameJSON_l1)); - // Record the trigger configuration metadata into it: - CHECK(m_metaStore->record(aux, m_metaName + "Aux.")); - CHECK(m_metaStore->record(m_tmc, m_metaName)); - } + // HLT PS JSON object - contains prescales sets for HLT menus + xAOD::TriggerMenuJsonAuxContainer *aux_hltps = new xAOD::TriggerMenuJsonAuxContainer(); + m_menuJSON_hltps = new xAOD::TriggerMenuJsonContainer(); + m_menuJSON_hltps->setStore(aux_hltps); - if (m_writexAODTriggerMenuJson) - { - - if (!m_isHLTJSONConfig) - { - ATH_MSG_ERROR("Require IsHLTJSONConfig to be TRUE when WritexAODTriggerMenuJson is TRUE"); - return StatusCode::FAILURE; - } - - if (!m_isL1JSONConfig) - { - ATH_MSG_ERROR("Require IsL1JSONConfig to be TRUE when WritexAODTriggerMenuJson is TRUE"); - return StatusCode::FAILURE; - } - - // HLT JSON object - contains HLT menus - xAOD::TriggerMenuJsonAuxContainer *aux_hlt = new xAOD::TriggerMenuJsonAuxContainer(); - m_menuJSON_hlt = new xAOD::TriggerMenuJsonContainer(); - m_menuJSON_hlt->setStore(aux_hlt); - - CHECK(m_metaStore->record(aux_hlt, m_metaNameJSON_hlt + "Aux.")); - CHECK(m_metaStore->record(m_menuJSON_hlt, m_metaNameJSON_hlt)); - - // L1 JSON object - contains L1 menus - xAOD::TriggerMenuJsonAuxContainer *aux_l1 = new xAOD::TriggerMenuJsonAuxContainer(); - m_menuJSON_l1 = new xAOD::TriggerMenuJsonContainer(); - m_menuJSON_l1->setStore(aux_l1); - - CHECK(m_metaStore->record(aux_l1, m_metaNameJSON_l1 + "Aux.")); - CHECK(m_metaStore->record(m_menuJSON_l1, m_metaNameJSON_l1)); - - // HLT PS JSON object - contains prescales sets for HLT menus - xAOD::TriggerMenuJsonAuxContainer *aux_hltps = new xAOD::TriggerMenuJsonAuxContainer(); - m_menuJSON_hltps = new xAOD::TriggerMenuJsonContainer(); - m_menuJSON_hltps->setStore(aux_hltps); - - CHECK(m_metaStore->record(aux_hltps, m_metaNameJSON_hltps + "Aux.")); - CHECK(m_metaStore->record(m_menuJSON_hltps, m_metaNameJSON_hltps)); - - // L1 PS JSON object - contains prescales sets for L1 menus - xAOD::TriggerMenuJsonAuxContainer *aux_l1ps = new xAOD::TriggerMenuJsonAuxContainer(); - m_menuJSON_l1ps = new xAOD::TriggerMenuJsonContainer(); - m_menuJSON_l1ps->setStore(aux_l1ps); - - CHECK(m_metaStore->record(aux_l1ps, m_metaNameJSON_l1ps + "Aux.")); - CHECK(m_metaStore->record(m_menuJSON_l1ps, m_metaNameJSON_l1ps)); - - // Bunchgroup JSON object - contains bungchgroup configuration - // TODO - // xAOD::TriggerMenuJsonAuxContainer* aux_bg = new xAOD::TriggerMenuJsonAuxContainer(); - // m_menuJSON_bg = new xAOD::TriggerMenuJsonContainer(); - // m_menuJSON_bg->setStore( aux_bg ); - - // CHECK( m_metaStore->record( aux_bg, m_metaNameJSON_bg + "Aux." ) ); - // CHECK( m_metaStore->record( m_menuJSON_bg, m_metaNameJSON_bg ) ); - } + ATH_CHECK(m_metaStore->record(aux_hltps, m_metaNameJSON_hltps + "Aux.")); + ATH_CHECK(m_metaStore->record(m_menuJSON_hltps, m_metaNameJSON_hltps)); + + // L1 PS JSON object - contains prescales sets for L1 menus + xAOD::TriggerMenuJsonAuxContainer *aux_l1ps = new xAOD::TriggerMenuJsonAuxContainer(); + m_menuJSON_l1ps = new xAOD::TriggerMenuJsonContainer(); + m_menuJSON_l1ps->setStore(aux_l1ps); + + ATH_CHECK(m_metaStore->record(aux_l1ps, m_metaNameJSON_l1ps + "Aux.")); + ATH_CHECK(m_metaStore->record(m_menuJSON_l1ps, m_metaNameJSON_l1ps)); + + // Bunchgroup JSON object - contains bungchgroup configuration + // TODO + // xAOD::TriggerMenuJsonAuxContainer* aux_bg = new xAOD::TriggerMenuJsonAuxContainer(); + // m_menuJSON_bg = new xAOD::TriggerMenuJsonContainer(); + // m_menuJSON_bg->setStore( aux_bg ); + + // ATH_CHECK( m_metaStore->record( aux_bg, m_metaNameJSON_bg + "Aux." ) ); + // ATH_CHECK( m_metaStore->record( m_menuJSON_bg, m_metaNameJSON_bg ) ); // Return gracefully: return StatusCode::SUCCESS; @@ -160,487 +117,75 @@ namespace TrigConf // Create the keys in the "internal format": TrigKey_t ckeys; - if (m_writexAODTriggerMenuJson) - { - // Write to SG via writer tool. - // Get keys back via pass-by-reference - ATH_CHECK(m_keyWriterTool->writeKeys(ctx, /*SMK*/ ckeys.first, /*L1PSK*/ ckeys.second.first, /*HLTPSK*/ ckeys.second.second)); - } - else - { // Fall back to R2 TrigConfSvc. Expect this to stop working in the near future (2021+) - ckeys.first = m_hltTrigConf->masterKey(); - ckeys.second.first = m_l1TrigConf->lvl1PrescaleKey(); - ckeys.second.second = m_hltTrigConf->hltPrescaleKey(); - // Write the keys here, do not use the keyWriterTool (this is R3 only) - std::unique_ptr<xAOD::TrigConfKeys> keys = std::make_unique<xAOD::TrigConfKeys>(ckeys.first, ckeys.second.first, ckeys.second.second); - SG::WriteHandle<xAOD::TrigConfKeys> trigConfKeysWrite(m_eventName, ctx); - ATH_CHECK(trigConfKeysWrite.record(std::move(keys))); - } + // Write to SG via writer tool. + // Get keys back via pass-by-reference + ATH_CHECK(m_keyWriterTool->writeKeys(ctx, /*SMK*/ ckeys.first, /*L1PSK*/ ckeys.second.first, /*HLTPSK*/ ckeys.second.second)); // The following code must only run on one event at a time std::lock_guard<std::mutex> lock(m_mutex); - // TODO - Deprecate this in the future. Only keep m_writexAODTriggerMenuJson mode - if (m_writexAODTriggerMenu) - { - - // Check if we converted this configuration already: - if (!m_convertedKeys.insert(ckeys).second) - { - ATH_MSG_VERBOSE("Configuration with keys SMK: " - << ckeys.first << ", L1PSK: " << ckeys.second.first - << ", HLTPSK: " << ckeys.second.second - << " already translated"); - } - else - { - - // Tell the user what's happening: - ATH_MSG_INFO("Converting configuration with keys SMK: " - << ckeys.first << ", L1PSK: " << ckeys.second.first - << ", HLTPSK: " << ckeys.second.second); - - // Apparently not, so let's make a new object: - xAOD::TriggerMenu *menu = new xAOD::TriggerMenu(); - m_tmc->push_back(menu); // Now owned by MetaDataStore - - // - // Set its keys: - // - menu->setSMK(ckeys.first); - menu->setL1psk(ckeys.second.first); - menu->setHLTpsk(ckeys.second.second); - - if (m_isL1JSONConfig) - { - CHECK(populateL1FromJSON(menu, ctx)); - } - else - { - CHECK(populateL1FromTrigConf(menu)); - } - - if (m_isHLTJSONConfig) - { - CHECK(populateHLTFromJSON(menu, ctx)); - } - else - { - CHECK(populateHLTFromTrigConf(menu)); - } - - CHECK(populateBunchGroup(menu)); - } // m_convertedKeys - } // m_writexAODTriggerMenu - - if (m_writexAODTriggerMenuJson) - { - - if (!m_converted_smk.insert(ckeys.first).second) - { - ATH_MSG_VERBOSE("Already converted SMK: " << ckeys.first); - } - else - { - ATH_MSG_DEBUG("Filling HLT information for SMK:" << ckeys.first); - SG::ReadHandle<TrigConf::HLTMenu> hltMenuHandle(m_HLTMenuKey, ctx); - ATH_CHECK(hltMenuHandle.isValid()); - std::stringstream hltTriggerMenuJson; - hltMenuHandle->printRaw(hltTriggerMenuJson); - xAOD::TriggerMenuJson *hlt = new xAOD::TriggerMenuJson(); - m_menuJSON_hlt->push_back(hlt); // Now owned by MetaDataStore - hlt->setKey(ckeys.first); - hlt->setName(hltMenuHandle->name()); - hlt->setPayload(hltTriggerMenuJson.str()); - ////////////////////////////////////////////////////////////////////////////// - ATH_MSG_DEBUG("Filling L1 information for SMK:" << ckeys.first); - SG::ReadHandle<TrigConf::L1Menu> l1MenuHandle = SG::makeHandle(m_L1MenuKey, ctx); - ATH_CHECK(l1MenuHandle.isValid()); - std::stringstream l1TriggerMenuJson; - l1MenuHandle->printRaw(l1TriggerMenuJson); - xAOD::TriggerMenuJson *l1 = new xAOD::TriggerMenuJson(); - m_menuJSON_l1->push_back(l1); // Now owned by MetaDataStore - l1->setKey(ckeys.first); - l1->setName(l1MenuHandle->name()); - l1->setPayload(l1TriggerMenuJson.str()); - } - - if (!m_converted_hltpsk.insert(ckeys.second.second).second) - { - ATH_MSG_VERBOSE("Already converted HLTPSK: " << ckeys.second.second); - } - else - { - ATH_MSG_DEBUG("Filling prescale information for HLTPSK:" << ckeys.second.second); - SG::ReadCondHandle<TrigConf::HLTPrescalesSet> hltPSHandle(m_HLTPrescaleSetInputKey, ctx); - ATH_CHECK(hltPSHandle.isValid()); - std::stringstream hltPSJSON; - hltPSHandle->printRaw(hltPSJSON); - xAOD::TriggerMenuJson *hltps = new xAOD::TriggerMenuJson(); - m_menuJSON_hltps->push_back(hltps); // Now owned by MetaDataStore - hltps->setKey(ckeys.second.second); - hltps->setName(hltPSHandle->name()); - hltps->setPayload(hltPSJSON.str()); - } - - if (!m_converted_l1psk.insert(ckeys.second.first).second) - { - ATH_MSG_VERBOSE("Already converted LVL1PSK: " << ckeys.second.first); - } - else - { - ATH_MSG_DEBUG("Filling prescale information for LVL1PSK:" << ckeys.second.first); - SG::ReadCondHandle<TrigConf::L1PrescalesSet> l1PSHandle(m_L1PrescaleSetInputKey, ctx); - ATH_CHECK(l1PSHandle.isValid()); - std::stringstream l1PSJSON; - l1PSHandle->printRaw(l1PSJSON); - xAOD::TriggerMenuJson *l1ps = new xAOD::TriggerMenuJson(); - m_menuJSON_l1ps->push_back(l1ps); // Now owned by MetaDataStore - l1ps->setKey(ckeys.second.first); - l1ps->setName(l1PSHandle->name()); - l1ps->setPayload(l1PSJSON.str()); - } - - // - // TODO: bg - // + if (!m_converted_smk.insert(ckeys.first).second) { + ATH_MSG_VERBOSE("Already converted SMK: " << ckeys.first); + } else { + ATH_MSG_DEBUG("Filling HLT information for SMK:" << ckeys.first); + SG::ReadHandle<TrigConf::HLTMenu> hltMenuHandle(m_HLTMenuKey, ctx); + ATH_CHECK(hltMenuHandle.isValid()); + std::stringstream hltTriggerMenuJson; + hltMenuHandle->printRaw(hltTriggerMenuJson); + xAOD::TriggerMenuJson *hlt = new xAOD::TriggerMenuJson(); + m_menuJSON_hlt->push_back(hlt); // Now owned by MetaDataStore + hlt->setKey(ckeys.first); + hlt->setName(hltMenuHandle->name()); + hlt->setPayload(hltTriggerMenuJson.str()); + ////////////////////////////////////////////////////////////////////////////// + ATH_MSG_DEBUG("Filling L1 information for SMK:" << ckeys.first); + SG::ReadHandle<TrigConf::L1Menu> l1MenuHandle = SG::makeHandle(m_L1MenuKey, ctx); + ATH_CHECK(l1MenuHandle.isValid()); + std::stringstream l1TriggerMenuJson; + l1MenuHandle->printRaw(l1TriggerMenuJson); + xAOD::TriggerMenuJson *l1 = new xAOD::TriggerMenuJson(); + m_menuJSON_l1->push_back(l1); // Now owned by MetaDataStore + l1->setKey(ckeys.first); + l1->setName(l1MenuHandle->name()); + l1->setPayload(l1TriggerMenuJson.str()); + } + + if (!m_converted_hltpsk.insert(ckeys.second.second).second) { + ATH_MSG_VERBOSE("Already converted HLTPSK: " << ckeys.second.second); + } else { + ATH_MSG_DEBUG("Filling prescale information for HLTPSK:" << ckeys.second.second); + SG::ReadCondHandle<TrigConf::HLTPrescalesSet> hltPSHandle(m_HLTPrescaleSetInputKey, ctx); + ATH_CHECK(hltPSHandle.isValid()); + std::stringstream hltPSJSON; + hltPSHandle->printRaw(hltPSJSON); + xAOD::TriggerMenuJson *hltps = new xAOD::TriggerMenuJson(); + m_menuJSON_hltps->push_back(hltps); // Now owned by MetaDataStore + hltps->setKey(ckeys.second.second); + hltps->setName(hltPSHandle->name()); + hltps->setPayload(hltPSJSON.str()); + } + + if (!m_converted_l1psk.insert(ckeys.second.first).second) { + ATH_MSG_VERBOSE("Already converted LVL1PSK: " << ckeys.second.first); + } else { + ATH_MSG_DEBUG("Filling prescale information for LVL1PSK:" << ckeys.second.first); + SG::ReadCondHandle<TrigConf::L1PrescalesSet> l1PSHandle(m_L1PrescaleSetInputKey, ctx); + ATH_CHECK(l1PSHandle.isValid()); + std::stringstream l1PSJSON; + l1PSHandle->printRaw(l1PSJSON); + xAOD::TriggerMenuJson *l1ps = new xAOD::TriggerMenuJson(); + m_menuJSON_l1ps->push_back(l1ps); // Now owned by MetaDataStore + l1ps->setKey(ckeys.second.first); + l1ps->setName(l1PSHandle->name()); + l1ps->setPayload(l1PSJSON.str()); } - // Return gracefully: - return StatusCode::SUCCESS; - } - - StatusCode xAODMenuWriterMT::populateL1FromJSON(xAOD::TriggerMenu *menu, const EventContext &ctx) const - { // - // Set its LVL1 information: + // TODO: bg // - ATH_MSG_DEBUG("Filling LVL1 information"); - SG::ReadHandle<TrigConf::L1Menu> l1MenuHandle(m_L1MenuKey, ctx); - ATH_CHECK(l1MenuHandle.isValid()); - const size_t nL1Items = l1MenuHandle->size(); - ATH_MSG_DEBUG("Configuring from " << m_L1MenuKey << " with " << nL1Items << " L1 items"); - - SG::ReadCondHandle<TrigConf::L1PrescalesSet> l1PSHandle(m_L1PrescaleSetInputKey, ctx); - ATH_CHECK(l1PSHandle.isValid()); - const size_t nL1ItemsPS = l1PSHandle->size(); - ATH_MSG_DEBUG("Prescales from " << m_L1PrescaleSetInputKey << " with " << nL1ItemsPS << " L1 items"); - - if (nL1Items != nL1ItemsPS) - { - ATH_MSG_ERROR("Inconsistent number of configured L1 items (" << nL1Items << ") and L1 item prescales (" << nL1ItemsPS << ")"); - return StatusCode::FAILURE; - } - - std::vector<uint16_t> ctpIds; - std::vector<std::string> itemNames; - std::vector<float> itemPrescales; - - ctpIds.reserve(nL1Items); - itemNames.reserve(nL1Items); - itemPrescales.reserve(nL1Items); - - for (const TrigConf::L1Item &l1 : *l1MenuHandle) - { - // Extract the information: - ctpIds.push_back(l1.ctpId()); - itemNames.push_back(l1.name()); - const TrigConf::L1PrescalesSet::L1Prescale l1ps = l1PSHandle->prescale(l1.name()); - itemPrescales.push_back(l1ps.prescale); - - // Some verbose information: - ATH_MSG_VERBOSE(" \"" << itemNames.back() << "\" CTP Id = " - << ctpIds.back() << ", prescale = " - << itemPrescales.back()); - } - - menu->setItemCtpIds(ctpIds); - menu->setItemNames(itemNames); - menu->setItemPrescales(itemPrescales); - - return StatusCode::SUCCESS; - } - - StatusCode xAODMenuWriterMT::populateHLTFromJSON(xAOD::TriggerMenu *menu, const EventContext &ctx) const - { - // - // Set its HLT information: - // - ATH_MSG_DEBUG("Filling HLT information"); - SG::ReadHandle<TrigConf::HLTMenu> hltMenuHandle(m_HLTMenuKey, ctx); - ATH_CHECK(hltMenuHandle.isValid()); - const size_t nChains = hltMenuHandle->size(); - ATH_MSG_DEBUG("Configuring from " << m_HLTMenuKey << " with " << nChains << " chains"); - - SG::ReadCondHandle<TrigConf::HLTPrescalesSet> hltPSHandle(m_HLTPrescaleSetInputKey, ctx); - ATH_CHECK(hltPSHandle.isValid()); - const size_t nChainsPS = hltPSHandle->size(); - ATH_MSG_DEBUG("Prescales from " << m_HLTPrescaleSetInputKey << " with " << nChains << " chains"); - - if (nChains != nChainsPS) - { - ATH_MSG_ERROR("Inconsistent number of configured HLT chains (" << nChains << ") and HLT chain prescales (" << nChainsPS << ")"); - return StatusCode::FAILURE; - } - - std::vector<uint16_t> chainIds; - std::vector<std::string> chainNames, chainParentNames; - std::vector<float> chainPrescales, chainRerunPrescales, - chainPassthroughPrescales; - - std::vector<std::vector<uint32_t>> chainSignatureCounters; - std::vector<std::vector<int>> chainSignatureLogics; - std::vector<std::vector<std::vector<std::string>>> chainSignatureOutputTEs; - std::vector<std::vector<std::string>> chainSignatureLabels; - - chainIds.reserve(nChains); - chainNames.reserve(nChains); - chainParentNames.reserve(nChains); - chainPrescales.reserve(nChains); - chainRerunPrescales.reserve(nChains); - chainPassthroughPrescales.reserve(nChains); - - chainSignatureCounters.reserve(nChains); - chainSignatureLogics.reserve(nChains); - chainSignatureOutputTEs.reserve(nChains); - chainSignatureLabels.reserve(nChains); - - for (const TrigConf::Chain &ch : *hltMenuHandle) - { - // Extract the information: - chainIds.push_back(ch.counter()); - chainNames.push_back(ch.name()); - chainParentNames.push_back(ch.l1item()); - const TrigConf::HLTPrescalesSet::HLTPrescale hltps = hltPSHandle->prescale(ch.name()); - chainPrescales.push_back(hltps.prescale); - chainRerunPrescales.push_back(-1.0); // Unused in Run3 - chainPassthroughPrescales.push_back(-1.0); // Unused in Run3 - - std::vector<uint32_t> counters; - std::vector<int> logics; - std::vector<std::vector<std::string>> outputTEs; - std::vector<std::string> labels; - - // Per-step algorithms is TODO, these are blank for now. - - chainSignatureCounters.push_back(counters); - chainSignatureLogics.push_back(logics); - chainSignatureOutputTEs.push_back(outputTEs); - chainSignatureLabels.push_back(labels); - - // Some verbose information: - ATH_MSG_VERBOSE(" \"" << chainNames.back() << "\" Chain Id = " - << chainIds.back() << ", parent name = \"" - << chainParentNames.back() << "\", prescale = " - << chainPrescales.back() << ", re-run prescale = " - << chainRerunPrescales.back() - << ", pass-through presclale = " - << chainPassthroughPrescales.back()); - } - - menu->setChainIds(chainIds); - menu->setChainNames(chainNames); - menu->setChainParentNames(chainParentNames); - menu->setChainPrescales(chainPrescales); - menu->setChainRerunPrescales(chainRerunPrescales); - menu->setChainPassthroughPrescales(chainPassthroughPrescales); - - menu->setChainSignatureCounters(chainSignatureCounters); - menu->setChainSignatureLogics(chainSignatureLogics); - menu->setChainSignatureOutputTEs(chainSignatureOutputTEs); - menu->setChainSignatureLabels(chainSignatureLabels); - - // - // Set its sequence information: - // - // TODO - - return StatusCode::SUCCESS; - } - - StatusCode xAODMenuWriterMT::populateL1FromTrigConf(xAOD::TriggerMenu *menu) const - { - // - // Set its LVL1 information: - // - ATH_MSG_DEBUG("Filling LVL1 information"); - std::vector<uint16_t> ctpIds; - std::vector<std::string> itemNames; - std::vector<float> itemPrescales; - TrigConf::ItemContainer::const_iterator item_itr = - m_l1TrigConf->ctpConfig()->menu().items().begin(); - TrigConf::ItemContainer::const_iterator item_end = - m_l1TrigConf->ctpConfig()->menu().items().end(); - std::vector<float> prescales = - m_l1TrigConf->ctpConfig()->prescaleSet().prescales_float(); - for (; item_itr != item_end; ++item_itr) - { - - // Extract the information: - ctpIds.push_back((*item_itr)->ctpId()); - itemNames.push_back((*item_itr)->name()); - itemPrescales.push_back(prescales[(*item_itr)->ctpId()]); - - // Some verbose information: - ATH_MSG_VERBOSE(" \"" << itemNames.back() << "\" CTP Id = " - << ctpIds.back() << ", prescale = " - << itemPrescales.back()); - } - menu->setItemCtpIds(ctpIds); - menu->setItemNames(itemNames); - menu->setItemPrescales(itemPrescales); - - return StatusCode::SUCCESS; - } - - StatusCode xAODMenuWriterMT::populateHLTFromTrigConf(xAOD::TriggerMenu *menu) const - { - // - // Set its HLT information: - // - ATH_MSG_DEBUG("Filling HLT information"); - std::vector<uint16_t> chainIds; - std::vector<std::string> chainNames, chainParentNames; - std::vector<float> chainPrescales, chainRerunPrescales, - chainPassthroughPrescales; - - std::vector<std::vector<uint32_t>> chainSignatureCounters; - std::vector<std::vector<int>> chainSignatureLogics; - std::vector<std::vector<std::vector<std::string>>> chainSignatureOutputTEs; - std::vector<std::vector<std::string>> chainSignatureLabels; - - TrigConf::HLTChainList::const_iterator chain_itr = - m_hltTrigConf->chains().begin(); - TrigConf::HLTChainList::const_iterator chain_end = - m_hltTrigConf->chains().end(); - for (; chain_itr != chain_end; ++chain_itr) - { - - // Extract the information: - chainIds.push_back((*chain_itr)->chain_counter()); - chainNames.push_back((*chain_itr)->chain_name()); - chainParentNames.push_back((*chain_itr)->lower_chain_name()); - chainPrescales.push_back((*chain_itr)->prescale()); - chainRerunPrescales.push_back( - (*chain_itr)->prescales().getRerunPrescale("").second); - chainPassthroughPrescales.push_back((*chain_itr)->pass_through()); - - std::vector<uint32_t> counters; - std::vector<int> logics; - std::vector<std::vector<std::string>> outputTEs; - std::vector<std::string> labels; - - ATH_MSG_VERBOSE((*chain_itr)->chain_name() << " has " << (*chain_itr)->signatureList().size() << " signatures"); - for (auto &signature : (*chain_itr)->signatureList()) - { - uint32_t cntr = signature->signature_counter(); - counters.push_back(cntr); - logics.push_back(signature->logic()); - labels.push_back(signature->label()); - std::vector<std::string> outputTEids; - for (auto &outputTE : signature->outputTEs()) - { - outputTEids.push_back(outputTE->name()); - } - outputTEs.push_back(outputTEids); - ATH_MSG_VERBOSE("converted this signature: " << *signature); - } - chainSignatureCounters.push_back(counters); - chainSignatureLogics.push_back(logics); - chainSignatureOutputTEs.push_back(outputTEs); - chainSignatureLabels.push_back(labels); - - // Some verbose information: - ATH_MSG_VERBOSE(" \"" << chainNames.back() << "\" Chain Id = " - << chainIds.back() << ", parent name = \"" - << chainParentNames.back() << "\", prescale = " - << chainPrescales.back() << ", re-run prescale = " - << chainRerunPrescales.back() - << ", pass-through presclale = " - << chainPassthroughPrescales.back()); - } - menu->setChainIds(chainIds); - menu->setChainNames(chainNames); - menu->setChainParentNames(chainParentNames); - menu->setChainPrescales(chainPrescales); - menu->setChainRerunPrescales(chainRerunPrescales); - menu->setChainPassthroughPrescales(chainPassthroughPrescales); - - menu->setChainSignatureCounters(chainSignatureCounters); - menu->setChainSignatureLogics(chainSignatureLogics); - menu->setChainSignatureOutputTEs(chainSignatureOutputTEs); - menu->setChainSignatureLabels(chainSignatureLabels); - - // - // Set its sequence information: - // - ATH_MSG_DEBUG("Filling sequence information"); - auto &sequenceList = m_hltTrigConf->sequences(); - std::vector<std::vector<std::string>> sequenceInputTEs; - std::vector<std::string> sequenceOutputTE; - std::vector<std::vector<std::string>> sequenceAlgorithms; - - for (auto &seq : sequenceList) - { - std::vector<std::string> inputTEs; - for (auto &input : seq->inputTEs()) - inputTEs.push_back(input->name()); - sequenceInputTEs.push_back(inputTEs); - sequenceAlgorithms.push_back(seq->algorithms()); - sequenceOutputTE.push_back(seq->outputTE()->name()); - - ATH_MSG_VERBOSE("original sequence: \n" - << *seq); - - ATH_MSG_VERBOSE("added sequence with: "); - ATH_MSG_VERBOSE(" inputTEs: " << sequenceInputTEs.back()); - ATH_MSG_VERBOSE(" algos: " << sequenceAlgorithms.back()); - ATH_MSG_VERBOSE(" outputTE: " << sequenceOutputTE.back()); - } - - menu->setSequenceInputTEs(sequenceInputTEs); - menu->setSequenceOutputTEs(sequenceOutputTE); - menu->setSequenceAlgorithms(sequenceAlgorithms); + // Return gracefully: return StatusCode::SUCCESS; } -} // namespace TrigConf -StatusCode -TrigConf::xAODMenuWriterMT::populateBunchGroup(xAOD::TriggerMenu *menu) const -{ - // - // Set its bunch-group information: - // - ATH_MSG_DEBUG("Filling bunch-group information"); - std::vector<std::vector<uint16_t>> bgs; - if (m_isL1JSONConfig) - { - const TrigConf::L1BunchGroupSet *l1bgs = nullptr; - detStore()->retrieve(l1bgs).ignore(); - if (l1bgs) - { - for (size_t i = 0; i < l1bgs->maxNBunchGroups(); ++i) - { - auto bg = l1bgs->getBunchGroup(i); - bgs.push_back(bg->bunches()); - } - } - else - { - ATH_MSG_ERROR("Did not find L1BunchGroupSet in DetectorStore"); - } - } - else - { - // vector of 16 bunchgroups, each containing the vector of BCIDs - for (auto &bunchGroup : m_l1TrigConf->bunchGroupSet()->bunchGroups()) - { - const std::vector<uint16_t> bunches(bunchGroup.bunches().begin(), - bunchGroup.bunches().end()); - bgs.push_back(bunches); - } - } - menu->setBunchGroupBunches(bgs); - return StatusCode::SUCCESS; -} +} \ No newline at end of file diff --git a/Trigger/TrigConfiguration/TrigConfxAOD/src/xAODMenuWriterMT.h b/Trigger/TrigConfiguration/TrigConfxAOD/src/xAODMenuWriterMT.h index 8a1c0b604a85cfec0a92126435bda4e05c91acde..ca869d0a59ccbde01dd4cdd0d8255887ed44f05c 100644 --- a/Trigger/TrigConfiguration/TrigConfxAOD/src/xAODMenuWriterMT.h +++ b/Trigger/TrigConfiguration/TrigConfxAOD/src/xAODMenuWriterMT.h @@ -20,26 +20,21 @@ extern "C" { // Gaudi/Athena include(s): #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" -#include "StoreGate/StoreGateSvc.h" #include "CxxUtils/checker_macros.h" // Trigger include(s): -#include "TrigConfInterfaces/ILVL1ConfigSvc.h" -#include "TrigConfInterfaces/IHLTConfigSvc.h" #include "TrigConfData/HLTMenu.h" #include "TrigConfData/L1Menu.h" #include "TrigConfData/HLTPrescalesSet.h" #include "TrigConfData/L1PrescalesSet.h" // EDM include(s): -#include "xAODTrigger/TriggerMenuContainer.h" #include "xAODTrigger/TriggerMenuJsonContainer.h" -#include "xAODTrigger/TrigConfKeys.h" namespace TrigConf { /** - * @short Algorithm used to write the light-weight xAOD configuration + * @short Algorithm used to write the light-weight xAOD configuration in the Run3 JSON format * * This algorithm needs to be scheduled in jobs that write xAOD * files in Athena in order to write the trigger configuration @@ -70,14 +65,11 @@ namespace TrigConf { private: - SG::WriteHandleKey<xAOD::TrigConfKeys> m_eventName {this, "EventObjectName", "TrigConfKeys", - "StoreGate key for the event object"}; - SG::ReadHandleKey<TrigConf::HLTMenu> m_HLTMenuKey {this, "HLTTriggerMenu", "DetectorStore+HLTTriggerMenu", - "HLT Menu key, for use if IsJSONConfig=True"}; + "HLT Menu key"}; SG::ReadHandleKey<TrigConf::L1Menu> m_L1MenuKey {this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu", - "L1 Menu key, for use if IsJSONConfig=True"}; + "L1 Menu key"}; SG::ReadCondHandleKey<TrigConf::HLTPrescalesSet> m_HLTPrescaleSetInputKey{this, "HLTPrescales", "HLTPrescales", "HLT prescales set condition handle"}; @@ -85,9 +77,6 @@ namespace TrigConf { SG::ReadCondHandleKey<TrigConf::L1PrescalesSet> m_L1PrescaleSetInputKey{this, "L1Prescales", "L1Prescales", "L1 prescales set condition handle"}; - Gaudi::Property< std::string > m_metaName {this, "MetaObjectName", "TriggerMenu", - "StoreGate key for the xAOD::TriggerMenu configuration object"}; - Gaudi::Property< std::string > m_metaNameJSON_hlt {this, "JSONMetaObjectNameHLT", "TriggerMenuJson_HLT", "StoreGate key for the xAOD::TriggerMenuJson HLT configuration object"}; @@ -104,21 +93,6 @@ namespace TrigConf { // Gaudi::Property< std::string > m_metaNameJSON_bg {this, "JSONMetaObjectNameBunchgroup", "TriggerMenuJson_BG", // "StoreGate key for the xAOD::TriggerMenuJson BunchGroup configuration object"}; - Gaudi::Property< bool > m_isL1JSONConfig {this, "IsL1JSONConfig", true, - "If converting from a L1 JSON menu (Run3) or from the TrigConfigSvc (Runs 1, 2)"}; - - Gaudi::Property< bool > m_isHLTJSONConfig {this, "IsHLTJSONConfig", true, - "If converting from a HLT JSON menu (Run3) or from the TrigConfigSvc (Runs 1, 2)"}; - - Gaudi::Property< bool > m_writexAODTriggerMenu {this, "WritexAODTriggerMenu", true, - "Flag to control the writing of xAOD::TriggerMenu metadata into the output file. This is the R2 persistent format."}; - - Gaudi::Property< bool > m_writexAODTriggerMenuJson {this, "WritexAODTriggerMenuJson", true, - "Flag to control the writing of xAOD::TriggerMenuJson metadata into the output file. This is the R3 persistent format."}; - - ServiceHandle<TrigConf::ILVL1ConfigSvc> m_l1TrigConf{this, "LVL1ConfigSvc", "LVL1ConfigSvc", "The LVL1 TrigConfigSvc"}; - - ServiceHandle<TrigConf::IHLTConfigSvc> m_hltTrigConf{this, "HLTConfigSvc", "HLTConfigSvc", "The HLT TrigConfigSvc"}; ServiceHandle< StoreGateSvc > m_metaStore {this, "MetaDataStore", "MetaDataStore", "The MetaDataStore"}; @@ -126,33 +100,17 @@ namespace TrigConf { ToolHandle<IKeyWriterTool> m_keyWriterTool{this, "KeyWriterTool", "KeyWriterTool/OfflineKeyWriterTool", "Writes the keys which are configured when the trigger configuration is written to in-file metadata."}; - StatusCode populateL1FromTrigConf(xAOD::TriggerMenu* menu) const; - - StatusCode populateHLTFromTrigConf(xAOD::TriggerMenu* menu) const; - - StatusCode populateL1FromJSON(xAOD::TriggerMenu* menu, const EventContext& ctx) const; - - StatusCode populateHLTFromJSON(xAOD::TriggerMenu* menu, const EventContext& ctx) const; - - StatusCode populateBunchGroup(xAOD::TriggerMenu* menu) const; - /// Trigger configuration key type (used just internally) typedef std::pair< uint32_t, std::pair< uint32_t, uint32_t > > TrigKey_t; - /// The configuration object that we are writing when WritexAODTriggerMenu - mutable xAOD::TriggerMenuContainer* m_tmc ATLAS_THREAD_SAFE; - - // The configuration objects that we are writing when WritexAODTriggerMenuJson + // The configuration objects that we are writing mutable xAOD::TriggerMenuJsonContainer* m_menuJSON_hlt ATLAS_THREAD_SAFE; mutable xAOD::TriggerMenuJsonContainer* m_menuJSON_l1 ATLAS_THREAD_SAFE; mutable xAOD::TriggerMenuJsonContainer* m_menuJSON_hltps ATLAS_THREAD_SAFE; mutable xAOD::TriggerMenuJsonContainer* m_menuJSON_l1ps ATLAS_THREAD_SAFE; // mutable xAOD::TriggerMenuJsonContainer* m_menuJSON_bg ATLAS_THREAD_SAFE; - /// Trigger configuration keys that are already converted when WritexAODTriggerMenu is true - mutable std::set< TrigKey_t > m_convertedKeys ATLAS_THREAD_SAFE; - - /// Trigger configuration keys that are already converted when WritexAODTriggerMenuJson is true + /// Trigger configuration keys that are already converted mutable std::set< uint32_t > m_converted_smk ATLAS_THREAD_SAFE; mutable std::set< uint32_t > m_converted_hltpsk ATLAS_THREAD_SAFE; mutable std::set< uint32_t > m_converted_l1psk ATLAS_THREAD_SAFE; diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py index cf7b088247a3ebac728d98b3840598c8c8cd8d85..f306928b8c4decede8077f341b95c3f832c040b9 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py @@ -466,25 +466,15 @@ def triggerPOOLOutputCfg(flags, edmSet): # Produce trigger metadata menuwriter = CompFactory.getComp("TrigConf::xAODMenuWriterMT")() - menuwriter.IsHLTJSONConfig = True - menuwriter.IsL1JSONConfig = flags.Trigger.readLVL1FromJSON - menuwriter.WritexAODTriggerMenu = True # This should be removed in the future - menuwriter.WritexAODTriggerMenuJson = True menuwriter.KeyWriterTool = CompFactory.getComp('TrigConf::KeyWriterTool')('KeyWriterToolOffline') acc.addEventAlgo( menuwriter ) + streamAlg.MetadataItemList += [ "xAOD::TriggerMenuJsonContainer#*", "xAOD::TriggerMenuJsonAuxContainer#*" ] # Schedule the insertion of L1 prescales into the conditions store # Required for metadata production from TrigConfigSvc.TrigConfigSvcCfg import L1PrescaleCondAlgCfg acc.merge( L1PrescaleCondAlgCfg( flags ) ) - # Add metadata to the output stream - if menuwriter.WritexAODTriggerMenu: - streamAlg.MetadataItemList += [ "xAOD::TriggerMenuContainer#*", "xAOD::TriggerMenuAuxContainer#*" ] - - if menuwriter.WritexAODTriggerMenuJson: - streamAlg.MetadataItemList += [ "xAOD::TriggerMenuJsonContainer#*", "xAOD::TriggerMenuJsonAuxContainer#*" ] - # Ensure OutputStream runs after TrigDecisionMakerMT and xAODMenuWriterMT streamAlg.ExtraInputs += [ ("xAOD::TrigDecision", str(decmaker.TrigDecisionKey)), diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigGetter.py index 37e61805f23109ad59b2e61ba25f249cf07a3c30..1920077623e1cfee9b90b6d6dd1e921ca7352cfe 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigGetter.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfigGetter.py @@ -242,16 +242,6 @@ class TriggerConfigGetter(Configured): if not hasattr(svcMgr, 'xAODConfigSvc'): from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc svcMgr += TrigConf__xAODConfigSvc('xAODConfigSvc') - else: # Does not have xAODMeta - # Run-3 Trigger Configuration Services - from TrigConfigSvc.TrigConfigSvcCfg import getL1ConfigSvc, getHLTConfigSvc - svcMgr += getL1ConfigSvc(ConfigFlags) - svcMgr += getHLTConfigSvc(ConfigFlags) - - # Needed for TrigConf::xAODMenuWriterMT - from TrigConfigSvc.TrigConfigSvcConfig import TrigConfigSvc - svcMgr += TrigConfigSvc("TrigConfigSvc") - svcMgr.TrigConfigSvc.UseNewConfig = ConfigFlags.Trigger.readLVL1FromJSON and ConfigFlags.Trigger.triggerMenuSetup != "Physics_pp_v7_primaries" else: # non-MT (Run-2) Trigger Configuration @@ -429,8 +419,8 @@ class TriggerConfigGetter(Configured): # Add the algorithm creating the trigger configuration metadata for # the output: - writeTriggerMenu = True - writeMenuJSON = False + writeTriggerMenu = False # Run2 offline xAOD metadata summary format. Writing of this now is deprecated. Reading supported still. + writeMenuJSON = False # Run3 offline xAOD metadata summary format from AthenaConfiguration.AllConfigFlags import ConfigFlags if ConfigFlags.Trigger.EDMVersion <= 2: if ConfigFlags.Trigger.doEDMVersionConversion: @@ -457,30 +447,19 @@ class TriggerConfigGetter(Configured): from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODMenuWriterMT, TrigConf__KeyWriterTool menuwriter = TrigConf__xAODMenuWriterMT() - menuwriter.IsHLTJSONConfig = True - menuwriter.IsL1JSONConfig = True - menuwriter.WritexAODTriggerMenu = True # This should be removed in the future - menuwriter.WritexAODTriggerMenuJson = True menuwriter.KeyWriterTool = TrigConf__KeyWriterTool('KeyWriterToolOffline') - menuwriter.LVL1ConfigSvc = l1ConfigSvc - menuwriter.HLTConfigSvc = hltConfigSvc - writeTriggerMenu = menuwriter.WritexAODTriggerMenu - writeMenuJSON = menuwriter.WritexAODTriggerMenuJson + writeMenuJSON = True topAlgs += menuwriter else: from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODMenuWriter topAlgs += TrigConf__xAODMenuWriter( OverwriteEventObj = True ) + writeTriggerMenu = True else: from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODMenuWriterMT, TrigConf__KeyWriterTool menuwriter = TrigConf__xAODMenuWriterMT() - menuwriter.IsHLTJSONConfig = True - menuwriter.IsL1JSONConfig = ConfigFlags.Trigger.readLVL1FromJSON - menuwriter.WritexAODTriggerMenu = True # This should be removed in the future - menuwriter.WritexAODTriggerMenuJson = True menuwriter.KeyWriterTool = TrigConf__KeyWriterTool('KeyWriterToolOffline') - writeTriggerMenu = menuwriter.WritexAODTriggerMenu - writeMenuJSON = menuwriter.WritexAODTriggerMenuJson + writeMenuJSON = True topAlgs += menuwriter # Schedule also the prescale conditions algs from AthenaCommon.Configurable import Configurable