Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup redundant edm ParameterSet exist in PhysicsTools #38284

Merged
merged 3 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 5 additions & 30 deletions PhysicsTools/PatAlgos/plugins/JetCorrFactorsProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,49 +174,24 @@ JetCorrFactorsProducer::JetCorrFactorsProducer(const edm::ParameterSet& cfg)
// L1Offset correction, which is an additional input to the L1JPTOffset
// corrector
if (std::find(levels.begin(), levels.end(), "L1JPTOffset") != levels.end()) {
if (cfg.existsAs<std::string>("extraJPTOffset")) {
extraJPTOffset_.push_back(cfg.getParameter<std::string>("extraJPTOffset"));
} else {
throw cms::Exception("No parameter extraJPTOffset specified")
<< "The configured correction levels contain a L1JPTOffset correction, which re- \n"
<< "quires the additional parameter extraJPTOffset or type std::string. This \n"
<< "string should correspond to the L1Offset corrections that should be applied \n"
<< "together with the JPTL1Offset corrections. These corrections can be of type \n"
<< "L1Offset or L1FastJet. \n";
}
extraJPTOffset_.push_back(cfg.getParameter<std::string>("extraJPTOffset"));
}
// if the std::string L1Offset can be found in levels an additional para-
// meter primaryVertices is needed, which should pass on the offline pri-
// mary vertex collection. The size of this collection is needed for the
// L1Offset correction.
if (useNPV_) {
if (cfg.existsAs<edm::InputTag>("primaryVertices")) {
primaryVertices_ = cfg.getParameter<edm::InputTag>("primaryVertices");
primaryVerticesToken_ = mayConsume<std::vector<reco::Vertex> >(primaryVertices_);
} else {
throw cms::Exception("No primaryVertices specified")
<< "The configured correction levels contain an L1Offset or L1FastJet correction, \n"
<< "which requires the number of offlinePrimaryVertices. Please specify this col- \n"
<< "lection as additional optional parameter primaryVertices of type edm::InputTag\n"
<< "in the jetCorrFactors module. \n";
}
primaryVertices_ = cfg.getParameter<edm::InputTag>("primaryVertices");
primaryVerticesToken_ = mayConsume<std::vector<reco::Vertex> >(primaryVertices_);
}
// if the std::string L1FastJet can be found in levels an additional
// parameter rho is needed, which should pass on the energy density
// parameter for the corresponding jet collection.
if (useRho_) {
if ((!extraJPTOffset_.empty() && extraJPTOffset_.front() == std::string("L1FastJet")) ||
std::find(levels.begin(), levels.end(), "L1FastJet") != levels.end()) {
if (cfg.existsAs<edm::InputTag>("rho")) {
rho_ = cfg.getParameter<edm::InputTag>("rho");
rhoToken_ = mayConsume<double>(rho_);
} else {
throw cms::Exception("No parameter rho specified")
<< "The configured correction levels contain a L1FastJet correction, which re- \n"
<< "quires the energy density parameter rho. Please specify this collection as \n"
<< "additional optional parameter rho of type edm::InputTag in the jetCorrFac- \n"
<< "tors module. \n";
}
rho_ = cfg.getParameter<edm::InputTag>("rho");
rhoToken_ = mayConsume<double>(rho_);
} else {
edm::LogInfo message("Parameter rho not used");
message << "Module is configured to use the parameter rho, but rho is only used \n"
Expand Down
15 changes: 3 additions & 12 deletions PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,7 @@ PATElectronProducer::PATElectronProducer(const edm::ParameterSet& iConfig)
pvToken_(mayConsume<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("pvSrc"))),
addElecID_(iConfig.getParameter<bool>("addElectronID")),
pTComparator_(),
isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation")
: edm::ParameterSet(),
consumesCollector(),
false),
isolator_(iConfig.getParameter<edm::ParameterSet>("userIsolation"), consumesCollector(), false),
addEfficiencies_(iConfig.getParameter<bool>("addEfficiencies")),
addResolutions_(iConfig.getParameter<bool>("addResolutions")),
useUserData_(iConfig.exists("userData")),
Expand All @@ -328,14 +325,8 @@ PATElectronProducer::PATElectronProducer(const edm::ParameterSet& iConfig)
// MC matching configurables (scheduled mode)

if (addGenMatch_) {
if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection>>(
iConfig.getParameter<edm::InputTag>("genParticleMatch")));
} else {
genMatchTokens_ = edm::vector_transform(
iConfig.getParameter<std::vector<edm::InputTag>>("genParticleMatch"),
[this](edm::InputTag const& tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
}
genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection>>(
iConfig.getParameter<edm::InputTag>("genParticleMatch")));
}
// resolution configurables
if (addResolutions_) {
Expand Down
5 changes: 1 addition & 4 deletions PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,7 @@ PATMuonProducer::PATMuonProducer(const edm::ParameterSet& iConfig, PATMuonHeavyO
computeSoftMuonMVA_(false),
recomputeBasicSelectors_(false),
mvaUseJec_(false),
isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation")
: edm::ParameterSet(),
consumesCollector(),
false),
isolator_(iConfig.getParameter<edm::ParameterSet>("userIsolation"), consumesCollector(), false),
geometryToken_{esConsumes()},
transientTrackBuilderToken_{esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))},
patMuonPutToken_{produces<std::vector<Muon>>()} {
Expand Down
19 changes: 4 additions & 15 deletions PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,8 @@ void pat::PATPhotonProducer::readIsolationLabels(const edm::ParameterSet& iConfi
using namespace pat;

PATPhotonProducer::PATPhotonProducer(const edm::ParameterSet& iConfig)
:

ecalClusterToolsESGetTokens_{consumesCollector()},
isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation")
: edm::ParameterSet(),
consumesCollector(),
false),
: ecalClusterToolsESGetTokens_{consumesCollector()},
isolator_(iConfig.getParameter<edm::ParameterSet>("userIsolation"), consumesCollector(), false),
useUserData_(iConfig.exists("userData")),
ecalTopologyToken_{esConsumes()},
ecalGeometryToken_{esConsumes()} {
Expand All @@ -221,14 +216,8 @@ PATPhotonProducer::PATPhotonProducer(const edm::ParameterSet& iConfig)
addGenMatch_ = iConfig.getParameter<bool>("addGenMatch");
if (addGenMatch_) {
embedGenMatch_ = iConfig.getParameter<bool>("embedGenMatch");
if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection>>(
iConfig.getParameter<edm::InputTag>("genParticleMatch")));
} else {
genMatchTokens_ = edm::vector_transform(
iConfig.getParameter<std::vector<edm::InputTag>>("genParticleMatch"),
[this](edm::InputTag const& tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
}
genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection>>(
iConfig.getParameter<edm::InputTag>("genParticleMatch")));
}
// Efficiency configurables
addEfficiencies_ = iConfig.getParameter<bool>("addEfficiencies");
Expand Down
15 changes: 3 additions & 12 deletions PhysicsTools/PatAlgos/plugins/PATTauProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,7 @@ namespace pat {
using namespace pat;

PATTauProducer::PATTauProducer(const edm::ParameterSet& iConfig)
: isolator_(iConfig.exists("userIsolation") ? iConfig.getParameter<edm::ParameterSet>("userIsolation")
: edm::ParameterSet(),
consumesCollector(),
false),
: isolator_(iConfig.getParameter<edm::ParameterSet>("userIsolation"), consumesCollector(), false),
useUserData_(iConfig.exists("userData")),
posAtECalEntranceComputer_(consumesCollector()) {
firstOccurence_ = true;
Expand All @@ -170,14 +167,8 @@ PATTauProducer::PATTauProducer(const edm::ParameterSet& iConfig)
addGenMatch_ = iConfig.getParameter<bool>("addGenMatch");
if (addGenMatch_) {
embedGenMatch_ = iConfig.getParameter<bool>("embedGenMatch");
if (iConfig.existsAs<edm::InputTag>("genParticleMatch")) {
genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection>>(
iConfig.getParameter<edm::InputTag>("genParticleMatch")));
} else {
genMatchTokens_ = edm::vector_transform(
iConfig.getParameter<std::vector<edm::InputTag>>("genParticleMatch"),
[this](edm::InputTag const& tag) { return consumes<edm::Association<reco::GenParticleCollection>>(tag); });
}
genMatchTokens_.push_back(consumes<edm::Association<reco::GenParticleCollection>>(
iConfig.getParameter<edm::InputTag>("genParticleMatch")));
}
addGenJetMatch_ = iConfig.getParameter<bool>("addGenJetMatch");
if (addGenJetMatch_) {
Expand Down