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

added esConsumes to modules in RecoBTag/SecondaryVertex #30555

Merged
merged 1 commit into from Jul 7, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions RecoBTag/SecondaryVertex/plugins/BoostedDoubleSVProducer.cc
Expand Up @@ -30,6 +30,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/StreamID.h"
#include "FWCore/Utilities/interface/isFinite.h"
#include "FWCore/Utilities/interface/ESGetToken.h"

#include "DataFormats/BTauReco/interface/CandIPTagInfo.h"
#include "DataFormats/BTauReco/interface/CandSecondaryVertexTagInfo.h"
Expand Down Expand Up @@ -93,6 +94,7 @@ class BoostedDoubleSVProducer : public edm::stream::EDProducer<> {
reco::TrackSelector trackSelector;

edm::EDGetTokenT<edm::ValueMap<float>> weightsToken_;
edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> trackBuilderToken_;
edm::Handle<edm::ValueMap<float>> weightsHandle_;

// static variables
Expand Down Expand Up @@ -131,6 +133,8 @@ BoostedDoubleSVProducer::BoostedDoubleSVProducer(const edm::ParameterSet& iConfi
trackPairV0Filter(iConfig.getParameter<edm::ParameterSet>("trackPairV0Filter")),
trackSelector(iConfig.getParameter<edm::ParameterSet>("trackSelection")) {
edm::InputTag srcWeights = iConfig.getParameter<edm::InputTag>("weights");
trackBuilderToken_ =
esConsumes<TransientTrackBuilder, TransientTrackRecord>(edm::ESInputTag("", "TransientTrackBuilder"));
if (!srcWeights.label().empty())
weightsToken_ = consumes<edm::ValueMap<float>>(srcWeights);
produces<std::vector<reco::BoostedDoubleSVTagInfo>>();
Expand All @@ -148,8 +152,7 @@ BoostedDoubleSVProducer::~BoostedDoubleSVProducer() {
// ------------ method called to produce the data ------------
void BoostedDoubleSVProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
// get the track builder
edm::ESHandle<TransientTrackBuilder> trackBuilder;
iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);
edm::ESHandle<TransientTrackBuilder> trackBuilder = iSetup.getHandle(trackBuilderToken_);

// get input secondary vertex TagInfos
edm::Handle<std::vector<reco::CandSecondaryVertexTagInfo>> svTagInfos;
Expand Down
Expand Up @@ -21,6 +21,7 @@
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/Utilities/interface/ESGetToken.h"

#include "FWCore/ParameterSet/interface/Registry.h"
#include "FWCore/Common/interface/Provenance.h"
Expand Down Expand Up @@ -167,6 +168,7 @@ class TemplatedSecondaryVertexProducer : public edm::stream::EDProducer<> {
edm::EDGetTokenT<edm::View<reco::Jet> > token_fatJets;
edm::EDGetTokenT<edm::View<reco::Jet> > token_groomedFatJets;
edm::EDGetTokenT<edm::ValueMap<float> > token_weights;
edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> token_trackBuilder;

ClusterSequencePtr fjClusterSeq;
JetDefPtr fjJetDefinition;
Expand Down Expand Up @@ -291,6 +293,8 @@ TemplatedSecondaryVertexProducer<IPTI, VTX>::TemplatedSecondaryVertexProducer(co
throw cms::Exception("InvalidJetAlgorithm") << "Jet clustering algorithm is invalid: " << jetAlgorithm
<< ", use CambridgeAachen | Kt | AntiKt" << std::endl;
}
token_trackBuilder =
esConsumes<TransientTrackBuilder, TransientTrackRecord>(edm::ESInputTag("", "TransientTrackBuilder"));
if (useFatJets) {
token_fatJets = consumes<edm::View<reco::Jet> >(params.getParameter<edm::InputTag>("fatJets"));
}
Expand All @@ -315,8 +319,7 @@ void TemplatedSecondaryVertexProducer<IPTI, VTX>::produce(edm::Event &event, con
//How about good old pointers?
typedef std::map<const Track *, TransientTrack> TransientTrackMap;

edm::ESHandle<TransientTrackBuilder> trackBuilder;
es.get<TransientTrackRecord>().get("TransientTrackBuilder", trackBuilder);
edm::ESHandle<TransientTrackBuilder> trackBuilder = es.getHandle(token_trackBuilder);

edm::Handle<std::vector<IPTI> > trackIPTagInfos;
event.getByToken(token_trackIPTagInfo, trackIPTagInfos);
Expand Down