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

add fillDescriptions to several more plugins in the reco area used at HLT (2/N) #47045

Merged
merged 13 commits into from
Jan 7, 2025
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
24 changes: 17 additions & 7 deletions CommonTools/RecoAlgos/interface/CandidateProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
* $Id: CandidateProducer.h,v 1.4 2010/02/11 00:10:53 wmtan Exp $
*
*/
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Candidate/interface/CandidateFwd.h"
#include "CommonTools/UtilAlgos/interface/MasterCollectionHelper.h"
#include "CommonTools/UtilAlgos/interface/AnySelector.h"
#include "CommonTools/UtilAlgos/interface/EventSetupInitTrait.h"
#include "CommonTools/UtilAlgos/interface/MasterCollectionHelper.h"
#include "DataFormats/Candidate/interface/CandidateFwd.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "FWCore/Utilities/interface/InputTag.h"

namespace converter {
namespace helper {
Expand Down Expand Up @@ -81,6 +83,14 @@ class CandidateProducer : public edm::stream::EDProducer<> {
/// destructor
~CandidateProducer() override {}

/// fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("src", edm::InputTag(""));
Conv::fillPSetDescription(desc);
descriptions.addWithDefaultLabel(desc);
}

private:
/// begin job (first run)
void beginRun(const edm::Run&, const edm::EventSetup& es) override {
Expand Down
7 changes: 6 additions & 1 deletion CommonTools/RecoAlgos/interface/MassiveCandidateConverter.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#ifndef RecoAlgos_MassiveCandidateConverter_h
#define RecoAlgos_MassiveCandidateConverter_h
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "SimGeneral/HepPDTRecord/interface/PdtEntry.h"
#include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
#include "SimGeneral/HepPDTRecord/interface/PdtEntry.h"
#include <string>

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

public:
static void fillPSetDescription(edm::ParameterSetDescription& desc);

protected:
double massSqr_;
PdtEntry particle_;
Expand Down
38 changes: 31 additions & 7 deletions CommonTools/RecoAlgos/interface/RecoTrackSelectorBase.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#ifndef CommonTools_RecoAlgos_RecoTrackSelectorBase_h
#define CommonTools_RecoAlgos_RecoTrackSelectorBase_h

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "DataFormats/Math/interface/deltaPhi.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/Math/interface/deltaPhi.h"
#include "FWCore/Framework/interface/ConsumesCollector.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"
#include "FWCore/Utilities/interface/InputTag.h"

class RecoTrackSelectorBase {
public:
Expand Down Expand Up @@ -79,6 +80,29 @@ class RecoTrackSelectorBase {
vertex_ = (*hVtx)[0].position();
}

static void fillPSetDescription(edm::ParameterSetDescription& desc) {
desc.add<bool>("invertRapidityCut", false);
desc.add<bool>("usePV", false);
desc.add<double>("lip", 300.0);
desc.add<double>("maxChi2", 10000.0);
desc.add<double>("maxPhi", -3.2);
desc.add<double>("maxRapidity", 5.0);
desc.add<double>("minPhi", 3.2);
desc.add<double>("minRapidity", -5.0);
desc.add<double>("ptMin", 0.1);
desc.add<double>("tip", 120.0);
desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
desc.add<edm::InputTag>("vertexTag", edm::InputTag("offlinePrimaryVertices"));
desc.add<int>("min3DLayer", 0);
desc.add<int>("minHit", 0);
desc.add<int>("minLayer", 3);
desc.add<int>("minPixelHit", 0);
desc.add<std::vector<std::string> >("algorithm", {});
desc.add<std::vector<std::string> >("algorithmMaskContains", {});
desc.add<std::vector<std::string> >("originalAlgorithm", {});
desc.add<std::vector<std::string> >("quality", {});
}

bool operator()(const reco::TrackRef& tref) const { return (*this)(*tref); }

bool operator()(const reco::Track& t) const { return (*this)(t, vertex_); }
Expand Down
30 changes: 19 additions & 11 deletions CommonTools/RecoAlgos/interface/TrackFullCloneSelectorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@
*
*/

#include <memory>

#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include <algorithm>
#include <map>
#include <memory>
#include <utility>
#include <vector>

#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackExtra.h"
#include "TrackingTools/PatternTools/interface/Trajectory.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
#include "TrackingTools/PatternTools/interface/Trajectory.h"

namespace reco {
namespace modules {
Expand Down Expand Up @@ -57,7 +57,16 @@ namespace reco {
}
}
/// destructor
~TrackFullCloneSelectorBase() override {}
~TrackFullCloneSelectorBase() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("src", edm::InputTag("generalTracks"));
desc.addUntracked<bool>("copyExtras", false);
desc.addUntracked<bool>("copyTrajectories", false);
Selector::fillPSetDescription(desc);
descriptions.addWithDefaultLabel(desc);
}

private:
/// process one event
Expand Down Expand Up @@ -173,7 +182,6 @@ namespace reco {
std::unique_ptr<std::vector<Trajectory> > selTrajs_;
std::unique_ptr<TrajTrackAssociationCollection> selTTAss_;
};

} // namespace modules
} // namespace reco
#endif
38 changes: 21 additions & 17 deletions CommonTools/RecoAlgos/interface/TrackWithVertexSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
// Created: Fri May 25 10:06:02 CEST 2007
// $Id: TrackWithVertexSelector.h,v 1.4 2010/04/07 08:56:18 gpetrucc Exp $

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "DataFormats/Common/interface/ValueMap.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "FWCore/Framework/interface/ConsumesCollector.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"
#include "FWCore/Utilities/interface/InputTag.h"

class TrackWithVertexSelector {
public:
Expand All @@ -21,6 +23,8 @@ class TrackWithVertexSelector {
explicit TrackWithVertexSelector(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC);
~TrackWithVertexSelector();

static void fillPSetDescription(edm::ParameterSetDescription &desc);

void init(const edm::Event &event, const edm::EventSetup &) { init(event); }
void init(const edm::Event &event);

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

private:
uint32_t numberOfValidHits_;
uint32_t numberOfValidPixelHits_;
uint32_t numberOfLostHits_;
double normalizedChi2_;
double ptMin_, ptMax_, etaMin_, etaMax_;
double dzMax_, d0Max_;
double ptErrorCut_;
std::string quality_;
const uint32_t numberOfValidHits_;
const uint32_t numberOfValidPixelHits_;
const uint32_t numberOfLostHits_;
const double normalizedChi2_;
const double ptMin_, ptMax_, etaMin_, etaMax_;
const double dzMax_, d0Max_;
const double ptErrorCut_;
const std::string quality_;

uint32_t nVertices_;
edm::EDGetTokenT<reco::VertexCollection> vertexToken_;
edm::EDGetTokenT<edm::ValueMap<float> > timesToken_, timeResosToken_;
bool vtxFallback_;
double zetaVtx_, rhoVtx_, nSigmaDtVertex_;
const uint32_t nVertices_;
const edm::EDGetTokenT<reco::VertexCollection> vertexToken_;
const edm::EDGetTokenT<edm::ValueMap<float> > timesToken_, timeResosToken_;
const bool vtxFallback_;
const double zetaVtx_, rhoVtx_, nSigmaDtVertex_;

reco::VertexCollection const *vcoll_ = nullptr;
edm::ValueMap<float> const *timescoll_ = nullptr;
Expand Down
6 changes: 6 additions & 0 deletions CommonTools/RecoAlgos/src/MassiveCandidateConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ void MassiveCandidateConverter::beginFirstRun(const EventSetup& es) {
massSqr_ = particle_.data().mass();
massSqr_ *= massSqr_;
}

void MassiveCandidateConverter::fillPSetDescription(edm::ParameterSetDescription& desc) {
desc.addNode(edm::ParameterDescription<int>("particleType", true) xor
edm::ParameterDescription<std::string>("particleType", true))
->setComment("the PdtEntry can be specified as either an 'int' or via its name using a 'string'");
}
2 changes: 2 additions & 0 deletions CommonTools/RecoAlgos/src/RecoChargedRefCandidateToTrackRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CommonTools_RecoAlgos_TrackToRefCandidate_h
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
#include "DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h"
#include "DataFormats/RecoCandidate/interface/RecoChargedRefCandidateFwd.h"

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

Expand Down
24 changes: 24 additions & 0 deletions CommonTools/RecoAlgos/src/TrackWithVertexSelector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,27 @@ bool TrackWithVertexSelector::operator()(const reco::TrackRef &tref) const {
return true;
return testVertices(tref, *vcoll_);
}

void TrackWithVertexSelector::fillPSetDescription(edm::ParameterSetDescription &desc) {
desc.add<uint32_t>("numberOfValidHits", 0);
desc.add<uint32_t>("numberOfValidPixelHits", 0);
desc.add<uint32_t>("numberOfLostHits", 999)->setComment("at most 999 lost hits");
desc.add<double>("normalizedChi2", 999999.);
desc.add<double>("ptMin", 0.3)->setComment("in GeV");
desc.add<double>("ptMax", 500.0)->setComment("in GeV");
desc.add<double>("etaMin", 0.0);
desc.add<double>("etaMax", 50.0);
desc.add<double>("dzMax", 999.)->setComment("in cm");
desc.add<double>("d0Max", 999.)->setComment("in cm");
desc.add<double>("ptErrorCut", 0.2)->setComment("[pTError/pT]*max(1,normChi2) <= ptErrorCut");
desc.add<std::string>("quality", "highPurity")->setComment(" quality cut as defined in reco::TrackBase");
desc.add<bool>("useVtx", true)->setComment("compatibility with a vertex");
desc.add<uint32_t>("nVertices", 0)->setComment(" how many vertices to look at before dropping the track");
desc.add<edm::InputTag>("vertexTag", edm::InputTag("offlinePrimaryVertices"));
desc.add<edm::InputTag>("timesTag", edm::InputTag(""));
desc.add<edm::InputTag>("timeResosTag", edm::InputTag(""));
desc.add<bool>("vtxFallback", true)->setComment("falback to beam spot if there are no vertices");
desc.add<double>("zetaVtx", 1.0);
desc.add<double>("rhoVtx", 0.2)->setComment("tags used by b-tagging folks");
desc.add<double>("nSigmaDtVertex", 0);
}
14 changes: 2 additions & 12 deletions JetMETCorrections/Modules/plugins/ChainedJetCorrectorProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,6 @@ class ChainedJetCorrectorProducer : public edm::stream::EDProducer<> {
std::vector<edm::EDGetTokenT<reco::JetCorrector>> correctorTokens_;
};

//
// constants, enums and typedefs
//

//
// static data member definitions
//

//
// constructors and destructor
//
Expand Down Expand Up @@ -169,11 +161,9 @@ void ChainedJetCorrectorProducer::produce(edm::Event& iEvent, const edm::EventSe

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

//define this as a plug-in
Expand Down
23 changes: 19 additions & 4 deletions RecoBTag/Combined/plugins/DeepFlavourJetTagsProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,26 @@ namespace {

// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
void DeepFlavourJetTagsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
//The following says we do not know what parameters are allowed so do no validation
// Please change this to state exactly what you do use, even if it is no parameters
edm::ParameterSetDescription desc;
desc.setUnknown();
descriptions.addDefault(desc);

// Define the parameters
desc.add<edm::InputTag>("src", edm::InputTag("pfDeepCSVTagInfos"))
->setComment("InputTag for the source tag info collection.");
desc.add<bool>("checkSVForDefaults", false)->setComment("Flag to check secondary vertex defaults.");
desc.add<bool>("meanPadding", false)->setComment("Enable or disable mean padding for input features.");
desc.add<edm::FileInPath>("NNConfig", edm::FileInPath("RecoBTag/Combined/data/DeepFlavourNoSL.json"))
->setComment("Path to the JSON file containing the neural network configuration.");

// Define the 'toAdd' parameter as a ParameterSet with arbitrary string keys
edm::ParameterSetDescription toAddDesc;
toAddDesc.setAllowAnything(); // Allow any string-to-string mappings
desc.add<edm::ParameterSetDescription>("toAdd", toAddDesc)
->setComment(
"ParameterSet for merging different NN outputs together. "
"Each key is an output to merge, and its value is the target output.");

// Add this producer's description to the descriptions registry
descriptions.addWithDefaultLabel(desc);
}
} // end unnamed namespace

Expand Down
Loading