3232
3333// user include files
3434#include " FWCore/Framework/interface/Frameworkfwd.h"
35- #include " FWCore/Framework/interface/EDAnalyzer.h"
3635#include " FWCore/Framework/interface/Event.h"
36+ #include " FWCore/Framework/interface/one/EDAnalyzer.h"
3737#include " FWCore/Framework/interface/MakerMacros.h"
3838#include " FWCore/Utilities/interface/EDGetToken.h"
3939#include " FWCore/ParameterSet/interface/ParameterSet.h"
4040#include " FWCore/ServiceRegistry/interface/Service.h"
41- #include " FWCore/Framework/interface/ESHandle.h"
4241
4342#include " TH1F.h"
4443#include " TH2F.h"
6463#include " SimDataFormats/CrossingFrame/interface/MixCollection.h"
6564#include " SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h"
6665#include " SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
67-
6866#include " Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
6967#include " Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
7068#include " Geometry/Records/interface/TrackerDigiGeometryRecord.h"
8078// class declaration
8179//
8280
83- class StripClusterMCanalysis : public edm ::EDAnalyzer {
81+ class StripClusterMCanalysis : public edm ::one:: EDAnalyzer<edm::one::SharedResources> {
8482public:
8583 explicit StripClusterMCanalysis (const edm::ParameterSet&);
86-
8784 ~StripClusterMCanalysis () override ;
8885
8986private:
9087 void beginJob () override ;
9188 void analyze (const edm::Event&, const edm::EventSetup&) override ;
92- void endJob () override ;
9389
9490 typedef std::pair<unsigned int , unsigned int > simHitCollectionID;
9591 typedef std::pair<simHitCollectionID, unsigned int > simhitAddr;
@@ -101,13 +97,14 @@ class StripClusterMCanalysis : public edm::EDAnalyzer {
10197 // ----------member data ---------------------------
10298
10399private:
100+ const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topoToken_;
101+ const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tkGeomToken_;
104102 edm::ParameterSet conf_;
105103 edm::InputTag beamSpotLabel_;
106104 edm::InputTag primaryVertexLabel_;
107105 edm::InputTag stripClusterSourceLabel_;
108106 edm::InputTag stripSimLinkLabel_;
109107 int printOut_;
110-
111108 edm::EDGetTokenT<reco::BeamSpot> beamSpotToken_;
112109 edm::EDGetTokenT<reco::VertexCollection> primaryVertexToken_;
113110 edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > clusterToken_;
@@ -180,25 +177,21 @@ class StripClusterMCanalysis : public edm::EDAnalyzer {
180177 TH1F* hZvSec;
181178};
182179
183- //
184- // constants, enums and typedefs
185- //
186-
187- //
188- // static data member definitions
189- //
190-
191180//
192181// constructors and destructor
193182//
194183StripClusterMCanalysis::StripClusterMCanalysis (const edm::ParameterSet& iConfig)
195- : conf_(iConfig),
184+ : topoToken_(esConsumes()),
185+ tkGeomToken_(esConsumes()),
186+ conf_(iConfig),
196187 beamSpotLabel_(iConfig.getParameter<edm::InputTag>(" beamSpot" )),
197188 primaryVertexLabel_(iConfig.getParameter<edm::InputTag>(" primaryVertex" )),
198189 stripClusterSourceLabel_(iConfig.getParameter<edm::InputTag>(" stripClusters" )),
199190 stripSimLinkLabel_(iConfig.getParameter<edm::InputTag>(" stripSimLinks" )),
200191 printOut_(iConfig.getUntrackedParameter<int >(" printOut" )) {
201192 // now do whatever initialization is needed
193+ usesResource (TFileService::kSharedResource );
194+
202195 beamSpotToken_ = consumes<reco::BeamSpot>(beamSpotLabel_);
203196 primaryVertexToken_ = consumes<reco::VertexCollection>(primaryVertexLabel_);
204197 clusterToken_ = consumes<edmNew::DetSetVector<SiStripCluster> >(stripClusterSourceLabel_);
@@ -213,10 +206,7 @@ StripClusterMCanalysis::StripClusterMCanalysis(const edm::ParameterSet& iConfig)
213206 }
214207}
215208
216- StripClusterMCanalysis::~StripClusterMCanalysis () {
217- // do anything here that needs to be done at destruction time
218- // (e.g. close files, deallocate resources etc.)
219- }
209+ StripClusterMCanalysis::~StripClusterMCanalysis () = default ;
220210
221211//
222212// member functions
@@ -233,9 +223,7 @@ void StripClusterMCanalysis::analyze(const edm::Event& iEvent, const edm::EventS
233223 evCnt_++;
234224
235225 // Retrieve tracker topology from geometry
236- edm::ESHandle<TrackerTopology> tTopoHandle;
237- iSetup.get <TrackerTopologyRcd>().get (tTopoHandle); // PR#7802
238- const TrackerTopology* const tTopo = tTopoHandle.product ();
226+ const TrackerTopology* const tTopo = &iSetup.getData (topoToken_);
239227
240228 // Get the beam spot
241229 edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
@@ -299,9 +287,7 @@ void StripClusterMCanalysis::analyze(const edm::Event& iEvent, const edm::EventS
299287 iEvent.getByToken (clusterToken_, dsv_SiStripCluster);
300288
301289 iEvent.getByToken (stripSimlinkToken_, stripdigisimlink);
302-
303- edm::ESHandle<TrackerGeometry> tkgeom;
304- iSetup.get <TrackerDigiGeometryRecord>().get (tkgeom);
290+ edm::ESHandle<TrackerGeometry> tkgeom = iSetup.getHandle (tkGeomToken_);
305291 if (!tkgeom.isValid ()) {
306292 std::cout << " Unable to find TrackerDigiGeometryRecord in event!" ;
307293 return ;
@@ -582,9 +568,6 @@ void StripClusterMCanalysis::beginJob() {
582568 evCnt_ = 0 ;
583569}
584570
585- // ------------ method called once each job just after ending the event loop ------------
586- void StripClusterMCanalysis::endJob () {}
587-
588571void StripClusterMCanalysis::makeMap (const edm::Event& theEvent) {
589572 // The simHit collections are specified in trackerContainers, and can
590573 // be either crossing frames (e.g., mix/g4SimHitsTrackerHitsTIBLowTof)
0 commit comments