Skip to content

Commit

Permalink
Merge pull request #47079 from mmusich/mm_fillDesc_migration_v3
Browse files Browse the repository at this point in the history
add `fillDescriptions` to several plugins used at HLT (3/N)
  • Loading branch information
cmsbuild authored Jan 12, 2025
2 parents a44b537 + 9115417 commit 98dcc38
Show file tree
Hide file tree
Showing 38 changed files with 763 additions and 340 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@
),
)

## remove uneeded paraemters sets because setNoiseFlags is False
for param in ['PETstat', 'S8S1stat', 'S9S1stat']:
if hasattr(_phase1_hfrecoNoise, param):
delattr(_phase1_hfrecoNoise, param)
if hasattr(_phase1_hfrecoMBNZS, param):
delattr(_phase1_hfrecoMBNZS, param)

_phase1_seqALCARECOHcalCalMinBias = seqALCARECOHcalCalMinBias.copy()
_phase1_seqALCARECOHcalCalMinBias.insert(0,hfprerecoMBNZS)
_phase1_seqALCARECOHcalCalMinBias.insert(0,hfprerecoNoise)
Expand Down
20 changes: 20 additions & 0 deletions EventFilter/SiStripRawToDigi/plugins/SiStripRawToDigiModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,23 @@ namespace sistrip {

void RawToDigiModule::endStream() { rawToDigi_->printWarningSummary(); }
} // namespace sistrip

void sistrip::RawToDigiModule::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("ProductLabel", edm::InputTag("rawDataCollector"));
desc.add<int>("AppendedBytes", 0);
desc.add<int>("TriggerFedId", 0);
desc.add<bool>("LegacyUnpacker", false);
desc.add<bool>("UseDaqRegister", false);
desc.add<bool>("UseFedKey", false);
desc.add<bool>("UnpackBadChannels", false);
desc.add<bool>("MarkModulesOnMissingFeds", true);
desc.addUntracked<int>("FedBufferDumpFreq", 0);
desc.addUntracked<int>("FedEventDumpFreq", 0);
desc.addUntracked<bool>("Quiet", true);
desc.add<bool>("UnpackCommonModeValues", false);
desc.add<bool>("DoAllCorruptBufferChecks", false);
desc.add<bool>("DoAPVEmulatorCheck", false);
desc.add<unsigned int>("ErrorThreshold", 7174);
descriptions.addWithDefaultLabel(desc);
}
13 changes: 9 additions & 4 deletions EventFilter/SiStripRawToDigi/plugins/SiStripRawToDigiModule.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#ifndef EventFilter_SiStripRawToDigi_SiStripRawToDigiModule_H
#define EventFilter_SiStripRawToDigi_SiStripRawToDigiModule_H

#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h"
#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/Visibility.h"
#include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h"

#include <string>
#include <cstdint>

Expand Down Expand Up @@ -39,6 +42,8 @@ namespace sistrip {
void produce(edm::Event&, const edm::EventSetup&) override;
void endStream() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
void updateCabling(const edm::EventSetup&);

Expand Down
21 changes: 2 additions & 19 deletions EventFilter/SiStripRawToDigi/python/SiStripDigis_cfi.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
import FWCore.ParameterSet.Config as cms

siStripDigis = cms.EDProducer(
"SiStripRawToDigiModule",
ProductLabel = cms.InputTag('rawDataCollector'),
LegacyUnpacker = cms.bool(False),
AppendedBytes = cms.int32(0),
UseDaqRegister = cms.bool(False),
UseFedKey = cms.bool(False),
UnpackBadChannels = cms.bool(False),
MarkModulesOnMissingFeds = cms.bool(True),
TriggerFedId = cms.int32(0),
#FedEventDumpFreq = cms.untracked.int32(0),
#FedBufferDumpFreq = cms.untracked.int32(0),
UnpackCommonModeValues = cms.bool(False),
DoAllCorruptBufferChecks = cms.bool(False),
DoAPVEmulatorCheck = cms.bool(False),
ErrorThreshold = cms.uint32(7174)
)


from EventFilter.SiStripRawToDigi.siStripRawToDigiModule_cfi import siStripRawToDigiModule
siStripDigis = siStripRawToDigiModule.clone()
11 changes: 0 additions & 11 deletions HLTrigger/Configuration/python/HLT_75e33/modules/hltHfreco_cfi.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import FWCore.ParameterSet.Config as cms

hltHfreco = cms.EDProducer("HFPhase1Reconstructor",
HFStripFilter = cms.PSet(
gap = cms.int32(2),
lstrips = cms.int32(2),
maxStripTime = cms.double(10.0),
maxThreshold = cms.double(100.0),
seedHitIetaMax = cms.int32(35),
stripThreshold = cms.double(40.0),
timeMax = cms.double(6.0),
verboseLevel = cms.untracked.int32(10),
wedgeCut = cms.double(0.05)
),
PETstat = cms.PSet(
HcalAcceptSeverityLevel = cms.int32(9),
longETParams = cms.vdouble(
Expand Down
24 changes: 0 additions & 24 deletions HLTrigger/Configuration/python/HLT_75e33/modules/hltHoreco_cfi.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import FWCore.ParameterSet.Config as cms

hltHoreco = cms.EDProducer("HcalHitReconstructor",
HFInWindowStat = cms.PSet(

),
PETstat = cms.PSet(

),
S8S1stat = cms.PSet(

),
S9S1stat = cms.PSet(

),
Subdetector = cms.string('HO'),
correctForPhaseContainment = cms.bool(True),
correctForTimeslew = cms.bool(True),
Expand All @@ -21,27 +9,15 @@
dataOOTCorrectionCategory = cms.string('Data'),
dataOOTCorrectionName = cms.string(''),
digiLabel = cms.InputTag("hltHcalDigis"),
digiTimeFromDB = cms.bool(True),
digistat = cms.PSet(

),
dropZSmarkedPassed = cms.bool(True),
firstAuxTS = cms.int32(4),
firstSample = cms.int32(4),
hfTimingTrustParameters = cms.PSet(

),
mcOOTCorrectionCategory = cms.string('MC'),
mcOOTCorrectionName = cms.string(''),
recoParamsFromDB = cms.bool(True),
samplesToAdd = cms.int32(4),
saturationParameters = cms.PSet(
maxADCvalue = cms.int32(127)
),
setHSCPFlags = cms.bool(False),
setNegativeFlags = cms.bool(False),
setNoiseFlags = cms.bool(False),
setPulseShapeFlags = cms.bool(False),
setSaturationFlags = cms.bool(False),
setTimingTrustFlags = cms.bool(False),
tsFromDB = cms.bool(True),
Expand Down
46 changes: 45 additions & 1 deletion HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,49 @@ def customizeHLTfor47017(process):

return process


def customizeHLTfor47079(process):
"""Remove unneeded parameters from the HLT menu"""
for filt in filters_by_type(process, 'PrimaryVertexObjectFilter'):
if hasattr(filt, 'filterParams') and hasattr(filt.filterParams, 'pvSrc'):
del filt.filterParams.pvSrc # Remove the pvSrc parameter

for prod in producers_by_type(process, 'HcalHitReconstructor'):
# Remove "digiTimeFromDB" if "Subdetector" is not "HF"
if hasattr(prod, 'Subdetector') and getattr(prod, 'Subdetector') != "HF":
if hasattr(prod, 'digiTimeFromDB'):
delattr(prod, 'digiTimeFromDB')

# Remove "saturationParameters" if "setSaturationFlags" is false
if hasattr(prod, 'setSaturationFlags') and not getattr(prod, 'setSaturationFlags'):
if hasattr(prod, 'saturationParameters'):
delattr(prod, 'saturationParameters')

# Remove "hfTimingTrustParameters" if "setTimingTrustFlags" is false
if hasattr(prod, 'setTimingTrustFlags') and not getattr(prod, 'setTimingTrustFlags'):
if hasattr(prod, 'hfTimingTrustParameters'):
delattr(prod, 'hfTimingTrustParameters')

# Remove 'PETstat', 'S8S1stat', 'S9S1stat', 'digistat' and 'HFInWindowStat' if "setNoiseFlags" is false
if hasattr(prod, 'setNoiseFlags') and not getattr(prod, 'setNoiseFlags'):
for param in ['PETstat', 'S8S1stat', 'S9S1stat', 'digistat', 'HFInWindowStat']:
if hasattr(prod, param):
delattr(prod, param)

# Remove useless parameters
if hasattr(prod,'setHSCPFlags'):
delattr(prod,'setHSCPFlags')

if hasattr(prod,'setPulseShapeFlags'):
delattr(prod,'setPulseShapeFlags')

for prod in producers_by_type(process, 'HFPhase1Reconstructor'):
# Remove 'HFStripFilter' if "runHFStripFilter" is false
if hasattr(prod, 'runHFStripFilter') and not getattr(prod, 'runHFStripFilter'):
delattr(prod,'HFStripFilter')

return process

# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):

Expand All @@ -94,6 +137,7 @@ def customizeHLTforCMSSW(process, menuType="GRun"):

process = customizeHLTfor46935(process)
process = customizeHLTfor47017(process)

process = customizeHLTfor47079(process)

return process

13 changes: 11 additions & 2 deletions PhysicsTools/SelectorUtils/interface/JetIDSelectionFunctor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
#ifndef __GCCXML__
#include "FWCore/Framework/interface/ConsumesCollector.h"
#endif

#include "DataFormats/PatCandidates/interface/Jet.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "PhysicsTools/SelectorUtils/interface/Selector.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "PhysicsTools/SelectorUtils/interface/Selector.h"

#include <TMath.h>
class JetIDSelectionFunctor : public Selector<pat::Jet> {
Expand Down Expand Up @@ -65,6 +67,13 @@ class JetIDSelectionFunctor : public Selector<pat::Jet> {
}
}

static edm::ParameterSetDescription getDescription() {
edm::ParameterSetDescription desc;
desc.add<std::string>("version", std::string(""));
desc.add<std::string>("quality", std::string(""));
return desc;
}

JetIDSelectionFunctor(Version_t version, Quality_t quality) { initialize(version, quality); }

void initialize(Version_t version, Quality_t quality) {
Expand Down
17 changes: 15 additions & 2 deletions PhysicsTools/SelectorUtils/interface/PVObjectSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include "PhysicsTools/SelectorUtils/interface/Selector.h"
#include "DataFormats/VertexReco/interface/Vertex.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

#include <vector>
#include <string>

Expand All @@ -34,8 +37,9 @@ class PVObjectSelector : public Selector<reco::Vertex> {
indexZ_ = index_type(&bits_, "PV Z");
indexRho_ = index_type(&bits_, "PV RHO");

if (params.exists("cutsToIgnore"))
setIgnoredCuts(params.getParameter<std::vector<std::string> >("cutsToIgnore"));
const auto& cutsToIgnore{params.getParameter<std::vector<std::string> >("cutsToIgnore")};
if (!cutsToIgnore.empty())
setIgnoredCuts(cutsToIgnore);

retInternal_ = getBitTemplate();
}
Expand All @@ -59,6 +63,15 @@ class PVObjectSelector : public Selector<reco::Vertex> {
return (bool)ret;
}

static edm::ParameterSetDescription getDescription() {
edm::ParameterSetDescription desc;
desc.add<double>("minNdof", 4.0);
desc.add<double>("maxZ", 24.0);
desc.add<double>("maxRho", 2.0);
desc.add<std::vector<std::string> >("cutsToIgnore", {});
return desc;
}

using Selector<reco::Vertex>::operator();

private:
Expand Down
10 changes: 10 additions & 0 deletions PhysicsTools/SelectorUtils/interface/PVSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include "PhysicsTools/SelectorUtils/interface/EventSelector.h"
#include "PhysicsTools/SelectorUtils/interface/PVObjectSelector.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

// make a selector for this selection
class PVSelector : public Selector<edm::EventBase> {
public:
Expand All @@ -28,6 +31,13 @@ class PVSelector : public Selector<edm::EventBase> {
}
#endif

static edm::ParameterSetDescription getDescription() {
edm::ParameterSetDescription desc = PVObjectSelector::getDescription();
desc.add<edm::InputTag>("pvSrc", edm::InputTag(""));
desc.add<int>("NPV", 1);
return desc;
}

bool operator()(edm::EventBase const& event, pat::strbitset& ret) override {
ret.set(false);
event.getByLabel(pvSrc_, h_primVtx);
Expand Down
27 changes: 17 additions & 10 deletions PhysicsTools/UtilAlgos/interface/EDFilterObjectWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
#include "FWCore/Framework/interface/stream/EDFilter.h"
#include "FWCore/Common/interface/EventBase.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

namespace edm {

Expand All @@ -51,17 +53,14 @@ namespace edm {
typename C::const_iterator const_iterator;

/// default contructor. Declares the output (type "C") and the filter (of type T, operates on C::value_type)
FilterObjectWrapper(const edm::ParameterSet& cfg) : src_(consumes<C>(cfg.getParameter<edm::InputTag>("src"))) {
FilterObjectWrapper(const edm::ParameterSet& cfg)
: src_(consumes<C>(cfg.getParameter<edm::InputTag>("src"))), doFilter_(cfg.getParameter<bool>("filter")) {
filter_ = std::shared_ptr<T>(new T(cfg.getParameter<edm::ParameterSet>("filterParams")));
if (cfg.exists("filter")) {
doFilter_ = cfg.getParameter<bool>("filter");
} else {
doFilter_ = false;
}
produces<C>();
}
/// default destructor
~FilterObjectWrapper() override {}
~FilterObjectWrapper() override = default;

/// everything which has to be done during the event loop. NOTE: We can't use the eventSetup in FWLite so ignore it
bool filter(edm::Event& event, const edm::EventSetup& eventSetup) override {
// create a collection of the objects to put into the event
Expand All @@ -84,13 +83,21 @@ namespace edm {
return true;
}

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("src", edm::InputTag(""))->setComment("input collection");
desc.add<edm::ParameterSetDescription>("filterParams", T::getDescription());
desc.add<bool>("filter", false);
descriptions.addWithDefaultLabel(desc);
}

protected:
/// InputTag of the input source
edm::EDGetTokenT<C> src_;
const edm::EDGetTokenT<C> src_;
/// whether or not to filter based on size
const bool doFilter_;
/// shared pointer to analysis class of type BasicAnalyzer
std::shared_ptr<T> filter_;
/// whether or not to filter based on size
bool doFilter_;
};

} // namespace edm
Expand Down
8 changes: 8 additions & 0 deletions PhysicsTools/UtilAlgos/interface/EDFilterWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "FWCore/Common/interface/EventBase.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

namespace edm {

Expand All @@ -54,6 +57,11 @@ namespace edm {
return (*filter_)(eventBaseConst);
}

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc = T::getDescription();
descriptions.addWithDefaultLabel(desc);
}

protected:
/// shared pointer to analysis class of type BasicAnalyzer
std::shared_ptr<T> filter_;
Expand Down
Loading

0 comments on commit 98dcc38

Please sign in to comment.