diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h b/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h index bcd45dc5e7fbf..6f893949b1fc3 100644 --- a/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h +++ b/CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationServiceBase.h @@ -21,6 +21,7 @@ #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/Exception.h" @@ -33,6 +34,8 @@ class SiPixelGainCalibrationServiceBase { SiPixelGainCalibrationServiceBase(){}; virtual ~SiPixelGainCalibrationServiceBase(){}; + + static void fillPSetDescription(edm::ParameterSetDescription& desc) {} // default inplementation from PixelThresholdClusterizer virtual void calibrate(uint32_t detID, DigiIterator b, DigiIterator e, float conversionFactor, float offset, int * electron); diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 4f429b96d56d9..ccbaabe51e5e7 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -47,6 +47,11 @@ def customiseFor2017DtUnpacking(process): return process +def customiseFor25811(process): + for prod in producers_by_type(process, "SiPixelClusterProducer"): + if hasattr(prod, "MissCalibrate") and not prod.MissCalibrate.isTracked(): + prod.MissCalibrate = cms.bool(prod.MissCalibrate.value()) + return process # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): @@ -54,4 +59,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) + process = customiseFor25811(process) + return process diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc index 99a7c792cc527..81cbeceeca549 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.cc @@ -58,7 +58,7 @@ PixelThresholdClusterizer::PixelThresholdClusterizer thePhase2KinkADC( conf.getParameter("Phase2KinkADC") ), theNumOfRows(0), theNumOfCols(0), theDetid(0), // Get the constants for the miss-calibration studies - doMissCalibrate( conf.getUntrackedParameter("MissCalibrate",true) ), + doMissCalibrate( conf.getParameter("MissCalibrate") ), doSplitClusters( conf.getParameter("SplitClusters") ) { theBuffer.setSize( theNumOfRows, theNumOfCols ); @@ -69,28 +69,22 @@ PixelThresholdClusterizer::~PixelThresholdClusterizer() {} // Configuration descriptions void -PixelThresholdClusterizer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - // siPixelClusters - edm::ParameterSetDescription desc; - desc.add("src", edm::InputTag("siPixelDigis")); +PixelThresholdClusterizer::fillPSetDescription(edm::ParameterSetDescription& desc) { desc.add("ChannelThreshold", 1000); - desc.addUntracked("MissCalibrate", true); + desc.add("MissCalibrate", true); desc.add("SplitClusters", false); desc.add("VCaltoElectronGain", 65); desc.add("VCaltoElectronGain_L1", 65); desc.add("VCaltoElectronOffset", -414); desc.add("VCaltoElectronOffset_L1", -414); - desc.add("payloadType", "Offline"); desc.add("SeedThreshold", 1000); desc.add("ClusterThreshold_L1", 4000); desc.add("ClusterThreshold", 4000); - desc.add("maxNumberOfClusters", -1); desc.add("ElectronPerADCGain", 135.); desc.add("Phase2Calibration", false); desc.add("Phase2ReadoutMode", -1); desc.add("Phase2DigiBaseline", 1200.); desc.add("Phase2KinkADC", 8); - descriptions.add("siClustersFromPixelThresholdClusterizer", desc); } //---------------------------------------------------------------------------- diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h index f699ae9bc301e..7c4babbcdfd05 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/PixelThresholdClusterizer.h @@ -50,7 +50,6 @@ // Parameter Set: #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include @@ -74,7 +73,7 @@ class dso_hidden PixelThresholdClusterizer final : public PixelClusterizerBase { const std::vector& badChannels, edmNew::DetSetVector::FastFiller& output) override { clusterizeDetUnitT(input, pixDet, tTopo, badChannels, output); } - static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); + static void fillPSetDescription(edm::ParameterSetDescription& desc); private: diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc index 45ca9be5fd6c3..95d1e7475e33e 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc @@ -32,6 +32,7 @@ // Framework #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" // STL #include @@ -48,26 +49,22 @@ //--------------------------------------------------------------------------- SiPixelClusterProducer::SiPixelClusterProducer(edm::ParameterSet const& conf) : - theSiPixelGainCalibration_(nullptr), - clusterMode_( conf.getUntrackedParameter("ClusterMode","PixelThresholdClusterizer") ), - clusterizer_(nullptr), // the default, in case we fail to make one - readyToCluster_(false), // since we obviously aren't - maxTotalClusters_( conf.getParameter( "maxNumberOfClusters" ) ), - payloadType_( conf.getParameter( "payloadType" ) ) + tPutPixelClusters(produces()), + clusterMode_( conf.getParameter("ClusterMode") ), + maxTotalClusters_( conf.getParameter( "maxNumberOfClusters" ) ) { if ( clusterMode_ == "PixelThresholdReclusterizer" ) tPixelClusters = consumes( conf.getParameter("src") ); else tPixelDigi = consumes>( conf.getParameter("src") ); - //--- Declare to the EDM what kind of collections we will be making. - produces(); - if (strcmp(payloadType_.c_str(), "HLT") == 0) - theSiPixelGainCalibration_ = new SiPixelGainCalibrationForHLTService(conf); - else if (strcmp(payloadType_.c_str(), "Offline") == 0) - theSiPixelGainCalibration_ = new SiPixelGainCalibrationOfflineService(conf); - else if (strcmp(payloadType_.c_str(), "Full") == 0) - theSiPixelGainCalibration_ = new SiPixelGainCalibrationService(conf); + const auto& payloadType = conf.getParameter( "payloadType" ); + if (payloadType == "HLT") + theSiPixelGainCalibration_ = std::make_unique(conf); + else if (payloadType == "Offline") + theSiPixelGainCalibration_ = std::make_unique(conf); + else if (payloadType == "Full") + theSiPixelGainCalibration_ = std::make_unique(conf); //--- Make the algorithm(s) according to what the user specified //--- in the ParameterSet. @@ -76,10 +73,21 @@ } // Destructor - SiPixelClusterProducer::~SiPixelClusterProducer() { - delete clusterizer_; - delete theSiPixelGainCalibration_; - } +SiPixelClusterProducer::~SiPixelClusterProducer() = default; + +void SiPixelClusterProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("src", edm::InputTag("siPixelDigis")); + desc.add("ClusterMode", "PixelThresholdClusterizer"); + desc.add("maxNumberOfClusters", -1)->setComment("-1 means no limit"); + desc.add("payloadType", "Offline")->setComment("Options: HLT - column granularity, Offline - gain:col/ped:pix"); + + PixelThresholdClusterizer::fillPSetDescription(desc); + SiPixelGainCalibrationServiceBase::fillPSetDescription(desc); // no-op, but in principle the structures are there... + + descriptions.add("SiPixelClusterizerDefault", desc); +} //--------------------------------------------------------------------------- @@ -120,7 +128,7 @@ // Step D: write output to file output->shrink_to_fit(); - e.put(std::move(output)); + e.put(tPutPixelClusters, std::move(output)); } @@ -132,16 +140,14 @@ void SiPixelClusterProducer::setupClusterizer(const edm::ParameterSet& conf) { if ( clusterMode_ == "PixelThresholdReclusterizer" || clusterMode_ == "PixelThresholdClusterizer" ) { - clusterizer_ = new PixelThresholdClusterizer(conf); - clusterizer_->setSiPixelGainCalibrationService(theSiPixelGainCalibration_); - readyToCluster_ = true; + clusterizer_ = std::make_unique(conf); + clusterizer_->setSiPixelGainCalibrationService(theSiPixelGainCalibration_.get()); } else { - edm::LogError("SiPixelClusterProducer") << "[SiPixelClusterProducer]:" + throw cms::Exception("Configuration") << "[SiPixelClusterProducer]:" <<" choice " << clusterMode_ << " is invalid.\n" << "Possible choices:\n" << " PixelThresholdClusterizer"; - readyToCluster_ = false; } } @@ -153,13 +159,6 @@ void SiPixelClusterProducer::run(const T & input, const edm::ESHandle & geom, edmNew::DetSetVector & output) { - if ( ! readyToCluster_ ) { - edm::LogError("SiPixelClusterProducer") - <<" at least one clusterizer is not ready -- can't run!" ; - // TO DO: throw an exception here? The user may want to know... - return; // clusterizer is invalid, bail out - } - int numberOfDetUnits = 0; int numberOfClusters = 0; diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h index e22eea15d2672..f5ef4f8d765b1 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h @@ -47,6 +47,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" class dso_hidden SiPixelClusterProducer final : public edm::stream::EDProducer<> { @@ -55,6 +56,8 @@ explicit SiPixelClusterProducer(const edm::ParameterSet& conf); ~SiPixelClusterProducer() override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void setupClusterizer(const edm::ParameterSet& conf); //--- The top-level event method. @@ -69,17 +72,15 @@ private: edm::EDGetTokenT tPixelClusters; edm::EDGetTokenT> tPixelDigi; + edm::EDPutTokenT tPutPixelClusters; // TO DO: maybe allow a map of pointers? - SiPixelGainCalibrationServiceBase * theSiPixelGainCalibration_; + std::unique_ptr theSiPixelGainCalibration_; const std::string clusterMode_; // user's choice of the clusterizer - PixelClusterizerBase * clusterizer_; // what we got (for now, one ptr to base class) - bool readyToCluster_; // needed clusterizers valid => good to go! + std::unique_ptr clusterizer_; // what we got (for now, one ptr to base class) const TrackerTopology* tTopo_; // needed to get correct layer number //! Optional limit on the total number of clusters const int32_t maxTotalClusters_; - - const std::string payloadType_; }; diff --git a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizer_cfi.py b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizer_cfi.py index bf0bda3b4c013..dc639fde61c93 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizer_cfi.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizer_cfi.py @@ -1,61 +1,32 @@ import FWCore.ParameterSet.Config as cms -# -from CondTools.SiPixel.SiPixelGainCalibrationService_cfi import * -siPixelClusters = cms.EDProducer("SiPixelClusterProducer", - SiPixelGainCalibrationServiceParameters, - src = cms.InputTag("siPixelDigis"), - ChannelThreshold = cms.int32(1000), - MissCalibrate = cms.untracked.bool(True), - SplitClusters = cms.bool(False), - VCaltoElectronGain = cms.int32(65), - VCaltoElectronGain_L1 = cms.int32(65), - VCaltoElectronOffset = cms.int32(-414), - VCaltoElectronOffset_L1 = cms.int32(-414), - # ************************************** - # **** payLoadType Options **** - # **** HLT - column granularity **** - # **** Offline - gain:col/ped:pix **** - # ************************************** - payloadType = cms.string('Offline'), - #payloadType = cms.string('Full'), - SeedThreshold = cms.int32(1000), - ClusterThreshold = cms.int32(4000), - ClusterThreshold_L1 = cms.int32(4000), - # ************************************** - maxNumberOfClusters = cms.int32(-1), # -1 means no limit. - ElectronPerADCGain = cms.double(135.0), - Phase2Calibration = cms.bool(False), - Phase2ReadoutMode = cms.int32(-1), - Phase2DigiBaseline = cms.double(1200.), - Phase2KinkADC = cms.int32(8), -) +from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizerDefault_cfi import SiPixelClusterizerDefault as _SiPixelClusterizerDefault +siPixelClusters = _SiPixelClusterizerDefault.clone() # phase1 pixel from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel phase1Pixel.toModify(siPixelClusters, - VCaltoElectronGain = cms.int32(47), # L2-4: 47 +- 4.7 - VCaltoElectronGain_L1 = cms.int32(50), # L1: 49.6 +- 2.6 - VCaltoElectronOffset = cms.int32(-60), # L2-4: -60 +- 130 - VCaltoElectronOffset_L1 = cms.int32(-670), # L1: -670 +- 220 - ChannelThreshold = cms.int32(10), - SeedThreshold = cms.int32(1000), - ClusterThreshold = cms.int32(4000), - ClusterThreshold_L1 = cms.int32(2000) - + VCaltoElectronGain = 47, # L2-4: 47 +- 4.7 + VCaltoElectronGain_L1 = 50, # L1: 49.6 +- 2.6 + VCaltoElectronOffset = -60, # L2-4: -60 +- 130 + VCaltoElectronOffset_L1 = -670, # L1: -670 +- 220 + ChannelThreshold = 10, + SeedThreshold = 1000, + ClusterThreshold = 4000, + ClusterThreshold_L1 = 2000 ) # Need these until phase2 pixel templates are used from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker phase2_tracker.toModify(siPixelClusters, # FIXME - src = cms.InputTag('simSiPixelDigis', "Pixel"), + src = 'simSiPixelDigis:Pixel', MissCalibrate = False, - Phase2Calibration = cms.bool(True), - Phase2ReadoutMode = cms.int32(-1), # Flag to decide Readout Mode : linear TDR (-1), dual slope with slope parameters (+1,+2,+3,+4 ...) with threshold subtraction - Phase2DigiBaseline = cms.double(1200.), - Phase2KinkADC = cms.int32(8), - ElectronPerADCGain = cms.double(600.) # it can be changed to something else (e.g. 135e) if needed + Phase2Calibration = True, + Phase2ReadoutMode = -1, # Flag to decide Readout Mode : linear TDR (-1), dual slope with slope parameters (+1,+2,+3,+4 ...) with threshold subtraction + Phase2DigiBaseline = 1200., + Phase2KinkADC = 8, + ElectronPerADCGain = 600. # it can be changed to something else (e.g. 135e) if needed ) from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 (premix_stage2 & phase2_tracker).toModify(siPixelClusters,