Skip to content

Commit 02a6f79

Browse files
authored
Merge pull request cms-sw#33997 from archiron/Validation_RecoEgamma_esConsumes_2
Validation RecoEgamma esconsumes modifications
2 parents 8185fb1 + 3ef5579 commit 02a6f79

10 files changed

+94
-132
lines changed

Validation/RecoEgamma/plugins/ElectronConversionRejectionValidator.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void ElectronConversionRejectionValidator::bookHistograms(DQMStore::IBooker& ibo
137137
"convLeadTrackAlgo", "# of Electrons", reco::TrackBase::algoSize, -0.5, reco::TrackBase::algoSize - 0.5);
138138
}
139139

140-
void ElectronConversionRejectionValidator::analyze(const edm::Event& e, const edm::EventSetup& esup) {
140+
void ElectronConversionRejectionValidator::analyze(const edm::Event& e, const edm::EventSetup&) {
141141
using namespace edm;
142142

143143
nEvt_++;
@@ -146,34 +146,30 @@ void ElectronConversionRejectionValidator::analyze(const edm::Event& e, const ed
146146
<< "\n";
147147

148148
///// Get the recontructed conversions
149-
Handle<reco::ConversionCollection> convHandle;
150-
e.getByToken(convToken_, convHandle);
149+
auto convHandle = e.getHandle(convToken_);
151150
if (!convHandle.isValid()) {
152151
edm::LogError("ElectronConversionRejectionValidator") << "Error! Can't get the Conversion collection " << std::endl;
153152
return;
154153
}
155154

156155
///// Get the recontructed photons
157-
Handle<reco::GsfElectronCollection> gsfElectronHandle;
158-
e.getByToken(gsfElecToken_, gsfElectronHandle);
156+
auto gsfElectronHandle = e.getHandle(gsfElecToken_);
159157
const reco::GsfElectronCollection& gsfElectronCollection = *(gsfElectronHandle.product());
160158
if (!gsfElectronHandle.isValid()) {
161159
edm::LogError("ElectronConversionRejectionValidator") << "Error! Can't get the Electron collection " << std::endl;
162160
return;
163161
}
164162

165163
// offline Primary vertex
166-
edm::Handle<reco::VertexCollection> vertexHandle;
167-
e.getByToken(offline_pvToken_, vertexHandle);
164+
auto vertexHandle = e.getHandle(offline_pvToken_);
168165
if (!vertexHandle.isValid()) {
169166
edm::LogError("ElectronConversionRejectionValidator") << "Error! Can't get the product primary Vertex Collection "
170167
<< "\n";
171168
return;
172169
}
173170
const reco::Vertex& thevtx = vertexHandle->at(0);
174171

175-
edm::Handle<reco::BeamSpot> bsHandle;
176-
e.getByToken(beamspotToken_, bsHandle);
172+
auto bsHandle = e.getHandle(beamspotToken_);
177173
if (!bsHandle.isValid()) {
178174
edm::LogError("ElectronConversionRejectionValidator") << "Error! Can't get the product beamspot Collection "
179175
<< "\n";

Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,8 @@ ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf)
5252
consumes<reco::ElectronSeedCollection>(conf.getParameter<edm::InputTag>("electronSeedCollection"));
5353
matchingObjectCollection_ =
5454
consumes<reco::GenJetCollection>(conf.getParameter<edm::InputTag>("matchingObjectCollection"));
55-
/* new 03/02/2015 */
5655
offlineVerticesCollection_ =
5756
consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("offlinePrimaryVertices"));
58-
/* fin new */
5957

6058
beamSpotTag_ = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpot"));
6159
readAOD_ = conf.getParameter<bool>("readAOD");
@@ -176,7 +174,7 @@ ElectronMcFakeValidator::ElectronMcFakeValidator(const edm::ParameterSet &conf)
176174
h1_recCoreNum_ = nullptr;
177175
h1_recTrackNum_ = nullptr;
178176
h1_recSeedNum_ = nullptr;
179-
h1_recOfflineVertices_ = nullptr; // new 2015.04.02
177+
h1_recOfflineVertices_ = nullptr;
180178

181179
h1_matchingObjectEta = nullptr;
182180
h1_matchingObjectAbsEta = nullptr;
@@ -2412,49 +2410,34 @@ ElectronMcFakeValidator::~ElectronMcFakeValidator() {}
24122410

24132411
void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
24142412
// get reco electrons
2415-
edm::Handle<reco::GsfElectronCollection> gsfElectrons;
2416-
iEvent.getByToken(electronCollection_, gsfElectrons);
2417-
edm::Handle<GsfElectronCoreCollection> gsfElectronCores;
2418-
iEvent.getByToken(electronCoreCollection_, gsfElectronCores);
2419-
edm::Handle<GsfTrackCollection> gsfElectronTracks;
2420-
iEvent.getByToken(electronTrackCollection_, gsfElectronTracks);
2421-
edm::Handle<ElectronSeedCollection> gsfElectronSeeds;
2422-
iEvent.getByToken(electronSeedCollection_, gsfElectronSeeds);
2423-
2424-
edm::Handle<edm::ValueMap<double>> isoFromDepsTk03Handle;
2425-
iEvent.getByToken(isoFromDepsTk03Tag_, isoFromDepsTk03Handle);
2426-
edm::Handle<edm::ValueMap<double>> isoFromDepsTk04Handle;
2427-
iEvent.getByToken(isoFromDepsTk04Tag_, isoFromDepsTk04Handle);
2428-
edm::Handle<edm::ValueMap<double>> isoFromDepsEcalFull03Handle;
2429-
iEvent.getByToken(isoFromDepsEcalFull03Tag_, isoFromDepsEcalFull03Handle);
2430-
edm::Handle<edm::ValueMap<double>> isoFromDepsEcalFull04Handle;
2431-
iEvent.getByToken(isoFromDepsEcalFull04Tag_, isoFromDepsEcalFull04Handle);
2432-
edm::Handle<edm::ValueMap<double>> isoFromDepsEcalReduced03Handle;
2433-
iEvent.getByToken(isoFromDepsEcalReduced03Tag_, isoFromDepsEcalReduced03Handle);
2434-
edm::Handle<edm::ValueMap<double>> isoFromDepsEcalReduced04Handle;
2435-
iEvent.getByToken(isoFromDepsEcalReduced04Tag_, isoFromDepsEcalReduced04Handle);
2436-
edm::Handle<edm::ValueMap<double>> isoFromDepsHcal03Handle;
2437-
iEvent.getByToken(isoFromDepsHcal03Tag_, isoFromDepsHcal03Handle);
2438-
edm::Handle<edm::ValueMap<double>> isoFromDepsHcal04Handle;
2439-
iEvent.getByToken(isoFromDepsHcal04Tag_, isoFromDepsHcal04Handle);
2440-
2441-
/* new 2015.04.02 */
2442-
edm::Handle<reco::VertexCollection> vertexCollectionHandle;
2443-
iEvent.getByToken(offlineVerticesCollection_, vertexCollectionHandle);
2413+
auto gsfElectrons = iEvent.getHandle(electronCollection_);
2414+
auto gsfElectronCores = iEvent.getHandle(electronCoreCollection_);
2415+
auto gsfElectronTracks = iEvent.getHandle(electronTrackCollection_);
2416+
auto gsfElectronSeeds = iEvent.getHandle(electronSeedCollection_);
2417+
2418+
auto isoFromDepsTk03Handle = iEvent.getHandle(isoFromDepsTk03Tag_);
2419+
auto isoFromDepsTk04Handle = iEvent.getHandle(isoFromDepsTk04Tag_);
2420+
auto isoFromDepsEcalFull03Handle = iEvent.getHandle(isoFromDepsEcalFull03Tag_);
2421+
auto isoFromDepsEcalFull04Handle = iEvent.getHandle(isoFromDepsEcalFull04Tag_);
2422+
auto isoFromDepsEcalReduced03Handle = iEvent.getHandle(isoFromDepsEcalReduced03Tag_);
2423+
auto isoFromDepsEcalReduced04Handle = iEvent.getHandle(isoFromDepsEcalReduced04Tag_);
2424+
auto isoFromDepsHcal03Handle = iEvent.getHandle(isoFromDepsHcal03Tag_);
2425+
auto isoFromDepsHcal04Handle = iEvent.getHandle(isoFromDepsHcal04Tag_);
2426+
2427+
/*edm::Handle<reco::VertexCollection> vertexCollectionHandle;
2428+
iEvent.getByToken(offlineVerticesCollection_, vertexCollectionHandle);*/
2429+
auto vertexCollectionHandle = iEvent.getHandle(offlineVerticesCollection_);
24442430
if (!vertexCollectionHandle.isValid()) {
24452431
edm::LogInfo("ElectronMcFakeValidator::analyze") << "vertexCollectionHandle KO";
24462432
} else {
24472433
edm::LogInfo("ElectronMcFakeValidator::analyze") << "vertexCollectionHandle OK";
24482434
}
2449-
/* fin new */
24502435

24512436
// get gen jets
2452-
edm::Handle<reco::GenJetCollection> genJets;
2453-
iEvent.getByToken(matchingObjectCollection_, genJets);
2437+
auto genJets = iEvent.getHandle(matchingObjectCollection_);
24542438

24552439
// get the beamspot from the Event:
2456-
edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
2457-
iEvent.getByToken(beamSpotTag_, recoBeamSpotHandle);
2440+
auto recoBeamSpotHandle = iEvent.getHandle(beamSpotTag_);
24582441
const BeamSpot bs = *recoBeamSpotHandle;
24592442

24602443
edm::LogInfo("ElectronMcFakeValidator::analyze")
@@ -2463,7 +2446,7 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event
24632446
h1_recCoreNum_->Fill((*gsfElectronCores).size());
24642447
h1_recTrackNum_->Fill((*gsfElectronTracks).size());
24652448
h1_recSeedNum_->Fill((*gsfElectronSeeds).size());
2466-
h1_recOfflineVertices_->Fill((*vertexCollectionHandle).size()); // new 2015.04.02
2449+
h1_recOfflineVertices_->Fill((*vertexCollectionHandle).size());
24672450

24682451
// all rec electrons
24692452
reco::GsfElectronCollection::const_iterator gsfIter;

Validation/RecoEgamma/plugins/ElectronMcMiniAODSignalValidator.cc

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,9 @@ void ElectronMcSignalValidatorMiniAOD::bookHistograms(DQMStore::IBooker& iBooker
420420

421421
void ElectronMcSignalValidatorMiniAOD::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
422422
// get collections
423-
edm::Handle<pat::ElectronCollection> electrons;
424-
iEvent.getByToken(electronToken_, electrons);
425-
426-
edm::Handle<pat::ElectronCollection> electrons_endcaps;
427-
iEvent.getByToken(electronTokenEndcaps_, electrons_endcaps);
428-
429-
edm::Handle<edm::View<reco::GenParticle> > genParticles;
430-
iEvent.getByToken(mcTruthCollection_, genParticles);
423+
auto electrons = iEvent.getHandle(electronToken_);
424+
auto electrons_endcaps = iEvent.getHandle(electronTokenEndcaps_);
425+
auto genParticles = iEvent.getHandle(mcTruthCollection_);
431426

432427
edm::Handle<pat::ElectronCollection> mergedElectrons;
433428

Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc

Lines changed: 24 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@
2626
#include "FWCore/ParameterSet/interface/ParameterSet.h"
2727
#include "FWCore/Framework/interface/EDAnalyzer.h"
2828
#include "FWCore/Framework/interface/Event.h"
29+
#include "FWCore/Framework/interface/EventSetup.h"
2930
#include "FWCore/Framework/interface/MakerMacros.h"
3031
#include "FWCore/MessageLogger/interface/MessageLogger.h"
3132

33+
#include "FWCore/Utilities/interface/InputTag.h"
34+
#include "FWCore/Utilities/interface/ESInputTag.h"
35+
#include "FWCore/Utilities/interface/ESGetToken.h"
36+
#include "FWCore/Framework/interface/ESHandle.h"
37+
#include "FWCore/Framework/interface/ConsumesCollector.h"
38+
3239
#include "CLHEP/Units/GlobalPhysicalConstants.h"
3340
#include "TMath.h"
3441
#include "TFile.h"
@@ -52,10 +59,8 @@ ElectronMcSignalValidator::ElectronMcSignalValidator(const edm::ParameterSet &co
5259
consumes<reco::GsfTrackCollection>(conf.getParameter<edm::InputTag>("electronTrackCollection"));
5360
electronSeedCollection_ =
5461
consumes<reco::ElectronSeedCollection>(conf.getParameter<edm::InputTag>("electronSeedCollection"));
55-
/* new 03/02/2015 */
5662
offlineVerticesCollection_ =
5763
consumes<reco::VertexCollection>(conf.getParameter<edm::InputTag>("offlinePrimaryVertices"));
58-
/* fin new */
5964
beamSpotTag_ = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("beamSpot"));
6065

6166
readAOD_ = conf.getParameter<bool>("readAOD");
@@ -3268,47 +3273,24 @@ void ElectronMcSignalValidator::bookHistograms(DQMStore::IBooker &iBooker, edm::
32683273

32693274
ElectronMcSignalValidator::~ElectronMcSignalValidator() {}
32703275

3271-
void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
3276+
void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::EventSetup &) {
32723277
// get collections
3273-
edm::Handle<GsfElectronCollection> gsfElectrons;
3274-
iEvent.getByToken(electronCollection_, gsfElectrons);
3275-
edm::Handle<GsfElectronCoreCollection> gsfElectronCores;
3276-
iEvent.getByToken(electronCoreCollection_, gsfElectronCores);
3277-
edm::Handle<GsfTrackCollection> gsfElectronTracks;
3278-
iEvent.getByToken(electronTrackCollection_, gsfElectronTracks);
3279-
edm::Handle<ElectronSeedCollection> gsfElectronSeeds;
3280-
iEvent.getByToken(electronSeedCollection_, gsfElectronSeeds);
3281-
edm::Handle<GenParticleCollection> genParticles;
3282-
iEvent.getByToken(mcTruthCollection_, genParticles);
3283-
edm::Handle<reco::BeamSpot> theBeamSpot;
3284-
iEvent.getByToken(beamSpotTag_, theBeamSpot);
3285-
3286-
edm::Handle<edm::ValueMap<double> > isoFromDepsTk03Handle;
3287-
iEvent.getByToken(isoFromDepsTk03Tag_, isoFromDepsTk03Handle);
3288-
3289-
edm::Handle<edm::ValueMap<double> > isoFromDepsTk04Handle;
3290-
iEvent.getByToken(isoFromDepsTk04Tag_, isoFromDepsTk04Handle);
3291-
3292-
edm::Handle<edm::ValueMap<double> > isoFromDepsEcalFull03Handle;
3293-
iEvent.getByToken(isoFromDepsEcalFull03Tag_, isoFromDepsEcalFull03Handle);
3294-
3295-
edm::Handle<edm::ValueMap<double> > isoFromDepsEcalFull04Handle;
3296-
iEvent.getByToken(isoFromDepsEcalFull04Tag_, isoFromDepsEcalFull04Handle);
3297-
3298-
edm::Handle<edm::ValueMap<double> > isoFromDepsEcalReduced03Handle;
3299-
iEvent.getByToken(isoFromDepsEcalReduced03Tag_, isoFromDepsEcalReduced03Handle);
3300-
3301-
edm::Handle<edm::ValueMap<double> > isoFromDepsEcalReduced04Handle;
3302-
iEvent.getByToken(isoFromDepsEcalReduced04Tag_, isoFromDepsEcalReduced04Handle);
3303-
3304-
edm::Handle<edm::ValueMap<double> > isoFromDepsHcal03Handle;
3305-
iEvent.getByToken(isoFromDepsHcal03Tag_, isoFromDepsHcal03Handle);
3306-
3307-
edm::Handle<edm::ValueMap<double> > isoFromDepsHcal04Handle;
3308-
iEvent.getByToken(isoFromDepsHcal04Tag_, isoFromDepsHcal04Handle);
3309-
3310-
edm::Handle<reco::VertexCollection> vertexCollectionHandle;
3311-
iEvent.getByToken(offlineVerticesCollection_, vertexCollectionHandle);
3278+
auto gsfElectrons = iEvent.getHandle(electronCollection_);
3279+
auto gsfElectronCores = iEvent.getHandle(electronCoreCollection_);
3280+
auto gsfElectronTracks = iEvent.getHandle(electronTrackCollection_);
3281+
auto gsfElectronSeeds = iEvent.getHandle(electronSeedCollection_);
3282+
auto genParticles = iEvent.getHandle(mcTruthCollection_);
3283+
auto theBeamSpot = iEvent.getHandle(beamSpotTag_);
3284+
3285+
auto isoFromDepsTk03Handle = iEvent.getHandle(isoFromDepsTk03Tag_);
3286+
auto isoFromDepsTk04Handle = iEvent.getHandle(isoFromDepsTk04Tag_);
3287+
auto isoFromDepsEcalFull03Handle = iEvent.getHandle(isoFromDepsEcalFull03Tag_);
3288+
auto isoFromDepsEcalFull04Handle = iEvent.getHandle(isoFromDepsEcalFull04Tag_);
3289+
auto isoFromDepsEcalReduced03Handle = iEvent.getHandle(isoFromDepsEcalReduced03Tag_);
3290+
auto isoFromDepsEcalReduced04Handle = iEvent.getHandle(isoFromDepsEcalReduced04Tag_);
3291+
auto isoFromDepsHcal03Handle = iEvent.getHandle(isoFromDepsHcal03Tag_);
3292+
auto isoFromDepsHcal04Handle = iEvent.getHandle(isoFromDepsHcal04Tag_);
3293+
auto vertexCollectionHandle = iEvent.getHandle(offlineVerticesCollection_);
33123294
if (!vertexCollectionHandle.isValid()) {
33133295
edm::LogInfo("ElectronMcSignalValidator::analyze") << "vertexCollectionHandle KO";
33143296
} else {
@@ -3792,7 +3774,6 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve
37923774
if (!bestGsfElectron.parentSuperCluster().isNull())
37933775
pfEnergy = bestGsfElectron.parentSuperCluster()->energy();
37943776
h2_scl_EoEtruePfVsEg->Fill(bestGsfElectron.ecalEnergy() / mcIter->p(), pfEnergy / mcIter->p());
3795-
/*New from 06 05 2016*/
37963777
// h1_scl_ESFrac->Fill( sclRef->preshowerEnergy() / sclRef->rawEnergy() );
37973778
if (bestGsfElectron.isEE())
37983779
h1_scl_ESFrac_endcaps->Fill(sclRef->preshowerEnergy() / sclRef->rawEnergy());

Validation/RecoEgamma/plugins/PhotonPostprocessing.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ PhotonPostprocessing::~PhotonPostprocessing() {}
5757

5858
void PhotonPostprocessing::beginJob() {}
5959

60-
void PhotonPostprocessing::analyze(const edm::Event& e, const edm::EventSetup& esup) {}
60+
void PhotonPostprocessing::analyze(const edm::Event& e, const edm::EventSetup&) {}
6161

6262
void PhotonPostprocessing::endJob() {
6363
if (standAlone_)
6464
runPostprocessing();
6565
}
6666

67-
void PhotonPostprocessing::endRun(const edm::Run& run, const edm::EventSetup& setup) {
67+
void PhotonPostprocessing::endRun(const edm::Run& run, const edm::EventSetup&) {
6868
if (!standAlone_)
6969
runPostprocessing();
7070
}

Validation/RecoEgamma/plugins/PhotonValidator.cc

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#include "TrackingTools/PatternTools/interface/TwoTrackMinimumDistance.h"
2929
#include "TrackingTools/TransientTrack/interface/TrackTransientTrack.h"
3030
//
31-
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
32-
#include "TrackingTools/Records/interface/TransientTrackRecord.h"
3331
#include "CLHEP/Units/GlobalPhysicalConstants.h"
3432
#include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
3533

@@ -60,7 +58,6 @@
6058
#include "RecoEgamma/EgammaMCTools/interface/ElectronMCTruth.h"
6159
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
6260

63-
#include "Geometry/Records/interface/CaloGeometryRecord.h"
6461
#include "Geometry/CaloTopology/interface/CaloTopology.h"
6562
#include "Geometry/Records/interface/CaloTopologyRecord.h"
6663
//
@@ -84,8 +81,9 @@
8481
using namespace std;
8582

8683
PhotonValidator::PhotonValidator(const edm::ParameterSet& pset)
87-
88-
{
84+
: magneticFieldToken_{esConsumes<edm::Transition::BeginRun>()},
85+
caloGeometryToken_{esConsumes()},
86+
transientTrackBuilderToken_{esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))} {
8987
fName_ = pset.getParameter<std::string>("analyzerName");
9088
verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
9189
parameters_ = pset;
@@ -158,7 +156,7 @@ PhotonValidator::PhotonValidator(const edm::ParameterSet& pset)
158156

159157
PhotonValidator::~PhotonValidator() {}
160158

161-
void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& es) {
159+
void PhotonValidator::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const&) {
162160
double resMin = parameters_.getParameter<double>("resMin");
163161
double resMax = parameters_.getParameter<double>("resMax");
164162
int resBin = parameters_.getParameter<int>("resBin");
@@ -3161,14 +3159,12 @@ void PhotonValidator::dqmBeginRun(edm::Run const& r, edm::EventSetup const& theE
31613159
//get magnetic field
31623160
edm::LogInfo("ConvertedPhotonProducer") << " get magnetic field"
31633161
<< "\n";
3164-
theEventSetup.get<IdealMagneticFieldRecord>().get(theMF_);
3162+
theMF_ = theEventSetup.getHandle(magneticFieldToken_);
31653163

31663164
thePhotonMCTruthFinder_ = std::make_unique<PhotonMCTruthFinder>();
31673165
}
31683166

3169-
void PhotonValidator::dqmEndRun(edm::Run const& r, edm::EventSetup const& theEventSetup) {
3170-
thePhotonMCTruthFinder_.reset();
3171-
}
3167+
void PhotonValidator::dqmEndRun(edm::Run const& r, edm::EventSetup const&) { thePhotonMCTruthFinder_.reset(); }
31723168

31733169
void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup) {
31743170
thePhotonMCTruthFinder_->clear();
@@ -3191,15 +3187,14 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
31913187
<< "\n";
31923188

31933189
// get the geometry from the event setup:
3194-
esup.get<CaloGeometryRecord>().get(theCaloGeom_);
3190+
theCaloGeom_ = esup.getHandle(caloGeometryToken_);
31953191

31963192
edm::Handle<reco::VertexCollection> vtxH;
31973193
e.getByToken(offline_pvToken_, vtxH);
31983194
h_nRecoVtx_->Fill(float(vtxH->size()));
31993195

32003196
// Transform Track into TransientTrack (needed by the Vertex fitter)
3201-
edm::ESHandle<TransientTrackBuilder> theTTB;
3202-
esup.get<TransientTrackRecord>().get("TransientTrackBuilder", theTTB);
3197+
auto theTTB = esup.getHandle(transientTrackBuilderToken_);
32033198

32043199
///// Get the recontructed photons
32053200
Handle<reco::PhotonCollection> photonHandle;
@@ -5514,4 +5509,4 @@ float PhotonValidator::etaTransformation(float EtaParticle, float Zvertex) {
55145509
//---Return the result
55155510
return ETA;
55165511
//---end
5517-
}
5512+
}

Validation/RecoEgamma/plugins/PhotonValidator.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#include "SimDataFormats/Vertex/interface/SimVertex.h"
2525
#include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
2626
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
27+
#include "Geometry/Records/interface/CaloGeometryRecord.h"
28+
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
29+
#include "TrackingTools/Records/interface/TransientTrackRecord.h"
2730
//
2831
//DQM services
2932
#include "DQMServices/Core/interface/DQMStore.h"
@@ -119,6 +122,10 @@ class PhotonValidator : public DQMOneEDAnalyzer<> {
119122
edm::EDGetTokenT<edm::HepMCProduct> hepMC_Token_;
120123
edm::EDGetTokenT<reco::GenJetCollection> genjets_Token_;
121124

125+
const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magneticFieldToken_;
126+
const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryToken_;
127+
const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> transientTrackBuilderToken_;
128+
122129
std::unique_ptr<PhotonMCTruthFinder> thePhotonMCTruthFinder_;
123130

124131
bool fastSim_;

0 commit comments

Comments
 (0)