Skip to content

Commit 502e64b

Browse files
authored
Merge pull request #47191 from mmusich/mm_fillDesc_migration_v6
add `fillDescriptions` to several `ESproducer`s used at HLT (2/N)
2 parents 7f549d8 + 095f808 commit 502e64b

File tree

69 files changed

+637
-361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+637
-361
lines changed

CalibCalorimetry/CastorCalib/plugins/CastorDbProducer.cc

+10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "FWCore/Framework/interface/ESProducer.h"
2727
#include "FWCore/Framework/interface/ESProductHost.h"
2828
#include "FWCore/Utilities/interface/ReusableObjectHolder.h"
29+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
2930

3031
#include "CalibCalorimetry/CastorCalib/interface/CastorDbASCIIIO.h"
3132
#include "CalibFormats/CastorObjects/interface/CastorDbService.h"
@@ -45,6 +46,8 @@ class CastorDbProducer : public edm::ESProducer {
4546
CastorDbProducer(const edm::ParameterSet&);
4647
~CastorDbProducer() override;
4748

49+
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
50+
4851
std::shared_ptr<CastorDbService> produce(const CastorDbRecord&);
4952

5053
private:
@@ -104,6 +107,13 @@ CastorDbProducer::~CastorDbProducer() {
104107
delete mDumpStream;
105108
}
106109

110+
void CastorDbProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
111+
edm::ParameterSetDescription desc;
112+
desc.addUntracked<std::vector<std::string> >("dump", std::vector<std::string>());
113+
desc.addUntracked<std::string>("file", "");
114+
descriptions.addWithDefaultLabel(desc);
115+
}
116+
107117
//
108118
// member functions
109119
//
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import FWCore.ParameterSet.Config as cms
22

3-
CastorDbProducer = cms.ESProducer( "CastorDbProducer",
4-
appendToDataLabel = cms.string( "" )
5-
)
3+
from CalibCalorimetry.CastorCalib.castorDbProducer_cfi import castorDbProducer as _castorDbProducer
4+
CastorDbProducer = _castorDbProducer.clone(
5+
appendToDataLabel = cms.string( "" )
6+
)

HLTrigger/Configuration/python/customizeHLTforCMSSW.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,17 @@ def customizeHLTfor47107(process):
154154

155155
return process
156156

157+
def customizeHLTfor47191(process):
158+
for esprod in esproducers_by_type(process, "PromptTrackCountingESProducer"):
159+
if hasattr(esprod, 'minimumImpactParameter'):
160+
delattr(esprod, 'minimumImpactParameter')
161+
162+
if hasattr(esprod, 'useSignedImpactParameterSig'):
163+
delattr(esprod, 'useSignedImpactParameterSig')
164+
165+
return process
166+
167+
157168
# CMSSW version specific customizations
158169
def customizeHLTforCMSSW(process, menuType="GRun"):
159170

@@ -167,5 +178,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"):
167178
process = customizeHLTfor47079(process)
168179
process = customizeHLTfor47047(process)
169180
process = customizeHLTfor47107(process)
170-
181+
process = customizeHLTfor47191(process)
182+
171183
return process

JetMETCorrections/Algorithms/src/JetCorrectorImplMakerBase.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ std::shared_ptr<FactorizedJetCorrectorCalculator const> JetCorrectorImplMakerBas
6868
}
6969

7070
void JetCorrectorImplMakerBase::addToDescription(edm::ParameterSetDescription& iDescription) {
71-
iDescription.add<std::string>("level");
72-
iDescription.add<std::string>("algorithm");
71+
iDescription.add<std::string>("level", "");
72+
iDescription.add<std::string>("algorithm", "");
7373
}

JetMETCorrections/Algorithms/src/L1FastjetCorrectorImpl.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ std::unique_ptr<reco::JetCorrectorImpl> L1FastjetCorrectorImplMaker::make(edm::E
4747
void L1FastjetCorrectorImplMaker::fillDescriptions(edm::ConfigurationDescriptions& iDescriptions) {
4848
edm::ParameterSetDescription desc;
4949
addToDescription(desc);
50-
desc.add<edm::InputTag>("srcRho");
51-
iDescriptions.addDefault(desc);
50+
desc.add<edm::InputTag>("srcRho", edm::InputTag(""));
51+
iDescriptions.addWithDefaultLabel(desc);
5252
}
5353

5454
//______________________________________________________________________________

JetMETCorrections/Algorithms/src/LXXXCorrectorImpl.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ std::unique_ptr<reco::JetCorrectorImpl> LXXXCorrectorImplMaker::make(edm::Event
4242
void LXXXCorrectorImplMaker::fillDescriptions(edm::ConfigurationDescriptions& iDescriptions) {
4343
edm::ParameterSetDescription desc;
4444
addToDescription(desc);
45-
46-
iDescriptions.addDefault(desc);
45+
iDescriptions.addWithDefaultLabel(desc);
4746
}
4847

4948
//------------------------------------------------------------------------

JetMETCorrections/Modules/interface/CorrectedJetProducer.h

+14-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
#include "DataFormats/Common/interface/Handle.h"
1010
#include "DataFormats/Common/interface/Ref.h"
1111
#include "DataFormats/Common/interface/RefToBase.h"
12-
#include "FWCore/Framework/interface/global/EDProducer.h"
1312
#include "FWCore/Framework/interface/Event.h"
1413
#include "FWCore/Framework/interface/EventSetup.h"
14+
#include "FWCore/Framework/interface/global/EDProducer.h"
15+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
16+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
1517
#include "FWCore/Utilities/interface/InputTag.h"
1618
#include "FWCore/Utilities/interface/transform.h"
17-
#include "FWCore/ParameterSet/interface/ParameterSet.h"
1819
#include "JetMETCorrections/JetCorrector/interface/JetCorrector.h"
1920

2021
namespace edm {
@@ -29,6 +30,7 @@ namespace reco {
2930
explicit CorrectedJetProducer(const edm::ParameterSet& fParameters);
3031
~CorrectedJetProducer() override {}
3132
void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
33+
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
3234

3335
private:
3436
const edm::EDGetTokenT<JetCollection> mInput;
@@ -55,6 +57,16 @@ namespace reco {
5557
produces<JetCollection>().setBranchAlias(alias);
5658
}
5759

60+
template <class T>
61+
void CorrectedJetProducer<T>::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
62+
edm::ParameterSetDescription desc;
63+
desc.add<edm::InputTag>("src", edm::InputTag(""));
64+
desc.add<std::vector<edm::InputTag> >("correctors", {});
65+
desc.addUntracked<bool>("verbose", false);
66+
desc.addUntracked<std::string>("alias", "");
67+
descriptions.addWithDefaultLabel(desc);
68+
}
69+
5870
template <class T>
5971
void CorrectedJetProducer<T>::produce(edm::StreamID, edm::Event& fEvent, const edm::EventSetup& fSetup) const {
6072
// FIXME - use something more efficient instead of an std::vector

RecoBTag/CTagging/interface/CharmTagger.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#ifndef RecoBTag_CTagging_CharmTagger_h
22
#define RecoBTag_CTagging_CharmTagger_h
33

4+
#include "CommonTools/MVAUtils/interface/TMVAEvaluator.h"
5+
#include "DataFormats/BTauReco/interface/TaggingVariable.h"
46
#include "FWCore/Framework/interface/ESConsumesCollector.h"
7+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
58
#include "FWCore/ParameterSet/interface/ParameterSet.h"
6-
#include "CommonTools/MVAUtils/interface/TMVAEvaluator.h"
7-
#include "RecoBTau/JetTagComputer/interface/JetTagComputer.h"
9+
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
810
#include "RecoBTag/SecondaryVertex/interface/CombinedSVSoftLeptonComputer.h"
9-
#include "DataFormats/BTauReco/interface/TaggingVariable.h"
11+
#include "RecoBTau/JetTagComputer/interface/JetTagComputer.h"
1012
#include "RecoBTau/JetTagComputer/interface/JetTagComputerRecord.h"
1113

1214
#include <memory>
@@ -29,6 +31,8 @@ class CharmTagger : public JetTagComputer {
2931
float discriminator(const TagInfoHelper& tagInfo) const override;
3032
void initialize(const JetTagComputerRecord& record) override;
3133

34+
static void fillPSetDescription(edm::ParameterSetDescription& desc);
35+
3236
typedef std::vector<edm::ParameterSet> vpset;
3337

3438
struct MVAVar {

RecoBTag/CTagging/python/charmTagsComputerCvsL_cfi.py

+14-21
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,20 @@
99
#
1010

1111
charmTagsComputerCvsL = cms.ESProducer(
12-
'CharmTaggerESProducer',
13-
#clone the cfg only
14-
slComputerCfg = cms.PSet(
15-
**sl_cfg.candidateCombinedSecondaryVertexSoftLeptonComputer.parameters_()
16-
),
17-
weightFile = cms.FileInPath('RecoBTag/CTagging/data/c_vs_udsg_sklearn.weight.xml'),
18-
variables = c_vs_l_vars_vpset,
19-
computer = cms.ESInputTag('combinedSecondaryVertexSoftLeptonComputer',''),
20-
tagInfos = cms.VInputTag(
21-
cms.InputTag('pfImpactParameterTagInfos'),
22-
cms.InputTag('pfInclusiveSecondaryVertexFinderCvsLTagInfos'),
23-
cms.InputTag('softPFMuonsTagInfos'),
24-
cms.InputTag('softPFElectronsTagInfos'),
25-
),
26-
mvaName = cms.string('BDT'),
27-
useCondDB = cms.bool(False),
28-
gbrForestLabel = cms.string(''),
29-
useGBRForest = cms.bool(True),
30-
useAdaBoost = cms.bool(False),
31-
defaultValueNoTracks = cms.bool(False)
32-
)
12+
'CharmTaggerESProducer',
13+
#clone the cfg only
14+
slComputerCfg = cms.PSet(
15+
**sl_cfg.candidateCombinedSecondaryVertexSoftLeptonComputer.parameters_()
16+
),
17+
weightFile = cms.FileInPath('RecoBTag/CTagging/data/c_vs_udsg_sklearn.weight.xml'),
18+
variables = c_vs_l_vars_vpset,
19+
mvaName = cms.string('BDT'),
20+
useCondDB = cms.bool(False),
21+
gbrForestLabel = cms.string(''),
22+
useGBRForest = cms.bool(True),
23+
useAdaBoost = cms.bool(False),
24+
defaultValueNoTracks = cms.bool(False)
25+
)
3326

3427
charmTagsComputerCvsL.slComputerCfg.correctVertexMass = False
3528

RecoBTag/CTagging/src/CharmTagger.cc

+26-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414

1515
CharmTagger::Tokens::Tokens(const edm::ParameterSet &configuration, edm::ESConsumesCollector &&cc) {
1616
if (configuration.getParameter<bool>("useCondDB")) {
17-
gbrForest_ = cc.consumes(edm::ESInputTag{"",
18-
configuration.existsAs<std::string>("gbrForestLabel")
19-
? configuration.getParameter<std::string>("gbrForestLabel")
20-
: ""});
17+
gbrForest_ = cc.consumes(edm::ESInputTag{"", configuration.getParameter<std::string>("gbrForestLabel")});
2118
}
2219
}
2320

@@ -35,7 +32,7 @@ CharmTagger::CharmTagger(const edm::ParameterSet &configuration, Tokens tokens)
3532
mva_var.name = var.getParameter<std::string>("name");
3633
mva_var.id = reco::getTaggingVariableName(var.getParameter<std::string>("taggingVarName"));
3734
mva_var.has_index = var.existsAs<int>("idx");
38-
mva_var.index = mva_var.has_index ? var.getParameter<int>("idx") : 0;
35+
mva_var.index = var.getParameter<int>("idx");
3936
mva_var.default_value = var.getParameter<double>("default");
4037

4138
variables_.push_back(mva_var);
@@ -104,3 +101,27 @@ float CharmTagger::discriminator(const TagInfoHelper &tagInfo) const {
104101
} // if no tracks available, put value at -2 (only for Phase I)
105102
return tag;
106103
}
104+
105+
void CharmTagger::fillPSetDescription(edm::ParameterSetDescription &desc) {
106+
desc.add<bool>("useCondDB", false);
107+
desc.add<bool>("defaultValueNoTracks", false);
108+
desc.add<bool>("useAdaBoost", false);
109+
desc.add<bool>("useGBRForest", true);
110+
desc.add<std::string>("mvaName", "BTD");
111+
desc.add<std::string>("gbrForestLabel", "");
112+
desc.add<edm::FileInPath>("weightFile", edm::FileInPath());
113+
114+
edm::ParameterSetDescription slComputerCfg;
115+
slComputerCfg.setAllowAnything();
116+
desc.add<edm::ParameterSetDescription>("slComputerCfg", slComputerCfg);
117+
118+
{
119+
std::vector<edm::ParameterSet> temp;
120+
edm::ParameterSetDescription variablePSet;
121+
variablePSet.add<int>("idx", 0.);
122+
variablePSet.add<double>("default", 1.);
123+
variablePSet.add<std::string>("name", "");
124+
variablePSet.add<std::string>("taggingVarName", "");
125+
desc.addVPSet("variables", variablePSet, temp)->setComment("Default empty VPSet, can contain anything");
126+
}
127+
}

RecoBTag/Combined/interface/CandidateChargeBTagComputer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CandidateChargeBTagComputer : public JetTagComputer {
2424
~CandidateChargeBTagComputer() override;
2525
void initialize(const JetTagComputerRecord &record) override;
2626
float discriminator(const TagInfoHelper &tagInfo) const override;
27-
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
27+
static void fillPSetDescription(edm::ParameterSetDescription &desc);
2828

2929
private:
3030
const edm::FileInPath weightFile_;

RecoBTag/Combined/interface/CombinedMVAV2JetTagComputer.h

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include "CommonTools/MVAUtils/interface/TMVAEvaluator.h"
1212
#include "CondFormats/DataRecord/interface/GBRWrapperRcd.h"
1313
#include "RecoBTau/JetTagComputer/interface/JetTagComputer.h"
14+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
15+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
16+
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
1417

1518
class CombinedMVAV2JetTagComputer : public JetTagComputer {
1619
public:
@@ -27,6 +30,8 @@ class CombinedMVAV2JetTagComputer : public JetTagComputer {
2730

2831
float discriminator(const TagInfoHelper &info) const override;
2932

33+
static void fillPSetDescription(edm::ParameterSetDescription &desc);
34+
3035
private:
3136
std::vector<const JetTagComputer *> computers;
3237

RecoBTag/Combined/interface/HeavyIonCSVTagger.h

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class HeavyIonCSVTagger : public JetTagComputer {
3030
float discriminator(const TagInfoHelper& tagInfo) const override;
3131
void initialize(const JetTagComputerRecord& record) override;
3232

33+
static void fillPSetDescription(edm::ParameterSetDescription& desc);
34+
3335
typedef std::vector<edm::ParameterSet> vpset;
3436

3537
struct MVAVar {

RecoBTag/Combined/python/heavyIonCSVComputer_cfi.py

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
weightFile = cms.FileInPath('RecoBTag/Combined/data/TMVA_Btag_CsJets_PbPb2018_BDTG.weights.xml'),
1111

1212
variables = heavyIonCSV_vpset,
13-
tagInfos = cms.VInputTag(
14-
cms.InputTag('impactParameterTagInfos'),
15-
cms.InputTag('secondaryVertexFinderTagInfos'),
16-
),
1713
mvaName = cms.string('BDT'),
1814
useCondDB = cms.bool(False),
1915
gbrForestLabel = cms.string(''),

RecoBTag/Combined/src/CandidateChargeBTagComputer.cc

+1-4
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,11 @@ float CandidateChargeBTagComputer::discriminator(const TagInfoHelper& tagInfo) c
245245
return value;
246246
}
247247

248-
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
249-
void CandidateChargeBTagComputer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
250-
edm::ParameterSetDescription desc;
248+
void CandidateChargeBTagComputer::fillPSetDescription(edm::ParameterSetDescription& desc) {
251249
desc.add<bool>("useCondDB", false);
252250
desc.add<std::string>("gbrForestLabel", "");
253251
desc.add<edm::FileInPath>("weightFile", edm::FileInPath());
254252
desc.add<bool>("useAdaBoost", true);
255253
desc.add<double>("jetChargeExp", 0.8);
256254
desc.add<double>("svChargeExp", 0.5);
257-
descriptions.addDefault(desc);
258255
}

RecoBTag/Combined/src/CombinedMVAV2JetTagComputer.cc

+16-6
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ using namespace reco;
1717

1818
CombinedMVAV2JetTagComputer::Tokens::Tokens(const edm::ParameterSet &params, edm::ESConsumesCollector &&cc) {
1919
if (params.getParameter<bool>("useCondDB")) {
20-
gbrForest_ = cc.consumes(edm::ESInputTag{
21-
"", params.existsAs<std::string>("gbrForestLabel") ? params.getParameter<std::string>("gbrForestLabel") : ""});
20+
gbrForest_ = cc.consumes(edm::ESInputTag{"", params.getParameter<std::string>("gbrForestLabel")});
2221
}
2322
const auto &inputComputerNames = params.getParameter<std::vector<std::string> >("jetTagComputers");
2423
computers_.resize(inputComputerNames.size());
@@ -31,10 +30,9 @@ CombinedMVAV2JetTagComputer::CombinedMVAV2JetTagComputer(const edm::ParameterSet
3130
: mvaName(params.getParameter<std::string>("mvaName")),
3231
variables(params.getParameter<std::vector<std::string> >("variables")),
3332
spectators(params.getParameter<std::vector<std::string> >("spectators")),
34-
weightFile(params.existsAs<edm::FileInPath>("weightFile") ? params.getParameter<edm::FileInPath>("weightFile")
35-
: edm::FileInPath()),
36-
useGBRForest(params.existsAs<bool>("useGBRForest") ? params.getParameter<bool>("useGBRForest") : false),
37-
useAdaBoost(params.existsAs<bool>("useAdaBoost") ? params.getParameter<bool>("useAdaBoost") : false),
33+
weightFile(params.getParameter<edm::FileInPath>("weightFile")),
34+
useGBRForest(params.getParameter<bool>("useGBRForest")),
35+
useAdaBoost(params.getParameter<bool>("useAdaBoost")),
3836
tokens(std::move(tokens))
3937

4038
{
@@ -127,3 +125,15 @@ float CombinedMVAV2JetTagComputer::discriminator(const JetTagComputer::TagInfoHe
127125
// return the final discriminator value
128126
return value;
129127
}
128+
129+
void CombinedMVAV2JetTagComputer::fillPSetDescription(edm::ParameterSetDescription &desc) {
130+
desc.add<bool>("useCondDB", false);
131+
desc.add<std::string>("gbrForestLabel", "");
132+
desc.add<std::vector<std::string> >("jetTagComputers", {});
133+
desc.add<std::string>("mvaName", "");
134+
desc.add<std::vector<std::string> >("variables", {});
135+
desc.add<std::vector<std::string> >("spectators", {});
136+
desc.add<edm::FileInPath>("weightFile", edm::FileInPath());
137+
desc.add<bool>("useGBRForest", false);
138+
desc.add<bool>("useAdaBoost", false);
139+
}

RecoBTag/Combined/src/HeavyIonCSVTagger.cc

+24-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010

1111
HeavyIonCSVTagger::Tokens::Tokens(const edm::ParameterSet &configuration, edm::ESConsumesCollector &&cc) {
1212
if (configuration.getParameter<bool>("useCondDB")) {
13-
gbrForest_ = cc.consumes(edm::ESInputTag{"",
14-
configuration.existsAs<std::string>("gbrForestLabel")
15-
? configuration.getParameter<std::string>("gbrForestLabel")
16-
: ""});
13+
gbrForest_ = cc.consumes(edm::ESInputTag{"", configuration.getParameter<std::string>("gbrForestLabel")});
1714
}
1815
}
1916
HeavyIonCSVTagger::HeavyIonCSVTagger(const edm::ParameterSet &configuration, Tokens tokens)
@@ -100,3 +97,26 @@ float HeavyIonCSVTagger::discriminator(const TagInfoHelper &tagInfo) const {
10097

10198
return (mvaID_->evaluate(inputs) + 1.) / 2.;
10299
}
100+
101+
void HeavyIonCSVTagger::fillPSetDescription(edm::ParameterSetDescription &desc) {
102+
desc.add<bool>("useCondDB", false);
103+
desc.add<bool>("useAdaBoost", false);
104+
desc.add<bool>("useGBRForest", true);
105+
desc.add<std::string>("mvaName", "");
106+
desc.add<std::string>("gbrForestLabel", "");
107+
desc.add<edm::FileInPath>("weightFile", edm::FileInPath());
108+
109+
edm::ParameterSetDescription svComputerCfg;
110+
svComputerCfg.setAllowAnything();
111+
desc.add<edm::ParameterSetDescription>("sv_cfg", svComputerCfg);
112+
113+
{
114+
std::vector<edm::ParameterSet> temp;
115+
edm::ParameterSetDescription variablePSet;
116+
variablePSet.add<int>("idx", 0.);
117+
variablePSet.add<double>("default", 1.);
118+
variablePSet.add<std::string>("name", "");
119+
variablePSet.add<std::string>("taggingVarName", "");
120+
desc.addVPSet("variables", variablePSet, temp)->setComment("Default empty VPSet, can contain anything");
121+
}
122+
}

0 commit comments

Comments
 (0)