From 5a0cb9755f0abc5cc83a11f7db386a56c1ad5f21 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Tue, 21 Sep 2021 14:35:47 +0200 Subject: [PATCH 01/11] OMTF O2O upgrade --- CondCore/L1TPlugins/src/UpgradeRecords2.cc | 5 + CondCore/Utilities/plugins/Module_2XML.cc | 1 + CondCore/Utilities/src/CondFormats.h | 1 + .../interface/L1TMuonOverlapFwVersionO2ORcd.h | 30 ++++ .../interface/L1TMuonOverlapFwVersionRcd.h | 25 +++ .../src/L1TMuonOverlapFwVersionO2ORcd.cc | 15 ++ .../src/L1TMuonOverlapFwVersionRcd.cc | 15 ++ .../interface/L1TMuonOverlapFwVersion.h | 50 ++++++ .../L1TObjects/src/L1TMuonOverlapFwVersion.cc | 1 + .../T_EventSetup_L1TMuonOverlapFwVersion.cc | 4 + CondFormats/L1TObjects/src/classes.h | 3 + CondFormats/L1TObjects/src/classes_def.xml | 3 + CondTools/L1TriggerExt/plugins/SealModule.cc | 5 + .../L1TriggerExt/python/L1CondEnumExt_cfi.py | 3 +- .../python/L1ConfigTSCPayloadsExt_cff.py | 6 + .../L1TriggerExt/python/L1O2OTagsExt_cfi.py | 1 + .../python/L1SubsystemParamsExt_cfi.py | 6 + .../L1TMuonOverlapFwVersionESProducer.cc | 35 ++++ .../L1TMuonOverlapFwVersionESProducer.h | 24 +++ .../python/fakeOmtfFwVersion_cff.py | 18 ++ .../L1TMuonOverlapFwVersionOnline_cfi.py | 26 +++ .../src/L1TMuonOverlapFwVersionOnlineProd.cc | 160 ++++++++++++++++++ .../src/L1TMuonOverlapObjectKeysOnlineProd.cc | 30 ++-- .../src/L1TMuonOverlapFwVersionTester.cc | 67 ++++++++ .../test/dumpL1TMuonOverlapFwVersion.py | 121 +++++++++++++ .../Utilities/test/uploadOmtfFwVersion.py | 42 +++++ .../Utilities/test/viewOmtfFwVersion.py | 57 +++++++ 27 files changed, 742 insertions(+), 12 deletions(-) create mode 100644 CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h create mode 100644 CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h create mode 100644 CondFormats/DataRecord/src/L1TMuonOverlapFwVersionO2ORcd.cc create mode 100644 CondFormats/DataRecord/src/L1TMuonOverlapFwVersionRcd.cc create mode 100644 CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h create mode 100644 CondFormats/L1TObjects/src/L1TMuonOverlapFwVersion.cc create mode 100644 CondFormats/L1TObjects/src/T_EventSetup_L1TMuonOverlapFwVersion.cc create mode 100644 L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.cc create mode 100644 L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.h create mode 100644 L1Trigger/L1TMuonOverlap/python/fakeOmtfFwVersion_cff.py create mode 100644 L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapFwVersionOnline_cfi.py create mode 100644 L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc create mode 100644 L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc create mode 100644 L1TriggerConfig/Utilities/test/dumpL1TMuonOverlapFwVersion.py create mode 100644 L1TriggerConfig/Utilities/test/uploadOmtfFwVersion.py create mode 100644 L1TriggerConfig/Utilities/test/viewOmtfFwVersion.py diff --git a/CondCore/L1TPlugins/src/UpgradeRecords2.cc b/CondCore/L1TPlugins/src/UpgradeRecords2.cc index 0a6b3e1dd1ada..bb691586721a8 100644 --- a/CondCore/L1TPlugins/src/UpgradeRecords2.cc +++ b/CondCore/L1TPlugins/src/UpgradeRecords2.cc @@ -14,6 +14,9 @@ #include "CondFormats/DataRecord/interface/L1TMuonEndCapForestRcd.h" #include "CondFormats/DataRecord/interface/L1TMuonEndCapForestO2ORcd.h" +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h" #include "CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h" #include "CondFormats/DataRecord/interface/L1TMuonOverlapParamsRcd.h" #include "CondFormats/DataRecord/interface/L1TMuonOverlapParamsO2ORcd.h" @@ -32,6 +35,7 @@ REGISTER_PLUGIN(L1TMuonEndcapParamsRcd, L1TMuonEndCapParams); // Temporary copy REGISTER_PLUGIN(L1TMuonEndCapParamsRcd, L1TMuonEndCapParams); REGISTER_PLUGIN(L1TMuonEndCapForestRcd, L1TMuonEndCapForest); +REGISTER_PLUGIN(L1TMuonOverlapFwVersionRcd, L1TMuonOverlapFwVersion); REGISTER_PLUGIN(L1TMuonOverlapParamsRcd, L1TMuonOverlapParams); REGISTER_PLUGIN(L1TMuonBarrelParamsRcd, L1TMuonBarrelParams); REGISTER_PLUGIN(L1TMuonBarrelKalmanParamsRcd, L1TMuonBarrelKalmanParams); @@ -39,6 +43,7 @@ REGISTER_PLUGIN(L1TMuonGlobalParamsRcd, L1TMuonGlobalParams); REGISTER_PLUGIN(L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams); REGISTER_PLUGIN(L1TMuonEndCapForestO2ORcd, L1TMuonEndCapForest); +REGISTER_PLUGIN(L1TMuonOverlapFwVersionO2ORcd, L1TMuonOverlapFwVersion); REGISTER_PLUGIN(L1TMuonOverlapParamsO2ORcd, L1TMuonOverlapParams); REGISTER_PLUGIN(L1TMuonBarrelParamsO2ORcd, L1TMuonBarrelParams); REGISTER_PLUGIN(L1TMuonGlobalParamsO2ORcd, L1TMuonGlobalParams); diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index ad1e52c5724d5..dfad2d48a81c7 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -192,6 +192,7 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(L1TMuonEndCapParams); PAYLOAD_2XML_CLASS(L1TMuonGlobalParams); PAYLOAD_2XML_CLASS(L1TMuonOverlapParams); + PAYLOAD_2XML_CLASS(L1TMuonOverlapFwVersion); PAYLOAD_2XML_CLASS(L1TUtmAlgorithm); PAYLOAD_2XML_CLASS(L1TUtmBin); PAYLOAD_2XML_CLASS(L1TUtmCondition); diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index 48fe8f23f996b..91a9a69f156b2 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -248,6 +248,7 @@ #include "CondFormats/L1TObjects/interface/L1TMuonEndCapParams.h" #include "CondFormats/L1TObjects/interface/L1TMuonGlobalParams.h" #include "CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h" +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" #include "CondFormats/L1TObjects/interface/L1TUtmAlgorithm.h" #include "CondFormats/L1TObjects/interface/L1TUtmBin.h" #include "CondFormats/L1TObjects/interface/L1TUtmCondition.h" diff --git a/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h b/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h new file mode 100644 index 0000000000000..c4a98ca383058 --- /dev/null +++ b/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h @@ -0,0 +1,30 @@ +#ifndef L1TMTFOverlapFwVersionRcd_L1TMuonOverlapFwVersionO2ORcd_h +#define L1TMTFOverlapFwVersionRcd_L1TMuonOverlapFwVersionO2ORcd_h +// -*- C++ -*- +// +// Package: CondFormats/DataRecord +// Class : L1TMuonOverlapFwVersionRcd +// +/**\class L1TMuonOverlapFwVersionRcd L1TMuonOverlapFwVersionRcd.h CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h + + Description: [one line class summary] + + Usage: + + +*/ +// +// Author: Michal Szleper +// Created: Wed, 20 Oct 2020 13:55:50 GMT +// + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" +#include "CondFormats/DataRecord/interface/L1TriggerKeyListExtRcd.h" +#include "CondFormats/DataRecord/interface/L1TriggerKeyExtRcd.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h" +class L1TMuonOverlapFwVersionO2ORcd + : public edm::eventsetup::DependentRecordImplementation< + L1TMuonOverlapFwVersionO2ORcd, + edm::mpl::Vector > {}; + +#endif diff --git a/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h b/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h new file mode 100644 index 0000000000000..4229c7158912f --- /dev/null +++ b/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h @@ -0,0 +1,25 @@ +#ifndef L1TMTFOverlapFwVersionRcd_L1TMTFOverlapFwVersionRcd_h +#define L1TMTFOverlapFwVersionRcd_L1TMTFOverlapFwVersionRcd_h +// -*- C++ -*- +// +// Package: CondFormats/DataRecord +// Class : L1TMuonOverlapFwVersionRcd +// +/**\class L1TMuonOverlapFwVersionRcd L1TMuonOverlapFwVersionRcd.h CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h + + Description: [one line class summary] + + Usage: + + +*/ +// +// Author: Michal Szleper +// Created: Wed, 20 May 2020 13:50:35 GMT +// + +#include "FWCore/Framework/interface/EventSetupRecordImplementation.h" + +class L1TMuonOverlapFwVersionRcd : public edm::eventsetup::EventSetupRecordImplementation {}; + +#endif diff --git a/CondFormats/DataRecord/src/L1TMuonOverlapFwVersionO2ORcd.cc b/CondFormats/DataRecord/src/L1TMuonOverlapFwVersionO2ORcd.cc new file mode 100644 index 0000000000000..d53d248ff141c --- /dev/null +++ b/CondFormats/DataRecord/src/L1TMuonOverlapFwVersionO2ORcd.cc @@ -0,0 +1,15 @@ +// -*- C++ -*- +// +// Package: CondFormats/DataRecord +// Class : L1TMuonOverlapFwVersionRcd +// +// Implementation: +// [Notes on implementation] +// +// Author: Michal Szleper +// Created: Wed, 20 Oct 2020 13:58:35 GMT + +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(L1TMuonOverlapFwVersionO2ORcd); diff --git a/CondFormats/DataRecord/src/L1TMuonOverlapFwVersionRcd.cc b/CondFormats/DataRecord/src/L1TMuonOverlapFwVersionRcd.cc new file mode 100644 index 0000000000000..8a0074ee07e27 --- /dev/null +++ b/CondFormats/DataRecord/src/L1TMuonOverlapFwVersionRcd.cc @@ -0,0 +1,15 @@ +// -*- C++ -*- +// +// Package: CondFormats/DataRecord +// Class : L1TMuonOverlapFwVersionRcd +// +// Implementation: +// [Notes on implementation] +// +// Author: Michal Szleper +// Created: Wed, 20 Oct 2020 13:57:35 GMT + +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h" +#include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" + +EVENTSETUP_RECORD_REG(L1TMuonOverlapFwVersionRcd); diff --git a/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h b/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h new file mode 100644 index 0000000000000..64bf3d50931e3 --- /dev/null +++ b/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h @@ -0,0 +1,50 @@ +#ifndef L1TMuonOverlapFwVersion_h +#define L1TMuonOverlapFwVersion_h + +#include +#include +#include +#include + +#include "CondFormats/Serialization/interface/Serializable.h" +#include "CondFormats/L1TObjects/interface/LUT.h" + +/////////////////////////////////////// +/////////////////////////////////////// +class L1TMuonOverlapFwVersion { +public: + + L1TMuonOverlapFwVersion() { + algorithmVer_ = 0x110; + layersVer_ = 0x6; + patternsVer_ = 0x3; + synthDate_ = "2018-9-18 21:26:2"; + } + L1TMuonOverlapFwVersion(unsigned algoV, unsigned layersV, unsigned patternsV, std::string sDate){ + algorithmVer_ = algoV; + layersVer_ = layersV; + patternsVer_ = patternsV; + synthDate_ = sDate; + } + ~L1TMuonOverlapFwVersion() {} + + unsigned algoVersion() const { return algorithmVer_; } + unsigned layersVersion() const { return layersVer_; } + unsigned fwVersion() const { return layersVer_; } + unsigned patternsVersion() const { return patternsVer_; } + std::string synthDate() const { return synthDate_; } + void setAlgoVersion(unsigned algoV) { algorithmVer_ = algoV; } + void setLayersVersion(unsigned layersV) { layersVer_ = layersV; } + void setFwVersion(unsigned layersV) { layersVer_ = layersV; } + void setPatternsVersion(unsigned patternsV) { patternsVer_ = patternsV; } + void setSynthDate(std::string sDate) { synthDate_ = sDate; } + + ///Firmware configuration parameters + unsigned algorithmVer_; + unsigned layersVer_; + unsigned patternsVer_; + std::string synthDate_; + + COND_SERIALIZABLE; +}; +#endif diff --git a/CondFormats/L1TObjects/src/L1TMuonOverlapFwVersion.cc b/CondFormats/L1TObjects/src/L1TMuonOverlapFwVersion.cc new file mode 100644 index 0000000000000..1837e8f1bbe48 --- /dev/null +++ b/CondFormats/L1TObjects/src/L1TMuonOverlapFwVersion.cc @@ -0,0 +1 @@ +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" diff --git a/CondFormats/L1TObjects/src/T_EventSetup_L1TMuonOverlapFwVersion.cc b/CondFormats/L1TObjects/src/T_EventSetup_L1TMuonOverlapFwVersion.cc new file mode 100644 index 0000000000000..b157f4a471204 --- /dev/null +++ b/CondFormats/L1TObjects/src/T_EventSetup_L1TMuonOverlapFwVersion.cc @@ -0,0 +1,4 @@ +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" +#include "FWCore/Utilities/interface/typelookup.h" + +TYPELOOKUP_DATA_REG(L1TMuonOverlapFwVersion); diff --git a/CondFormats/L1TObjects/src/classes.h b/CondFormats/L1TObjects/src/classes.h index 1e8a970371d25..53469ea1c2d9d 100644 --- a/CondFormats/L1TObjects/src/classes.h +++ b/CondFormats/L1TObjects/src/classes.h @@ -51,6 +51,7 @@ #include "CondFormats/L1TObjects/interface/CaloConfig.h" #include "CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h" +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" #include "CondFormats/L1TObjects/interface/L1TMuonGlobalParams.h" #include "CondFormats/L1TObjects/interface/L1TMuonBarrelParams.h" #include "CondFormats/L1TObjects/interface/L1TMuonBarrelKalmanParams.h" @@ -96,6 +97,8 @@ namespace CondFormats_L1TObjects { // std::vector dummy15; // std::vector dummy15a; // std::vector dummy15b; + L1TMuonOverlapFwVersion dummy15; + L1TMuonGlobalParams dummy16; std::vector dummy16a; diff --git a/CondFormats/L1TObjects/src/classes_def.xml b/CondFormats/L1TObjects/src/classes_def.xml index 158b8cdd2c18b..c2fe776b1ee9c 100644 --- a/CondFormats/L1TObjects/src/classes_def.xml +++ b/CondFormats/L1TObjects/src/classes_def.xml @@ -11,6 +11,9 @@ + + + diff --git a/CondTools/L1TriggerExt/plugins/SealModule.cc b/CondTools/L1TriggerExt/plugins/SealModule.cc index 2042439681653..c70f0c4ad507b 100644 --- a/CondTools/L1TriggerExt/plugins/SealModule.cc +++ b/CondTools/L1TriggerExt/plugins/SealModule.cc @@ -61,6 +61,11 @@ REGISTER_L1_WRITER(L1TMuonEndCapParamsO2ORcd, L1TMuonEndCapParams); REGISTER_L1_WRITER(L1TMuonEndCapForestO2ORcd, L1TMuonEndCapForest); +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h" + +REGISTER_L1_WRITER(L1TMuonOverlapFwVersionO2ORcd, L1TMuonOverlapFwVersion); + #include "CondFormats/L1TObjects/interface/L1TMuonOverlapParams.h" #include "CondFormats/DataRecord/interface/L1TMuonOverlapParamsO2ORcd.h" diff --git a/CondTools/L1TriggerExt/python/L1CondEnumExt_cfi.py b/CondTools/L1TriggerExt/python/L1CondEnumExt_cfi.py index caf9a5edfa075..4800820a6d0c2 100644 --- a/CondTools/L1TriggerExt/python/L1CondEnumExt_cfi.py +++ b/CondTools/L1TriggerExt/python/L1CondEnumExt_cfi.py @@ -11,5 +11,6 @@ class L1CondEnumExt: L1TCaloParams=7 L1TGlobalPrescalesVetosFract=8 L1TMuonEndCapForest=9 - NumL1Cond=10 + L1TMuonOverlapFwVersion=10 + NumL1Cond=11 diff --git a/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py b/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py index 28a156e988286..afae222e53681 100644 --- a/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py +++ b/CondTools/L1TriggerExt/python/L1ConfigTSCPayloadsExt_cff.py @@ -2,6 +2,7 @@ from L1TriggerConfig.L1TConfigProducers.L1TMuonBarrelParamsOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TMuonGlobalParamsOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapParamsOnline_cfi import * +from L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapFwVersionOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapParamsOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TMuonEndCapForestOnline_cfi import * from L1TriggerConfig.L1TConfigProducers.L1TCaloParamsOnline_cfi import * @@ -16,6 +17,7 @@ def setTSCPayloadsDB(process, DBConnect, DBAuth, protoDBConnect, protoDBAuth): process.L1TMuonEndCapForestOnlineProd.onlineDB = cms.string( DBConnect ) process.L1TMuonGlobalParamsOnlineProd.onlineDB = cms.string( DBConnect ) process.L1TMuonOverlapParamsOnlineProd.onlineDB = cms.string( DBConnect ) + process.L1TMuonOverlapFwVersionOnlineProd.onlineDB = cms.string( DBConnect ) process.L1TUtmTriggerMenuOnlineProd.onlineDB = cms.string( DBConnect ) process.L1TCaloParamsOnlineProd.onlineAuthentication = cms.string( DBAuth ) @@ -25,15 +27,18 @@ def setTSCPayloadsDB(process, DBConnect, DBAuth, protoDBConnect, protoDBAuth): process.L1TMuonEndCapForestOnlineProd.onlineAuthentication = cms.string( DBAuth ) process.L1TMuonGlobalParamsOnlineProd.onlineAuthentication = cms.string( DBAuth ) process.L1TMuonOverlapParamsOnlineProd.onlineAuthentication = cms.string( DBAuth ) + process.L1TMuonOverlapFwVersionOnlineProd.onlineAuthentication = cms.string( DBAuth ) process.L1TUtmTriggerMenuOnlineProd.onlineAuthentication = cms.string( DBAuth ) process.l1caloparProtodb.connect = cms.string( protoDBConnect ) process.l1bmtfparProtodb.connect = cms.string( protoDBConnect ) process.l1emtfparProtodb.connect = cms.string( protoDBConnect ) +# process.l1omtfparProtodb.connect = cms.string( protoDBConnect ) process.l1gmtparProtodb.connect = cms.string( protoDBConnect ) process.l1caloparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) process.l1bmtfparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) process.l1emtfparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) +# process.l1omtfparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) process.l1gmtparProtodb.DBParameters.authenticationPath = cms.untracked.string( protoDBAuth ) def liftPayloadSafetyFor(process, systems): @@ -55,4 +60,5 @@ def liftPayloadSafetyFor(process, systems): if 'OMTF' in systems: process.L1TMuonOverlapParamsOnlineProd.transactionSafe = cms.bool(False) + process.L1TMuonOverlapFwVersionOnlineProd.transactionSafe = cms.bool(False) diff --git a/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py b/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py index 05bd22acd8757..d63fdbc495aca 100644 --- a/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py +++ b/CondTools/L1TriggerExt/python/L1O2OTagsExt_cfi.py @@ -11,6 +11,7 @@ def initL1O2OTagsExt(): initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TUtmTriggerMenu ] = "Stage2v0_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TGlobalPrescalesVetosFract ] = "Stage2v0_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonBarrelParams ] = "Stage2v1_hlt" + initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonOverlapFwVersion ] = "Stage2v0_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonOverlapParams ] = "Stage2v0_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapParams ] = "Stage2v3_hlt" initL1O2OTagsExt.tagBaseVec[ L1CondEnumExt.L1TMuonEndCapForest ] = "Stage2v1_hlt" diff --git a/CondTools/L1TriggerExt/python/L1SubsystemParamsExt_cfi.py b/CondTools/L1TriggerExt/python/L1SubsystemParamsExt_cfi.py index e9f8009a17a74..2c6b8bf6ed7a4 100644 --- a/CondTools/L1TriggerExt/python/L1SubsystemParamsExt_cfi.py +++ b/CondTools/L1TriggerExt/python/L1SubsystemParamsExt_cfi.py @@ -41,6 +41,12 @@ def initL1SubsystemsExt( tagBaseVec = [], type = cms.string('L1TMuonEndCapForest'), key = cms.string(objectKey) ), + cms.PSet( + record = cms.string('L1TMuonOverlapFwVersionO2ORcd'), + tag = cms.string('L1TMuonOverlapFwVersion_' + tagBaseVec[ L1CondEnumExt.L1TMuonOverlapFwVersion ]), + type = cms.string('L1TMuonOverlapFwVersion'), + key = cms.string(objectKey) + ), cms.PSet( record = cms.string('L1TMuonOverlapParamsO2ORcd'), tag = cms.string('L1TMuonOverlapParams_' + tagBaseVec[ L1CondEnumExt.L1TMuonOverlapParams ]), diff --git a/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.cc b/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.cc new file mode 100644 index 0000000000000..21c82b1d2a320 --- /dev/null +++ b/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.cc @@ -0,0 +1,35 @@ +#include "sstream" + +// user include files +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ESProducts.h" + +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h" + +#include "L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.h" + +L1TMuonOverlapFwVersionESProducer::L1TMuonOverlapFwVersionESProducer(const edm::ParameterSet& theConfig) { + + setWhatProduced(this, &L1TMuonOverlapFwVersionESProducer::produceFwVersion); + + unsigned algoV = theConfig.getParameter("algoVersion"); + unsigned layersV = theConfig.getParameter("layersVersion"); + unsigned patternsV = theConfig.getParameter("patternsVersion"); + std::string sDate = theConfig.getParameter("synthDate"); + params.setAlgoVersion(algoV); + params.setLayersVersion(layersV); + params.setPatternsVersion(patternsV); + params.setSynthDate(sDate); +} + +L1TMuonOverlapFwVersionESProducer::~L1TMuonOverlapFwVersionESProducer() {} + +L1TMuonOverlapFwVersionESProducer::ReturnType L1TMuonOverlapFwVersionESProducer::produceFwVersion(const L1TMuonOverlapFwVersionRcd& iRecord) { + return std::make_unique(params); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonOverlapFwVersionESProducer); diff --git a/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.h b/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.h new file mode 100644 index 0000000000000..5bba71f1d1d29 --- /dev/null +++ b/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.h @@ -0,0 +1,24 @@ +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/Framework/interface/ESProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ESProducts.h" + +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h" + +class L1TMuonOverlapFwVersionESProducer : public edm::ESProducer { +public: + L1TMuonOverlapFwVersionESProducer(const edm::ParameterSet&); + ~L1TMuonOverlapFwVersionESProducer() override; + + using ReturnType = std::unique_ptr; + + ReturnType produceFwVersion(const L1TMuonOverlapFwVersionRcd&); + +private: + L1TMuonOverlapFwVersion params; +}; diff --git a/L1Trigger/L1TMuonOverlap/python/fakeOmtfFwVersion_cff.py b/L1Trigger/L1TMuonOverlap/python/fakeOmtfFwVersion_cff.py new file mode 100644 index 0000000000000..db476ed9048fe --- /dev/null +++ b/L1Trigger/L1TMuonOverlap/python/fakeOmtfFwVersion_cff.py @@ -0,0 +1,18 @@ +import FWCore.ParameterSet.Config as cms + +omtfFwVersionSource = cms.ESSource( + "EmptyESSource", + recordName = cms.string('L1TMuonOverlapFwVersionRcd'), + iovIsRunNotTime = cms.bool(True), + firstValid = cms.vuint32(1) +) + +###OMTF FW ESProducer. +omtfFwVersion = cms.ESProducer( + "L1TMuonOverlapFwVersionESProducer", + algoVersion = cms.uint32(0x110), + layersVersion = cms.uint32(6), + patternsVersion = cms.uint32(3), + synthDate = cms.string("2001-01-01 00:00") +) + diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapFwVersionOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapFwVersionOnline_cfi.py new file mode 100644 index 0000000000000..8b7416bc485d7 --- /dev/null +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapFwVersionOnline_cfi.py @@ -0,0 +1,26 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.L1TMuonOverlap.fakeOmtfFwVersion_cff import * + +#from CondCore.CondDB.CondDB_cfi import CondDB +#CondDB.connect = cms.string('oracle://cms_orcon_prod/CMS_CONDITIONS') +#CondDB.connect = cms.string('oracle://cms_orcon_adg/CMS_CONDITIONS') +#CondDB.connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS') + +#l1omtfparProtodb = cms.ESSource("PoolDBESSource", +# CondDB, +# toGet = cms.VPSet( +# cms.PSet( +# record = cms.string('L1TMuonOverlapFwVersionRcd'), +# tag = cms.string("L1TMuonOverlapFwVersionPrototype_Stage2v0_hlt") +# ) +# ) +#) + +L1TMuonOverlapFwVersionOnlineProd = cms.ESProducer("L1TMuonOverlapFwVersionOnlineProd", + onlineAuthentication = cms.string('.'), + forceGeneration = cms.bool(False), + onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), +# onlineDB = cms.string('oracle://cms_omds_adg/CMS_TRG_R'), + transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what +) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc new file mode 100644 index 0000000000000..a24ec71576916 --- /dev/null +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc @@ -0,0 +1,160 @@ +#include +#include + +#include "CondTools/L1TriggerExt/interface/L1ConfigOnlineProdBaseExt.h" +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h" +#include "L1Trigger/L1TCommon/interface/TriggerSystem.h" +#include "L1Trigger/L1TCommon/interface/XmlConfigParser.h" +#include "OnlineDBqueryHelper.h" + +#include "xercesc/util/PlatformUtils.hpp" +using namespace XERCES_CPP_NAMESPACE; + +class L1TMuonOverlapFwVersionOnlineProd : public L1ConfigOnlineProdBaseExt { +private: + const bool transactionSafe; + const edm::ESGetToken baseSettings_token; + +public: + std::unique_ptr newObject(const std::string& objectKey, const L1TMuonOverlapFwVersionO2ORcd& record) override; + + L1TMuonOverlapFwVersionOnlineProd(const edm::ParameterSet&); + ~L1TMuonOverlapFwVersionOnlineProd(void) override {} +}; + +void replaceAll(std::string& str, const std::string& from, const std::string& to) { + if(from.empty()) + return; + size_t start_pos = 0; + while((start_pos = str.find(from, start_pos)) != std::string::npos) { + str.replace(start_pos, from.length(), to); + start_pos += to.length(); + } +} + +void removeAll(std::string& str, const std::string& from, const std::string& to) { + if(from.empty()) + return; + size_t start_pos = 0; + while((start_pos = str.find(from, start_pos)) != std::string::npos) { + size_t end_pos = str.find(to) + to.length(); + int length = end_pos - start_pos; + str.replace(start_pos, length, ""); + } +} + +L1TMuonOverlapFwVersionOnlineProd::L1TMuonOverlapFwVersionOnlineProd(const edm::ParameterSet& iConfig) + : L1ConfigOnlineProdBaseExt(iConfig), + transactionSafe(iConfig.getParameter("transactionSafe")), + baseSettings_token(wrappedSetWhatProduced(iConfig).consumes()) {} + +std::unique_ptr L1TMuonOverlapFwVersionOnlineProd::newObject( + const std::string& objectKey, const L1TMuonOverlapFwVersionO2ORcd& record) { + + const L1TMuonOverlapFwVersionRcd& baseRcd = record.template getRecord(); + auto const& baseSettings = baseRcd.get(baseSettings_token); + + if (objectKey.empty()) { + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "Key is empty, returning empty L1TMuonOverlapFwVersion"; + if (transactionSafe) + throw std::runtime_error("SummaryForFunctionManager: OMTF | Faulty | Empty objectKey"); + else { + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "returning unmodified prototype of L1TMuonOverlapFwVersion"; + return std::make_unique(baseSettings); + } + } + + edm::LogInfo("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") + << "Producing L1TMuonOverlapFwVersion for key = " << objectKey; + + std::string infra_payload, payload, hw_fake; + std::string algoV_string, layersV_string, patternsV_string, synthDate; + + try { + + infra_payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "OMTF_CLOBS", objectKey, m_omdsReader)["CONF"]; +// removeAll(infra_payload,""); + + } catch (std::runtime_error& e) { + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << e.what(); + if (transactionSafe) + throw std::runtime_error(std::string("SummaryForFunctionManager: OMTF | Faulty | ") + e.what()); + else { + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "returning unmodified prototype of L1TMuonOverlapFwVersion"; + return std::make_unique(baseSettings); + } + } + // for debugging dump the configs to local files + { + std::ofstream output(std::string("/tmp/").append(objectKey.substr(0, objectKey.find('/'))).append(".xml")); + output << objectKey; + output.close(); + } + +// finally push all payloads to the XML parser and construct the TrigSystem object + l1t::XmlConfigParser xmlRdr; + l1t::TriggerSystem parsedXMLs; + + try { + +// no need to read all the HW settings, just define a dummy processor + hw_fake = " "; + xmlRdr.readDOMFromString(hw_fake); + parsedXMLs.addProcessor("processors", "processors", "all_crates", "all_slots"); + xmlRdr.readRootElement(parsedXMLs); + +// INFRA payload needs some editing to be suitable for the standard XML parser +// replaceAll(infra_payload,"infra","algo"); +// removeAll(infra_payload,""); + payload = " "; + std::string str_P1 = infra_payload.substr(infra_payload.find(""),std::string::npos); + std::string str_P2 = str_P1.substr(0,str_P1.find("") + 10); + payload.append(str_P2); + payload.append(" "); + xmlRdr.readDOMFromString(payload); + xmlRdr.readRootElement(parsedXMLs); + + parsedXMLs.setConfigured(); + + } catch (std::runtime_error& e) { + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << e.what(); + if (transactionSafe) + throw std::runtime_error(std::string("SummaryForFunctionManager: OMTF | Faulty at parsing XML | ") + e.what()); + else { + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "returning unmodified prototype of L1TMuonOverlapFwVersion"; + return std::make_unique(baseSettings); + } + } + + std::map conf = parsedXMLs.getParameters("processors"); + algoV_string = conf["algorithmVer"].getValueAsStr(); + layersV_string = conf["layersVer"].getValueAsStr(); + patternsV_string = conf["patternsVer"].getValueAsStr(); + synthDate = conf["synthDate"].getValueAsStr(); + +// DEBUG PRINTOUTS TO BE REMOVED LATER +// std::cout<<" *** objectKey: "<> algoV; + sslayersV << std::hex << layersV_string.c_str(); + sslayersV >> layersV; + sspatternsV << std::hex << patternsV_string.c_str(); + sspatternsV >> patternsV; + auto retval = std::make_unique(algoV,layersV,patternsV,synthDate); + + edm::LogInfo("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "SummaryForFunctionManager: OMTF | OK | All looks good"; + return retval; +} + +//define this as a plug-in +DEFINE_FWK_EVENTSETUP_MODULE(L1TMuonOverlapFwVersionOnlineProd); diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc index 39e591c74b39d..a02f53af62e04 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc @@ -1,6 +1,7 @@ #include #include "CondTools/L1TriggerExt/interface/L1ObjectKeysOnlineProdBaseExt.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "OnlineDBqueryHelper.h" class L1TMuonOverlapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt { private: @@ -19,36 +20,43 @@ L1TMuonOverlapObjectKeysOnlineProd::L1TMuonOverlapObjectKeysOnlineProd(const edm } void L1TMuonOverlapObjectKeysOnlineProd::fillObjectKeys(L1TriggerKeyExt* pL1TriggerKey) { - std::string OMTFKey = pL1TriggerKey->subsystemKey(L1TriggerKeyExt::kOMTF); - std::string stage2Schema = "CMS_TRG_L1_CONF"; + std::string OMTFKey = pL1TriggerKey->subsystemKey(L1TriggerKeyExt::kOMTF); std::string tscKey = OMTFKey.substr(0, OMTFKey.find(':')); + std::string algo_key, infra_key; - std::vector queryStrings; - queryStrings.push_back("ALGO"); +// L1TMuonOverlapFwVersion and L1TMuonOverlapParams keys to be found from INFRA and ALGO, respectively - std::string algo_key; + try { - // select ALGO from CMS_TRG_L1_CONF.OMTF_KEYS where ID = tscKey ; - l1t::OMDSReader::QueryResults queryResult = m_omdsReader.basicQuery( - queryStrings, stage2Schema, "OMTF_KEYS", "OMTF_KEYS.ID", m_omdsReader.singleAttribute(tscKey)); + std::map keys = + l1t::OnlineDBqueryHelper::fetch({"ALGO", "INFRA"}, "OMTF_KEYS", tscKey, m_omdsReader); + algo_key = keys["ALGO"]; + infra_key = keys["INFRA"]; - if (queryResult.queryFailed() || queryResult.numberRows() != 1 || !queryResult.fillVariable("ALGO", algo_key)) { - edm::LogError("L1-O2O L1TMuonOverlapObjectKeysOnlineProd") << "Cannot get OMTF_KEYS.ALGO "; + } catch (std::runtime_error& e) { + + edm::LogError("L1-O2O L1TMuonOverlapObjectKeysOnlineProd") << "Cannot get OMTF_KEYS "; if (transactionSafe) throw std::runtime_error("SummaryForFunctionManager: OMTF | Faulty | Broken key"); else { + edm::LogError("L1-O2O: L1TMuonOverlapObjectKeysOnlineProd") + << "forcing L1TMuonOverlapFwVersion key to be = 'OMTF_INFRA_EMPTY' with baseline settings"; + pL1TriggerKey->add("L1TMuonOverlapFwVersionO2ORcd", "L1TMuonOverlapFwVersion", "OMTF_INFRA_EMPTY"); edm::LogError("L1-O2O: L1TMuonOverlapObjectKeysOnlineProd") << "forcing L1TMuonOverlapParams key to be = 'OMTF_ALGO_EMPTY' (known to exist)"; pL1TriggerKey->add("L1TMuonOverlapParamsO2ORcd", "L1TMuonOverlapParams", "OMTF_ALGO_EMPTY"); return; } + } - // simply assign the algo key to the record + pL1TriggerKey->add("L1TMuonOverlapFwVersionO2ORcd", "L1TMuonOverlapFwVersion", infra_key); + pL1TriggerKey->add("L1TMuonOverlapParamsO2ORcd", "L1TMuonOverlapParams", algo_key); + } //define this as a plug-in diff --git a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc new file mode 100644 index 0000000000000..bdfbd00f72bfc --- /dev/null +++ b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc @@ -0,0 +1,67 @@ +#include +#include + +#include "FWCore/Framework/interface/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" + +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h" +#include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h" +#include "CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CondCore/DBOutputService/interface/PoolDBOutputService.h" +#include "CondCore/CondDB/interface/Session.h" + +using namespace std; + +class L1TMuonOverlapFwVersionTester : public edm::EDAnalyzer { +private: + bool isO2Opayload; + bool writeToDB; + +public: + void analyze(const edm::Event &, const edm::EventSetup &) override; + + explicit L1TMuonOverlapFwVersionTester(const edm::ParameterSet &pset) : edm::EDAnalyzer() { + isO2Opayload = pset.getUntrackedParameter("isO2Opayload", false); + writeToDB = pset.getUntrackedParameter("writeToDB", false); + } + ~L1TMuonOverlapFwVersionTester(void) override {} +}; + +void L1TMuonOverlapFwVersionTester::analyze(const edm::Event &iEvent, const edm::EventSetup &evSetup) { + edm::ESHandle handle1; + if (isO2Opayload) + evSetup.get().get(handle1); + else + evSetup.get().get(handle1); + std::shared_ptr ptr1(new L1TMuonOverlapFwVersion(*(handle1.product()))); + + cout << "Contents of L1TMuonOverlapFwVersion: " << endl; + + cout << " algoVersion() = " << ptr1->algoVersion() << endl; + cout << " layersVersion() = " << ptr1->layersVersion() << endl; + cout << " patternsVersion() = " << ptr1->patternsVersion() << endl; + cout << " synthDate() = " << ptr1->synthDate() << endl; + + if (writeToDB) { + edm::Service poolDb; + if (poolDb.isAvailable()) { + cout << "Writing payload to DB" << endl; + cond::Time_t firstSinceTime = poolDb->beginOfTime(); + poolDb->writeOne( + ptr1.get(), firstSinceTime, (isO2Opayload ? "L1TMuonOverlapFwVersionO2ORcd" : "L1TMuonOverlapFwVersionRcd")); + } + } + +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ModuleFactory.h" + +DEFINE_FWK_MODULE(L1TMuonOverlapFwVersionTester); diff --git a/L1TriggerConfig/Utilities/test/dumpL1TMuonOverlapFwVersion.py b/L1TriggerConfig/Utilities/test/dumpL1TMuonOverlapFwVersion.py new file mode 100644 index 0000000000000..d2734c02269b2 --- /dev/null +++ b/L1TriggerConfig/Utilities/test/dumpL1TMuonOverlapFwVersion.py @@ -0,0 +1,121 @@ +from __future__ import print_function +# to test the communication with DBS and produce the csctf configuration +import FWCore.ParameterSet.Config as cms + +process = cms.Process("QWE") +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cout.enable = cms.untracked.bool(True) +process.MessageLogger.cout.threshold = cms.untracked.string('INFO') +process.MessageLogger.debugModules = cms.untracked.vstring('*') + +import FWCore.ParameterSet.VarParsing as VarParsing +options = VarParsing.VarParsing() +options.register('topKey', + '', # empty default value +# 'TSCKEY_DUMMY:RSKEY_DUMMY', + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "object key") +options.register('systemKey', +# '', # empty default value + 'L1TMuonOverlapFwVersion_DUMMY', + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "object key") +options.register('outputDBConnect', + 'sqlite_file:./l1config.db', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Connection string for output DB") +options.register('DBConnect', + 'oracle://cms_omds_adg/CMS_TRG_R', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "OMDS connect string") +options.register('DBAuth', + '.', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Authentication path for the DB") +options.parseArguments() + +# sanity checks +if ( len(options.topKey) and len(options.systemKey) ) or ( len(options.topKey)==0 and len(options.systemKey)==0 ) : + print("Specify either the topKey (top-level tsc:rs key) or systemKey (system specific tsc:rs key), but not both") + exit(1) + +# standard CMSSW stuff +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) +process.source = cms.Source("EmptySource") + +# add dummy L1TriggerKeyList so as to suppress framework related warning +process.load("CondTools.L1TriggerExt.L1TriggerKeyListDummyExt_cff") + +# produce L1TriggerKey for the subsystem online producers +if len(options.topKey) : + # parent L1TriggerKey that will seed system-specific key to be automatically generated below + process.load("CondTools.L1TriggerExt.L1TriggerKeyRcdSourceExt_cfi") + process.load("CondTools.L1TriggerExt.L1SubsystemKeysOnlineExt_cfi") + process.L1SubsystemKeysOnlineExt.tscKey = cms.string( options.topKey.split(':')[0] ) + process.L1SubsystemKeysOnlineExt.rsKey = cms.string( options.topKey.split(':')[1] ) + process.L1SubsystemKeysOnlineExt.onlineAuthentication = cms.string( options.DBAuth ) + process.L1SubsystemKeysOnlineExt.forceGeneration = cms.bool(True) + # using the parent L1TriggerKey above start generation of system-specific (labeled) L1TriggerKeys and pack them the main (unlabeled) L1TriggerKey (just one subsystem here) + process.load("CondTools.L1TriggerExt.L1TriggerKeyOnlineExt_cfi") + process.L1TriggerKeyOnlineExt.subsystemLabels = cms.vstring('OMTF') + # include the system-specific subkeys ESProducer (generates OMTF labeled L1TriggerKey) + process.load("L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapObjectKeysOnline_cfi") + process.L1TMuonOverlapObjectKeysOnline.onlineAuthentication = cms.string( options.DBAuth ) + process.L1TMuonOverlapObjectKeysOnline.onlineDB = cms.string( options.DBConnect ) +else : + # instantiate manually the system-specific L1TriggerKey using the subsystemKey option + process.load("CondTools.L1TriggerExt.L1TriggerKeyDummyExt_cff") + process.L1TriggerKeyDummyExt.tscKey = cms.string('TSCKEY_DUMMY') + process.L1TriggerKeyDummyExt.objectKeys = cms.VPSet( + cms.PSet( + record = cms.string('L1TMuonOverlapFwVersionO2ORcd'), + type = cms.string('L1TMuonOverlapFwVersion'), + key = cms.string(options.systemKey) + ) + ) + +# Online producer for the payload +process.load("L1TriggerConfig.L1TConfigProducers.L1TMuonOverlapFwVersionOnline_cfi") +#process.load("L1Trigger.L1TMuonOverlap.fakeOmtfFwVersion_cff") +#process.L1TMuonOverlapFwVersionOnlineProd.onlineAuthentication = cms.string( options.DBAuth ) +#process.L1TMuonOverlapFwVersionOnlineProd.onlineDB = cms.string( options.DBConnect ) +# +process.getter = cms.EDAnalyzer("EventSetupRecordDataGetter", + toGet = cms.VPSet(cms.PSet( + record = cms.string('L1TMuonOverlapFwVersionO2ORcd'), +# record = cms.string('L1TMuonOverlapFwVersionRcd'), + data = cms.vstring('L1TMuonOverlapFwVersion') + )), + verbose = cms.untracked.bool(True) +) + +process.l1mow = cms.EDAnalyzer("L1TMuonOverlapFwVersionTester", writeToDB = cms.untracked.bool(True), isO2Opayload = cms.untracked.bool(False)) + +from CondCore.CondDB.CondDB_cfi import CondDB +CondDB.connect = cms.string(options.outputDBConnect) + +outputDB = cms.Service("PoolDBOutputService", + CondDB, + toPut = cms.VPSet( + cms.PSet( +# record = cms.string('L1TMuonOverlapFwVersionO2ORcd'), + record = cms.string('L1TMuonOverlapFwVersionRcd'), + tag = cms.string('L1TMuonOverlapFwVersion_Stage2v0_hlt') + ), + cms.PSet( + record = cms.string("L1TriggerKeyListExtRcd"), + tag = cms.string("L1TriggerKeyListExt_Stage2v0_hlt") + ) + ) +) + +outputDB.DBParameters.authenticationPath = options.DBAuth +process.add_(outputDB) + +process.p = cms.Path(process.getter + process.l1mow) + diff --git a/L1TriggerConfig/Utilities/test/uploadOmtfFwVersion.py b/L1TriggerConfig/Utilities/test/uploadOmtfFwVersion.py new file mode 100644 index 0000000000000..5ff6d02b91ee2 --- /dev/null +++ b/L1TriggerConfig/Utilities/test/uploadOmtfFwVersion.py @@ -0,0 +1,42 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("tester") +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cout.enable = cms.untracked.bool(True) +process.MessageLogger.cout.threshold = cms.untracked.string('DEBUG') +process.MessageLogger.debugModules = cms.untracked.vstring('*') + +process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(3)) +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) + +process.load("L1Trigger.L1TMuonOverlap.fakeOmtfFwVersion_cff") + +process.getter = cms.EDAnalyzer("EventSetupRecordDataGetter", + toGet = cms.VPSet( + cms.PSet( + record = cms.string('L1TMuonOverlapFwVersionRcd'), + data = cms.vstring('L1TMuonOverlapFwVersion') + ) + ), + verbose = cms.untracked.bool(True) +) + +from CondCore.CondDB.CondDB_cfi import CondDB +CondDB.connect = cms.string('sqlite:l1config.db') + +outputDB = cms.Service("PoolDBOutputService", + CondDB, + toPut = cms.VPSet( + cms.PSet( + record = cms.string('L1TMuonOverlapFwVersionRcd'), + tag = cms.string('L1TMuonOverlapFwVersionPrototype_Stage2v0_hlt') + ) + ) +) +outputDB.DBParameters.authenticationPath = '.' +process.add_(outputDB) + +process.l1opw = cms.EDAnalyzer("L1TMuonOverlapFwVersionTester", isO2Opayload = cms.untracked.bool(False), writeToDB = cms.untracked.bool(True)) + +process.p = cms.Path(process.getter + process.l1opw) + diff --git a/L1TriggerConfig/Utilities/test/viewOmtfFwVersion.py b/L1TriggerConfig/Utilities/test/viewOmtfFwVersion.py new file mode 100644 index 0000000000000..00328d27479f9 --- /dev/null +++ b/L1TriggerConfig/Utilities/test/viewOmtfFwVersion.py @@ -0,0 +1,57 @@ +from __future__ import print_function +import FWCore.ParameterSet.Config as cms + +process = cms.Process("tester") +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cout.enable = cms.untracked.bool(True) +process.MessageLogger.cout.threshold = cms.untracked.string('DEBUG') +process.MessageLogger.debugModules = cms.untracked.vstring('*') + +import FWCore.ParameterSet.VarParsing as VarParsing +options = VarParsing.VarParsing() +options.register('db', + 'static', + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Source DB: prod/prep/static/sqlite" +) +options.register('run', + 1, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int, + "Run (IOV)" +) +options.parseArguments() + +if options.db == "static" : + process.load('L1Trigger.L1TMuonOverlap.fakeOmtfFwVersion_cff') +else : + if options.db == "prod" : + sourceDB = "frontier://FrontierProd/CMS_CONDITIONS" + elif options.db == "prep" : + sourceDB = "frontier://FrontierPrep/CMS_CONDITIONS" + elif "sqlite" in options.db : + sourceDB = options.db + else : + print("Unknown input DB: ", options.db, " should be static/prod/prep/sqlite:...") + exit(0) + + from CondCore.CondDB.CondDB_cfi import CondDB + CondDB.connect = cms.string(sourceDB) + process.l1conddb = cms.ESSource("PoolDBESSource", + CondDB, + toGet = cms.VPSet( + cms.PSet( + record = cms.string('L1TMuonOverlapFwVersionRcd'), + tag = cms.string("L1TMuonOverlapFwVersionPrototype_Stage2v0_hlt") + ) + ) + ) + +process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(options.run)) +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) + +process.l1mor = cms.EDAnalyzer("L1TMuonOverlapFwVersionTester", isO2Opayload = cms.untracked.bool(False), writeToDB = cms.untracked.bool(False)) + +process.p = cms.Path(process.l1mor) + From 932db3bdd18f21cbb04fc0189c82a7cb43cf6c06 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Wed, 20 Oct 2021 16:04:01 +0200 Subject: [PATCH 02/11] Minor cosmetics --- .../src/L1TMuonOverlapFwVersionOnlineProd.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc index a24ec71576916..3047f66f6c03c 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc @@ -69,13 +69,13 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd edm::LogInfo("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "Producing L1TMuonOverlapFwVersion for key = " << objectKey; - std::string infra_payload, payload, hw_fake; + std::string payload, hw_fake; std::string algoV_string, layersV_string, patternsV_string, synthDate; try { - infra_payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "OMTF_CLOBS", objectKey, m_omdsReader)["CONF"]; -// removeAll(infra_payload,""); + payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "OMTF_CLOBS", objectKey, m_omdsReader)["CONF"]; +// removeAll(payload,""); } catch (std::runtime_error& e) { edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << e.what(); @@ -106,13 +106,9 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd xmlRdr.readRootElement(parsedXMLs); // INFRA payload needs some editing to be suitable for the standard XML parser -// replaceAll(infra_payload,"infra","algo"); -// removeAll(infra_payload,""); - payload = " "; - std::string str_P1 = infra_payload.substr(infra_payload.find(""),std::string::npos); - std::string str_P2 = str_P1.substr(0,str_P1.find("") + 10); - payload.append(str_P2); - payload.append(" "); + replaceAll(payload,"infra","algo"); + removeAll(payload,""); + removeAll(payload,""); xmlRdr.readDOMFromString(payload); xmlRdr.readRootElement(parsedXMLs); From a18830ad994fd41d938b8d9891c14f93eb6971a4 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Thu, 28 Oct 2021 10:50:33 +0200 Subject: [PATCH 03/11] Add L1TriggerKeyExt and L1TriggerKeyListExt as per Hyejin Kwon's request --- CondCore/Utilities/plugins/Module_2XML.cc | 2 ++ CondCore/Utilities/src/CondFormats.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CondCore/Utilities/plugins/Module_2XML.cc b/CondCore/Utilities/plugins/Module_2XML.cc index dfad2d48a81c7..6f8f8116fde77 100644 --- a/CondCore/Utilities/plugins/Module_2XML.cc +++ b/CondCore/Utilities/plugins/Module_2XML.cc @@ -203,6 +203,8 @@ PAYLOAD_2XML_MODULE(pluginUtilities_payload2xml) { PAYLOAD_2XML_CLASS(L1TUtmTriggerMenu); PAYLOAD_2XML_CLASS(L1TriggerKey); PAYLOAD_2XML_CLASS(L1TriggerKeyList); + PAYLOAD_2XML_CLASS(L1TriggerKeyExt); + PAYLOAD_2XML_CLASS(L1TriggerKeyListExt); PAYLOAD_2XML_CLASS(LHCInfo); PAYLOAD_2XML_CLASS(METCorrectorParametersCollection); PAYLOAD_2XML_CLASS(MEtXYcorrectParametersCollection); diff --git a/CondCore/Utilities/src/CondFormats.h b/CondCore/Utilities/src/CondFormats.h index 91a9a69f156b2..2d6d8505b9a7b 100644 --- a/CondCore/Utilities/src/CondFormats.h +++ b/CondCore/Utilities/src/CondFormats.h @@ -262,6 +262,8 @@ #include "CondFormats/L1TObjects/interface/L1TGlobalPrescalesVetosFract.h" #include "CondFormats/L1TObjects/interface/L1TriggerKey.h" #include "CondFormats/L1TObjects/interface/L1TriggerKeyList.h" +#include "CondFormats/L1TObjects/interface/L1TriggerKeyExt.h" +#include "CondFormats/L1TObjects/interface/L1TriggerKeyListExt.h" #include "CondFormats/PhysicsToolsObjects/interface/Histogram3D.h" #include "CondFormats/PhysicsToolsObjects/interface/PerformancePayload.h" #include "CondFormats/PhysicsToolsObjects/interface/PerformancePayloadFromTFormula.h" From 250d619bf5e78fa43e2b76a77b872ab6993d3d64 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Thu, 28 Oct 2021 11:04:37 +0200 Subject: [PATCH 04/11] Remove unnecessary commented lines --- .../python/L1TMuonOverlapFwVersionOnline_cfi.py | 16 ---------------- .../src/L1TMuonOverlapFwVersionOnlineProd.cc | 9 --------- 2 files changed, 25 deletions(-) diff --git a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapFwVersionOnline_cfi.py b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapFwVersionOnline_cfi.py index 8b7416bc485d7..cd7f616b3d9ef 100644 --- a/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapFwVersionOnline_cfi.py +++ b/L1TriggerConfig/L1TConfigProducers/python/L1TMuonOverlapFwVersionOnline_cfi.py @@ -2,25 +2,9 @@ from L1Trigger.L1TMuonOverlap.fakeOmtfFwVersion_cff import * -#from CondCore.CondDB.CondDB_cfi import CondDB -#CondDB.connect = cms.string('oracle://cms_orcon_prod/CMS_CONDITIONS') -#CondDB.connect = cms.string('oracle://cms_orcon_adg/CMS_CONDITIONS') -#CondDB.connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS') - -#l1omtfparProtodb = cms.ESSource("PoolDBESSource", -# CondDB, -# toGet = cms.VPSet( -# cms.PSet( -# record = cms.string('L1TMuonOverlapFwVersionRcd'), -# tag = cms.string("L1TMuonOverlapFwVersionPrototype_Stage2v0_hlt") -# ) -# ) -#) - L1TMuonOverlapFwVersionOnlineProd = cms.ESProducer("L1TMuonOverlapFwVersionOnlineProd", onlineAuthentication = cms.string('.'), forceGeneration = cms.bool(False), onlineDB = cms.string('oracle://CMS_OMDS_LB/CMS_TRG_R'), -# onlineDB = cms.string('oracle://cms_omds_adg/CMS_TRG_R'), transactionSafe = cms.bool(True) # nothrow guarantee if set to False: carry on no matter what ) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc index 3047f66f6c03c..cf36dd523f23c 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc @@ -75,7 +75,6 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd try { payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "OMTF_CLOBS", objectKey, m_omdsReader)["CONF"]; -// removeAll(payload,""); } catch (std::runtime_error& e) { edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << e.what(); @@ -130,14 +129,6 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd patternsV_string = conf["patternsVer"].getValueAsStr(); synthDate = conf["synthDate"].getValueAsStr(); -// DEBUG PRINTOUTS TO BE REMOVED LATER -// std::cout<<" *** objectKey: "< Date: Wed, 10 Nov 2021 10:42:16 +0100 Subject: [PATCH 05/11] Cosmetics requested by code-checks --- .../interface/L1TMuonOverlapFwVersionRcd.h | 3 +- .../interface/L1TMuonOverlapFwVersion.h | 8 +-- .../L1TMuonOverlapFwVersionESProducer.cc | 4 +- .../src/L1TMuonOverlapFwVersionOnlineProd.cc | 49 ++++++++++--------- .../src/L1TMuonOverlapObjectKeysOnlineProd.cc | 9 +--- .../src/L1TMuonOverlapFwVersionTester.cc | 3 +- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h b/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h index 4229c7158912f..7a2d86948982f 100644 --- a/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h +++ b/CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h @@ -20,6 +20,7 @@ #include "FWCore/Framework/interface/EventSetupRecordImplementation.h" -class L1TMuonOverlapFwVersionRcd : public edm::eventsetup::EventSetupRecordImplementation {}; +class L1TMuonOverlapFwVersionRcd : public edm::eventsetup::EventSetupRecordImplementation { +}; #endif diff --git a/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h b/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h index 64bf3d50931e3..a0b8647b5125d 100644 --- a/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h +++ b/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h @@ -21,10 +21,10 @@ class L1TMuonOverlapFwVersion { synthDate_ = "2018-9-18 21:26:2"; } L1TMuonOverlapFwVersion(unsigned algoV, unsigned layersV, unsigned patternsV, std::string sDate){ - algorithmVer_ = algoV; - layersVer_ = layersV; - patternsVer_ = patternsV; - synthDate_ = sDate; + algorithmVer_ = algoV; + layersVer_ = layersV; + patternsVer_ = patternsV; + synthDate_ = sDate; } ~L1TMuonOverlapFwVersion() {} diff --git a/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.cc b/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.cc index 21c82b1d2a320..82ca9f64334ac 100644 --- a/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.cc +++ b/L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.cc @@ -12,7 +12,6 @@ #include "L1Trigger/L1TMuonOverlap/plugins/L1TMuonOverlapFwVersionESProducer.h" L1TMuonOverlapFwVersionESProducer::L1TMuonOverlapFwVersionESProducer(const edm::ParameterSet& theConfig) { - setWhatProduced(this, &L1TMuonOverlapFwVersionESProducer::produceFwVersion); unsigned algoV = theConfig.getParameter("algoVersion"); @@ -27,7 +26,8 @@ L1TMuonOverlapFwVersionESProducer::L1TMuonOverlapFwVersionESProducer(const edm:: L1TMuonOverlapFwVersionESProducer::~L1TMuonOverlapFwVersionESProducer() {} -L1TMuonOverlapFwVersionESProducer::ReturnType L1TMuonOverlapFwVersionESProducer::produceFwVersion(const L1TMuonOverlapFwVersionRcd& iRecord) { +L1TMuonOverlapFwVersionESProducer::ReturnType L1TMuonOverlapFwVersionESProducer::produceFwVersion( + const L1TMuonOverlapFwVersionRcd& iRecord) { return std::make_unique(params); } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc index cf36dd523f23c..6e60c4a6255d4 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc @@ -12,33 +12,35 @@ #include "xercesc/util/PlatformUtils.hpp" using namespace XERCES_CPP_NAMESPACE; -class L1TMuonOverlapFwVersionOnlineProd : public L1ConfigOnlineProdBaseExt { +class L1TMuonOverlapFwVersionOnlineProd + : public L1ConfigOnlineProdBaseExt { private: const bool transactionSafe; const edm::ESGetToken baseSettings_token; public: - std::unique_ptr newObject(const std::string& objectKey, const L1TMuonOverlapFwVersionO2ORcd& record) override; + std::unique_ptr newObject(const std::string& objectKey, + const L1TMuonOverlapFwVersionO2ORcd& record) override; L1TMuonOverlapFwVersionOnlineProd(const edm::ParameterSet&); ~L1TMuonOverlapFwVersionOnlineProd(void) override {} }; void replaceAll(std::string& str, const std::string& from, const std::string& to) { - if(from.empty()) + if (from.empty()) return; size_t start_pos = 0; - while((start_pos = str.find(from, start_pos)) != std::string::npos) { + while ((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); } } void removeAll(std::string& str, const std::string& from, const std::string& to) { - if(from.empty()) + if (from.empty()) return; size_t start_pos = 0; - while((start_pos = str.find(from, start_pos)) != std::string::npos) { + while ((start_pos = str.find(from, start_pos)) != std::string::npos) { size_t end_pos = str.find(to) + to.length(); int length = end_pos - start_pos; str.replace(start_pos, length, ""); @@ -47,21 +49,22 @@ void removeAll(std::string& str, const std::string& from, const std::string& to) L1TMuonOverlapFwVersionOnlineProd::L1TMuonOverlapFwVersionOnlineProd(const edm::ParameterSet& iConfig) : L1ConfigOnlineProdBaseExt(iConfig), - transactionSafe(iConfig.getParameter("transactionSafe")), - baseSettings_token(wrappedSetWhatProduced(iConfig).consumes()) {} + transactionSafe(iConfig.getParameter("transactionSafe")), + baseSettings_token(wrappedSetWhatProduced(iConfig).consumes()) {} std::unique_ptr L1TMuonOverlapFwVersionOnlineProd::newObject( const std::string& objectKey, const L1TMuonOverlapFwVersionO2ORcd& record) { - const L1TMuonOverlapFwVersionRcd& baseRcd = record.template getRecord(); auto const& baseSettings = baseRcd.get(baseSettings_token); if (objectKey.empty()) { - edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "Key is empty, returning empty L1TMuonOverlapFwVersion"; + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") + << "Key is empty, returning empty L1TMuonOverlapFwVersion"; if (transactionSafe) throw std::runtime_error("SummaryForFunctionManager: OMTF | Faulty | Empty objectKey"); else { - edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "returning unmodified prototype of L1TMuonOverlapFwVersion"; + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") + << "returning unmodified prototype of L1TMuonOverlapFwVersion"; return std::make_unique(baseSettings); } } @@ -73,7 +76,6 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd std::string algoV_string, layersV_string, patternsV_string, synthDate; try { - payload = l1t::OnlineDBqueryHelper::fetch({"CONF"}, "OMTF_CLOBS", objectKey, m_omdsReader)["CONF"]; } catch (std::runtime_error& e) { @@ -81,7 +83,8 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd if (transactionSafe) throw std::runtime_error(std::string("SummaryForFunctionManager: OMTF | Faulty | ") + e.what()); else { - edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "returning unmodified prototype of L1TMuonOverlapFwVersion"; + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") + << "returning unmodified prototype of L1TMuonOverlapFwVersion"; return std::make_unique(baseSettings); } } @@ -92,22 +95,22 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd output.close(); } -// finally push all payloads to the XML parser and construct the TrigSystem object + // finally push all payloads to the XML parser and construct the TrigSystem object l1t::XmlConfigParser xmlRdr; l1t::TriggerSystem parsedXMLs; try { -// no need to read all the HW settings, just define a dummy processor + // no need to read all the HW settings, just define a dummy processor hw_fake = " "; xmlRdr.readDOMFromString(hw_fake); parsedXMLs.addProcessor("processors", "processors", "all_crates", "all_slots"); xmlRdr.readRootElement(parsedXMLs); -// INFRA payload needs some editing to be suitable for the standard XML parser - replaceAll(payload,"infra","algo"); - removeAll(payload,""); - removeAll(payload,""); + // INFRA payload needs some editing to be suitable for the standard XML parser + replaceAll(payload, "infra", "algo"); + removeAll(payload, ""); + removeAll(payload, ""); xmlRdr.readDOMFromString(payload); xmlRdr.readRootElement(parsedXMLs); @@ -118,7 +121,8 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd if (transactionSafe) throw std::runtime_error(std::string("SummaryForFunctionManager: OMTF | Faulty at parsing XML | ") + e.what()); else { - edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "returning unmodified prototype of L1TMuonOverlapFwVersion"; + edm::LogError("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") + << "returning unmodified prototype of L1TMuonOverlapFwVersion"; return std::make_unique(baseSettings); } } @@ -137,9 +141,10 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd sslayersV >> layersV; sspatternsV << std::hex << patternsV_string.c_str(); sspatternsV >> patternsV; - auto retval = std::make_unique(algoV,layersV,patternsV,synthDate); + auto retval = std::make_unique(algoV, layersV, patternsV, synthDate); - edm::LogInfo("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") << "SummaryForFunctionManager: OMTF | OK | All looks good"; + edm::LogInfo("L1-O2O: L1TMuonOverlapFwVersionOnlineProd") + << "SummaryForFunctionManager: OMTF | OK | All looks good"; return retval; } diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc index a02f53af62e04..40f5fc1d4620e 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc @@ -20,23 +20,20 @@ L1TMuonOverlapObjectKeysOnlineProd::L1TMuonOverlapObjectKeysOnlineProd(const edm } void L1TMuonOverlapObjectKeysOnlineProd::fillObjectKeys(L1TriggerKeyExt* pL1TriggerKey) { - std::string OMTFKey = pL1TriggerKey->subsystemKey(L1TriggerKeyExt::kOMTF); std::string tscKey = OMTFKey.substr(0, OMTFKey.find(':')); std::string algo_key, infra_key; -// L1TMuonOverlapFwVersion and L1TMuonOverlapParams keys to be found from INFRA and ALGO, respectively + // L1TMuonOverlapFwVersion and L1TMuonOverlapParams keys to be found from INFRA and ALGO, respectively try { - std::map keys = - l1t::OnlineDBqueryHelper::fetch({"ALGO", "INFRA"}, "OMTF_KEYS", tscKey, m_omdsReader); + l1t::OnlineDBqueryHelper::fetch({"ALGO", "INFRA"}, "OMTF_KEYS", tscKey, m_omdsReader); algo_key = keys["ALGO"]; infra_key = keys["INFRA"]; } catch (std::runtime_error& e) { - edm::LogError("L1-O2O L1TMuonOverlapObjectKeysOnlineProd") << "Cannot get OMTF_KEYS "; if (transactionSafe) @@ -50,13 +47,11 @@ void L1TMuonOverlapObjectKeysOnlineProd::fillObjectKeys(L1TriggerKeyExt* pL1Trig pL1TriggerKey->add("L1TMuonOverlapParamsO2ORcd", "L1TMuonOverlapParams", "OMTF_ALGO_EMPTY"); return; } - } pL1TriggerKey->add("L1TMuonOverlapFwVersionO2ORcd", "L1TMuonOverlapFwVersion", infra_key); pL1TriggerKey->add("L1TMuonOverlapParamsO2ORcd", "L1TMuonOverlapParams", algo_key); - } //define this as a plug-in diff --git a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc index bdfbd00f72bfc..ce05567a1ddeb 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc @@ -54,10 +54,9 @@ void L1TMuonOverlapFwVersionTester::analyze(const edm::Event &iEvent, const edm: cout << "Writing payload to DB" << endl; cond::Time_t firstSinceTime = poolDb->beginOfTime(); poolDb->writeOne( - ptr1.get(), firstSinceTime, (isO2Opayload ? "L1TMuonOverlapFwVersionO2ORcd" : "L1TMuonOverlapFwVersionRcd")); + ptr1.get(), firstSinceTime, (isO2Opayload ? "L1TMuonOverlapFwVersionO2ORcd" : "L1TMuonOverlapFwVersionRcd")); } } - } #include "FWCore/PluginManager/interface/ModuleDef.h" From 686f068a36011ebe464347dd8308a533171489a9 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Wed, 10 Nov 2021 11:01:49 +0100 Subject: [PATCH 06/11] More cosmetics requested by code-checks --- CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h | 4 ++-- .../src/L1TMuonOverlapFwVersionOnlineProd.cc | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h b/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h index a0b8647b5125d..7f7d9b38d1dd6 100644 --- a/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h +++ b/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h @@ -13,14 +13,14 @@ /////////////////////////////////////// class L1TMuonOverlapFwVersion { public: - L1TMuonOverlapFwVersion() { algorithmVer_ = 0x110; layersVer_ = 0x6; patternsVer_ = 0x3; synthDate_ = "2018-9-18 21:26:2"; } - L1TMuonOverlapFwVersion(unsigned algoV, unsigned layersV, unsigned patternsV, std::string sDate){ + L1TMuonOverlapFwVersion(unsigned algoV, unsigned layersV, unsigned patternsV, std::string +sDate){ algorithmVer_ = algoV; layersVer_ = layersV; patternsVer_ = patternsV; diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc index 6e60c4a6255d4..e898b501aa58d 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc @@ -100,7 +100,6 @@ std::unique_ptr L1TMuonOverlapFwVersionOnlineProd l1t::TriggerSystem parsedXMLs; try { - // no need to read all the HW settings, just define a dummy processor hw_fake = " "; xmlRdr.readDOMFromString(hw_fake); From 091846d079865aea8c1f862a85f8e234004b2c3d Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Wed, 10 Nov 2021 11:19:22 +0100 Subject: [PATCH 07/11] More cosmetics requested by code-checks --- CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h b/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h index 7f7d9b38d1dd6..ac28442c22054 100644 --- a/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h +++ b/CondFormats/L1TObjects/interface/L1TMuonOverlapFwVersion.h @@ -19,8 +19,7 @@ class L1TMuonOverlapFwVersion { patternsVer_ = 0x3; synthDate_ = "2018-9-18 21:26:2"; } - L1TMuonOverlapFwVersion(unsigned algoV, unsigned layersV, unsigned patternsV, std::string -sDate){ + L1TMuonOverlapFwVersion(unsigned algoV, unsigned layersV, unsigned patternsV, std::string sDate) { algorithmVer_ = algoV; layersVer_ = layersV; patternsVer_ = patternsV; From 1b551f37d2627ed58c6c97ee70958460e5bfa4d9 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Thu, 11 Nov 2021 14:22:51 +0100 Subject: [PATCH 08/11] Use override = default --- .../L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc | 2 +- .../src/L1TMuonOverlapObjectKeysOnlineProd.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc index e898b501aa58d..9023a8f3b321f 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapFwVersionOnlineProd.cc @@ -23,7 +23,7 @@ class L1TMuonOverlapFwVersionOnlineProd const L1TMuonOverlapFwVersionO2ORcd& record) override; L1TMuonOverlapFwVersionOnlineProd(const edm::ParameterSet&); - ~L1TMuonOverlapFwVersionOnlineProd(void) override {} + ~L1TMuonOverlapFwVersionOnlineProd(void) override = default; }; void replaceAll(std::string& str, const std::string& from, const std::string& to) { diff --git a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc index 40f5fc1d4620e..e6f7c45463b98 100644 --- a/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc +++ b/L1TriggerConfig/L1TConfigProducers/src/L1TMuonOverlapObjectKeysOnlineProd.cc @@ -11,7 +11,7 @@ class L1TMuonOverlapObjectKeysOnlineProd : public L1ObjectKeysOnlineProdBaseExt void fillObjectKeys(L1TriggerKeyExt* pL1TriggerKey) override; L1TMuonOverlapObjectKeysOnlineProd(const edm::ParameterSet&); - ~L1TMuonOverlapObjectKeysOnlineProd(void) override {} + ~L1TMuonOverlapObjectKeysOnlineProd(void) override = default; }; L1TMuonOverlapObjectKeysOnlineProd::L1TMuonOverlapObjectKeysOnlineProd(const edm::ParameterSet& iConfig) From db8c72b87dd980790e87991e1144f5e8ac7b8795 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Thu, 11 Nov 2021 22:08:54 +0100 Subject: [PATCH 09/11] Change ESget to getData, writeOne to writeOneIOV, cout to LogInfo --- .../src/L1TMuonOverlapFwVersionTester.cc | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc index ce05567a1ddeb..4460ecd9d628e 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc @@ -7,7 +7,6 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionRcd.h" #include "CondFormats/DataRecord/interface/L1TMuonOverlapFwVersionO2ORcd.h" @@ -22,6 +21,8 @@ class L1TMuonOverlapFwVersionTester : public edm::EDAnalyzer { private: bool isO2Opayload; bool writeToDB; + edm::ESGetToken esToken; + edm::ESGetToken esToken_O2O; public: void analyze(const edm::Event &, const edm::EventSetup &) override; @@ -29,32 +30,33 @@ class L1TMuonOverlapFwVersionTester : public edm::EDAnalyzer { explicit L1TMuonOverlapFwVersionTester(const edm::ParameterSet &pset) : edm::EDAnalyzer() { isO2Opayload = pset.getUntrackedParameter("isO2Opayload", false); writeToDB = pset.getUntrackedParameter("writeToDB", false); + esToken = esConsumes(); + esToken_O2O = esConsumes(); } - ~L1TMuonOverlapFwVersionTester(void) override {} + ~L1TMuonOverlapFwVersionTester(void) override = default; }; void L1TMuonOverlapFwVersionTester::analyze(const edm::Event &iEvent, const edm::EventSetup &evSetup) { - edm::ESHandle handle1; + L1TMuonOverlapFwVersion data; if (isO2Opayload) - evSetup.get().get(handle1); + data = evSetup.getData(esToken_O2O); else - evSetup.get().get(handle1); - std::shared_ptr ptr1(new L1TMuonOverlapFwVersion(*(handle1.product()))); + data = evSetup.getData(esToken); - cout << "Contents of L1TMuonOverlapFwVersion: " << endl; - - cout << " algoVersion() = " << ptr1->algoVersion() << endl; - cout << " layersVersion() = " << ptr1->layersVersion() << endl; - cout << " patternsVersion() = " << ptr1->patternsVersion() << endl; - cout << " synthDate() = " << ptr1->synthDate() << endl; + edm::LogInfo("L1TMuonOverlapFwVersionTester") + << "*** Contents of L1TMuonOverlapFwVersion: algoVersion() = " << data.algoVersion() + << ", layersVersion() = " << data.layersVersion() + << ", patternsVersion() = " << data.patternsVersion() + << ", synthDate() = " << data.synthDate(); if (writeToDB) { edm::Service poolDb; if (poolDb.isAvailable()) { - cout << "Writing payload to DB" << endl; + edm::LogInfo("L1TMuonOverlapFwVersionTester") + << "*** Writing payload to DB"; cond::Time_t firstSinceTime = poolDb->beginOfTime(); - poolDb->writeOne( - ptr1.get(), firstSinceTime, (isO2Opayload ? "L1TMuonOverlapFwVersionO2ORcd" : "L1TMuonOverlapFwVersionRcd")); + poolDb->writeOneIOV( + data, firstSinceTime, (isO2Opayload ? "L1TMuonOverlapFwVersionO2ORcd" : "L1TMuonOverlapFwVersionRcd")); } } } From 336741019e57255ab45fe194daa2f154bbd8dc39 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Thu, 11 Nov 2021 22:24:35 +0100 Subject: [PATCH 10/11] code-checks --- .../Utilities/src/L1TMuonOverlapFwVersionTester.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc index 4460ecd9d628e..d70d8ef324e15 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc @@ -45,15 +45,13 @@ void L1TMuonOverlapFwVersionTester::analyze(const edm::Event &iEvent, const edm: edm::LogInfo("L1TMuonOverlapFwVersionTester") << "*** Contents of L1TMuonOverlapFwVersion: algoVersion() = " << data.algoVersion() - << ", layersVersion() = " << data.layersVersion() - << ", patternsVersion() = " << data.patternsVersion() + << ", layersVersion() = " << data.layersVersion() << ", patternsVersion() = " << data.patternsVersion() << ", synthDate() = " << data.synthDate(); if (writeToDB) { edm::Service poolDb; if (poolDb.isAvailable()) { - edm::LogInfo("L1TMuonOverlapFwVersionTester") - << "*** Writing payload to DB"; + edm::LogInfo("L1TMuonOverlapFwVersionTester") << "*** Writing payload to DB"; cond::Time_t firstSinceTime = poolDb->beginOfTime(); poolDb->writeOneIOV( data, firstSinceTime, (isO2Opayload ? "L1TMuonOverlapFwVersionO2ORcd" : "L1TMuonOverlapFwVersionRcd")); From 05dd25a759c719f2e829a906480563ff92612ea4 Mon Sep 17 00:00:00 2001 From: Michal Szleper Date: Fri, 12 Nov 2021 10:38:36 +0100 Subject: [PATCH 11/11] Change edm::EDAnalyzer to edm::one::EDAnalyzer<> --- .../Utilities/src/L1TMuonOverlapFwVersionTester.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc index d70d8ef324e15..e6785afc8bf0b 100644 --- a/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc +++ b/L1TriggerConfig/Utilities/src/L1TMuonOverlapFwVersionTester.cc @@ -1,7 +1,7 @@ #include #include -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -17,7 +17,7 @@ using namespace std; -class L1TMuonOverlapFwVersionTester : public edm::EDAnalyzer { +class L1TMuonOverlapFwVersionTester : public edm::one::EDAnalyzer<> { private: bool isO2Opayload; bool writeToDB; @@ -27,7 +27,7 @@ class L1TMuonOverlapFwVersionTester : public edm::EDAnalyzer { public: void analyze(const edm::Event &, const edm::EventSetup &) override; - explicit L1TMuonOverlapFwVersionTester(const edm::ParameterSet &pset) : edm::EDAnalyzer() { + explicit L1TMuonOverlapFwVersionTester(const edm::ParameterSet &pset) : edm::one::EDAnalyzer<>() { isO2Opayload = pset.getUntrackedParameter("isO2Opayload", false); writeToDB = pset.getUntrackedParameter("writeToDB", false); esToken = esConsumes();