Skip to content

Commit 84d3a60

Browse files
authored
Merge pull request #47045 from mmusich/mm_fillDesc_migration_v2
add `fillDescriptions` to several more plugins in the reco area used at HLT
2 parents d51a812 + f046bd8 commit 84d3a60

30 files changed

+566
-311
lines changed

CommonTools/RecoAlgos/interface/CandidateProducer.h

+17-7
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212
* $Id: CandidateProducer.h,v 1.4 2010/02/11 00:10:53 wmtan Exp $
1313
*
1414
*/
15-
#include "FWCore/Utilities/interface/InputTag.h"
16-
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
17-
#include "FWCore/Framework/interface/stream/EDProducer.h"
18-
#include "FWCore/Framework/interface/Event.h"
19-
#include "DataFormats/Common/interface/Handle.h"
20-
#include "DataFormats/Candidate/interface/CandidateFwd.h"
21-
#include "CommonTools/UtilAlgos/interface/MasterCollectionHelper.h"
2215
#include "CommonTools/UtilAlgos/interface/AnySelector.h"
2316
#include "CommonTools/UtilAlgos/interface/EventSetupInitTrait.h"
17+
#include "CommonTools/UtilAlgos/interface/MasterCollectionHelper.h"
18+
#include "DataFormats/Candidate/interface/CandidateFwd.h"
19+
#include "DataFormats/Common/interface/Handle.h"
20+
#include "FWCore/Framework/interface/Event.h"
21+
#include "FWCore/Framework/interface/stream/EDProducer.h"
22+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
23+
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
24+
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
25+
#include "FWCore/Utilities/interface/InputTag.h"
2426

2527
namespace converter {
2628
namespace helper {
@@ -81,6 +83,14 @@ class CandidateProducer : public edm::stream::EDProducer<> {
8183
/// destructor
8284
~CandidateProducer() override {}
8385

86+
/// fillDescriptions
87+
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
88+
edm::ParameterSetDescription desc;
89+
desc.add<edm::InputTag>("src", edm::InputTag(""));
90+
Conv::fillPSetDescription(desc);
91+
descriptions.addWithDefaultLabel(desc);
92+
}
93+
8494
private:
8595
/// begin job (first run)
8696
void beginRun(const edm::Run&, const edm::EventSetup& es) override {

CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#ifndef RecoAlgos_MassiveCandidateConverter_h
22
#define RecoAlgos_MassiveCandidateConverter_h
3+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
4+
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
35
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
46
#include "FWCore/Utilities/interface/ESGetToken.h"
5-
#include "SimGeneral/HepPDTRecord/interface/PdtEntry.h"
67
#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
8+
#include "SimGeneral/HepPDTRecord/interface/PdtEntry.h"
79
#include <string>
810

911
namespace edm {
@@ -16,6 +18,9 @@ namespace converter {
1618
MassiveCandidateConverter(const edm::ParameterSet&, edm::ConsumesCollector);
1719
void beginFirstRun(const edm::EventSetup&);
1820

21+
public:
22+
static void fillPSetDescription(edm::ParameterSetDescription& desc);
23+
1924
protected:
2025
double massSqr_;
2126
PdtEntry particle_;

CommonTools/RecoAlgos/interface/RecoTrackSelectorBase.h

+31-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
#ifndef CommonTools_RecoAlgos_RecoTrackSelectorBase_h
22
#define CommonTools_RecoAlgos_RecoTrackSelectorBase_h
33

4-
#include "FWCore/Framework/interface/Event.h"
5-
#include "FWCore/Framework/interface/ConsumesCollector.h"
6-
#include "FWCore/ParameterSet/interface/ParameterSet.h"
7-
#include "FWCore/Utilities/interface/InputTag.h"
8-
4+
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
5+
#include "DataFormats/Math/interface/deltaPhi.h"
96
#include "DataFormats/TrackReco/interface/Track.h"
107
#include "DataFormats/TrackReco/interface/TrackFwd.h"
11-
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
128
#include "DataFormats/VertexReco/interface/Vertex.h"
139
#include "DataFormats/VertexReco/interface/VertexFwd.h"
14-
#include "DataFormats/Math/interface/deltaPhi.h"
10+
#include "FWCore/Framework/interface/ConsumesCollector.h"
11+
#include "FWCore/Framework/interface/Event.h"
12+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
13+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
14+
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
15+
#include "FWCore/Utilities/interface/InputTag.h"
1516

1617
class RecoTrackSelectorBase {
1718
public:
@@ -79,6 +80,29 @@ class RecoTrackSelectorBase {
7980
vertex_ = (*hVtx)[0].position();
8081
}
8182

83+
static void fillPSetDescription(edm::ParameterSetDescription& desc) {
84+
desc.add<bool>("invertRapidityCut", false);
85+
desc.add<bool>("usePV", false);
86+
desc.add<double>("lip", 300.0);
87+
desc.add<double>("maxChi2", 10000.0);
88+
desc.add<double>("maxPhi", -3.2);
89+
desc.add<double>("maxRapidity", 5.0);
90+
desc.add<double>("minPhi", 3.2);
91+
desc.add<double>("minRapidity", -5.0);
92+
desc.add<double>("ptMin", 0.1);
93+
desc.add<double>("tip", 120.0);
94+
desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
95+
desc.add<edm::InputTag>("vertexTag", edm::InputTag("offlinePrimaryVertices"));
96+
desc.add<int>("min3DLayer", 0);
97+
desc.add<int>("minHit", 0);
98+
desc.add<int>("minLayer", 3);
99+
desc.add<int>("minPixelHit", 0);
100+
desc.add<std::vector<std::string> >("algorithm", {});
101+
desc.add<std::vector<std::string> >("algorithmMaskContains", {});
102+
desc.add<std::vector<std::string> >("originalAlgorithm", {});
103+
desc.add<std::vector<std::string> >("quality", {});
104+
}
105+
82106
bool operator()(const reco::TrackRef& tref) const { return (*this)(*tref); }
83107

84108
bool operator()(const reco::Track& t) const { return (*this)(t, vertex_); }

CommonTools/RecoAlgos/interface/TrackFullCloneSelectorBase.h

+19-11
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@
1212
*
1313
*/
1414

15-
#include <memory>
16-
17-
#include "FWCore/Framework/interface/ConsumesCollector.h"
18-
#include "FWCore/Framework/interface/Event.h"
19-
#include "FWCore/Framework/interface/stream/EDProducer.h"
20-
#include "FWCore/ParameterSet/interface/ParameterSet.h"
21-
#include "FWCore/Utilities/interface/InputTag.h"
2215
#include <algorithm>
2316
#include <map>
2417
#include <memory>
2518
#include <utility>
2619
#include <vector>
2720

28-
#include "DataFormats/TrackReco/interface/TrackFwd.h"
2921
#include "DataFormats/TrackReco/interface/Track.h"
3022
#include "DataFormats/TrackReco/interface/TrackExtra.h"
31-
#include "TrackingTools/PatternTools/interface/Trajectory.h"
23+
#include "DataFormats/TrackReco/interface/TrackFwd.h"
24+
#include "FWCore/Framework/interface/ConsumesCollector.h"
25+
#include "FWCore/Framework/interface/Event.h"
26+
#include "FWCore/Framework/interface/stream/EDProducer.h"
27+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
28+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
29+
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
30+
#include "FWCore/Utilities/interface/InputTag.h"
3231
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
32+
#include "TrackingTools/PatternTools/interface/Trajectory.h"
3333

3434
namespace reco {
3535
namespace modules {
@@ -57,7 +57,16 @@ namespace reco {
5757
}
5858
}
5959
/// destructor
60-
~TrackFullCloneSelectorBase() override {}
60+
~TrackFullCloneSelectorBase() override = default;
61+
62+
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
63+
edm::ParameterSetDescription desc;
64+
desc.add<edm::InputTag>("src", edm::InputTag("generalTracks"));
65+
desc.addUntracked<bool>("copyExtras", false);
66+
desc.addUntracked<bool>("copyTrajectories", false);
67+
Selector::fillPSetDescription(desc);
68+
descriptions.addWithDefaultLabel(desc);
69+
}
6170

6271
private:
6372
/// process one event
@@ -173,7 +182,6 @@ namespace reco {
173182
std::unique_ptr<std::vector<Trajectory> > selTrajs_;
174183
std::unique_ptr<TrajTrackAssociationCollection> selTTAss_;
175184
};
176-
177185
} // namespace modules
178186
} // namespace reco
179187
#endif

CommonTools/RecoAlgos/interface/TrackWithVertexSelector.h

+21-17
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
// Created: Fri May 25 10:06:02 CEST 2007
66
// $Id: TrackWithVertexSelector.h,v 1.4 2010/04/07 08:56:18 gpetrucc Exp $
77

8-
#include "FWCore/ParameterSet/interface/ParameterSet.h"
9-
#include "FWCore/Utilities/interface/InputTag.h"
10-
#include "FWCore/Framework/interface/Event.h"
11-
#include "FWCore/Framework/interface/ConsumesCollector.h"
128
#include "DataFormats/Common/interface/ValueMap.h"
139
#include "DataFormats/TrackReco/interface/Track.h"
1410
#include "DataFormats/VertexReco/interface/Vertex.h"
1511
#include "DataFormats/VertexReco/interface/VertexFwd.h"
12+
#include "FWCore/Framework/interface/ConsumesCollector.h"
13+
#include "FWCore/Framework/interface/Event.h"
14+
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
15+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
16+
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
17+
#include "FWCore/Utilities/interface/InputTag.h"
1618

1719
class TrackWithVertexSelector {
1820
public:
@@ -21,6 +23,8 @@ class TrackWithVertexSelector {
2123
explicit TrackWithVertexSelector(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC);
2224
~TrackWithVertexSelector();
2325

26+
static void fillPSetDescription(edm::ParameterSetDescription &desc);
27+
2428
void init(const edm::Event &event, const edm::EventSetup &) { init(event); }
2529
void init(const edm::Event &event);
2630

@@ -42,20 +46,20 @@ class TrackWithVertexSelector {
4246
bool testVertices(const reco::TrackRef &t, const reco::VertexCollection &vtxs) const;
4347

4448
private:
45-
uint32_t numberOfValidHits_;
46-
uint32_t numberOfValidPixelHits_;
47-
uint32_t numberOfLostHits_;
48-
double normalizedChi2_;
49-
double ptMin_, ptMax_, etaMin_, etaMax_;
50-
double dzMax_, d0Max_;
51-
double ptErrorCut_;
52-
std::string quality_;
49+
const uint32_t numberOfValidHits_;
50+
const uint32_t numberOfValidPixelHits_;
51+
const uint32_t numberOfLostHits_;
52+
const double normalizedChi2_;
53+
const double ptMin_, ptMax_, etaMin_, etaMax_;
54+
const double dzMax_, d0Max_;
55+
const double ptErrorCut_;
56+
const std::string quality_;
5357

54-
uint32_t nVertices_;
55-
edm::EDGetTokenT<reco::VertexCollection> vertexToken_;
56-
edm::EDGetTokenT<edm::ValueMap<float> > timesToken_, timeResosToken_;
57-
bool vtxFallback_;
58-
double zetaVtx_, rhoVtx_, nSigmaDtVertex_;
58+
const uint32_t nVertices_;
59+
const edm::EDGetTokenT<reco::VertexCollection> vertexToken_;
60+
const edm::EDGetTokenT<edm::ValueMap<float> > timesToken_, timeResosToken_;
61+
const bool vtxFallback_;
62+
const double zetaVtx_, rhoVtx_, nSigmaDtVertex_;
5963

6064
reco::VertexCollection const *vcoll_ = nullptr;
6165
edm::ValueMap<float> const *timescoll_ = nullptr;

CommonTools/RecoAlgos/src/MassiveCandidateConverter.cc

+6
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ void MassiveCandidateConverter::beginFirstRun(const EventSetup& es) {
2020
massSqr_ = particle_.data().mass();
2121
massSqr_ *= massSqr_;
2222
}
23+
24+
void MassiveCandidateConverter::fillPSetDescription(edm::ParameterSetDescription& desc) {
25+
desc.addNode(edm::ParameterDescription<int>("particleType", true) xor
26+
edm::ParameterDescription<std::string>("particleType", true))
27+
->setComment("the PdtEntry can be specified as either an 'int' or via its name using a 'string'");
28+
}

CommonTools/RecoAlgos/src/RecoChargedRefCandidateToTrackRef.h

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define CommonTools_RecoAlgos_TrackToRefCandidate_h
33
#include "DataFormats/TrackReco/interface/Track.h"
44
#include "DataFormats/TrackReco/interface/TrackFwd.h"
5+
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
56
#include "DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h"
67
#include "DataFormats/RecoCandidate/interface/RecoChargedRefCandidateFwd.h"
78

@@ -19,6 +20,7 @@ namespace converter {
1920
RecoChargedRefCandidateToTrackRef(const edm::ParameterSet& cfg, const edm::ConsumesCollector&) {}
2021
void beginFirstRun(const edm::EventSetup&) {}
2122
void convert(const reco::RecoChargedRefCandidateRef& c, reco::TrackRef& trkRef) const { trkRef = c->track(); }
23+
static void fillPSetDescription(edm::ParameterSetDescription& desc) {}
2224
};
2325
} // namespace converter
2426

CommonTools/RecoAlgos/src/TrackWithVertexSelector.cc

+24
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,27 @@ bool TrackWithVertexSelector::operator()(const reco::TrackRef &tref) const {
128128
return true;
129129
return testVertices(tref, *vcoll_);
130130
}
131+
132+
void TrackWithVertexSelector::fillPSetDescription(edm::ParameterSetDescription &desc) {
133+
desc.add<uint32_t>("numberOfValidHits", 0);
134+
desc.add<uint32_t>("numberOfValidPixelHits", 0);
135+
desc.add<uint32_t>("numberOfLostHits", 999)->setComment("at most 999 lost hits");
136+
desc.add<double>("normalizedChi2", 999999.);
137+
desc.add<double>("ptMin", 0.3)->setComment("in GeV");
138+
desc.add<double>("ptMax", 500.0)->setComment("in GeV");
139+
desc.add<double>("etaMin", 0.0);
140+
desc.add<double>("etaMax", 50.0);
141+
desc.add<double>("dzMax", 999.)->setComment("in cm");
142+
desc.add<double>("d0Max", 999.)->setComment("in cm");
143+
desc.add<double>("ptErrorCut", 0.2)->setComment("[pTError/pT]*max(1,normChi2) <= ptErrorCut");
144+
desc.add<std::string>("quality", "highPurity")->setComment(" quality cut as defined in reco::TrackBase");
145+
desc.add<bool>("useVtx", true)->setComment("compatibility with a vertex");
146+
desc.add<uint32_t>("nVertices", 0)->setComment(" how many vertices to look at before dropping the track");
147+
desc.add<edm::InputTag>("vertexTag", edm::InputTag("offlinePrimaryVertices"));
148+
desc.add<edm::InputTag>("timesTag", edm::InputTag(""));
149+
desc.add<edm::InputTag>("timeResosTag", edm::InputTag(""));
150+
desc.add<bool>("vtxFallback", true)->setComment("falback to beam spot if there are no vertices");
151+
desc.add<double>("zetaVtx", 1.0);
152+
desc.add<double>("rhoVtx", 0.2)->setComment("tags used by b-tagging folks");
153+
desc.add<double>("nSigmaDtVertex", 0);
154+
}

JetMETCorrections/Modules/plugins/ChainedJetCorrectorProducer.cc

+2-12
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,6 @@ class ChainedJetCorrectorProducer : public edm::stream::EDProducer<> {
122122
std::vector<edm::EDGetTokenT<reco::JetCorrector>> correctorTokens_;
123123
};
124124

125-
//
126-
// constants, enums and typedefs
127-
//
128-
129-
//
130-
// static data member definitions
131-
//
132-
133125
//
134126
// constructors and destructor
135127
//
@@ -169,11 +161,9 @@ void ChainedJetCorrectorProducer::produce(edm::Event& iEvent, const edm::EventSe
169161

170162
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
171163
void ChainedJetCorrectorProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
172-
//The following says we do not know what parameters are allowed so do no validation
173-
// Please change this to state exactly what you do use, even if it is no parameters
174164
edm::ParameterSetDescription desc;
175-
desc.add<std::vector<edm::InputTag>>("correctors");
176-
descriptions.addDefault(desc);
165+
desc.add<std::vector<edm::InputTag>>("correctors", {});
166+
descriptions.addWithDefaultLabel(desc);
177167
}
178168

179169
//define this as a plug-in

RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc

+19-4
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,26 @@ namespace {
288288

289289
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
290290
void DeepFlavourJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
291-
//The following says we do not know what parameters are allowed so do no validation
292-
// Please change this to state exactly what you do use, even if it is no parameters
293291
edm::ParameterSetDescription desc;
294-
desc.setUnknown();
295-
descriptions.addDefault(desc);
292+
293+
// Define the parameters
294+
desc.add<edm::InputTag>("src", edm::InputTag("pfDeepCSVTagInfos"))
295+
->setComment("InputTag for the source tag info collection.");
296+
desc.add<bool>("checkSVForDefaults", false)->setComment("Flag to check secondary vertex defaults.");
297+
desc.add<bool>("meanPadding", false)->setComment("Enable or disable mean padding for input features.");
298+
desc.add<edm::FileInPath>("NNConfig", edm::FileInPath("RecoBTag/Combined/data/DeepFlavourNoSL.json"))
299+
->setComment("Path to the JSON file containing the neural network configuration.");
300+
301+
// Define the 'toAdd' parameter as a ParameterSet with arbitrary string keys
302+
edm::ParameterSetDescription toAddDesc;
303+
toAddDesc.setAllowAnything(); // Allow any string-to-string mappings
304+
desc.add<edm::ParameterSetDescription>("toAdd", toAddDesc)
305+
->setComment(
306+
"ParameterSet for merging different NN outputs together. "
307+
"Each key is an output to merge, and its value is the target output.");
308+
309+
// Add this producer's description to the descriptions registry
310+
descriptions.addWithDefaultLabel(desc);
296311
}
297312
} // end unnamed namespace
298313

0 commit comments

Comments
 (0)