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

Fix CMS deprecated warnings in CommonTools/RecoAlgos #35789

Merged
merged 1 commit into from Oct 23, 2021
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
12 changes: 7 additions & 5 deletions CommonTools/RecoAlgos/plugins/CaloRecHitCandidateProducer.cc
@@ -1,12 +1,12 @@
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/RecoCandidate/interface/CaloRecHitCandidate.h"

namespace reco {
namespace modules {

template <typename HitCollection>
class CaloRecHitCandidateProducer : public edm::EDProducer {
class CaloRecHitCandidateProducer : public edm::global::EDProducer<> {
public:
/// constructor
CaloRecHitCandidateProducer(const edm::ParameterSet &cfg)
Expand All @@ -16,9 +16,9 @@ namespace reco {

private:
/// process one event
void produce(edm::Event &, const edm::EventSetup &) override;
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
/// source collection tag
edm::EDGetTokenT<HitCollection> srcToken_;
const edm::EDGetTokenT<HitCollection> srcToken_;
};
} // namespace modules
} // namespace reco
Expand All @@ -31,7 +31,9 @@ namespace reco {
namespace modules {

template <typename HitCollection>
void CaloRecHitCandidateProducer<HitCollection>::produce(edm::Event &evt, const edm::EventSetup &) {
void CaloRecHitCandidateProducer<HitCollection>::produce(edm::StreamID,
edm::Event &evt,
const edm::EventSetup &) const {
using namespace edm;
using namespace reco;
using namespace std;
Expand Down
13 changes: 8 additions & 5 deletions CommonTools/RecoAlgos/plugins/PrimaryVertexSorter.h
Expand Up @@ -22,6 +22,9 @@
#include "CommonTools/RecoAlgos/interface/PrimaryVertexSorting.h"
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"

#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
#include "TrackingTools/Records/interface/TransientTrackRecord.h"

/**\class PrimaryVertexSorter
* \author Andrea Rizzi

Expand Down Expand Up @@ -56,6 +59,8 @@ class PrimaryVertexSorter : public edm::stream::EDProducer<> {
edm::EDGetTokenT<edm::ValueMap<float>> tokenTrackTimeTag_;
edm::EDGetTokenT<edm::ValueMap<float>> tokenTrackTimeResoTag_;

edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> tokenBuilder_;

bool produceOriginalMapping_;
bool produceSortedVertices_;
bool producePFPileUp_;
Expand All @@ -75,8 +80,6 @@ class PrimaryVertexSorter : public edm::stream::EDProducer<> {
};

#include "DataFormats/VertexReco/interface/Vertex.h"
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
#include "TrackingTools/Records/interface/TransientTrackRecord.h"
#include "FWCore/Framework/interface/ESHandle.h"

// #include "FWCore/MessageLogger/interface/MessageLogger.h"
Expand All @@ -90,6 +93,7 @@ PrimaryVertexSorter<ParticlesCollection>::PrimaryVertexSorter(const edm::Paramet
tokenCandidates_(consumes<ParticlesCollection>(iConfig.getParameter<edm::InputTag>("particles"))),
tokenVertices_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"))),
tokenJets_(consumes<edm::View<reco::Candidate>>(iConfig.getParameter<edm::InputTag>("jets"))),
tokenBuilder_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))),
produceOriginalMapping_(iConfig.getParameter<bool>("produceAssociationToOriginalVertices")),
produceSortedVertices_(iConfig.getParameter<bool>("produceSortedVertices")),
producePFPileUp_(iConfig.getParameter<bool>("producePileUpCollection")),
Expand Down Expand Up @@ -140,8 +144,7 @@ void PrimaryVertexSorter<ParticlesCollection>::produce(edm::Event& iEvent, const
Handle<edm::View<reco::Candidate>> jets;
iEvent.getByToken(tokenJets_, jets);

edm::ESHandle<TransientTrackBuilder> builder;
iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
TransientTrackBuilder const& builder = iSetup.getData(tokenBuilder_);

Handle<VertexCollection> vertices;
iEvent.getByToken(tokenVertices_, vertices);
Expand Down Expand Up @@ -174,7 +177,7 @@ void PrimaryVertexSorter<ParticlesCollection>::produce(edm::Event& iEvent, const

for (auto const& pf : particles) {
std::pair<int, PrimaryVertexAssignment::Quality> vtxWithQuality =
runAlgo(*vertices, pf, trackTimeTag, trackTimeResoTag, *jets, *builder);
runAlgo(*vertices, pf, trackTimeTag, trackTimeResoTag, *jets, builder);
pfToPVVector.push_back(vtxWithQuality.first);
pfToPVQualityVector.push_back(vtxWithQuality.second);
}
Expand Down
10 changes: 5 additions & 5 deletions CommonTools/RecoAlgos/plugins/ShallowCloneProducer.cc
Expand Up @@ -13,13 +13,13 @@
*/

#include "DataFormats/Candidate/interface/ShallowCloneCandidate.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

template <typename C>
class ShallowCloneProducer : public edm::EDProducer {
class ShallowCloneProducer : public edm::global::EDProducer<> {
public:
/// constructor from parameter set
explicit ShallowCloneProducer(const edm::ParameterSet&);
Expand All @@ -28,9 +28,9 @@ class ShallowCloneProducer : public edm::EDProducer {

private:
/// process an event
void produce(edm::Event&, const edm::EventSetup&) override;
void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
/// labels of the collection to be converted
edm::EDGetTokenT<C> srcToken_;
const edm::EDGetTokenT<C> srcToken_;
};

template <typename C>
Expand All @@ -43,7 +43,7 @@ template <typename C>
ShallowCloneProducer<C>::~ShallowCloneProducer() {}

template <typename C>
void ShallowCloneProducer<C>::produce(edm::Event& evt, const edm::EventSetup&) {
void ShallowCloneProducer<C>::produce(edm::StreamID, edm::Event& evt, const edm::EventSetup&) const {
std::unique_ptr<reco::CandidateCollection> coll(new reco::CandidateCollection);
edm::Handle<C> masterCollection;
evt.getByToken(srcToken_, masterCollection);
Expand Down