1010#include " FWCore/Framework/interface/MakerMacros.h"
1111#include " FWCore/Framework/interface/EDAnalyzer.h"
1212#include " FWCore/Framework/interface/Event.h"
13- #include " FWCore/Framework/interface/ESHandle.h"
1413#include " FWCore/Framework/interface/EventSetup.h"
1514#include " FWCore/MessageLogger/interface/MessageLogger.h"
1615#include " FWCore/Utilities/interface/InputTag.h"
@@ -176,6 +175,9 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer {
176175 edm::EDGetTokenT<l1t::TkJetCollection> TrackJetsToken_;
177176 edm::EDGetTokenT<l1t::TkJetCollection> TrackJetsExtendedToken_;
178177
178+ edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;
179+ edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeomToken_;
180+
179181 // -----------------------------------------------------------------------------------------------
180182 // tree & branches for mini-ntuple
181183
@@ -452,6 +454,9 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon
452454 GenJetToken_ = consumes<std::vector<reco::GenJet> >(GenJetInputTag);
453455 GenParticleToken_ = consumes<std::vector<reco::GenParticle> >(GenParticleInputTag);
454456 L1VertexToken_ = consumes<l1t::TkPrimaryVertexCollection>(RecoVertexInputTag);
457+
458+ tTopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd>(edm::ESInputTag (" " , " " ));
459+ tGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>(edm::ESInputTag (" " , " " ));
455460}
456461
457462// ///////////
@@ -1093,7 +1098,10 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
10931098
10941099 // -----------------------------------------------------------------------------------------------
10951100 // more for TTStubs
1096- edm::ESHandle<TrackerGeometry> geometryHandle;
1101+ const TrackerTopology& tTopo = iSetup.getData (tTopoToken_);
1102+ const TrackerGeometry& tGeom = iSetup.getData (tGeomToken_);
1103+
1104+ /* edm::ESHandle<TrackerGeometry> geometryHandle;
10971105 iSetup.get<TrackerDigiGeometryRecord>().get(geometryHandle);
10981106
10991107 edm::ESHandle<TrackerTopology> tTopoHandle;
@@ -1103,7 +1111,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
11031111 iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle);
11041112
11051113 const TrackerTopology* const tTopo = tTopoHandle.product();
1106- const TrackerGeometry* const theTrackerGeom = tGeomHandle.product ();
1114+ const TrackerGeometry* const theTrackerGeom = tGeomHandle.product();*/
11071115
11081116 // Gen particles
11091117 edm::Handle<std::vector<reco::GenParticle> > GenParticleHandle;
@@ -1186,20 +1194,20 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
11861194 // loop over L1 stubs
11871195 // ----------------------------------------------------------------------------------------------
11881196 if (SaveStubs) {
1189- for (auto gd = theTrackerGeom-> dets ().begin (); gd != theTrackerGeom-> dets ().end (); gd++) {
1197+ for (auto gd = tGeom. dets ().begin (); gd != tGeom. dets ().end (); gd++) {
11901198 DetId detid = (*gd)->geographicalId ();
11911199 if (detid.subdetId () != StripSubdetector::TOB && detid.subdetId () != StripSubdetector::TID)
11921200 continue ;
1193- if (!tTopo-> isLower (detid))
1194- continue ; // loop on the stacks: choose the lower arbitrarily
1195- DetId stackDetid = tTopo-> stack (detid); // Stub module detid
1201+ if (!tTopo. isLower (detid))
1202+ continue ; // loop on the stacks: choose the lower arbitrarily
1203+ DetId stackDetid = tTopo. stack (detid); // Stub module detid
11961204
11971205 if (TTStubHandle->find (stackDetid) == TTStubHandle->end ())
11981206 continue ;
11991207
12001208 // Get the DetSets of the Clusters
12011209 edmNew::DetSet<TTStub<Ref_Phase2TrackerDigi_> > stubs = (*TTStubHandle)[stackDetid];
1202- const GeomDetUnit* det0 = theTrackerGeom-> idToDetUnit (detid);
1210+ const GeomDetUnit* det0 = tGeom. idToDetUnit (detid);
12031211 const auto * theGeomDet = dynamic_cast <const PixelGeomDetUnit*>(det0);
12041212 const PixelTopology* topol = dynamic_cast <const PixelTopology*>(&(theGeomDet->specificTopology ()));
12051213
@@ -1212,10 +1220,10 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
12121220 int layer = -999999 ;
12131221 if (detid.subdetId () == StripSubdetector::TOB) {
12141222 isBarrel = 1 ;
1215- layer = static_cast <int >(tTopo-> layer (detid));
1223+ layer = static_cast <int >(tTopo. layer (detid));
12161224 } else if (detid.subdetId () == StripSubdetector::TID) {
12171225 isBarrel = 0 ;
1218- layer = static_cast <int >(tTopo-> layer (detid));
1226+ layer = static_cast <int >(tTopo. layer (detid));
12191227 } else {
12201228 edm::LogVerbatim (" Tracklet" ) << " WARNING -- neither TOB or TID stub, shouldn't happen..." ;
12211229 layer = -1 ;
@@ -1330,9 +1338,9 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
13301338 // loop over stubs
13311339 for (int is = 0 ; is < tmp_trk_nstub; is++) {
13321340 // detID of stub
1333- DetId detIdStub = theTrackerGeom-> idToDet ((stubRefs.at (is)->clusterRef (0 ))->getDetId ())->geographicalId ();
1341+ DetId detIdStub = tGeom. idToDet ((stubRefs.at (is)->clusterRef (0 ))->getDetId ())->geographicalId ();
13341342 MeasurementPoint coords = stubRefs.at (is)->clusterRef (0 )->findAverageLocalCoordinatesCentered ();
1335- const GeomDet* theGeomDet = theTrackerGeom-> idToDet (detIdStub);
1343+ const GeomDet* theGeomDet = tGeom. idToDet (detIdStub);
13361344 Global3DPoint posStub = theGeomDet->surface ().toGlobal (theGeomDet->topology ().localPosition (coords));
13371345
13381346 double x = posStub.x ();
@@ -1341,13 +1349,13 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
13411349
13421350 int layer = -999999 ;
13431351 if (detIdStub.subdetId () == StripSubdetector::TOB) {
1344- layer = static_cast <int >(tTopo-> layer (detIdStub));
1352+ layer = static_cast <int >(tTopo. layer (detIdStub));
13451353 if (DebugMode)
13461354 edm::LogVerbatim (" Tracklet" )
13471355 << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z;
13481356 tmp_trk_lhits += pow (10 , layer - 1 );
13491357 } else if (detIdStub.subdetId () == StripSubdetector::TID) {
1350- layer = static_cast <int >(tTopo-> layer (detIdStub));
1358+ layer = static_cast <int >(tTopo. layer (detIdStub));
13511359 if (DebugMode)
13521360 edm::LogVerbatim (" Tracklet" )
13531361 << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z;
@@ -1509,9 +1517,9 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
15091517 // loop over stubs
15101518 for (int is = 0 ; is < tmp_trk_nstub; is++) {
15111519 // detID of stub
1512- DetId detIdStub = theTrackerGeom-> idToDet ((stubRefs.at (is)->clusterRef (0 ))->getDetId ())->geographicalId ();
1520+ DetId detIdStub = tGeom. idToDet ((stubRefs.at (is)->clusterRef (0 ))->getDetId ())->geographicalId ();
15131521 MeasurementPoint coords = stubRefs.at (is)->clusterRef (0 )->findAverageLocalCoordinatesCentered ();
1514- const GeomDet* theGeomDet = theTrackerGeom-> idToDet (detIdStub);
1522+ const GeomDet* theGeomDet = tGeom. idToDet (detIdStub);
15151523 Global3DPoint posStub = theGeomDet->surface ().toGlobal (theGeomDet->topology ().localPosition (coords));
15161524
15171525 double x = posStub.x ();
@@ -1520,13 +1528,13 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
15201528
15211529 int layer = -999999 ;
15221530 if (detIdStub.subdetId () == StripSubdetector::TOB) {
1523- layer = static_cast <int >(tTopo-> layer (detIdStub));
1531+ layer = static_cast <int >(tTopo. layer (detIdStub));
15241532 if (DebugMode)
15251533 edm::LogVerbatim (" Tracklet" )
15261534 << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z;
15271535 tmp_trk_lhits += pow (10 , layer - 1 );
15281536 } else if (detIdStub.subdetId () == StripSubdetector::TID) {
1529- layer = static_cast <int >(tTopo-> layer (detIdStub));
1537+ layer = static_cast <int >(tTopo. layer (detIdStub));
15301538 if (DebugMode)
15311539 edm::LogVerbatim (" Tracklet" )
15321540 << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z;
@@ -1738,9 +1746,9 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
17381746
17391747 int layer = -1 ;
17401748 if (detid.subdetId () == StripSubdetector::TOB) {
1741- layer = static_cast <int >(tTopo-> layer (detid)) - 1 ; // fill in array as entries 0-5
1749+ layer = static_cast <int >(tTopo. layer (detid)) - 1 ; // fill in array as entries 0-5
17421750 } else if (detid.subdetId () == StripSubdetector::TID) {
1743- layer = static_cast <int >(tTopo-> layer (detid)) + 5 ; // fill in array as entries 6-10
1751+ layer = static_cast <int >(tTopo. layer (detid)) + 5 ; // fill in array as entries 6-10
17441752 }
17451753
17461754 // treat genuine stubs separately (==2 is genuine, ==1 is not)
@@ -1932,13 +1940,13 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
19321940 int tmp_nstub = stubRefs.size ();
19331941
19341942 for (int is = 0 ; is < tmp_nstub; is++) {
1935- DetId detIdStub = theTrackerGeom-> idToDet ((stubRefs.at (is)->clusterRef (0 ))->getDetId ())->geographicalId ();
1943+ DetId detIdStub = tGeom. idToDet ((stubRefs.at (is)->clusterRef (0 ))->getDetId ())->geographicalId ();
19361944 int layer = -999999 ;
19371945 if (detIdStub.subdetId () == StripSubdetector::TOB) {
1938- layer = static_cast <int >(tTopo-> layer (detIdStub));
1946+ layer = static_cast <int >(tTopo. layer (detIdStub));
19391947 tmp_matchtrk_lhits += pow (10 , layer - 1 );
19401948 } else if (detIdStub.subdetId () == StripSubdetector::TID) {
1941- layer = static_cast <int >(tTopo-> layer (detIdStub));
1949+ layer = static_cast <int >(tTopo. layer (detIdStub));
19421950 tmp_matchtrk_dhits += pow (10 , layer - 1 );
19431951 }
19441952 }
@@ -2102,13 +2110,13 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even
21022110 int tmp_nstub = stubRefs.size ();
21032111
21042112 for (int is = 0 ; is < tmp_nstub; is++) {
2105- DetId detIdStub = theTrackerGeom-> idToDet ((stubRefs.at (is)->clusterRef (0 ))->getDetId ())->geographicalId ();
2113+ DetId detIdStub = tGeom. idToDet ((stubRefs.at (is)->clusterRef (0 ))->getDetId ())->geographicalId ();
21062114 int layer = -999999 ;
21072115 if (detIdStub.subdetId () == StripSubdetector::TOB) {
2108- layer = static_cast <int >(tTopo-> layer (detIdStub));
2116+ layer = static_cast <int >(tTopo. layer (detIdStub));
21092117 tmp_matchtrkExt_lhits += pow (10 , layer - 1 );
21102118 } else if (detIdStub.subdetId () == StripSubdetector::TID) {
2111- layer = static_cast <int >(tTopo-> layer (detIdStub));
2119+ layer = static_cast <int >(tTopo. layer (detIdStub));
21122120 tmp_matchtrkExt_dhits += pow (10 , layer - 1 );
21132121 }
21142122 }
0 commit comments