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
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/CaloEventSetup/interface/CaloTopologyRecord.h"
66- //
67- // #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
68- //
63+
6964#include " TFile.h"
7065#include " TH1.h"
7166#include " TH2.h"
8479using namespace std ;
8580
8681PhotonValidator::PhotonValidator (const edm::ParameterSet& pset)
87-
88- {
82+ : magneticFieldToken_{esConsumes<edm::Transition::BeginRun>()},
83+ caloGeometryToken_{esConsumes ()},
84+ transientTrackBuilderToken_{esConsumes (edm::ESInputTag (" " , " TransientTrackBuilder" ))} {
8985 fName_ = pset.getParameter <std::string>(" analyzerName" );
9086 verbosity_ = pset.getUntrackedParameter <int >(" Verbosity" );
9187 parameters_ = pset;
@@ -158,7 +154,7 @@ PhotonValidator::PhotonValidator(const edm::ParameterSet& pset)
158154
159155PhotonValidator::~PhotonValidator () {}
160156
161- void PhotonValidator::bookHistograms (DQMStore::IBooker& iBooker, edm::Run const & run, edm::EventSetup const & es ) {
157+ void PhotonValidator::bookHistograms (DQMStore::IBooker& iBooker, edm::Run const & run, edm::EventSetup const &) {
162158 double resMin = parameters_.getParameter <double >(" resMin" );
163159 double resMax = parameters_.getParameter <double >(" resMax" );
164160 int resBin = parameters_.getParameter <int >(" resBin" );
@@ -3161,14 +3157,12 @@ void PhotonValidator::dqmBeginRun(edm::Run const& r, edm::EventSetup const& theE
31613157 // get magnetic field
31623158 edm::LogInfo (" ConvertedPhotonProducer" ) << " get magnetic field"
31633159 << " \n " ;
3164- theEventSetup.get <IdealMagneticFieldRecord>(). get (theMF_ );
3160+ theMF_ = theEventSetup.getHandle (magneticFieldToken_ );
31653161
31663162 thePhotonMCTruthFinder_ = std::make_unique<PhotonMCTruthFinder>();
31673163}
31683164
3169- void PhotonValidator::dqmEndRun (edm::Run const & r, edm::EventSetup const & theEventSetup) {
3170- thePhotonMCTruthFinder_.reset ();
3171- }
3165+ void PhotonValidator::dqmEndRun (edm::Run const & r, edm::EventSetup const &) { thePhotonMCTruthFinder_.reset (); }
31723166
31733167void PhotonValidator::analyze (const edm::Event& e, const edm::EventSetup& esup) {
31743168 thePhotonMCTruthFinder_->clear ();
@@ -3191,15 +3185,14 @@ void PhotonValidator::analyze(const edm::Event& e, const edm::EventSetup& esup)
31913185 << " \n " ;
31923186
31933187 // get the geometry from the event setup:
3194- esup.get <CaloGeometryRecord>(). get (theCaloGeom_ );
3188+ theCaloGeom_ = esup.getHandle (caloGeometryToken_ );
31953189
31963190 edm::Handle<reco::VertexCollection> vtxH;
31973191 e.getByToken (offline_pvToken_, vtxH);
31983192 h_nRecoVtx_->Fill (float (vtxH->size ()));
31993193
32003194 // Transform Track into TransientTrack (needed by the Vertex fitter)
3201- edm::ESHandle<TransientTrackBuilder> theTTB;
3202- esup.get <TransientTrackRecord>().get (" TransientTrackBuilder" , theTTB);
3195+ auto theTTB = esup.getHandle (transientTrackBuilderToken_);
32033196
32043197 // /// Get the recontructed photons
32053198 Handle<reco::PhotonCollection> photonHandle;
0 commit comments