diff --git a/CalibTracker/Configuration/python/Tracker_DependentRecords_forGlobalTag_nofakes_cff.py b/CalibTracker/Configuration/python/Tracker_DependentRecords_forGlobalTag_nofakes_cff.py index 51f4de06462d5..f43798b2d39a6 100644 --- a/CalibTracker/Configuration/python/Tracker_DependentRecords_forGlobalTag_nofakes_cff.py +++ b/CalibTracker/Configuration/python/Tracker_DependentRecords_forGlobalTag_nofakes_cff.py @@ -36,15 +36,8 @@ # Default is "False". siStripQualityESProducer.UseEmptyRunInfo = cms.bool(False) -from CalibTracker.SiPixelESProducers.SiPixelQualityESProducer_cfi import * -siPixelQualityESProducer.ListOfRecordToMerge = cms.VPSet( - cms.PSet( record = cms.string("SiPixelQualityFromDbRcd"), - tag = cms.string("") - ), - cms.PSet( record = cms.string("SiPixelDetVOffRcd"), - tag = cms.string("") - ) - ) +from CalibTracker.SiPixelESProducers.siPixelQualityESProducer_cfi import * +from CalibTracker.SiPixelESProducers.siPixelQualityForRawToDigiESProducer_cfi import * # Multiple scattering parametrisation from RecoTracker.TkMSParametrization.multipleScatteringParametrisationMakerESProducer_cfi import * diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixelQualityESProducer.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixelQualityESProducer.cc index 624b4e14aa10e..8e64fea6bba0a 100644 --- a/CalibTracker/SiPixelESProducers/plugins/SiPixelQualityESProducer.cc +++ b/CalibTracker/SiPixelESProducers/plugins/SiPixelQualityESProducer.cc @@ -16,39 +16,27 @@ // // -// system include files #include -#include -// user include files -#include "CalibTracker/Records/interface/SiStripDependentRecords.h" -#include "CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileReader.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" -#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" -#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" -#include "CondFormats/DataRecord/interface/SiPixelQualityFromDbRcd.h" -#include "CalibTracker/Records/interface/SiStripDependentRecords.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESProducer.h" #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" #include "FWCore/Framework/interface/ModuleFactory.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -using namespace edm; +#include "CondFormats/DataRecord/interface/SiPixelQualityFromDbRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" +#include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" class SiPixelQualityESProducer : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder { public: SiPixelQualityESProducer(const edm::ParameterSet& iConfig); - ~SiPixelQualityESProducer() override; + ~SiPixelQualityESProducer() override = default; std::unique_ptr produce(const SiPixelQualityRcd& iRecord); - std::unique_ptr produceWithLabel(const SiPixelQualityRcd& iRecord); - std::unique_ptr produceWithLabelRawToDigi(const SiPixelQualityRcd& iRecord); static void fillDescriptions(edm::ConfigurationDescriptions&); @@ -57,54 +45,29 @@ class SiPixelQualityESProducer : public edm::ESProducer, public edm::EventSetupR const edm::IOVSyncValue&, edm::ValidityInterval&) override; - struct Tokens { - Tokens() = default; - explicit Tokens(edm::ESConsumesCollector cc, const std::string& label) { - voffToken_ = cc.consumes(); - dbobjectToken_ = cc.consumes(edm::ESInputTag{"", label}); - } - edm::ESGetToken voffToken_; - edm::ESGetToken dbobjectToken_; - }; - - std::unique_ptr get_pointer(const SiPixelQualityRcd& iRecord, const Tokens& tokens); - - const Tokens defaultTokens_; - Tokens labelTokens_; - Tokens labelTokens_RawToDigi_; + edm::ESGetToken siPixelQualityFromDbToken_; + edm::ESGetToken voffToken_; }; -// -// constructors and destructor -// +SiPixelQualityESProducer::SiPixelQualityESProducer(const edm::ParameterSet& iConfig) { + // setWhatProduced internally uses "appendToDataLabel" to name the output product of this ESProducer + auto const& appendToDataLabel = iConfig.getParameter("appendToDataLabel"); + auto esCC = setWhatProduced(this); -SiPixelQualityESProducer::SiPixelQualityESProducer(const edm::ParameterSet& conf_) - : defaultTokens_(setWhatProduced(this), "") { - edm::LogInfo("SiPixelQualityESProducer::SiPixelQualityESProducer"); + // "siPixelQualityFromDbLabel" corresponds to the Label of a tag with Record + // "SiPixelQualityFromDbRcd" in the EventSetup (normally provided by the GlobalTag) + auto const& siPixelQualityFromDbLabel = iConfig.getParameter("siPixelQualityFromDbLabel"); + siPixelQualityFromDbToken_ = esCC.consumes(edm::ESInputTag{"", siPixelQualityFromDbLabel}); + voffToken_ = esCC.consumes(); - auto label = conf_.getParameter("siPixelQualityLabel"); - - if (label == "forDigitizer") { - labelTokens_ = - Tokens(setWhatProduced(this, &SiPixelQualityESProducer::produceWithLabel, edm::es::Label(label)), label); - } - - label = conf_.getParameter("siPixelQualityLabel_RawToDigi"); - - if (label == "forRawToDigi") { - labelTokens_RawToDigi_ = Tokens( - setWhatProduced(this, &SiPixelQualityESProducer::produceWithLabelRawToDigi, edm::es::Label(label)), label); - } findingRecord(); -} -SiPixelQualityESProducer::~SiPixelQualityESProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) + edm::LogInfo("SiPixelQualityESProducer") + << "Module = \"" << description().label_ << "\" (appendToDataLabel = \"" << appendToDataLabel + << "\", siPixelQualityFromDbLabel = \"" << siPixelQualityFromDbLabel << "\")"; } -std::unique_ptr SiPixelQualityESProducer::get_pointer(const SiPixelQualityRcd& iRecord, - const Tokens& tokens) { +std::unique_ptr SiPixelQualityESProducer::produce(const SiPixelQualityRcd& iRecord) { /////////////////////////////////////////////////////// // errortype "whole" = int 0 in DB BadRocs = 65535 // // errortype "tbmA" = int 1 in DB BadRocs = 255 // @@ -118,23 +81,13 @@ std::unique_ptr SiPixelQualityESProducer::get_pointer(const SiPi //BadModule.DetID = 1; BadModule.errorType = 0; BadModule.BadRocs = 65535; obj->addDisabledModule(BadModule); //now the dbobject is the one copied from the db - auto dbptr = std::make_unique(iRecord.get(tokens.dbobjectToken_)); + auto dbptr = std::make_unique(iRecord.get(siPixelQualityFromDbToken_)); //here is the magic line in which it switches off Bad Modules - dbptr->add(&(iRecord.get(tokens.voffToken_))); + dbptr->add(&(iRecord.get(voffToken_))); return dbptr; } -std::unique_ptr SiPixelQualityESProducer::produce(const SiPixelQualityRcd& iRecord) { - return get_pointer(iRecord, defaultTokens_); -} -std::unique_ptr SiPixelQualityESProducer::produceWithLabel(const SiPixelQualityRcd& iRecord) { - return get_pointer(iRecord, labelTokens_); -} -std::unique_ptr SiPixelQualityESProducer::produceWithLabelRawToDigi(const SiPixelQualityRcd& iRecord) { - return get_pointer(iRecord, labelTokens_RawToDigi_); -} - void SiPixelQualityESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iosv, edm::ValidityInterval& oValidity) { @@ -144,8 +97,7 @@ void SiPixelQualityESProducer::setIntervalFor(const edm::eventsetup::EventSetupR void SiPixelQualityESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("siPixelQualityLabel", ""); - desc.add("siPixelQualityLabel_RawToDigi", ""); + desc.add("siPixelQualityFromDbLabel", ""); { edm::ParameterSetDescription desc_ps; desc_ps.add("record", "SiPixelQualityFromDbRcd"); diff --git a/CalibTracker/SiPixelESProducers/python/SiPixelQualityESProducer_cfi.py b/CalibTracker/SiPixelESProducers/python/SiPixelQualityESProducer_cfi.py deleted file mode 100644 index 6eddcccb9db8e..0000000000000 --- a/CalibTracker/SiPixelESProducers/python/SiPixelQualityESProducer_cfi.py +++ /dev/null @@ -1,9 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from CalibTracker.SiPixelESProducers.siPixelQualityESProducer_cfi import siPixelQualityESProducer - -from Configuration.ProcessModifiers.siPixelQualityRawToDigi_cff import siPixelQualityRawToDigi -siPixelQualityRawToDigi.toModify(siPixelQualityESProducer, - siPixelQualityLabel_RawToDigi = 'forRawToDigi', -) - diff --git a/CalibTracker/SiPixelESProducers/python/siPixelQualityForDigitizerESProducer_cfi.py b/CalibTracker/SiPixelESProducers/python/siPixelQualityForDigitizerESProducer_cfi.py new file mode 100644 index 0000000000000..64da18394bba7 --- /dev/null +++ b/CalibTracker/SiPixelESProducers/python/siPixelQualityForDigitizerESProducer_cfi.py @@ -0,0 +1,16 @@ +import FWCore.ParameterSet.Config as cms + +from CalibTracker.SiPixelESProducers.siPixelQualityESProducer_cfi import siPixelQualityESProducer as _siPixelQualityESProducer + +siPixelQualityForDigitizerESProducer = _siPixelQualityESProducer.clone( + appendToDataLabel = 'forDigitizer', + siPixelQualityFromDbLabel = 'forDigitizer' +) + +# remove siPixelQualityForDigitizerESProducer when the modifier run2_SiPixel_2018 is not enabled +def _removeSiPixelQualityForDigitizerESProducer(process): + if hasattr(process, 'siPixelQualityForDigitizerESProducer'): + del process.siPixelQualityForDigitizerESProducer + +from Configuration.Eras.Modifier_run2_SiPixel_2018_cff import run2_SiPixel_2018 +removeSiPixelQualityForDigitizerESProducer_ = (~run2_SiPixel_2018).makeProcessModifier( _removeSiPixelQualityForDigitizerESProducer ) diff --git a/CalibTracker/SiPixelESProducers/python/siPixelQualityForRawToDigiESProducer_cfi.py b/CalibTracker/SiPixelESProducers/python/siPixelQualityForRawToDigiESProducer_cfi.py new file mode 100644 index 0000000000000..a6215f82b3ef2 --- /dev/null +++ b/CalibTracker/SiPixelESProducers/python/siPixelQualityForRawToDigiESProducer_cfi.py @@ -0,0 +1,16 @@ +import FWCore.ParameterSet.Config as cms + +from CalibTracker.SiPixelESProducers.siPixelQualityESProducer_cfi import siPixelQualityESProducer as _siPixelQualityESProducer + +siPixelQualityForRawToDigiESProducer = _siPixelQualityESProducer.clone( + appendToDataLabel = 'forRawToDigi', + siPixelQualityFromDbLabel = 'forRawToDigi' +) + +# remove siPixelQualityForRawToDigiESProducer when the modifier siPixelQualityRawToDigi is not enabled +def _removeSiPixelQualityForRawToDigiESProducer(process): + if hasattr(process, 'siPixelQualityForRawToDigiESProducer'): + del process.siPixelQualityForRawToDigiESProducer + +from Configuration.ProcessModifiers.siPixelQualityRawToDigi_cff import siPixelQualityRawToDigi +removeSiPixelQualityForRawToDigiESProducer_ = (~siPixelQualityRawToDigi).makeProcessModifier( _removeSiPixelQualityForRawToDigiESProducer ) diff --git a/CondTools/SiPixel/test/SiPixelBadModule_ESProducer_cfg.py b/CondTools/SiPixel/test/SiPixelBadModule_ESProducer_cfg.py index dac68726e4c01..0674f0a26336b 100644 --- a/CondTools/SiPixel/test/SiPixelBadModule_ESProducer_cfg.py +++ b/CondTools/SiPixel/test/SiPixelBadModule_ESProducer_cfg.py @@ -36,7 +36,7 @@ process.GlobalTag.globaltag = 'START311_V1::All' ###### Quality ESProducer --- copied from SiStripESProducer -process.load("CalibTracker.SiPixelESProducers.SiPixelQualityESProducer_cfi") +process.load("CalibTracker.SiPixelESProducers.siPixelQualityESProducer_cfi") process.GlobalTag.toGet = cms.VPSet( cms.PSet( @@ -66,10 +66,3 @@ ) process.p = cms.Path(process.BadModuleReader) - - - - - - - diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index b3c0b20700909..78e74e812b03e 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -268,6 +268,19 @@ def customizeHLTfor42410(process): return process +def customizeHLTfor42497(process): + for producer in esproducers_by_type(process, 'SiPixelQualityESProducer'): + producer.siPixelQualityFromDbLabel = cms.string('') + producer.appendToDataLabel = '' + for parName in [ + 'siPixelQualityLabel', + 'siPixelQualityLabel_RawToDigi', + ]: + if hasattr(producer, parName): + producer.__delattr__(parName) + + return process + # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): @@ -281,5 +294,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"): process = customizeHLTfor41815(process) process = customizeHLTfor41632(process) process = customizeHLTfor42410(process) + process = customizeHLTfor42497(process) return process diff --git a/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py b/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py index 830d6b28b738c..817422a6a1e79 100644 --- a/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py +++ b/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py @@ -120,10 +120,8 @@ def _modifyPixelDigitizerForRun3( digitizer ): phase1Pixel.toModify( SiPixelSimBlock, func=_modifyPixelDigitizerForPhase1Pixel ) # use Label 'forDigitizer' for years >= 2018 -from CalibTracker.SiPixelESProducers.SiPixelQualityESProducer_cfi import siPixelQualityESProducer from Configuration.Eras.Modifier_run2_SiPixel_2018_cff import run2_SiPixel_2018 -run2_SiPixel_2018.toModify(siPixelQualityESProducer,siPixelQualityLabel = 'forDigitizer',) -run2_SiPixel_2018.toModify(SiPixelSimBlock, SiPixelQualityLabel = 'forDigitizer',) +run2_SiPixel_2018.toModify(SiPixelSimBlock, SiPixelQualityLabel = 'forDigitizer') # change the digitizer threshold for Run3 # - new layer1 installed: expected improvement in timing alignment of L1 and L2 diff --git a/SimGeneral/MixingModule/python/pixelDigitizer_cfi.py b/SimGeneral/MixingModule/python/pixelDigitizer_cfi.py index e5de08d3f5f23..bb0bd83bd13a4 100644 --- a/SimGeneral/MixingModule/python/pixelDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/pixelDigitizer_cfi.py @@ -11,6 +11,9 @@ from Configuration.ProcessModifiers.premix_stage1_cff import premix_stage1 premix_stage1.toModify(pixelDigitizer, makeDigiSimLinks = False) +# ESProducer for SiPixelQuality with "forDigitizer" label +from CalibTracker.SiPixelESProducers.siPixelQualityForDigitizerESProducer_cfi import * + # Customize here instead of SiPixelSimBlock as the latter is imported # also to DataMixer configuration, and the original version is needed # there in stage2. Customize before phase2_tracker because this