diff --git a/CalibTracker/SiPixelConnectivity/interface/SiPixelFedCablingMapBuilder.h b/CalibTracker/SiPixelConnectivity/interface/SiPixelFedCablingMapBuilder.h index 6415a2c9b22fa..a13080800d6ab 100644 --- a/CalibTracker/SiPixelConnectivity/interface/SiPixelFedCablingMapBuilder.h +++ b/CalibTracker/SiPixelConnectivity/interface/SiPixelFedCablingMapBuilder.h @@ -1,9 +1,12 @@ #ifndef SiPixelFedCablingMapBuilder_H #define SiPixelFedCablingMapBuilder_H -#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" -#include "DataFormats/DetId/interface/DetId.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include #include @@ -14,7 +17,7 @@ class PixelGeomDetUnit; class SiPixelFedCablingMapBuilder { public: //SiPixelFedCablingMapBuilder(const std::string & associatorName); - SiPixelFedCablingMapBuilder(const std::string fileName, const bool phase1 = false); + SiPixelFedCablingMapBuilder(edm::ConsumesCollector&& iCC, const std::string fileName, const bool phase1 = false); SiPixelFedCablingTree* produce(const edm::EventSetup& setup); private: @@ -27,6 +30,9 @@ class SiPixelFedCablingMapBuilder { std::string fileName_; std::string myprint(const PixelGeomDetUnit* pxUnit); bool phase1_; + + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; }; #endif diff --git a/CalibTracker/SiPixelConnectivity/src/SiPixelFedCablingMapBuilder.cc b/CalibTracker/SiPixelConnectivity/src/SiPixelFedCablingMapBuilder.cc index 0736e2082cca6..d4b40d8c299fb 100644 --- a/CalibTracker/SiPixelConnectivity/src/SiPixelFedCablingMapBuilder.cc +++ b/CalibTracker/SiPixelConnectivity/src/SiPixelFedCablingMapBuilder.cc @@ -1,11 +1,8 @@ #include #include "CalibTracker/SiPixelConnectivity/interface/SiPixelFedCablingMapBuilder.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "FWCore/Framework/interface/ESHandle.h" #include #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" @@ -30,16 +27,19 @@ using namespace std; using namespace sipixelobjects; -SiPixelFedCablingMapBuilder::SiPixelFedCablingMapBuilder(const string fileName, +SiPixelFedCablingMapBuilder::SiPixelFedCablingMapBuilder(edm::ConsumesCollector&& iCC, + const string fileName, const bool phase1) : fileName_(fileName) //, phase1_(phase1) not used anymore -{} +{ + trackerTopoToken_ = iCC.esConsumes(); + trackerGeomToken_ = iCC.esConsumes(); +} SiPixelFedCablingTree* SiPixelFedCablingMapBuilder::produce(const edm::EventSetup& setup) { // Access geometry edm::LogInfo("read tracker geometry..."); - edm::ESHandle pDD; - setup.get().get(pDD); + edm::ESHandle pDD = setup.getHandle(trackerGeomToken_); edm::LogInfo("tracker geometry read") << "There are: " << pDD->dets().size() << " detectors"; // Test new TrackerGeometry features @@ -86,8 +86,7 @@ SiPixelFedCablingTree* SiPixelFedCablingMapBuilder::produce(const edm::EventSetu edm::LogInfo(" version ") << version << endl; // Access topology - edm::ESHandle tTopo; - setup.get().get(tTopo); + edm::ESHandle tTopo = setup.getHandle(trackerTopoToken_); const TrackerTopology* tt = tTopo.product(); typedef TrackerGeometry::DetContainer::const_iterator ITG; diff --git a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter.cc b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter.cc index 81e2e5877ea86..2211cf59282cb 100644 --- a/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter.cc +++ b/CalibTracker/SiPixelConnectivity/test/SiPixelFedCablingMapWriter.cc @@ -61,7 +61,7 @@ void SiPixelFedCablingMapWriter::analyze(const edm::Event& iEvent, const edm::Ev //std::cout << "-------HERE-----------" << endl; //cabling = SiPixelFedCablingMapBuilder(pixelToFedAssociator_).produce(iSetup); //cabling = SiPixelFedCablingMapBuilder(fileName_,phase1_).produce(iSetup); - cabling = SiPixelFedCablingMapBuilder(fileName_).produce(iSetup); + cabling = SiPixelFedCablingMapBuilder(consumesCollector(), fileName_).produce(iSetup); //std::cout << "-------Print Map ----------- DOES NOT WORK for phase1 " << endl; edm::LogInfo("PRINTING MAP (Does not work for phase1: ") << cabling->print(3); } diff --git a/CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h b/CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h index bc484a9238af4..fb44a80d783ea 100644 --- a/CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h +++ b/CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h @@ -19,6 +19,8 @@ // #include "FWCore/Framework/interface/EDAnalyzer.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include #include #include @@ -34,6 +36,7 @@ class SiPixelDetInfoFileWriter : public edm::EDAnalyzer { void analyze(const edm::Event &, const edm::EventSetup &) override; private: + edm::ESGetToken trackerGeomTokenBeginRun_; std::ofstream outputFile_; std::string filePath_; }; diff --git a/CalibTracker/SiPixelESProducers/plugins/SiPixelDetInfoFileWriter.cc b/CalibTracker/SiPixelESProducers/plugins/SiPixelDetInfoFileWriter.cc index 5cd3ccbb028b7..1955a0f09a263 100644 --- a/CalibTracker/SiPixelESProducers/plugins/SiPixelDetInfoFileWriter.cc +++ b/CalibTracker/SiPixelESProducers/plugins/SiPixelDetInfoFileWriter.cc @@ -6,11 +6,8 @@ #include "CalibTracker/SiPixelESProducers/interface/SiPixelDetInfoFileWriter.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" @@ -21,6 +18,7 @@ using namespace std; SiPixelDetInfoFileWriter::SiPixelDetInfoFileWriter(const edm::ParameterSet &iConfig) { edm::LogInfo("SiPixelDetInfoFileWriter::SiPixelDetInfoFileWriter"); + trackerGeomTokenBeginRun_ = esConsumes(); filePath_ = iConfig.getUntrackedParameter("FilePath", std::string("SiPixelDetInfo.dat")); } @@ -32,9 +30,7 @@ void SiPixelDetInfoFileWriter::beginRun(const edm::Run &run, const edm::EventSet outputFile_.open(filePath_.c_str()); if (outputFile_.is_open()) { - edm::ESHandle pDD; - - iSetup.get().get(pDD); + edm::ESHandle pDD = iSetup.getHandle(trackerGeomTokenBeginRun_); edm::LogInfo("SiPixelDetInfoFileWriter::beginJob - got geometry ") << std::endl; edm::LogInfo("SiPixelDetInfoFileWriter") << " There are " << pDD->detUnits().size() << " detectors" << std::endl; diff --git a/CalibTracker/SiPixelESProducers/test/PixelFEDChannelCollectionMapTestReader.cc b/CalibTracker/SiPixelESProducers/test/PixelFEDChannelCollectionMapTestReader.cc index 008d7861fa7db..f77b7928d542f 100644 --- a/CalibTracker/SiPixelESProducers/test/PixelFEDChannelCollectionMapTestReader.cc +++ b/CalibTracker/SiPixelESProducers/test/PixelFEDChannelCollectionMapTestReader.cc @@ -2,12 +2,9 @@ #include #include #include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" #include "CalibTracker/Records/interface/SiPixelFEDChannelContainerESProducerRcd.h" @@ -25,11 +22,15 @@ class PixelFEDChannelCollectionMapTestReader : public edm::one::EDAnalyzer<> { // ----------member data --------------------------- const bool printdebug_; const std::string formatedOutput_; + edm::ESGetToken + pixelFEDChannelCollectionMapToken_; }; PixelFEDChannelCollectionMapTestReader::PixelFEDChannelCollectionMapTestReader(edm::ParameterSet const& p) : printdebug_(p.getUntrackedParameter("printDebug", true)), - formatedOutput_(p.getUntrackedParameter("outputFile", "")) { + formatedOutput_(p.getUntrackedParameter("outputFile", "")), + pixelFEDChannelCollectionMapToken_( + esConsumes()) { edm::LogInfo("PixelFEDChannelCollectionMapTestReader") << "PixelFEDChannelCollectionMapTestReader" << std::endl; } @@ -53,11 +54,9 @@ void PixelFEDChannelCollectionMapTestReader::analyze(const edm::Event& e, const } //this part gets the handle of the event source and the record (i.e. the Database) - edm::ESHandle PixelFEDChannelCollectionMapHandle; - edm::LogInfo("PixelFEDChannelCollectionMapTestReader") << "got eshandle" << std::endl; - - context.get().get(PixelFEDChannelCollectionMapHandle); - edm::LogInfo("PixelFEDChannelCollectionMapTestReader") << "got context" << std::endl; + edm::ESHandle PixelFEDChannelCollectionMapHandle = + context.getHandle(pixelFEDChannelCollectionMapToken_); + edm::LogInfo("PixelFEDChannelCollectionMapTestReader") << "got eshandle and context" << std::endl; const PixelFEDChannelCollectionMap* thePixelFEDChannelCollectionMap = PixelFEDChannelCollectionMapHandle.product(); edm::LogInfo("PixelFEDChannelCollectionMapTestReader") << "got SiPixelFEDChannelContainer* " << std::endl; diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.cc b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.cc index ada6c3a063323..9a4519ffd139b 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.cc +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.cc @@ -3,11 +3,12 @@ #include "CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" namespace cms { SiPixelFakeGainForHLTReader::SiPixelFakeGainForHLTReader(const edm::ParameterSet& conf) : conf_(conf), + trackerGeomToken_(esConsumes()), + trackerGeomTokenBeginRun_(esConsumes()), SiPixelGainCalibrationForHLTService_(conf), filename_(conf.getParameter("fileName")) {} @@ -17,14 +18,9 @@ namespace cms { fFile->cd(); // Get the Geometry - iSetup.get().get(tkgeom); + edm::ESHandle tkgeom = iSetup.getHandle(trackerGeomToken_); edm::LogInfo("SiPixelFakeGainForHLTReader") << " There are " << tkgeom->dets().size() << " detectors" << std::endl; - // Get the calibrationForHLT data - //iSetup.get().get(SiPixelGainCalibrationForHLT_); - //edm::LogInfo("SiPixelFakeGainForHLTReader") << "[SiPixelFakeGainForHLTReader::analyze] End Reading FakeGainForHLTects" << std::endl; - //SiPixelGainCalibrationForHLTService_.setESObjects(iSetup); - // for(TrackerGeometry::DetContainer::const_iterator it = tkgeom->dets().begin(); it != tkgeom->dets().end(); it++){ // if( dynamic_cast((*it))!=0){ // uint32_t detid=((*it)->geographicalId()).rawId(); @@ -85,17 +81,14 @@ namespace cms { char name[128]; // Get Geometry - iSetup.get().get(tkgeom); + edm::ESHandle tkgeom = iSetup.getHandle(trackerGeomTokenBeginRun_); // Get the calibrationForHLT data - //edm::ESHandle SiPixelGainCalibration_; - //iSetup.get().get(SiPixelGainCalibration_); SiPixelGainCalibrationForHLTService_.setESObjects(iSetup); edm::LogInfo("SiPixelFakeGainForHLTReader") << "[SiPixelFakeGainForHLTReader::beginJob] End Reading FakeGainForHLTects" << std::endl; // Get the list of DetId's std::vector vdetId_ = SiPixelGainCalibrationForHLTService_.getDetIds(); - //SiPixelGainCalibrationForHLT_->getDetIds(vdetId_); // Loop over DetId's for (std::vector::const_iterator detid_iter = vdetId_.begin(); detid_iter != vdetId_.end(); detid_iter++) { diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h index e9a4c9bbc157a..d448ea799ac96 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainForHLTReader.h @@ -19,13 +19,9 @@ // #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -//#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationForHLT.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationForHLTService.h" #include "TROOT.h" @@ -47,8 +43,8 @@ namespace cms { private: edm::ParameterSet conf_; - edm::ESHandle tkgeom; - //edm::ESHandle SiPixelGainCalibrationForHLT_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken trackerGeomTokenBeginRun_; SiPixelGainCalibrationForHLTService SiPixelGainCalibrationForHLTService_; std::map _TH1F_Pedestals_m; diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.cc b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.cc index 2cefd90a64e9b..66ea38075a0f3 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.cc +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.cc @@ -3,12 +3,13 @@ #include "CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" namespace cms { SiPixelFakeGainOfflineReader::SiPixelFakeGainOfflineReader(const edm::ParameterSet& conf) : conf_(conf), SiPixelGainCalibrationOfflineService_(conf), + trackerGeomToken_(esConsumes()), + trackerGeomTokenBeginRun_(esConsumes()), filename_(conf.getParameter("fileName")) {} void SiPixelFakeGainOfflineReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -17,14 +18,9 @@ namespace cms { fFile->cd(); // Get the Geometry - iSetup.get().get(tkgeom); + edm::ESHandle tkgeom = iSetup.getHandle(trackerGeomToken_); edm::LogInfo("SiPixelFakeGainOfflineReader") << " There are " << tkgeom->dets().size() << " detectors" << std::endl; - // Get the calibrationOffline data - //iSetup.get().get(SiPixelGainCalibrationOffline_); - //edm::LogInfo("SiPixelFakeGainOfflineReader") << "[SiPixelFakeGainOfflineReader::analyze] End Reading FakeGainOfflineects" << std::endl; - //SiPixelGainCalibrationOfflineService_.setESObjects(iSetup); - // for(TrackerGeometry::DetContainer::const_iterator it = tkgeom->dets().begin(); it != tkgeom->dets().end(); it++){ // if( dynamic_cast((*it))!=0){ // uint32_t detid=((*it)->geographicalId()).rawId(); @@ -91,17 +87,14 @@ namespace cms { char name[128]; // Get Geometry - iSetup.get().get(tkgeom); + edm::ESHandle tkgeom = iSetup.getHandle(trackerGeomTokenBeginRun_); // Get the calibrationOffline data - //edm::ESHandle SiPixelGainCalibrationOffline_; - //iSetup.get().get(SiPixelGainCalibrationOffline_); SiPixelGainCalibrationOfflineService_.setESObjects(iSetup); edm::LogInfo("SiPixelFakeGainOfflineReader") << "[SiPixelFakeGainOfflineReader::beginJob] End Reading FakeGainOfflineects" << std::endl; // Get the list of DetId's std::vector vdetId_ = SiPixelGainCalibrationOfflineService_.getDetIds(); - //SiPixelGainCalibrationOffline_->getDetIds(vdetId_); // Loop over DetId's for (std::vector::const_iterator detid_iter = vdetId_.begin(); detid_iter != vdetId_.end(); detid_iter++) { diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h index 8613cc6f307c4..4a8f1753bef09 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainOfflineReader.h @@ -19,13 +19,9 @@ // #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -//#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibrationOffline.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationOfflineService.h" #include "TROOT.h" @@ -47,10 +43,10 @@ namespace cms { private: edm::ParameterSet conf_; - edm::ESHandle tkgeom; - //edm::ESHandle SiPixelGainCalibrationOffline_; - SiPixelGainCalibrationOfflineService SiPixelGainCalibrationOfflineService_; + SiPixelGainCalibrationOfflineService SiPixelGainCalibrationOfflineService_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken trackerGeomTokenBeginRun_; std::map _TH1F_Pedestals_m; std::map _TH1F_Gains_m; std::string filename_; diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.cc b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.cc index 9943129073c13..7ca86117ea9ed 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.cc +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.cc @@ -3,11 +3,14 @@ #include "CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" namespace cms { SiPixelFakeGainReader::SiPixelFakeGainReader(const edm::ParameterSet& conf) - : conf_(conf), SiPixelGainCalibrationService_(conf), filename_(conf.getParameter("fileName")) {} + : conf_(conf), + trackerGeomToken_(esConsumes()), + trackerGeomTokenBeginRun_(esConsumes()), + SiPixelGainCalibrationService_(conf), + filename_(conf.getParameter("fileName")) {} void SiPixelFakeGainReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { unsigned int nmodules = 0; @@ -15,14 +18,9 @@ namespace cms { fFile->cd(); // Get the Geometry - iSetup.get().get(tkgeom); + edm::ESHandle tkgeom = iSetup.getHandle(trackerGeomToken_); edm::LogInfo("SiPixelFakeGainReader") << " There are " << tkgeom->dets().size() << " detectors" << std::endl; - // Get the calibration data - //iSetup.get().get(SiPixelGainCalibration_); - //edm::LogInfo("SiPixelFakeGainReader") << "[SiPixelFakeGainReader::analyze] End Reading FakeGainects" << std::endl; - //SiPixelGainCalibrationService_.setESObjects(iSetup); - // for(TrackerGeometry::DetContainer::const_iterator it = tkgeom->dets().begin(); it != tkgeom->dets().end(); it++){ // if( dynamic_cast((*it))!=0){ // uint32_t detid=((*it)->geographicalId()).rawId(); @@ -89,17 +87,14 @@ namespace cms { char name[128]; // Get Geometry - iSetup.get().get(tkgeom); + edm::ESHandle tkgeom = iSetup.getHandle(trackerGeomTokenBeginRun_); // Get the calibration data - //edm::ESHandle SiPixelGainCalibration_; - //iSetup.get().get(SiPixelGainCalibration_); SiPixelGainCalibrationService_.setESObjects(iSetup); edm::LogInfo("SiPixelFakeGainReader") << "[SiPixelFakeGainReader::beginJob] End Reading FakeGainects" << std::endl; // Get the list of DetId's std::vector vdetId_ = SiPixelGainCalibrationService_.getDetIds(); - //SiPixelGainCalibration_->getDetIds(vdetId_); // Loop over DetId's for (std::vector::const_iterator detid_iter = vdetId_.begin(); detid_iter != vdetId_.end(); detid_iter++) { diff --git a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h index 7d96d3bf646ff..3b72d11eca08c 100644 --- a/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h +++ b/CalibTracker/SiPixelESProducers/test/SiPixelFakeGainReader.h @@ -19,13 +19,9 @@ // #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -//#include "CondFormats/SiPixelObjects/interface/SiPixelGainCalibration.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "CalibTracker/SiPixelESProducers/interface/SiPixelGainCalibrationService.h" #include "TROOT.h" @@ -47,8 +43,8 @@ namespace cms { private: edm::ParameterSet conf_; - edm::ESHandle tkgeom; - //edm::ESHandle SiPixelGainCalibration_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken trackerGeomTokenBeginRun_; SiPixelGainCalibrationService SiPixelGainCalibrationService_; std::map _TH1F_Pedestals_m; diff --git a/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h b/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h index a45822ebe8ce2..2dee8aceba9a3 100644 --- a/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h +++ b/CalibTracker/SiPixelErrorEstimation/interface/SiPixelErrorEstimation.h @@ -77,6 +77,9 @@ class SiPixelErrorEstimation : public edm::EDAnalyzer { edm::EDGetTokenT tPixRecHitCollection; edm::EDGetTokenT tSimTrackContainer; edm::EDGetTokenT tTrackCollection; + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken magneticFieldToken_; std::string outputFile_; std::string src_; bool checkType_; // do we check that the simHit associated with recHit is of the expected particle type ? diff --git a/CalibTracker/SiPixelErrorEstimation/src/SiPixelErrorEstimation.cc b/CalibTracker/SiPixelErrorEstimation/src/SiPixelErrorEstimation.cc index 3678bc99d791e..036f34b3073c1 100644 --- a/CalibTracker/SiPixelErrorEstimation/src/SiPixelErrorEstimation.cc +++ b/CalibTracker/SiPixelErrorEstimation/src/SiPixelErrorEstimation.cc @@ -53,6 +53,9 @@ SiPixelErrorEstimation::SiPixelErrorEstimation(const edm::ParameterSet& ps) tPixRecHitCollection = consumes(edm::InputTag("siPixelRecHits")); tSimTrackContainer = consumes(edm::InputTag("g4SimHits")); tTrackCollection = consumes(src_); + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + magneticFieldToken_ = esConsumes(); } SiPixelErrorEstimation::~SiPixelErrorEstimation() {} @@ -370,8 +373,7 @@ void SiPixelErrorEstimation::endJob() { void SiPixelErrorEstimation::analyze(const edm::Event& e, const edm::EventSetup& es) { //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = es.getHandle(trackerTopoToken_); const TrackerTopology* const tTopo = tTopoHandle.product(); using namespace edm; @@ -392,14 +394,12 @@ void SiPixelErrorEstimation::analyze(const edm::Event& e, const edm::EventSetup& std::vector matched; TrackerHitAssociator associate(e, trackerHitAssociatorConfig_); - edm::ESHandle pDD; - es.get().get(pDD); + edm::ESHandle pDD = es.getHandle(trackerGeomToken_); const TrackerGeometry* tracker = &(*pDD); //cout << "...1..." << endl; - edm::ESHandle magneticField; - es.get().get(magneticField); + edm::ESHandle magneticField = es.getHandle(magneticFieldToken_); //const MagneticField* magField_ = magFieldHandle.product(); edm::FileInPath FileInPath_; diff --git a/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.cc b/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.cc index b8fef9d76991a..5db0ff1824d19 100644 --- a/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.cc +++ b/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.cc @@ -61,6 +61,10 @@ SiPixelCalibDigiProducer::SiPixelCalibDigiProducer(const edm::ParameterSet& iCon produces>(); if (includeErrors_) produces>(); + + calibToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + cablingMapToken_ = esConsumes(); } SiPixelCalibDigiProducer::~SiPixelCalibDigiProducer() { @@ -249,9 +253,9 @@ void SiPixelCalibDigiProducer::setPattern() { void SiPixelCalibDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { // edm::LogInfo("SiPixelCalibDigiProducer") <<"in produce() " << std::endl; using namespace edm; - iSetup.get().get(calib_); - iSetup.get().get(theGeometry_); - iSetup.get().get(theCablingMap_); + calib_ = iSetup.getHandle(calibToken_); + theGeometry_ = iSetup.getHandle(trackerGeomToken_); + theCablingMap_ = iSetup.getHandle(cablingMapToken_); pattern_repeat_ = calib_->getNTriggers() * calib_->nVCal(); if (use_realeventnumber_) { iEventCounter_ = iEvent.id().event() - 1; diff --git a/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.h b/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.h index bed3e000bbb14..49fcc7c42088f 100644 --- a/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.h +++ b/CalibTracker/SiPixelGainCalibration/plugins/SiPixelCalibDigiProducer.h @@ -26,7 +26,6 @@ #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ServiceRegistry/interface/Service.h" @@ -87,6 +86,10 @@ class SiPixelCalibDigiProducer : public edm::EDProducer { edm::ESHandle theGeometry_; // the tracker geometry edm::ESHandle theCablingMap_; + edm::ESGetToken calibToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken cablingMapToken_; + // worker variables std::map intermediate_data_; // data container, copied over into the event every pattern_repeat_ events diff --git a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.cc b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.cc index 34ef68147eb93..91711f8cfb253 100644 --- a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.cc +++ b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.cc @@ -9,7 +9,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include "DataFormats/GeometryVector/interface/LocalVector.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -63,6 +62,8 @@ SiPixelLorentzAngle::SiPixelLorentzAngle(edm::ParameterSet const& conf) max_drift_ = 1000.; //400.; t_trajTrack = consumes(conf.getParameter("src")); + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); } // Virtual destructor needed. @@ -175,25 +176,20 @@ void SiPixelLorentzAngle::beginJob() { hitCounter_ = 0; usedHitCounter_ = 0; pixelTracksCounter_ = 0; - // edm::ESHandle estracker; //this block should not be in beginJob() - // c.get().get(estracker); - // tracker=&(* estracker); } // Functions that gets called by framework every event void SiPixelLorentzAngle::analyze(const edm::Event& e, const edm::EventSetup& es) { //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = es.getHandle(trackerTopoToken_); const TrackerTopology* const tTopo = tTopoHandle.product(); event_counter_++; // if(event_counter_ % 500 == 0) cout << "event number " << event_counter_ << endl; cout << "event number " << event_counter_ << endl; - edm::ESHandle estracker; - es.get().get(estracker); - tracker = &(*estracker); + edm::ESHandle estracker = es.getHandle(trackerGeomToken_); + const TrackerGeometry* tracker = &(*estracker); std::unique_ptr associate; if (simData_) diff --git a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.h b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.h index 78bf54246ca83..790e30588f5b4 100644 --- a/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.h +++ b/CalibTracker/SiPixelLorentzAngle/src/SiPixelLorentzAngle.h @@ -186,10 +186,10 @@ namespace analyzer { const TransientTrackingRecHitBuilder *RHBuilder; const KFTrajectorySmoother *theSmoother; const KFTrajectoryFitter *theFitter; - const TrackerGeometry *tracker; - const MagneticField *magfield; TrajectoryStateTransform tsTransform; edm::EDGetTokenT t_trajTrack; + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; }; } // namespace analyzer diff --git a/CalibTracker/SiPixelSCurveCalibration/src/SiPixelSCurveCalibrationAnalysis.cc b/CalibTracker/SiPixelSCurveCalibration/src/SiPixelSCurveCalibrationAnalysis.cc index 491aecbf88451..db71b39e1e44e 100644 --- a/CalibTracker/SiPixelSCurveCalibration/src/SiPixelSCurveCalibrationAnalysis.cc +++ b/CalibTracker/SiPixelSCurveCalibration/src/SiPixelSCurveCalibrationAnalysis.cc @@ -4,6 +4,7 @@ #include #include +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h" #include "CondFormats/SiPixelObjects/interface/ElectronicIndex.h" #include "CondFormats/SiPixelObjects/interface/LocalPixel.h" diff --git a/CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h b/CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h index 5be413d4425de..d1f6a42240602 100644 --- a/CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h +++ b/CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h @@ -26,12 +26,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/ServiceRegistry/interface/Service.h" -//#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/DetId/interface/DetId.h" @@ -52,6 +46,7 @@ #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h" #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" #include @@ -114,6 +109,11 @@ class SiPixelOfflineCalibAnalysisBase : public edm::EDAnalyzer { edm::ESHandle geom_; edm::ESHandle theCablingMap_; + edm::ESGetToken calibTokenBeginRun_; + edm::ESGetToken calibToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken cablingMapToken_; + std::string calibrationMode_; short nTriggers_; static std::vector vCalValues_; diff --git a/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.cc b/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.cc index 9a20af7f83d5d..299c34e55848e 100644 --- a/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.cc +++ b/CalibTracker/SiPixelTools/plugins/SiPixelErrorsDigisToCalibDigis.cc @@ -22,14 +22,8 @@ #include "SiPixelErrorsDigisToCalibDigis.h" // user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" - -#include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - // // constants, enums and typedefs // @@ -52,6 +46,8 @@ SiPixelErrorsDigisToCalibDigis::SiPixelErrorsDigisToCalibDigis(const edm::Parame tPixelCalibDigiError = consumes >(siPixelProducerLabel_); + trackerGeomToken_ = esConsumes(); + // std::cout<<"siPixelProducerLabel_ = "< geom_; + edm::ESGetToken trackerGeomToken_; + private: void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; diff --git a/CalibTracker/SiPixelTools/src/SiPixelOfflineCalibAnalysisBase.cc b/CalibTracker/SiPixelTools/src/SiPixelOfflineCalibAnalysisBase.cc index e3ca46fdff76e..2d96f81d7fa41 100644 --- a/CalibTracker/SiPixelTools/src/SiPixelOfflineCalibAnalysisBase.cc +++ b/CalibTracker/SiPixelTools/src/SiPixelOfflineCalibAnalysisBase.cc @@ -17,11 +17,12 @@ // // +#include "FWCore/Framework/interface/MakerMacros.h" + #include "CalibTracker/SiPixelTools/interface/SiPixelOfflineCalibAnalysisBase.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFrameConverter.h" #include "CondFormats/SiPixelObjects/interface/ElectronicIndex.h" @@ -41,6 +42,12 @@ SiPixelOfflineCalibAnalysisBase::SiPixelOfflineCalibAnalysisBase(const edm::Para daqBE_ = &*edm::Service(); folderMaker_ = new SiPixelFolderOrganizer(); tPixelCalibDigi = consumes >(siPixelCalibDigiProducer_); + + calibTokenBeginRun_ = + esConsumes(); + calibToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + cablingMapToken_ = esConsumes(); } SiPixelOfflineCalibAnalysisBase::SiPixelOfflineCalibAnalysisBase() { @@ -60,9 +67,9 @@ SiPixelOfflineCalibAnalysisBase::~SiPixelOfflineCalibAnalysisBase() {} void SiPixelOfflineCalibAnalysisBase::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - iSetup.get().get(geom_); - iSetup.get().get(theCablingMap_); - iSetup.get().get(calib_); + calib_ = iSetup.getHandle(calibToken_); + geom_ = iSetup.getHandle(trackerGeomToken_); + theCablingMap_ = iSetup.getHandle(cablingMapToken_); if (eventCounter_ == 0) this->calibrationSetup(iSetup); eventCounter_++; @@ -111,13 +118,11 @@ void SiPixelOfflineCalibAnalysisBase::analyze(const edm::Event& iEvent, const ed void SiPixelOfflineCalibAnalysisBase::beginRun(const edm::Run&, const edm::EventSetup& iSetup) { //load the calibration information from the database - iSetup.get().get(calib_); - iSetup.get().get(geom_); - iSetup.get().get(theCablingMap_); + edm::ESHandle calib = iSetup.getHandle(calibTokenBeginRun_); - calibrationMode_ = calib_->getCalibrationMode(); - nTriggers_ = calib_->getNTriggers(); - vCalValues_ = calib_->getVCalValues(); + calibrationMode_ = calib->getCalibrationMode(); + nTriggers_ = calib->getNTriggers(); + vCalValues_ = calib->getVCalValues(); std::cout << "!!!! in beginRun" << std::endl; edm::LogInfo("SiPixelOfflineCalibAnalysisBase") << "Calibration file loaded. Mode: " << calibrationMode_ << " nTriggers: " << nTriggers_ diff --git a/DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h b/DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h index 034e72872e767..01e643bab055b 100644 --- a/DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h +++ b/DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h @@ -8,10 +8,6 @@ #include "DQM/SiPixelMonitorClient/interface/SiPixelConfigParser.h" #include "DQM/SiPixelMonitorClient/interface/SiPixelConfigWriter.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include #include #include @@ -112,7 +108,6 @@ class SiPixelActionExecutor { SiPixelConfigParser *configParser_; SiPixelConfigWriter *configWriter_; - edm::ESHandle theCablingMap; std::vector summaryMENames; std::vector tkMapMENames; diff --git a/DQM/SiPixelMonitorClient/interface/SiPixelCertification.h b/DQM/SiPixelMonitorClient/interface/SiPixelCertification.h index 51137512b4024..88bdcf86723c6 100644 --- a/DQM/SiPixelMonitorClient/interface/SiPixelCertification.h +++ b/DQM/SiPixelMonitorClient/interface/SiPixelCertification.h @@ -6,20 +6,8 @@ #include #include -// FWCore -#include "DQMServices/Core/interface/DQMEDHarvester.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/LuminosityBlock.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - // DQM -#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMEDHarvester.h" class SiPixelCertification : public DQMEDHarvester { public: diff --git a/DQM/SiPixelMonitorClient/interface/SiPixelDaqInfo.h b/DQM/SiPixelMonitorClient/interface/SiPixelDaqInfo.h index 69e749222ad35..e6eeb3b9258ac 100644 --- a/DQM/SiPixelMonitorClient/interface/SiPixelDaqInfo.h +++ b/DQM/SiPixelMonitorClient/interface/SiPixelDaqInfo.h @@ -6,21 +6,11 @@ #include #include -// FWCore -#include "DQMServices/Core/interface/DQMEDHarvester.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/LuminosityBlock.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - // DQM -#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMEDHarvester.h" +#include "CondFormats/DataRecord/interface/RunSummaryRcd.h" +#include "CondFormats/RunInfo/interface/RunInfo.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" class SiPixelDaqInfo : public DQMEDHarvester { @@ -53,6 +43,7 @@ class SiPixelDaqInfo : public DQMEDHarvester { // define Token(-s) edm::EDGetTokenT daqSourceToken_; + edm::ESGetToken runInfoToken_; }; #endif diff --git a/DQM/SiPixelMonitorClient/interface/SiPixelDataQuality.h b/DQM/SiPixelMonitorClient/interface/SiPixelDataQuality.h index f91efba7e9cbf..4e349913022d6 100644 --- a/DQM/SiPixelMonitorClient/interface/SiPixelDataQuality.h +++ b/DQM/SiPixelMonitorClient/interface/SiPixelDataQuality.h @@ -7,11 +7,6 @@ #include "DQM/SiPixelMonitorClient/interface/SiPixelLayoutParser.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" @@ -58,7 +53,7 @@ class SiPixelDataQuality { void fillGlobalQualityPlot(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool init, - edm::ESHandle theCablingMap, + const SiPixelFedCablingMap *theCablingMap, int nFEDs, bool Tier0Flag, int lumisec); @@ -82,7 +77,6 @@ class SiPixelDataQuality { std::ofstream myfile_; int nevents_; bool endOfModules_; - edm::ESHandle theCablingMap; // Final combined Data Quality Flags: MonitorElement *SummaryReportMap; diff --git a/DQM/SiPixelMonitorClient/interface/SiPixelDcsInfo.h b/DQM/SiPixelMonitorClient/interface/SiPixelDcsInfo.h index 84b75dd55cb67..a2f84de13ca4e 100644 --- a/DQM/SiPixelMonitorClient/interface/SiPixelDcsInfo.h +++ b/DQM/SiPixelMonitorClient/interface/SiPixelDcsInfo.h @@ -6,20 +6,8 @@ #include #include -// FWCore -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/LuminosityBlock.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - // DQM #include "DQMServices/Core/interface/DQMEDHarvester.h" -#include "DQMServices/Core/interface/DQMStore.h" class SiPixelDcsInfo : public DQMEDHarvester { public: diff --git a/DQM/SiPixelMonitorClient/interface/SiPixelEDAClient.h b/DQM/SiPixelMonitorClient/interface/SiPixelEDAClient.h index 2b7c01e00a060..7e81edc708333 100644 --- a/DQM/SiPixelMonitorClient/interface/SiPixelEDAClient.h +++ b/DQM/SiPixelMonitorClient/interface/SiPixelEDAClient.h @@ -3,7 +3,6 @@ #include "DQMServices/Core/interface/DQMEDHarvester.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/LuminosityBlock.h" #include "FWCore/Framework/interface/Run.h" @@ -73,7 +72,9 @@ class SiPixelEDAClient : public DQMEDHarvester { std::ostringstream html_out_; edm::EDGetTokenT inputSourceToken_; - edm::ESHandle theCablingMap; + SiPixelFedCablingMap theCablingMap; + + edm::ESGetToken cablingMapToken_; }; #endif diff --git a/DQM/SiPixelMonitorClient/interface/SiPixelInformationExtractor.h b/DQM/SiPixelMonitorClient/interface/SiPixelInformationExtractor.h index 90bda458235dc..76a8358d79c30 100644 --- a/DQM/SiPixelMonitorClient/interface/SiPixelInformationExtractor.h +++ b/DQM/SiPixelMonitorClient/interface/SiPixelInformationExtractor.h @@ -8,11 +8,6 @@ #include "DQM/SiPixelMonitorClient/interface/SiPixelConfigWriter.h" #include "DQM/SiPixelMonitorClient/interface/SiPixelLayoutParser.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" #include "CondFormats/SiPixelObjects/interface/DetectorIndex.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" @@ -64,7 +59,7 @@ class SiPixelInformationExtractor { bool init, float noiseRate, int noiseRateDenominator, - edm::ESHandle theCablingMap); + const SiPixelFedCablingMap *theCablingMap); private: void getItemList(const std::multimap &req_map, diff --git a/DQM/SiPixelMonitorClient/src/SiPixelDaqInfo.cc b/DQM/SiPixelMonitorClient/src/SiPixelDaqInfo.cc index b19c14e8cf607..f05d308b3c13c 100644 --- a/DQM/SiPixelMonitorClient/src/SiPixelDaqInfo.cc +++ b/DQM/SiPixelMonitorClient/src/SiPixelDaqInfo.cc @@ -1,6 +1,4 @@ -#include "CondFormats/DataRecord/interface/RunSummaryRcd.h" -#include "CondFormats/RunInfo/interface/RunInfo.h" -#include "CondFormats/RunInfo/interface/RunSummary.h" + #include "DQM/SiPixelMonitorClient/interface/SiPixelDaqInfo.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" @@ -23,6 +21,7 @@ SiPixelDaqInfo::SiPixelDaqInfo(const edm::ParameterSet &ps) { // set Token(-s) daqSourceToken_ = consumes(ps.getUntrackedParameter("daqSource", "source")); + runInfoToken_ = esConsumes(); } SiPixelDaqInfo::~SiPixelDaqInfo() {} @@ -44,9 +43,8 @@ void SiPixelDaqInfo::dqmEndLuminosityBlock(DQMStore::IBooker &iBooker, if (auto runInfoRec = iSetup.tryToGet()) { // get fed summary information - ESHandle sumFED; - runInfoRec->get(sumFED); - vector FedsInIds = sumFED->m_fed_in; + const RunInfo &sumFED = runInfoRec->get(runInfoToken_); + vector FedsInIds = sumFED.m_fed_in; int FedCount = 0; int FedCountBarrel = 0; diff --git a/DQM/SiPixelMonitorClient/src/SiPixelDataQuality.cc b/DQM/SiPixelMonitorClient/src/SiPixelDataQuality.cc index 6c6fcca2a9757..cf85896ee51b4 100644 --- a/DQM/SiPixelMonitorClient/src/SiPixelDataQuality.cc +++ b/DQM/SiPixelMonitorClient/src/SiPixelDataQuality.cc @@ -790,7 +790,7 @@ void SiPixelDataQuality::computeGlobalQualityFlagByLumi(DQMStore::IGetter &iGett void SiPixelDataQuality::fillGlobalQualityPlot(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool init, - edm::ESHandle theCablingMap, + const SiPixelFedCablingMap *theCablingMap, int nFEDs, bool Tier0Flag, int lumisec) { @@ -916,7 +916,7 @@ void SiPixelDataQuality::fillGlobalQualityPlot(DQMStore::IBooker &iBooker, modCounter_++; detId = getDetId(me); for (int fedid = 0; fedid != 40; ++fedid) { - SiPixelFrameConverter converter(theCablingMap.product(), fedid); + SiPixelFrameConverter converter(theCablingMap, fedid); uint32_t newDetId = detId; if (converter.hasDetUnit(newDetId)) { fedId = fedid; diff --git a/DQM/SiPixelMonitorClient/src/SiPixelEDAClient.cc b/DQM/SiPixelMonitorClient/src/SiPixelEDAClient.cc index 0f2cdcc52b5de..f7c67fe92b3d4 100644 --- a/DQM/SiPixelMonitorClient/src/SiPixelEDAClient.cc +++ b/DQM/SiPixelMonitorClient/src/SiPixelEDAClient.cc @@ -96,6 +96,7 @@ SiPixelEDAClient::SiPixelEDAClient(const edm::ParameterSet &ps) { sipixelDataQuality_ = new SiPixelDataQuality(offlineXMLfile_); inputSourceToken_ = consumes(ps.getUntrackedParameter("inputSource", "source")); + cablingMapToken_ = esConsumes(); // cout<<"...leaving SiPixelEDAClient::SiPixelEDAClient. "<getBinContent(i + 1); } } - eSetup.get().get(theCablingMap); + // copy is intentional to allow using the SiPixelFedCablingMap in dqmEndJob() where accessing EventSetup products is not allowed + theCablingMap = eSetup.getData(cablingMapToken_); firstLumi = false; } @@ -234,11 +236,11 @@ void SiPixelEDAClient::dqmEndLuminosityBlock(DQMStore::IBooker &iBooker, init = true; iBooker.cd(); iGetter.cd(); - sipixelDataQuality_->fillGlobalQualityPlot(iBooker, iGetter, init, theCablingMap, nFEDs_, Tier0Flag_, nLumiSecs_); + sipixelDataQuality_->fillGlobalQualityPlot(iBooker, iGetter, init, &theCablingMap, nFEDs_, Tier0Flag_, nLumiSecs_); init = true; if (noiseRate_ >= 0.) sipixelInformationExtractor_->findNoisyPixels( - iBooker, iGetter, init, noiseRate_, noiseRateDenominator_, theCablingMap); + iBooker, iGetter, init, noiseRate_, noiseRateDenominator_, &theCablingMap); } // cout<<"...leaving SiPixelEDAClient::endLuminosityBlock. "<fillGlobalQualityPlot(iBooker, iGetter, init, theCablingMap, nFEDs_, Tier0Flag_, nLumiSecs_); + sipixelDataQuality_->fillGlobalQualityPlot(iBooker, iGetter, init, &theCablingMap, nFEDs_, Tier0Flag_, nLumiSecs_); init = true; if (noiseRate_ >= 0.) sipixelInformationExtractor_->findNoisyPixels( - iBooker, iGetter, init, noiseRate_, noiseRateDenominator_, theCablingMap); + iBooker, iGetter, init, noiseRate_, noiseRateDenominator_, &theCablingMap); } } diff --git a/DQM/SiPixelMonitorClient/src/SiPixelInformationExtractor.cc b/DQM/SiPixelMonitorClient/src/SiPixelInformationExtractor.cc index 47382b8e71376..262cf2673fc6b 100644 --- a/DQM/SiPixelMonitorClient/src/SiPixelInformationExtractor.cc +++ b/DQM/SiPixelMonitorClient/src/SiPixelInformationExtractor.cc @@ -348,7 +348,7 @@ void SiPixelInformationExtractor::findNoisyPixels(DQMStore::IBooker &iBooker, bool init, float noiseRate_, int noiseRateDenominator_, - edm::ESHandle theCablingMap) { + const SiPixelFedCablingMap *theCablingMap) { if (init) { endOfModules_ = false; nevents_ = noiseRateDenominator_; @@ -447,7 +447,7 @@ void SiPixelInformationExtractor::findNoisyPixels(DQMStore::IBooker &iBooker, std::vector, float>> noisyPixels = (*it).second; // now convert into online conventions: for (int fedid = 0; fedid <= 40; ++fedid) { - SiPixelFrameConverter converter(theCablingMap.product(), fedid); + SiPixelFrameConverter converter(theCablingMap, fedid); uint32_t newDetId = detid; if (converter.hasDetUnit(newDetId)) { realfedID = fedid; @@ -486,7 +486,7 @@ void SiPixelInformationExtractor::findNoisyPixels(DQMStore::IBooker &iBooker, counter++; sipixelobjects::ElectronicIndex cabling; - SiPixelFrameConverter formatter(theCablingMap.product(), realfedID); + SiPixelFrameConverter formatter(theCablingMap, realfedID); sipixelobjects::DetectorIndex detector = {detid, offlineRow, offlineColumn}; formatter.toCabling(cabling, detector); // cabling should now contain cabling.roc and cabling.dcol and diff --git a/DQM/SiPixelMonitorCluster/interface/SiPixelClusterModule.h b/DQM/SiPixelMonitorCluster/interface/SiPixelClusterModule.h index a05f59b60ee56..40eed7459d5a5 100644 --- a/DQM/SiPixelMonitorCluster/interface/SiPixelClusterModule.h +++ b/DQM/SiPixelMonitorCluster/interface/SiPixelClusterModule.h @@ -22,19 +22,10 @@ #include "DQMServices/Core/interface/DQMStore.h" #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/CommonDetUnit/interface/GeomDetType.h" -#include "Geometry/CommonDetUnit/interface/GluedGeomDet.h" -#include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" #include class SiPixelClusterModule { @@ -55,7 +46,7 @@ class SiPixelClusterModule { /// Book histograms void book(const edm::ParameterSet &iConfig, - const edm::EventSetup &iSetup, + const TrackerTopology *pTT, DQMStore::IBooker &iBooker, int type = 0, bool twoD = true, @@ -63,6 +54,7 @@ class SiPixelClusterModule { bool isUpgrade = false); /// Fill histograms int fill(const edmNew::DetSetVector &input, + const TrackerTopology *pTT, const TrackerGeometry *tracker, int *barrelClusterTotal, int *fpixPClusterTotal, @@ -83,7 +75,6 @@ class SiPixelClusterModule { bool isUpgrade = false); private: - const TrackerTopology *pTT; uint32_t id_; int ncols_; int nrows_; diff --git a/DQM/SiPixelMonitorCluster/interface/SiPixelClusterSource.h b/DQM/SiPixelMonitorCluster/interface/SiPixelClusterSource.h index 177e767862ac6..bf0a4c5c70c57 100644 --- a/DQM/SiPixelMonitorCluster/interface/SiPixelClusterSource.h +++ b/DQM/SiPixelMonitorCluster/interface/SiPixelClusterSource.h @@ -23,36 +23,13 @@ #include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" - #include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" - #include "DQM/SiPixelMonitorCluster/interface/SiPixelClusterModule.h" - -#include "DataFormats/Common/interface/DetSetVectorNew.h" -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/CommonDetUnit/interface/GeomDetType.h" -#include "Geometry/CommonDetUnit/interface/GluedGeomDet.h" -#include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include class SiPixelClusterSource : public DQMEDAnalyzer { @@ -123,6 +100,11 @@ class SiPixelClusterSource : public DQMEDAnalyzer { // define Token(-s) edm::EDGetTokenT> srcToken_; edm::EDGetTokenT> digisrcToken_; + + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken trackerTopoTokenBeginRun_; + edm::ESGetToken trackerGeomTokenBeginRun_; }; #endif diff --git a/DQM/SiPixelMonitorCluster/src/SiPixelClusterModule.cc b/DQM/SiPixelMonitorCluster/src/SiPixelClusterModule.cc index ab399e96c36b9..1c15633659866 100644 --- a/DQM/SiPixelMonitorCluster/src/SiPixelClusterModule.cc +++ b/DQM/SiPixelMonitorCluster/src/SiPixelClusterModule.cc @@ -56,16 +56,12 @@ SiPixelClusterModule::~SiPixelClusterModule() {} // Book histograms // void SiPixelClusterModule::book(const edm::ParameterSet &iConfig, - const edm::EventSetup &iSetup, + const TrackerTopology *pTT, DQMStore::IBooker &iBooker, int type, bool twoD, bool reducedSet, bool isUpgrade) { - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - pTT = tTopoHandle.product(); - bool barrel = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelBarrel); bool endcap = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelEndcap); bool isHalfModule = false; @@ -539,6 +535,7 @@ void SiPixelClusterModule::book(const edm::ParameterSet &iConfig, // Fill histograms // int SiPixelClusterModule::fill(const edmNew::DetSetVector &input, + const TrackerTopology *pTT, const TrackerGeometry *tracker, int *barrelClusterTotal, int *fpixPClusterTotal, diff --git a/DQM/SiPixelMonitorCluster/src/SiPixelClusterSource.cc b/DQM/SiPixelMonitorCluster/src/SiPixelClusterSource.cc index f8219893c3d7e..84f087b3c4940 100644 --- a/DQM/SiPixelMonitorCluster/src/SiPixelClusterSource.cc +++ b/DQM/SiPixelMonitorCluster/src/SiPixelClusterSource.cc @@ -21,15 +21,13 @@ // Framework #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/MakerMacros.h" // DQM Framework #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "DQMServices/Core/interface/DQMStore.h" // Geometry -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" // DataFormats #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" @@ -37,7 +35,6 @@ #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" // #include #include @@ -71,6 +68,12 @@ SiPixelClusterSource::SiPixelClusterSource(const edm::ParameterSet &iConfig) // set Token(-s) srcToken_ = consumes>(conf_.getParameter("src")); digisrcToken_ = consumes>(conf_.getParameter("digisrc")); + + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + trackerTopoTokenBeginRun_ = esConsumes(); + trackerGeomTokenBeginRun_ = esConsumes(); + firstRun = true; topFolderName_ = conf_.getParameter("TopFolderName"); } @@ -228,16 +231,14 @@ void SiPixelClusterSource::analyze(const edm::Event &iEvent, const edm::EventSet iEvent.getByToken(srcToken_, input); auto const &clustColl = *(input.product()); - edm::ESHandle pDD; - iSetup.get().get(pDD); + edm::ESHandle pDD = iSetup.getHandle(trackerGeomToken_); const TrackerGeometry *tracker = &(*pDD); edm::Handle> digiinput; iEvent.getByToken(digisrcToken_, digiinput); const edm::DetSetVector diginp = *(digiinput.product()); - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoToken_); const TrackerTopology *pTT = tTopoHandle.product(); int lumiSection = (int)iEvent.luminosityBlock(); @@ -251,6 +252,7 @@ void SiPixelClusterSource::analyze(const edm::Event &iEvent, const edm::EventSet for (struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++) { int numberOfFpixClusters = (*struct_iter) .second->fill(*input, + pTT, tracker, &nEventsBarrel, &nEventsFPIXp, @@ -311,11 +313,9 @@ void SiPixelClusterSource::analyze(const edm::Event &iEvent, const edm::EventSet //------------------------------------------------------------------ void SiPixelClusterSource::buildStructure(const edm::EventSetup &iSetup) { LogInfo("PixelDQM") << " SiPixelClusterSource::buildStructure"; - edm::ESHandle pDD; - iSetup.get().get(pDD); + edm::ESHandle pDD = iSetup.getHandle(trackerGeomTokenBeginRun_); - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); const TrackerTopology *pTT = tTopoHandle.product(); LogVerbatim("PixelDQM") << " *** Geometry node for TrackerGeom is " << &(*pDD) << std::endl; @@ -396,11 +396,14 @@ void SiPixelClusterSource::bookMEs(DQMStore::IBooker &iBooker, const edm::EventS SiPixelFolderOrganizer theSiPixelFolder(false); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); + const TrackerTopology *pTT = tTopoHandle.product(); + for (struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++) { /// Create folder tree and book histograms if (modOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 0, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 0, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 0, twoDimOn, reducedSet, isUpgrade); } else { if (!isPIB) throw cms::Exception("LogicError") << "[SiPixelClusterSource::bookMEs] Creation of DQM folder " @@ -409,49 +412,49 @@ void SiPixelClusterSource::bookMEs(DQMStore::IBooker &iBooker, const edm::EventS } if (ladOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 1, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 1, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 1, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH LADDER-FOLDER\n"; } } if (layOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 2, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 2, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 2, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH LAYER-FOLDER\n"; } } if (phiOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 3, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 3, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 3, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH PHI-FOLDER\n"; } } if (bladeOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 4, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 4, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 4, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH BLADE-FOLDER\n"; } } if (diskOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 5, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 5, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 5, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH DISK-FOLDER\n"; } } if (ringOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 6, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 6, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 6, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH RING-FOLDER\n"; } } if (smileyOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 7, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 7, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 7, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH BARREL-FOLDER\n"; } diff --git a/DQM/SiPixelMonitorDigi/interface/SiPixelDigiModule.h b/DQM/SiPixelMonitorDigi/interface/SiPixelDigiModule.h index b7e2366d37bbc..0fc5af04e13a7 100644 --- a/DQM/SiPixelMonitorDigi/interface/SiPixelDigiModule.h +++ b/DQM/SiPixelMonitorDigi/interface/SiPixelDigiModule.h @@ -23,22 +23,8 @@ #include "DQMServices/Core/interface/DQMStore.h" #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "DataFormats/Common/interface/DetSetVector.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" -#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFrameReverter.h" -#include "CondFormats/SiPixelObjects/interface/GlobalPixel.h" - -#include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/CommonDetUnit/interface/GeomDetType.h" -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/CommonDetUnit/interface/GluedGeomDet.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include class SiPixelDigiModule { @@ -59,7 +45,7 @@ class SiPixelDigiModule { /// Book histograms void book(const edm::ParameterSet& iConfig, - const edm::EventSetup& iSetup, + const TrackerTopology* pTT, DQMStore::IBooker& iBooker, int type = 0, bool twoD = true, @@ -74,7 +60,7 @@ class SiPixelDigiModule { // bool twoD=true, bool reducedSet=false, bool twoDimModOn = true, bool twoDimOnlyLayDisk = false, // int &nDigisA, int &nDigisB); int fill(const edm::DetSetVector& input, - const edm::EventSetup& iSetup, + const TrackerTopology* pTT, MonitorElement* combBarrel, MonitorElement* chanBarrel, std::vector& chanBarrelL, diff --git a/DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h b/DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h index faf2716baaa95..0ccfb71b4dcfa 100644 --- a/DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h +++ b/DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h @@ -21,26 +21,13 @@ #include // user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "DQMServices/Core/interface/DQMStore.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/CommonTopologies/interface/PixelTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" - #include "DQM/SiPixelMonitorDigi/interface/SiPixelDigiModule.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" -#include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" - -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include class SiPixelDigiSource : public DQMOneLumiEDAnalyzer<> { @@ -240,6 +227,9 @@ class SiPixelDigiSource : public DQMOneLumiEDAnalyzer<> { //define Token(-s) edm::EDGetTokenT > srcToken_; + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerTopoTokenBeginRun_; + edm::ESGetToken trackerGeomTokenBeginRun_; int noOfLayers; int noOfDisks; }; diff --git a/DQM/SiPixelMonitorDigi/src/SiPixelDigiModule.cc b/DQM/SiPixelMonitorDigi/src/SiPixelDigiModule.cc index c578075d2ba11..1a05fc6400f21 100644 --- a/DQM/SiPixelMonitorDigi/src/SiPixelDigiModule.cc +++ b/DQM/SiPixelMonitorDigi/src/SiPixelDigiModule.cc @@ -19,8 +19,6 @@ #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" // // Constructors @@ -39,7 +37,7 @@ SiPixelDigiModule::~SiPixelDigiModule() {} // Book histograms // void SiPixelDigiModule::book(const edm::ParameterSet& iConfig, - const edm::EventSetup& iSetup, + const TrackerTopology* pTT, DQMStore::IBooker& iBooker, int type, bool twoD, @@ -47,11 +45,6 @@ void SiPixelDigiModule::book(const edm::ParameterSet& iConfig, bool reducedSet, bool additInfo, bool isUpgrade) { - //isUpgrade = iConfig.getUntrackedParameter("isUpgrade"); - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* pTT = tTopoHandle.product(); - bool barrel = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelBarrel); bool endcap = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelEndcap); bool isHalfModule = false; @@ -321,7 +314,7 @@ void SiPixelDigiModule::book(const edm::ParameterSet& iConfig, // Fill histograms // int SiPixelDigiModule::fill(const edm::DetSetVector& input, - const edm::EventSetup& iSetup, + const TrackerTopology* pTT, MonitorElement* combBarrel, MonitorElement* chanBarrel, std::vector& chanBarrelL, @@ -340,10 +333,6 @@ int SiPixelDigiModule::fill(const edm::DetSetVector& input, int& nDigisA, int& nDigisB, bool isUpgrade) { - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* pTT = tTopoHandle.product(); - bool barrel = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelBarrel); bool endcap = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelEndcap); bool isHalfModule = false; diff --git a/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc b/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc index f1c954a66a0ab..8f06141a8b76d 100644 --- a/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc +++ b/DQM/SiPixelMonitorDigi/src/SiPixelDigiSource.cc @@ -17,6 +17,7 @@ // #include "DQM/SiPixelMonitorDigi/interface/SiPixelDigiSource.h" // Framework +#include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -25,11 +26,7 @@ #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "DQMServices/Core/interface/DQMStore.h" // Geometry -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" // DataFormats #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" @@ -71,6 +68,10 @@ SiPixelDigiSource::SiPixelDigiSource(const edm::ParameterSet& iConfig) //set Token(-s) srcToken_ = consumes >(conf_.getParameter("src")); + trackerTopoToken_ = esConsumes(); + trackerTopoTokenBeginRun_ = esConsumes(); + trackerGeomTokenBeginRun_ = esConsumes(); + topFolderName_ = conf_.getParameter("TopFolderName"); firstRun = true; @@ -316,8 +317,7 @@ void SiPixelDigiSource::bookHistograms(DQMStore::IBooker& iBooker, edm::Run cons // Method called for every event //------------------------------------------------------------------ void SiPixelDigiSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoToken_); const TrackerTopology* pTT = tTopoHandle.product(); // get input data @@ -343,7 +343,7 @@ void SiPixelDigiSource::analyze(const edm::Event& iEvent, const edm::EventSetup& for (struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++) { int numberOfDigisMod = (*struct_iter) .second->fill(*input, - iSetup, + pTT, meNDigisCOMBBarrel_, meNDigisCHANBarrel_, meNDigisCHANBarrelLs_, @@ -1095,13 +1095,11 @@ void SiPixelDigiSource::analyze(const edm::Event& iEvent, const edm::EventSetup& // Build data structure //------------------------------------------------------------------ void SiPixelDigiSource::buildStructure(const edm::EventSetup& iSetup) { - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); const TrackerTopology* pTT = tTopoHandle.product(); LogInfo("PixelDQM") << " SiPixelDigiSource::buildStructure"; - edm::ESHandle pDD; - iSetup.get().get(pDD); + edm::ESHandle pDD = iSetup.getHandle(trackerGeomTokenBeginRun_); LogVerbatim("PixelDQM") << " *** Geometry node for TrackerGeom is " << &(*pDD) << std::endl; LogVerbatim("PixelDQM") << " *** I have " << pDD->dets().size() << " detectors" << std::endl; @@ -1258,11 +1256,14 @@ void SiPixelDigiSource::bookMEs(DQMStore::IBooker& iBooker, const edm::EventSetu SiPixelFolderOrganizer theSiPixelFolder(false); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); + const TrackerTopology* pTT = tTopoHandle.product(); + for (struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++) { /// Create folder tree and book histograms if (modOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 0, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 0, twoDimOn, hiRes, reducedSet, twoDimModOn, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 0, twoDimOn, hiRes, reducedSet, twoDimModOn, isUpgrade); } else { if (!isPIB) throw cms::Exception("LogicError") << "[SiPixelDigiSource::bookMEs] Creation of DQM folder failed"; @@ -1270,15 +1271,14 @@ void SiPixelDigiSource::bookMEs(DQMStore::IBooker& iBooker, const edm::EventSetu } if (ladOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 1, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 1, twoDimOn, hiRes, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 1, twoDimOn, hiRes, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH LADDER-FOLDER\n"; } } if (layOn || twoDimOnlyLayDisk) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 2, isUpgrade)) { - (*struct_iter) - .second->book(conf_, iSetup, iBooker, 2, twoDimOn, hiRes, reducedSet, twoDimOnlyLayDisk, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 2, twoDimOn, hiRes, reducedSet, twoDimOnlyLayDisk, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH LAYER-FOLDER\n"; } @@ -1286,29 +1286,28 @@ void SiPixelDigiSource::bookMEs(DQMStore::IBooker& iBooker, const edm::EventSetu if (phiOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 3, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 3, twoDimOn, hiRes, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 3, twoDimOn, hiRes, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH PHI-FOLDER\n"; } } if (bladeOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 4, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 4, twoDimOn, hiRes, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 4, twoDimOn, hiRes, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH BLADE-FOLDER\n"; } } if (diskOn || twoDimOnlyLayDisk) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 5, isUpgrade)) { - (*struct_iter) - .second->book(conf_, iSetup, iBooker, 5, twoDimOn, hiRes, reducedSet, twoDimOnlyLayDisk, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 5, twoDimOn, hiRes, reducedSet, twoDimOnlyLayDisk, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH DISK-FOLDER\n"; } } if (ringOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 6, isUpgrade)) { - (*struct_iter).second->book(conf_, iSetup, iBooker, 6, twoDimOn, hiRes, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, pTT, iBooker, 6, twoDimOn, hiRes, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH RING-FOLDER\n"; } diff --git a/DQM/SiPixelMonitorRawData/interface/SiPixelHLTSource.h b/DQM/SiPixelMonitorRawData/interface/SiPixelHLTSource.h index 37d5f63016ba7..720373211e626 100644 --- a/DQM/SiPixelMonitorRawData/interface/SiPixelHLTSource.h +++ b/DQM/SiPixelMonitorRawData/interface/SiPixelHLTSource.h @@ -23,25 +23,15 @@ #include // user include files -#include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" - #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" class SiPixelHLTSource : public DQMEDAnalyzer { public: @@ -57,7 +47,7 @@ class SiPixelHLTSource : public DQMEDAnalyzer { edm::ParameterSet conf_; edm::EDGetTokenT rawin_; edm::EDGetTokenT> errin_; - edm::ESHandle pDD; + edm::ESGetToken trackerGeomToken_; bool saveFile; bool slowDown; std::string dirName_; diff --git a/DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorSource.h b/DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorSource.h index f31970dcd4ebf..f6214527753ee 100644 --- a/DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorSource.h +++ b/DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorSource.h @@ -28,25 +28,14 @@ #include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" - #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" - #include "DQM/SiPixelMonitorRawData/interface/SiPixelRawDataErrorModule.h" - #include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" - -#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include class SiPixelRawDataErrorSource : public DQMOneLumiEDAnalyzer<> { @@ -67,6 +56,8 @@ class SiPixelRawDataErrorSource : public DQMOneLumiEDAnalyzer<> { edm::ParameterSet conf_; edm::EDGetTokenT> src_; edm::EDGetTokenT inputSourceToken_; + edm::ESGetToken trackerTopoTokenBeginRun_; + edm::ESGetToken trackerGeomTokenBeginRun_; std::string topFolderName_; bool saveFile; bool isPIB; diff --git a/DQM/SiPixelMonitorRawData/src/SiPixelHLTSource.cc b/DQM/SiPixelMonitorRawData/src/SiPixelHLTSource.cc index 90f6d7c59d581..d721ff6444106 100644 --- a/DQM/SiPixelMonitorRawData/src/SiPixelHLTSource.cc +++ b/DQM/SiPixelMonitorRawData/src/SiPixelHLTSource.cc @@ -20,6 +20,7 @@ // Framework #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/MakerMacros.h" // DQM Framework #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h" @@ -50,6 +51,7 @@ SiPixelHLTSource::SiPixelHLTSource(const edm::ParameterSet &iConfig) : conf_(iConfig), rawin_(consumes(conf_.getParameter("RawInput"))), errin_(consumes>(conf_.getParameter("ErrorInput"))), + trackerGeomToken_(esConsumes()), saveFile(conf_.getUntrackedParameter("saveFile", false)), slowDown(conf_.getUntrackedParameter("slowDown", false)), dirName_(conf_.getUntrackedParameter("DirName", "Pixel/FEDIntegrity/")) { @@ -65,7 +67,7 @@ SiPixelHLTSource::~SiPixelHLTSource() { void SiPixelHLTSource::dqmBeginRun(const edm::Run &r, const edm::EventSetup &iSetup) { LogInfo("PixelDQM") << " SiPixelHLTSource::beginJob - Initialisation ... " << std::endl; - iSetup.get().get(pDD); + if (firstRun) { eventNo = 0; @@ -83,6 +85,7 @@ void SiPixelHLTSource::bookHistograms(DQMStore::IBooker &iBooker, edm::Run const //------------------------------------------------------------------ void SiPixelHLTSource::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { eventNo++; + edm::ESHandle pDD = iSetup.getHandle(trackerGeomToken_); // get raw input data edm::Handle rawinput; iEvent.getByToken(rawin_, rawinput); diff --git a/DQM/SiPixelMonitorRawData/src/SiPixelRawDataErrorSource.cc b/DQM/SiPixelMonitorRawData/src/SiPixelRawDataErrorSource.cc index f808c9dd1d4ee..a5d4e2a2fca77 100644 --- a/DQM/SiPixelMonitorRawData/src/SiPixelRawDataErrorSource.cc +++ b/DQM/SiPixelMonitorRawData/src/SiPixelRawDataErrorSource.cc @@ -26,6 +26,7 @@ // Framework #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/MakerMacros.h" // DQM Framework #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h" @@ -33,10 +34,7 @@ // Geometry #include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" // DataFormats #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" @@ -69,6 +67,8 @@ SiPixelRawDataErrorSource::SiPixelRawDataErrorSource(const edm::ParameterSet &iC << endl; topFolderName_ = conf_.getParameter("TopFolderName"); inputSourceToken_ = consumes(conf_.getUntrackedParameter("inputSource", "source")); + trackerTopoTokenBeginRun_ = esConsumes(); + trackerGeomTokenBeginRun_ = esConsumes(); } SiPixelRawDataErrorSource::~SiPixelRawDataErrorSource() { @@ -185,12 +185,9 @@ void SiPixelRawDataErrorSource::analyze(const edm::Event &iEvent, const edm::Eve void SiPixelRawDataErrorSource::buildStructure(const edm::EventSetup &iSetup) { LogInfo("PixelDQM") << " SiPixelRawDataErrorSource::buildStructure"; - edm::ESHandle pDD; - edm::ESHandle tTopoHandle; - - iSetup.get().get(pDD); - iSetup.get().get(tTopoHandle); + edm::ESHandle pDD = iSetup.getHandle(trackerGeomTokenBeginRun_); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); const TrackerTopology *pTT = tTopoHandle.product(); LogVerbatim("PixelDQM") << " *** Geometry node for TrackerGeom is " << &(*pDD) << std::endl; diff --git a/DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitModule.h b/DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitModule.h index 10c8d40c01928..757bd7c8eca89 100644 --- a/DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitModule.h +++ b/DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitModule.h @@ -29,6 +29,8 @@ detector segment (detID) #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include class SiPixelRecHitModule { @@ -48,7 +50,7 @@ class SiPixelRecHitModule { /// Book histograms void book(const edm::ParameterSet &iConfig, DQMStore::IBooker &iBooker, - const edm::EventSetup &iSetup, + const TrackerTopology *pTT, int type = 0, bool twoD = true, bool reducedSet = false, diff --git a/DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitSource.h b/DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitSource.h index 087b9cd94e602..dc1e5b109a1e0 100644 --- a/DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitSource.h +++ b/DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitSource.h @@ -25,12 +25,7 @@ #include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" - #include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" #include "DQM/SiPixelMonitorRecHit/interface/SiPixelRecHitModule.h" @@ -38,14 +33,10 @@ #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include class SiPixelRecHitSource : public DQMEDAnalyzer { @@ -67,6 +58,8 @@ class SiPixelRecHitSource : public DQMEDAnalyzer { private: edm::ParameterSet conf_; edm::EDGetTokenT src_; + edm::ESGetToken trackerTopoTokenBeginRun_; + edm::ESGetToken trackerGeomTokenBeginRun_; bool saveFile; bool isPIB; diff --git a/DQM/SiPixelMonitorRecHit/src/SiPixelRecHitModule.cc b/DQM/SiPixelMonitorRecHit/src/SiPixelRecHitModule.cc index 3ae5cb1ff4844..606c243fcfc9c 100644 --- a/DQM/SiPixelMonitorRecHit/src/SiPixelRecHitModule.cc +++ b/DQM/SiPixelMonitorRecHit/src/SiPixelRecHitModule.cc @@ -17,19 +17,7 @@ #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/EDProducer.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Framework/interface/Event.h" - -#include "FWCore/Framework/interface/EventSetup.h" // Constructors // SiPixelRecHitModule::SiPixelRecHitModule() : id_(0) {} @@ -45,15 +33,11 @@ SiPixelRecHitModule::~SiPixelRecHitModule() {} // void SiPixelRecHitModule::book(const edm::ParameterSet &iConfig, DQMStore::IBooker &iBooker, - const edm::EventSetup &iSetup, + const TrackerTopology *pTT, int type, bool twoD, bool reducedSet, bool isUpgrade) { - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology *pTT = tTopoHandle.product(); - bool barrel = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelBarrel); bool endcap = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelEndcap); bool isHalfModule = false; diff --git a/DQM/SiPixelMonitorRecHit/src/SiPixelRecHitSource.cc b/DQM/SiPixelMonitorRecHit/src/SiPixelRecHitSource.cc index 8465d50e62215..d084e640cc6a9 100644 --- a/DQM/SiPixelMonitorRecHit/src/SiPixelRecHitSource.cc +++ b/DQM/SiPixelMonitorRecHit/src/SiPixelRecHitSource.cc @@ -25,14 +25,12 @@ // Framework #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/MakerMacros.h" // DQM Framework #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "DQMServices/Core/interface/DQMStore.h" // Geometry -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" // DataFormats #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" @@ -51,6 +49,8 @@ using namespace edm; SiPixelRecHitSource::SiPixelRecHitSource(const edm::ParameterSet &iConfig) : conf_(iConfig), src_(consumes(conf_.getParameter("src"))), + trackerTopoTokenBeginRun_(esConsumes()), + trackerGeomTokenBeginRun_(esConsumes()), saveFile(conf_.getUntrackedParameter("saveFile", false)), isPIB(conf_.getUntrackedParameter("isPIB", false)), slowDown(conf_.getUntrackedParameter("slowDown", false)), @@ -176,12 +176,9 @@ void SiPixelRecHitSource::analyze(const edm::Event &iEvent, const edm::EventSetu void SiPixelRecHitSource::buildStructure(const edm::EventSetup &iSetup) { LogInfo("PixelDQM") << " SiPixelRecHitSource::buildStructure"; - edm::ESHandle pDD; - edm::ESHandle tTopoHandle; - - iSetup.get().get(pDD); - iSetup.get().get(tTopoHandle); + edm::ESHandle pDD = iSetup.getHandle(trackerGeomTokenBeginRun_); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); const TrackerTopology *pTT = tTopoHandle.product(); LogVerbatim("PixelDQM") << " *** Geometry node for TrackerGeom is " << &(*pDD) << std::endl; @@ -247,11 +244,14 @@ void SiPixelRecHitSource::bookMEs(DQMStore::IBooker &iBooker, const edm::EventSe SiPixelFolderOrganizer theSiPixelFolder(false); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); + const TrackerTopology *pTT = tTopoHandle.product(); + for (struct_iter = thePixelStructure.begin(); struct_iter != thePixelStructure.end(); struct_iter++) { /// Create folder tree and book histograms if (modOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 0, isUpgrade)) { - (*struct_iter).second->book(conf_, iBooker, iSetup, 0, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, iBooker, pTT, 0, twoDimOn, reducedSet, isUpgrade); } else { if (!isPIB) throw cms::Exception("LogicError") << "[SiPixelDigiSource::bookMEs] Creation of DQM folder failed"; @@ -259,42 +259,42 @@ void SiPixelRecHitSource::bookMEs(DQMStore::IBooker &iBooker, const edm::EventSe } if (ladOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 1, isUpgrade)) { - (*struct_iter).second->book(conf_, iBooker, iSetup, 1, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, iBooker, pTT, 1, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH LADDER-FOLDER\n"; } } if (layOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 2, isUpgrade)) { - (*struct_iter).second->book(conf_, iBooker, iSetup, 2, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, iBooker, pTT, 2, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH LAYER-FOLDER\n"; } } if (phiOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 3, isUpgrade)) { - (*struct_iter).second->book(conf_, iBooker, iSetup, 3, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, iBooker, pTT, 3, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH PHI-FOLDER\n"; } } if (bladeOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 4, isUpgrade)) { - (*struct_iter).second->book(conf_, iBooker, iSetup, 4, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, iBooker, pTT, 4, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH BLADE-FOLDER\n"; } } if (diskOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 5, isUpgrade)) { - (*struct_iter).second->book(conf_, iBooker, iSetup, 5, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, iBooker, pTT, 5, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH DISK-FOLDER\n"; } } if (ringOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*struct_iter).first, 6, isUpgrade)) { - (*struct_iter).second->book(conf_, iBooker, iSetup, 6, twoDimOn, reducedSet, isUpgrade); + (*struct_iter).second->book(conf_, iBooker, pTT, 6, twoDimOn, reducedSet, isUpgrade); } else { LogDebug("PixelDQM") << "PROBLEM WITH RING-FOLDER\n"; } diff --git a/DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencyModule.h b/DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencyModule.h index dd7db455fe2b1..e4c39a599bd57 100644 --- a/DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencyModule.h +++ b/DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencyModule.h @@ -15,10 +15,9 @@ #include -//#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementVector.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DQMServices/Core/interface/DQMStore.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h" #include @@ -37,7 +36,7 @@ class SiPixelHitEfficiencyModule { ~SiPixelHitEfficiencyModule(); void book( - const edm::ParameterSet &, edm::EventSetup const &, DQMStore::IBooker &, int type = 0, bool isUpgrade = false); + const edm::ParameterSet &, const TrackerTopology *, DQMStore::IBooker &, int type = 0, bool isUpgrade = false); void fill(const TrackerTopology *pTT, const LocalTrajectoryParameters <p, bool isHitValid, diff --git a/DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencySource.h b/DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencySource.h index f61d33fa26885..892aa41173fe0 100644 --- a/DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencySource.h +++ b/DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencySource.h @@ -17,12 +17,6 @@ #include "DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencyModule.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" // Files added for monitoring track quantities #include "Alignment/OfflineValidation/interface/TrackerValidationVariables.h" @@ -38,6 +32,17 @@ #include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" + +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" +#include "RecoTracker/Record/interface/CkfComponentsRecord.h" +#include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h" +#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" +#include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h" + #include class SiPixelHitEfficiencySource : public DQMEDAnalyzer { @@ -60,6 +65,15 @@ class SiPixelHitEfficiencySource : public DQMEDAnalyzer { edm::EDGetTokenT measurementTrackerEventToken_; + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken measurementTrackerToken_; + edm::ESGetToken chi2MeasurementEstimatorBaseToken_; + edm::ESGetToken propagatorToken_; + edm::ESGetToken pixelClusterParameterEstimatorToken_; + edm::ESGetToken trackerTopoTokenBeginRun_; + edm::ESGetToken trackerGeomTokenBeginRun_; + bool applyEdgeCut_; double nSigma_EdgeCut_; diff --git a/DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualModule.h b/DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualModule.h index f621b496ed5f4..b128ffb9dbf82 100644 --- a/DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualModule.h +++ b/DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualModule.h @@ -14,10 +14,11 @@ #ifndef SiPixelMonitorTrack_SiPixelTrackResidualModule_h #define SiPixelMonitorTrack_SiPixelTrackResidualModule_h -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DQMServices/Core/interface/DQMStore.h" #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementVector.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include namespace edm { @@ -34,7 +35,7 @@ class SiPixelTrackResidualModule { ~SiPixelTrackResidualModule(); void book(const edm::ParameterSet &, - edm::EventSetup const &, + const TrackerTopology *, DQMStore::IBooker &, bool reducedSet = true, int type = 0, diff --git a/DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualSource.h b/DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualSource.h index 5c189517d88c7..135be5c2f8218 100644 --- a/DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualSource.h +++ b/DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualSource.h @@ -19,28 +19,26 @@ #include "DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualModule.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" // Files added for monitoring track quantities #include "Alignment/OfflineValidation/interface/TrackerValidationVariables.h" #include "Alignment/TrackerAlignment/interface/TrackerAlignableId.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" -//#include "DataFormats/SiPixelDetId/interface/PixelBarrelNameWrapper.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" #include "DataFormats/TrackReco/interface/Track.h" - #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" -#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include @@ -90,6 +88,13 @@ class SiPixelTrackResidualSource : public DQMEDAnalyzer { edm::InputTag digisrc_; edm::EDGetTokenT> digisrcToken_; + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken transientTrackBuilderToken_; + edm::ESGetToken transientTrackingRecHitBuilderToken_; + edm::ESGetToken trackerTopoTokenBeginRun_; + edm::ESGetToken trackerGeomTokenBeginRun_; + bool debug_; bool modOn; bool reducedSet; diff --git a/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencyModule.cc b/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencyModule.cc index a6e38a60f75f2..2d34f1d084f94 100644 --- a/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencyModule.cc +++ b/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencyModule.cc @@ -16,11 +16,6 @@ #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h" #include "DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencyModule.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Utilities/interface/InputTag.h" - // Data Formats #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" @@ -28,10 +23,8 @@ #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" using namespace std; @@ -42,14 +35,10 @@ SiPixelHitEfficiencyModule::SiPixelHitEfficiencyModule(uint32_t id) : id_(id) { SiPixelHitEfficiencyModule::~SiPixelHitEfficiencyModule() {} void SiPixelHitEfficiencyModule::book(const edm::ParameterSet &iConfig, - edm::EventSetup const &iSetup, + const TrackerTopology *pTT, DQMStore::IBooker &iBooker, int type, bool isUpgrade) { - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology *pTT = tTopoHandle.product(); - bool barrel = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelBarrel); bool endcap = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelEndcap); bool isHalfModule = false; diff --git a/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencySource.cc b/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencySource.cc index 9fa9037d0a5e4..45b5deacbdc09 100644 --- a/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencySource.cc +++ b/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencySource.cc @@ -17,53 +17,34 @@ #include #include -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/MakerMacros.h" -#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h" #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h" #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" - #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" - -#include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h" -#include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" -//#include "RecoLocalTracker/SiPixelRecHits/plugins/PixelCPEGenericESProducer.h" - #include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h" #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" #include "TrackingTools/PatternTools/interface/Trajectory.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" #include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h" #include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h" #include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" +#include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h" #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencySource.h" -#include "DQMServices/Core/interface/DQMStore.h" - -#include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h" -#include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" -#include "RecoTracker/Record/interface/CkfComponentsRecord.h" -#include "TrackingTools/DetLayers/interface/BarrelDetLayer.h" -#include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h" -#include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" using namespace std; using namespace edm; @@ -92,6 +73,17 @@ SiPixelHitEfficiencySource::SiPixelHitEfficiencySource(const edm::ParameterSet & measurementTrackerEventToken_ = consumes(std::string("MeasurementTrackerEvent")); + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + measurementTrackerToken_ = esConsumes(); + chi2MeasurementEstimatorBaseToken_ = + esConsumes(edm::ESInputTag("", "Chi2")); + propagatorToken_ = esConsumes(edm::ESInputTag("", "PropagatorWithMaterial")); + pixelClusterParameterEstimatorToken_ = + esConsumes(edm::ESInputTag("", "PixelCPEGeneric")); + trackerTopoTokenBeginRun_ = esConsumes(); + trackerGeomTokenBeginRun_ = esConsumes(); + firstRun = true; LogInfo("PixelDQM") << "SiPixelHitEfficiencySource constructor" << endl; @@ -162,8 +154,7 @@ void SiPixelHitEfficiencySource::dqmBeginRun(const edm::Run &r, edm::EventSetup firstRun = false; } - edm::ESHandle TG; - iSetup.get().get(TG); + edm::ESHandle TG = iSetup.getHandle(trackerGeomTokenBeginRun_); if (debug_) LogVerbatim("PixelDQM") << "TrackerGeometry " << &(*TG) << " size is " << TG->dets().size() << endl; @@ -192,48 +183,52 @@ void SiPixelHitEfficiencySource::bookHistograms(DQMStore::IBooker &iBooker, // book residual histograms in theSiPixelFolder - one (x,y) pair of histograms // per det SiPixelFolderOrganizer theSiPixelFolder(false); + + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); + const TrackerTopology *pTT = tTopoHandle.product(); + for (std::map::iterator pxd = theSiPixelStructure.begin(); pxd != theSiPixelStructure.end(); pxd++) { if (modOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 0, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, 0, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, 0, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource Folder Creation Failed! "; } if (ladOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 1, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, 1, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, 1, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource ladder Folder Creation Failed! "; } if (layOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 2, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, 2, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, 2, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource layer Folder Creation Failed! "; } if (phiOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 3, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, 3, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, 3, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource phi Folder Creation Failed! "; } if (bladeOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 4, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, 4, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, 4, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource Blade Folder Creation Failed! "; } if (diskOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 5, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, 5, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, 5, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource Disk Folder Creation Failed! "; } if (ringOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 6, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, 6, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, 6, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelHitEfficiencySource Ring Folder Creation Failed! "; } @@ -286,8 +281,7 @@ void SiPixelHitEfficiencySource::bookHistograms(DQMStore::IBooker &iBooker, } void SiPixelHitEfficiencySource::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoToken_); const TrackerTopology *pTT = tTopoHandle.product(); edm::Handle vertexCollectionHandle; @@ -352,16 +346,12 @@ void SiPixelHitEfficiencySource::analyze(const edm::Event &iEvent, const edm::Ev float maxlxmatch_ = 0.2; float maxlymatch_ = 0.2; bool keepOriginalMissingHit_ = true; - ESHandle measurementTrackerHandle; - - iSetup.get().get(measurementTrackerHandle); + edm::ESHandle measurementTrackerHandle = iSetup.getHandle(measurementTrackerToken_); - edm::ESHandle est; - iSetup.get().get("Chi2", est); + edm::ESHandle est = iSetup.getHandle(chi2MeasurementEstimatorBaseToken_); edm::Handle measurementTrackerEventHandle; iEvent.getByToken(measurementTrackerEventToken_, measurementTrackerEventHandle); - edm::ESHandle prop; - iSetup.get().get("PropagatorWithMaterial", prop); + edm::ESHandle prop = iSetup.getHandle(propagatorToken_); Propagator *thePropagator = prop.product()->clone(); // determines direction of the propagator => inward if (extrapolateFrom_ >= extrapolateTo_) { @@ -737,12 +727,11 @@ void SiPixelHitEfficiencySource::analyze(const edm::Event &iEvent, const edm::Ev float dx_cl[2]; float dy_cl[2]; dx_cl[0] = dx_cl[1] = dy_cl[0] = dy_cl[1] = -9999.; - ESHandle cpEstimator; - iSetup.get().get("PixelCPEGeneric", cpEstimator); + edm::ESHandle cpEstimator = + iSetup.getHandle(pixelClusterParameterEstimatorToken_); if (cpEstimator.isValid()) { const PixelClusterParameterEstimator &cpe(*cpEstimator); - edm::ESHandle tracker; - iSetup.get().get(tracker); + edm::ESHandle tracker = iSetup.getHandle(trackerGeomToken_); if (tracker.isValid()) { const TrackerGeometry *tkgeom = &(*tracker); edm::Handle> clusterCollectionHandle; diff --git a/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualModule.cc b/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualModule.cc index 8792c091d5d9f..7c75ef1ef121c 100644 --- a/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualModule.cc +++ b/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualModule.cc @@ -15,13 +15,6 @@ #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h" #include "DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualModule.h" -#include "DQMServices/Core/interface/DQMStore.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" // Data Formats #include "DataFormats/DetId/interface/DetId.h" @@ -41,15 +34,11 @@ SiPixelTrackResidualModule::SiPixelTrackResidualModule(uint32_t id) : id_(id) { SiPixelTrackResidualModule::~SiPixelTrackResidualModule() {} void SiPixelTrackResidualModule::book(const edm::ParameterSet &iConfig, - edm::EventSetup const &iSetup, + const TrackerTopology *pTT, DQMStore::IBooker &iBooker, bool reducedSet, int type, bool isUpgrade) { - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology *pTT = tTopoHandle.product(); - bool barrel = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelBarrel); bool endcap = DetId(id_).subdetId() == static_cast(PixelSubdetector::PixelEndcap); bool isHalfModule = false; diff --git a/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualSource.cc b/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualSource.cc index 050b2747ddfd2..dba902bde3f2e 100644 --- a/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualSource.cc +++ b/DQM/SiPixelMonitorTrack/src/SiPixelTrackResidualSource.cc @@ -17,16 +17,12 @@ #include #include -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/MakerMacros.h" -#include "DataFormats/Common/interface/Handle.h" #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -//#include "DataFormats/SiPixelDetId/interface/PixelBarrelNameWrapper.h" #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h" #include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" @@ -34,28 +30,17 @@ #include "Geometry/CommonTopologies/interface/PixelTopology.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h" - -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" #include "TrackingTools/TrackFitters/interface/TrajectoryFitter.h" #include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" #include "DQM/SiPixelCommon/interface/SiPixelFolderOrganizer.h" #include "DQM/SiPixelMonitorTrack/interface/SiPixelTrackResidualSource.h" -#include "DQMServices/Core/interface/DQMStore.h" // Claudia new libraries #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" -#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" -#include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" -#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" -#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" using namespace std; using namespace edm; @@ -94,6 +79,15 @@ SiPixelTrackResidualSource::SiPixelTrackResidualSource(const edm::ParameterSet & digisrc_ = pSet_.getParameter("digisrc"); digisrcToken_ = consumes>(pSet_.getParameter("digisrc")); + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + transientTrackBuilderToken_ = + esConsumes(edm::ESInputTag("", "TransientTrackBuilder")); + transientTrackingRecHitBuilderToken_ = + esConsumes(edm::ESInputTag("", ttrhbuilder_)); + trackerTopoTokenBeginRun_ = esConsumes(); + trackerGeomTokenBeginRun_ = esConsumes(); + LogInfo("PixelDQM") << "SiPixelTrackResidualSource constructor" << endl; LogInfo("PixelDQM") << "Mod/Lad/Lay/Phi " << modOn << "/" << ladOn << "/" << layOn << "/" << phiOn << std::endl; LogInfo("PixelDQM") << "Blade/Disk/Ring" << bladeOn << "/" << diskOn << "/" << ringOn << std::endl; @@ -118,12 +112,10 @@ SiPixelTrackResidualSource::~SiPixelTrackResidualSource() { void SiPixelTrackResidualSource::dqmBeginRun(const edm::Run &r, edm::EventSetup const &iSetup) { LogInfo("PixelDQM") << "SiPixelTrackResidualSource beginRun()" << endl; // retrieve TrackerGeometry for pixel dets - edm::ESHandle TG; - iSetup.get().get(TG); + edm::ESHandle TG = iSetup.getHandle(trackerGeomTokenBeginRun_); if (debug_) LogVerbatim("PixelDQM") << "TrackerGeometry " << &(*TG) << " size is " << TG->dets().size() << endl; - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); const TrackerTopology *pTT = tTopoHandle.product(); // build theSiPixelStructure with the pixel barrel and endcap dets from @@ -160,6 +152,10 @@ void SiPixelTrackResidualSource::bookHistograms(DQMStore::IBooker &iBooker, // book residual histograms in theSiPixelFolder - one (x,y) pair of histograms // per det SiPixelFolderOrganizer theSiPixelFolder(false); + + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoTokenBeginRun_); + const TrackerTopology *pTT = tTopoHandle.product(); + std::stringstream nameX, titleX, nameY, titleY; if (ladOn) { @@ -185,43 +181,43 @@ void SiPixelTrackResidualSource::bookHistograms(DQMStore::IBooker &iBooker, pxd++) { if (modOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 0, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 0, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, reducedSet, 0, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelTrackResidualSource Folder Creation Failed! "; } if (ladOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 1, isUpgrade)) { - (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 1, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, reducedSet, 1, isUpgrade); } else throw cms::Exception("LogicError") << "SiPixelTrackResidualSource ladder Folder Creation Failed! "; } if (layOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 2, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 2, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, reducedSet, 2, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelTrackResidualSource layer Folder Creation Failed! "; } if (phiOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 3, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 3, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, reducedSet, 3, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelTrackResidualSource phi Folder Creation Failed! "; } if (bladeOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 4, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 4, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, reducedSet, 4, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelTrackResidualSource Blade Folder Creation Failed! "; } if (diskOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 5, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 5, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, reducedSet, 5, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelTrackResidualSource Disk Folder Creation Failed! "; } if (ringOn) { if (theSiPixelFolder.setModuleFolder(iBooker, (*pxd).first, 6, isUpgrade)) - (*pxd).second->book(pSet_, iSetup, iBooker, reducedSet, 6, isUpgrade); + (*pxd).second->book(pSet_, pTT, iBooker, reducedSet, 6, isUpgrade); else throw cms::Exception("LogicError") << "SiPixelTrackResidualSource Ring Folder Creation Failed! "; } @@ -826,15 +822,13 @@ void SiPixelTrackResidualSource::bookHistograms(DQMStore::IBooker &iBooker, void SiPixelTrackResidualSource::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoToken_); const TrackerTopology *tTopo = tTopoHandle.product(); // retrieve TrackerGeometry again and MagneticField for use in transforming // a TrackCandidate's P(ersistent)TrajectoryStateoOnDet (PTSoD) to a // TrajectoryStateOnSurface (TSoS) - ESHandle TG; - iSetup.get().get(TG); + edm::ESHandle TG = iSetup.getHandle(trackerGeomToken_); const TrackerGeometry *theTrackerGeometry = TG.product(); // analytic triplet method to calculate the track residuals in the pixe barrel @@ -901,13 +895,12 @@ void SiPixelTrackResidualSource::analyze(const edm::Event &iEvent, const edm::Ev // // transient track builder, needs B-field from data base (global tag in .py) // - edm::ESHandle theB; - iSetup.get().get("TransientTrackBuilder", theB); + edm::ESHandle theB = iSetup.getHandle(transientTrackBuilderToken_); // get the TransienTrackingRecHitBuilder needed for extracting the global // position of the hits in the pixel - edm::ESHandle theTrackerRecHitBuilder; - iSetup.get().get(ttrhbuilder_, theTrackerRecHitBuilder); + edm::ESHandle theTrackerRecHitBuilder = + iSetup.getHandle(transientTrackingRecHitBuilderToken_); // check that tracks are valid if (TracksForRes.failedToGet()) @@ -915,15 +908,6 @@ void SiPixelTrackResidualSource::analyze(const edm::Event &iEvent, const edm::Ev if (!TracksForRes.isValid()) return; - // get tracker geometry - edm::ESHandle pDD; - iSetup.get().get(pDD); - - if (!pDD.isValid()) { - cout << "Unable to find TrackerDigiGeometry. Return\n"; - return; - } - int kk = -1; //---------------------------------------------------------------------------- // Residuals: diff --git a/DQM/SiPixelPhase1Common/plugins/SiPixelPhase1DeadFEDChannels.cc b/DQM/SiPixelPhase1Common/plugins/SiPixelPhase1DeadFEDChannels.cc index 64a4acc18d886..f30d5e4660622 100644 --- a/DQM/SiPixelPhase1Common/plugins/SiPixelPhase1DeadFEDChannels.cc +++ b/DQM/SiPixelPhase1Common/plugins/SiPixelPhase1DeadFEDChannels.cc @@ -47,6 +47,8 @@ namespace { private: edm::EDGetTokenT pixelFEDChannelCollectionToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken cablingMapToken_; bool firstEvent_; const TrackerGeometry* trackerGeometry_ = nullptr; @@ -56,6 +58,8 @@ namespace { SiPixelPhase1DeadFEDChannels::SiPixelPhase1DeadFEDChannels(const edm::ParameterSet& iConfig) : SiPixelPhase1Base(iConfig) { pixelFEDChannelCollectionToken_ = consumes(edm::InputTag("siPixelDigis")); + trackerGeomToken_ = esConsumes(); + cablingMapToken_ = esConsumes(); firstEvent_ = true; }; @@ -64,12 +68,10 @@ namespace { return; if (firstEvent_) { - edm::ESHandle tmpTkGeometry; - iSetup.get().get(tmpTkGeometry); + edm::ESHandle tmpTkGeometry = iSetup.getHandle(trackerGeomToken_); trackerGeometry_ = &(*tmpTkGeometry); - edm::ESHandle pixelCabling; - iSetup.get().get(pixelCabling); + edm::ESHandle pixelCabling = iSetup.getHandle(cablingMapToken_); cablingMap = pixelCabling.product(); firstEvent_ = false; diff --git a/DQM/SiPixelPhase1Common/plugins/SiPixelPhase1RawData.cc b/DQM/SiPixelPhase1Common/plugins/SiPixelPhase1RawData.cc index 0a67d0597cc19..e776a33345f28 100644 --- a/DQM/SiPixelPhase1Common/plugins/SiPixelPhase1RawData.cc +++ b/DQM/SiPixelPhase1Common/plugins/SiPixelPhase1RawData.cc @@ -11,9 +11,6 @@ #include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "DataFormats/GeometryVector/interface/LocalPoint.h" - namespace { class SiPixelPhase1RawData final : public SiPixelPhase1Base { diff --git a/DQM/SiPixelPhase1Common/src/GeometryInterface.cc b/DQM/SiPixelPhase1Common/src/GeometryInterface.cc index 931cc6374055f..0ded28340fafd 100644 --- a/DQM/SiPixelPhase1Common/src/GeometryInterface.cc +++ b/DQM/SiPixelPhase1Common/src/GeometryInterface.cc @@ -12,11 +12,6 @@ // general plotting helpers #include "DQM/SiPixelPhase1Common/interface/SiPixelCoordinates.h" -// edm stuff -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "FWCore/Utilities/interface/ESInputTag.h" - // Tracker Geometry/Topology stuff #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" diff --git a/DQM/SiPixelPhase1Common/src/HistogramManager.cc b/DQM/SiPixelPhase1Common/src/HistogramManager.cc index e084cce375570..9838f66f37808 100644 --- a/DQM/SiPixelPhase1Common/src/HistogramManager.cc +++ b/DQM/SiPixelPhase1Common/src/HistogramManager.cc @@ -9,7 +9,6 @@ #include // Geometry stuff -#include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1RecHits.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1RecHits.cc index d3b05430bada2..fb6665bc3567b 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1RecHits.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1RecHits.cc @@ -11,7 +11,6 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/GeometryVector/interface/LocalPoint.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonTopologies/interface/PixelTopology.h" @@ -35,6 +34,8 @@ namespace { edm::EDGetTokenT srcToken_; edm::EDGetTokenT offlinePrimaryVerticesToken_; + edm::ESGetToken trackerGeomToken_; + bool onlyValid_; bool applyVertexCut_; }; @@ -44,6 +45,8 @@ namespace { offlinePrimaryVerticesToken_ = consumes(std::string("offlinePrimaryVertices")); + trackerGeomToken_ = esConsumes(); + onlyValid_ = iConfig.getParameter("onlyValidHits"); applyVertexCut_ = iConfig.getUntrackedParameter("VertexCut", true); @@ -53,8 +56,7 @@ namespace { if (!checktrigger(iEvent, iSetup, DCS)) return; - edm::ESHandle tracker; - iSetup.get().get(tracker); + edm::ESHandle tracker = iSetup.getHandle(trackerGeomToken_); assert(tracker.isValid()); edm::Handle tracks; diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 9d933ddf22f62..e20d91d101f99 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -17,7 +17,6 @@ #include "DataFormats/SiPixelCluster/interface/SiPixelClusterShapeCache.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -83,6 +82,10 @@ namespace { edm::EDGetTokenT tracksToken_; edm::EDGetTokenT offlinePrimaryVerticesToken_; edm::EDGetTokenT pixelClusterShapeCacheToken_; + + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken clusterShapeHitFilterToken_; }; SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) @@ -95,6 +98,11 @@ namespace { pixelClusterShapeCacheToken_ = consumes(iConfig.getParameter("clusterShapeCache")); + + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + clusterShapeHitFilterToken_ = + esConsumes(edm::ESInputTag("", "ClusterShapeHitFilter")); } void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -108,16 +116,13 @@ namespace { } // get geometry - edm::ESHandle tracker; - iSetup.get().get(tracker); + edm::ESHandle tracker = iSetup.getHandle(trackerGeomToken_); assert(tracker.isValid()); - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(trackerTopoToken_); auto const& tkTpl = *tTopoHandle; - edm::ESHandle shapeFilterH; - iSetup.get().get("ClusterShapeHitFilter", shapeFilterH); + edm::ESHandle shapeFilterH = iSetup.getHandle(clusterShapeHitFilterToken_); auto const& shapeFilter = *shapeFilterH; edm::Handle vertices; diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackEfficiency.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackEfficiency.cc index ae05624d07783..6b840f1623f55 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackEfficiency.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackEfficiency.cc @@ -12,7 +12,6 @@ #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" @@ -56,6 +55,13 @@ namespace { edm::EDGetTokenT tracker_; //new bool applyVertexCut_; + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken propagatorToken_; + edm::ESGetToken chi2MeasurementEstimatorBaseToken_; + edm::ESGetToken measurementTrackerToken_; + edm::ESGetToken pixelClusterParameterEstimatorToken_; + const TrackerTopology* trackerTopology_; const Propagator* trackerPropagator_; const MeasurementEstimator* chi2MeasurementEstimator_; @@ -71,6 +77,15 @@ namespace { trajTrackCollectionToken_ = consumes(iConfig.getParameter("trajectoryInput")); clustersToken_ = consumes>(iConfig.getParameter("clusters")); + + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + propagatorToken_ = esConsumes(edm::ESInputTag("", "PropagatorWithMaterial")); + chi2MeasurementEstimatorBaseToken_ = + esConsumes(edm::ESInputTag("", "Chi2")); + measurementTrackerToken_ = esConsumes(); + pixelClusterParameterEstimatorToken_ = + esConsumes(edm::ESInputTag("", "PixelCPEGeneric")); } void SiPixelPhase1TrackEfficiency::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -78,8 +93,7 @@ namespace { return; // get geometry - edm::ESHandle tracker; - iSetup.get().get(tracker); + edm::ESHandle tracker = iSetup.getHandle(trackerGeomToken_); assert(tracker.isValid()); // get primary vertex @@ -87,28 +101,25 @@ namespace { iEvent.getByToken(vtxToken_, vertices); // TrackerTopology for module informations - edm::ESHandle trackerTopologyHandle; - iSetup.get().get(trackerTopologyHandle); + edm::ESHandle trackerTopologyHandle = iSetup.getHandle(trackerTopoToken_); trackerTopology_ = trackerTopologyHandle.product(); // Tracker propagator for propagating tracks to other layers - edm::ESHandle propagatorHandle; - iSetup.get().get("PropagatorWithMaterial", propagatorHandle); + edm::ESHandle propagatorHandle = iSetup.getHandle(propagatorToken_); std::unique_ptr propagatorUniquePtr(propagatorHandle.product()->clone()); trackerPropagator_ = propagatorUniquePtr.get(); const_cast(trackerPropagator_)->setPropagationDirection(oppositeToMomentum); // Measurement estimator - edm::ESHandle chi2MeasurementEstimatorHandle; - iSetup.get().get("Chi2", chi2MeasurementEstimatorHandle); + edm::ESHandle chi2MeasurementEstimatorHandle = + iSetup.getHandle(chi2MeasurementEstimatorBaseToken_); chi2MeasurementEstimator_ = chi2MeasurementEstimatorHandle.product(); //Tracker edm::Handle trackerMeas; iEvent.getByToken(tracker_, trackerMeas); - edm::ESHandle measurementTrackerHandle; - iSetup.get().get(measurementTrackerHandle); + edm::ESHandle measurementTrackerHandle = iSetup.getHandle(measurementTrackerToken_); //vertices if (!vertices.isValid()) @@ -139,8 +150,7 @@ namespace { return; // - edm::ESHandle cpEstimator; - iSetup.get().get("PixelCPEGeneric", cpEstimator); + edm::ESHandle cpEstimator = iSetup.getHandle(pixelClusterParameterEstimatorToken_); if (!cpEstimator.isValid()) return; diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackResiduals.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackResiduals.cc index 6f51b313ec9fc..04bf6d6ed2568 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackResiduals.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackResiduals.cc @@ -10,8 +10,6 @@ #include "Alignment/OfflineValidation/interface/TrackerValidationVariables.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" @@ -33,6 +31,8 @@ namespace { TrackerValidationVariables validator; edm::EDGetTokenT offlinePrimaryVerticesToken_; + edm::ESGetToken trackerGeomToken_; + bool applyVertexCut_; }; @@ -41,14 +41,15 @@ namespace { applyVertexCut_ = iConfig.getUntrackedParameter("VertexCut", true); offlinePrimaryVerticesToken_ = consumes(iConfig.getParameter("vertices")); + + trackerGeomToken_ = esConsumes(); } void SiPixelPhase1TrackResiduals::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { if (!checktrigger(iEvent, iSetup, DCS)) return; - edm::ESHandle tracker; - iSetup.get().get(tracker); + edm::ESHandle tracker = iSetup.getHandle(trackerGeomToken_); assert(tracker.isValid()); edm::Handle vertices; diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc index 15a6536ca644b..d35e04ebe16f7 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.cc @@ -16,7 +16,6 @@ #include "PixelThresholdClusterizer.h" // Geometry -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" // Data Formats @@ -55,6 +54,9 @@ SiPixelClusterProducer::SiPixelClusterProducer(edm::ParameterSet const& conf) else tPixelDigi = consumes>(conf.getParameter("src")); + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + const auto& payloadType = conf.getParameter("payloadType"); if (payloadType == "HLT") theSiPixelGainCalibration_ = std::make_unique(conf); @@ -102,11 +104,9 @@ void SiPixelClusterProducer::produce(edm::Event& e, const edm::EventSetup& es) { e.getByToken(tPixelDigi, inputDigi); // Step A.2: get event setup - edm::ESHandle geom; - es.get().get(geom); + edm::ESHandle geom = es.getHandle(trackerGeomToken_); - edm::ESHandle trackerTopologyHandle; - es.get().get(trackerTopologyHandle); + edm::ESHandle trackerTopologyHandle = es.getHandle(trackerTopoToken_); tTopo_ = trackerTopologyHandle.product(); // Step B: create the final output collection diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h index 463b5db290dee..6e8cb0c21496c 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelClusterProducer.h @@ -33,6 +33,7 @@ //#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/Common/interface/DetSetVectorNew.h" @@ -71,6 +72,8 @@ class dso_hidden SiPixelClusterProducer final : public edm::stream::EDProducer<> edm::EDGetTokenT tPixelClusters; edm::EDGetTokenT> tPixelDigi; edm::EDPutTokenT tPutPixelClusters; + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; // TO DO: maybe allow a map of pointers? std::unique_ptr theSiPixelGainCalibration_; const std::string clusterMode_; // user's choice of the clusterizer diff --git a/RecoLocalTracker/SiPixelClusterizer/test/ReadPixClusters.cc b/RecoLocalTracker/SiPixelClusterizer/test/ReadPixClusters.cc index 37118f45f2db8..7988274cbc04b 100644 --- a/RecoLocalTracker/SiPixelClusterizer/test/ReadPixClusters.cc +++ b/RecoLocalTracker/SiPixelClusterizer/test/ReadPixClusters.cc @@ -97,6 +97,8 @@ class ReadPixClusters : public edm::EDAnalyzer { edm::ParameterSet conf_; edm::InputTag src_; edm::EDGetTokenT> tPixelCluster; + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; bool printLocal; int countEvents, countAllEvents; double sumClusters; @@ -145,6 +147,8 @@ ReadPixClusters::ReadPixClusters(edm::ParameterSet const &conf) cout << " Construct " << printLocal << endl; tPixelCluster = consumes>(src_); + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); } // Virtual destructor needed. ReadPixClusters::~ReadPixClusters() {} @@ -330,14 +334,12 @@ void ReadPixClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { using namespace edm; // Get event setup - edm::ESHandle geom; - es.get().get(geom); + edm::ESHandle geom = es.getHandle(trackerGeomToken_); const TrackerGeometry &theTracker(*geom); #ifdef NEW_ID //Retrieve tracker topology from geometry - edm::ESHandle tTopo; - es.get().get(tTopo); + edm::ESHandle tTopo = es.getHandle(trackerTopoToken_); #endif countAllEvents++; diff --git a/RecoLocalTracker/SiPixelClusterizer/test/TestClusters.cc b/RecoLocalTracker/SiPixelClusterizer/test/TestClusters.cc index 681a48065f1ed..742ca5275360f 100644 --- a/RecoLocalTracker/SiPixelClusterizer/test/TestClusters.cc +++ b/RecoLocalTracker/SiPixelClusterizer/test/TestClusters.cc @@ -836,8 +836,6 @@ class TestClusters : public edm::EDAnalyzer { virtual void endJob() override; private: - edm::ParameterSet conf_; - edm::InputTag src_; //const static bool PRINT = false; bool PRINT; int select1, select2; @@ -848,6 +846,16 @@ class TestClusters : public edm::EDAnalyzer { // Needed for the ByToken method edm::EDGetTokenT > myClus; + edm::EDGetTokenT lumiSummaryToken_; + edm::EDGetTokenT lumiDetailsToken_; + edm::EDGetTokenT condToken_; + edm::EDGetTokenT l1gtrrToken_; + edm::EDGetTokenT l1tsToken_; + edm::EDGetTokenT hltToken_; + edm::EDGetTokenT vtxToken_; + + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; //TFile* hFile; TH1D *hdetunit; @@ -986,16 +994,24 @@ class TestClusters : public edm::EDAnalyzer { ///////////////////////////////////////////////////////////////// // Contructor, empty. -TestClusters::TestClusters(edm::ParameterSet const &conf) : conf_(conf), src_(conf.getParameter("src")) { +TestClusters::TestClusters(edm::ParameterSet const &conf) { PRINT = conf.getUntrackedParameter("Verbosity", false); select1 = conf.getUntrackedParameter("Select1", 0); select2 = conf.getUntrackedParameter("Select2", 0); - //src_ = conf.getParameter( "src" ); if (PRINT) cout << " Construct " << endl; // For the ByToken method myClus = consumes >(conf.getParameter("src")); + lumiSummaryToken_ = consumes(edm::InputTag("lumiProducer")); + lumiDetailsToken_ = consumes(edm::InputTag("lumiProducer")); + condToken_ = consumes(edm::InputTag("conditionsInEdm")); + l1gtrrToken_ = consumes(edm::InputTag("gtDigis")); + l1tsToken_ = consumes(edm::InputTag("scalersRawToDigi")); + hltToken_ = consumes(edm::InputTag("TriggerResults", "", "HLT")); + vtxToken_ = consumes(edm::InputTag("offlinePrimaryVertices")); + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); } // Virtual destructor needed. TestClusters::~TestClusters() {} @@ -1861,8 +1877,7 @@ void TestClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { //static int nsum = 0, lsold=-999, lumiold=0.; // Get event setup - edm::ESHandle geom; - es.get().get(geom); + edm::ESHandle geom = es.getHandle(trackerGeomToken_); const TrackerGeometry &theTracker(*geom); countAllEvents++; @@ -1889,11 +1904,11 @@ void TestClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { edm::LuminosityBlock const &iLumi = e.getLuminosityBlock(); edm::Handle lumi; edm::Handle ld; - iLumi.getByLabel("lumiProducer", lumi); - iLumi.getByLabel("lumiProducer", ld); + iLumi.getByToken(lumiSummaryToken_, lumi); + iLumi.getByToken(lumiDetailsToken_, ld); edm::Handle cond; - iLumi.getByLabel("conditionsInEdm", cond); + iLumi.getByToken(condToken_, cond); // This will only work when running on RECO until (if) they fix it in the FW // When running on RAW and reconstructing, the LumiSummary will not appear // in the event before reaching endLuminosityBlock(). Therefore, it is not @@ -1941,7 +1956,7 @@ void TestClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { int numPVsGood = 0; if (select2 < 11 && run > 165000) { // skip for earlier runs, crashes edm::Handle vertices; - e.getByLabel("offlinePrimaryVertices", vertices); + e.getByToken(vtxToken_, vertices); //int numPVs = vertices->size(); // unused if (!vertices.failedToGet() && vertices.isValid()) { @@ -2003,7 +2018,6 @@ void TestClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { // Get Cluster Collection from InputTag edm::Handle > clusters; - //e.getByLabel( src_ , clusters); // New By Token method e.getByToken(myClus, clusters); @@ -2029,7 +2043,7 @@ void TestClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { #ifdef L1 // Get L1 Handle L1GTRR; - e.getByLabel("gtDigis", L1GTRR); + e.getByToken(l1gtrrToken_, L1GTRR); if (L1GTRR.isValid()) { //bool l1a = L1GTRR->decision(); // global decission? unused @@ -2102,7 +2116,7 @@ void TestClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { edm::Handle HLTResults; // Extract the HLT results - e.getByLabel(edm::InputTag("TriggerResults", "", "HLT"), HLTResults); + e.getByToken(hltToken_, HLTResults); if ((HLTResults.isValid() == true) && (HLTResults->size() > 0)) { //TrigNames.init(*HLTResults); const edm::TriggerNames &TrigNames = e.triggerNames(*HLTResults); @@ -2142,7 +2156,7 @@ void TestClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { #ifdef USE_RESYNCS Handle l1ts; - e.getByLabel("scalersRawToDigi", l1ts); + e.getByToken(l1tsToken_, l1ts); if (l1ts->size() > 0) { int r1 = (*l1ts)[0].lastResync(); @@ -2245,8 +2259,7 @@ void TestClusters::analyze(const edm::Event &e, const edm::EventSetup &es) { #ifdef NEW_ID //Retrieve tracker topology from geometry - edm::ESHandle tTopo; - es.get().get(tTopo); + edm::ESHandle tTopo = es.getHandle(trackerTopoToken_); #endif //--------------------------------------- diff --git a/RecoLocalTracker/SiPixelClusterizer/test/TestPixTracks.cc b/RecoLocalTracker/SiPixelClusterizer/test/TestPixTracks.cc index 2f3691219de4a..017cd5c90496d 100644 --- a/RecoLocalTracker/SiPixelClusterizer/test/TestPixTracks.cc +++ b/RecoLocalTracker/SiPixelClusterizer/test/TestPixTracks.cc @@ -117,8 +117,14 @@ class TestPixTracks : public edm::EDAnalyzer { virtual void endJob() override; private: - edm::ParameterSet conf_; - edm::InputTag src_; + edm::EDGetTokenT lumiToken_; + edm::EDGetTokenT condToken_; + edm::EDGetTokenT l1gtrrToken_; + edm::EDGetTokenT hltToken_; + edm::EDGetTokenT vtxToken_; + edm::EDGetTokenT srcToken_; + edm::EDGetTokenT trackAssocToken_; + edm::ESGetToken trackerGeomToken_; //const static bool PRINT = false; bool PRINT; float countTracks, countGoodTracks, countTracksInPix, countPVs, countEvents, countLumi; @@ -172,11 +178,17 @@ class TestPixTracks : public edm::EDAnalyzer { }; ///////////////////////////////////////////////////////////////// // Contructor, -TestPixTracks::TestPixTracks(edm::ParameterSet const &conf) - // : conf_(conf), src_(conf.getParameter( "src" )) { } - : conf_(conf) { +TestPixTracks::TestPixTracks(edm::ParameterSet const &conf) { PRINT = conf.getUntrackedParameter("Verbosity", false); - src_ = conf.getParameter("src"); + lumiToken_ = consumes(edm::InputTag("lumiProducer")); + condToken_ = consumes(edm::InputTag("conditionsInEdm")); + l1gtrrToken_ = consumes(edm::InputTag("gtDigis")); + hltToken_ = consumes(edm::InputTag("TriggerResults", "", "HLT")); + vtxToken_ = consumes(edm::InputTag("offlinePrimaryVertices")); + srcToken_ = consumes(conf.getParameter("src")); + trackAssocToken_ = + consumes(edm::InputTag(conf.getParameter("trajectoryInput"))); + trackerGeomToken_ = esConsumes(); //if(PRINT) cout<<" Construct "< lumi; - iLumi.getByLabel("lumiProducer", lumi); + iLumi.getByToken(lumiToken_, lumi); edm::Handle cond; float intlumi = 0, instlumi = 0; int beamint1 = 0, beamint2 = 0; - iLumi.getByLabel("conditionsInEdm", cond); + iLumi.getByToken(condToken_, cond); // This will only work when running on RECO until (if) they fix it in the FW // When running on RAW and reconstructing, the LumiSummary will not appear // in the event before reaching endLuminosityBlock(). Therefore, it is not @@ -441,7 +453,7 @@ void TestPixTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { #ifdef L1 // Get L1 Handle L1GTRR; - e.getByLabel("gtDigis", L1GTRR); + e.getByToken(l1gtrrToken_, L1GTRR); if (L1GTRR.isValid()) { //bool l1a = L1GTRR->decision(); // global decission? @@ -468,7 +480,7 @@ void TestPixTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { edm::Handle HLTResults; // Extract the HLT results - e.getByLabel(edm::InputTag("TriggerResults", "", "HLT"), HLTResults); + e.getByToken(hltToken_, HLTResults); if ((HLTResults.isValid() == true) && (HLTResults->size() > 0)) { //TrigNames.init(*HLTResults); const edm::TriggerNames &TrigNames = e.triggerNames(*HLTResults); @@ -490,20 +502,14 @@ void TestPixTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { } // if valid #endif - // -- Does this belong into beginJob()? - //ESHandle TG; - //iSetup.get().get(TG); - //const TrackerGeometry* theTrackerGeometry = TG.product(); - //const TrackerGeometry& theTracker(*theTrackerGeometry); // Get event setup - edm::ESHandle geom; - es.get().get(geom); + edm::ESHandle geom = es.getHandle(trackerGeomToken_); const TrackerGeometry &theTracker(*geom); // -- Primary vertices // ---------------------------------------------------------------------- edm::Handle vertices; - e.getByLabel("offlinePrimaryVertices", vertices); + e.getByToken(vtxToken_, vertices); if (PRINT) cout << " PV list " << vertices->size() << endl; @@ -555,7 +561,7 @@ void TestPixTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { // e.getByLabel("ctfWithMaterialTracksP5", recTracks); // e.getByLabel("splittedTracksP5", recTracks); //e.getByLabel("cosmictrackfinderP5", recTracks); - e.getByLabel(src_, recTracks); + e.getByToken(srcToken_, recTracks); if (PRINT) cout << " Tracks " << recTracks->size() << endl; @@ -865,7 +871,7 @@ void TestPixTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { // Use Trajectories edm::Handle trajTrackCollectionHandle; - e.getByLabel(conf_.getParameter("trajectoryInput"), trajTrackCollectionHandle); + e.getByToken(trackAssocToken_, trajTrackCollectionHandle); TrajectoryStateCombiner tsoscomb; diff --git a/RecoLocalTracker/SiPixelClusterizer/test/TestWithTracks.cc b/RecoLocalTracker/SiPixelClusterizer/test/TestWithTracks.cc index 4a749c8dde615..b01009bff78ba 100644 --- a/RecoLocalTracker/SiPixelClusterizer/test/TestWithTracks.cc +++ b/RecoLocalTracker/SiPixelClusterizer/test/TestWithTracks.cc @@ -125,8 +125,15 @@ class TestWithTracks : public edm::EDAnalyzer { virtual void endJob() override; private: - edm::ParameterSet conf_; - edm::InputTag src_; + edm::EDGetTokenT lumiToken_; + edm::EDGetTokenT condToken_; + edm::EDGetTokenT l1gtrrToken_; + edm::EDGetTokenT hltToken_; + edm::EDGetTokenT vtxToken_; + edm::EDGetTokenT srcToken_; + edm::EDGetTokenT trackAssocToken_; + + edm::ESGetToken trackerGeomToken_; //const static bool PRINT = false; bool PRINT; float countTracks, countGoodTracks, countTracksInPix, countPVs, countEvents, countLumi; @@ -193,11 +200,17 @@ class TestWithTracks : public edm::EDAnalyzer { }; ///////////////////////////////////////////////////////////////// // Contructor, -TestWithTracks::TestWithTracks(edm::ParameterSet const &conf) - // : conf_(conf), src_(conf.getParameter( "src" )) { } - : conf_(conf) { +TestWithTracks::TestWithTracks(edm::ParameterSet const &conf) { PRINT = conf.getUntrackedParameter("Verbosity", false); - src_ = conf.getParameter("src"); + lumiToken_ = consumes(edm::InputTag("lumiProducer")); + condToken_ = consumes(edm::InputTag("conditionsInEdm")); + l1gtrrToken_ = consumes(edm::InputTag("gtDigis")); + hltToken_ = consumes(edm::InputTag("TriggerResults", "", "HLT")); + vtxToken_ = consumes(edm::InputTag("offlinePrimaryVertices")); + srcToken_ = consumes(conf.getParameter("src")); + trackAssocToken_ = + consumes(edm::InputTag(conf.getParameter("trajectoryInput"))); + trackerGeomToken_ = esConsumes(); //if(PRINT) cout<<" Construct "< lumi; - iLumi.getByLabel("lumiProducer", lumi); + iLumi.getByToken(lumiToken_, lumi); edm::Handle cond; float intlumi = 0, instlumi = 0; int beamint1 = 0, beamint2 = 0; - iLumi.getByLabel("conditionsInEdm", cond); + iLumi.getByToken(condToken_, cond); // This will only work when running on RECO until (if) they fix it in the FW // When running on RAW and reconstructing, the LumiSummary will not appear // in the event before reaching endLuminosityBlock(). Therefore, it is not @@ -544,7 +557,7 @@ void TestWithTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { #ifdef L1 // Get L1 Handle L1GTRR; - e.getByLabel("gtDigis", L1GTRR); + e.getByToken(l1gtrrToken_, L1GTRR); if (L1GTRR.isValid()) { //bool l1a = L1GTRR->decision(); // global decission? @@ -571,7 +584,7 @@ void TestWithTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { edm::Handle HLTResults; // Extract the HLT results - e.getByLabel(edm::InputTag("TriggerResults", "", "HLT"), HLTResults); + e.getByToken(hltToken_, HLTResults); if ((HLTResults.isValid() == true) && (HLTResults->size() > 0)) { //TrigNames.init(*HLTResults); const edm::TriggerNames &TrigNames = e.triggerNames(*HLTResults); @@ -593,20 +606,14 @@ void TestWithTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { } // if valid #endif - // -- Does this belong into beginJob()? - //ESHandle TG; - //iSetup.get().get(TG); - //const TrackerGeometry* theTrackerGeometry = TG.product(); - //const TrackerGeometry& theTracker(*theTrackerGeometry); // Get event setup - edm::ESHandle geom; - es.get().get(geom); + edm::ESHandle geom = es.getHandle(trackerGeomToken_); const TrackerGeometry &theTracker(*geom); // -- Primary vertices // ---------------------------------------------------------------------- edm::Handle vertices; - e.getByLabel("offlinePrimaryVertices", vertices); + e.getByToken(vtxToken_, vertices); if (PRINT) cout << " PV list " << vertices->size() << endl; @@ -660,7 +667,7 @@ void TestWithTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { // e.getByLabel("ctfWithMaterialTracksP5", recTracks); // e.getByLabel("splittedTracksP5", recTracks); //e.getByLabel("cosmictrackfinderP5", recTracks); - e.getByLabel(src_, recTracks); + e.getByToken(srcToken_, recTracks); if (PRINT) cout << " Tracks " << recTracks->size() << endl; @@ -1247,7 +1254,7 @@ void TestWithTracks::analyze(const edm::Event &e, const edm::EventSetup &es) { // Use Trajectories edm::Handle trajTrackCollectionHandle; - e.getByLabel(conf_.getParameter("trajectoryInput"), trajTrackCollectionHandle); + e.getByToken(trackAssocToken_, trajTrackCollectionHandle); TrajectoryStateCombiner tsoscomb; diff --git a/RecoLocalTracker/SiPixelClusterizer/test/Triplet.cc b/RecoLocalTracker/SiPixelClusterizer/test/Triplet.cc index bd4d58c68c047..ec26979d2fd45 100644 --- a/RecoLocalTracker/SiPixelClusterizer/test/Triplet.cc +++ b/RecoLocalTracker/SiPixelClusterizer/test/Triplet.cc @@ -110,6 +110,14 @@ class Triplet : public edm::EDAnalyzer { double &dz); // ----------member data: + edm::EDGetTokenT bsToken_; + edm::EDGetTokenT vtxToken_; + edm::EDGetTokenT trackToken_; + + edm::ESGetToken trackerTopoToken_; + edm::ESGetToken trackerGeomToken_; + edm::ESGetToken transientTrackBuilderToken_; + edm::ESGetToken transientTrackingRecHitBuilderToken_; TH1D *h000, *h001, *h002, *h003, *h004, *h005, *h006, *h007, *h008, *h009; TH1D *h010, *h011, *h012, *h013, *h014, *h015, *h016, *h017, *h018, *h019; @@ -167,7 +175,20 @@ class Triplet : public edm::EDAnalyzer { // // constructor: // -Triplet::Triplet(const edm::ParameterSet &iConfig) { std::cout << "Triplet constructed\n"; } +Triplet::Triplet(const edm::ParameterSet &iConfig) { + bsToken_ = consumes(edm::InputTag("offlineBeamSpot")); + vtxToken_ = consumes(edm::InputTag("offlinePrimaryVertices")); + trackToken_ = consumes(edm::InputTag("generalTracks")); + + trackerTopoToken_ = esConsumes(); + trackerGeomToken_ = esConsumes(); + transientTrackBuilderToken_ = + esConsumes(edm::ESInputTag("", "TransientTrackBuilder")); + transientTrackingRecHitBuilderToken_ = + esConsumes(edm::ESInputTag("", "WithTrackAngle")); + + std::cout << "Triplet constructed\n"; +} // // destructor: // @@ -360,8 +381,7 @@ void Triplet::beginJob() { // void Triplet::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { //Retrieve tracker topology from geometry - edm::ESHandle tTopo; - iSetup.get().get(tTopo); + edm::ESHandle tTopo = iSetup.getHandle(trackerTopoToken_); using namespace std; using namespace edm; @@ -395,7 +415,7 @@ void Triplet::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // beam spot: // edm::Handle rbs; - iEvent.getByLabel("offlineBeamSpot", rbs); + iEvent.getByToken(bsToken_, rbs); XYZPoint bsP = XYZPoint(0, 0, 0); //int ibs = 0; @@ -427,7 +447,7 @@ void Triplet::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // primary vertices: // Handle vertices; - iEvent.getByLabel("offlinePrimaryVertices", vertices); + iEvent.getByToken(vtxToken_, vertices); if (vertices.failedToGet()) return; @@ -543,7 +563,7 @@ void Triplet::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // Handle tracks; - iEvent.getByLabel("generalTracks", tracks); + iEvent.getByToken(trackToken_, tracks); if (tracks.failedToGet()) return; @@ -554,8 +574,7 @@ void Triplet::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // // get tracker geometry: // - edm::ESHandle pDD; - iSetup.get().get(pDD); + edm::ESHandle pDD = iSetup.getHandle(trackerGeomToken_); if (!pDD.isValid()) { cout << "Unable to find TrackerDigiGeometry. Return\n"; @@ -649,14 +668,11 @@ void Triplet::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { // // transient track builder, needs B-field from data base (global tag in .py) // - edm::ESHandle theB; - - iSetup.get().get("TransientTrackBuilder", theB); + edm::ESHandle theB = iSetup.getHandle(transientTrackBuilderToken_); // // transient rec hits: // - ESHandle hitBuilder; - iSetup.get().get("WithTrackAngle", hitBuilder); + edm::ESHandle hitBuilder = iSetup.getHandle(transientTrackingRecHitBuilderToken_); // // // diff --git a/SimTracker/SiPixelDigitizer/test/PixelDigisTest.cc b/SimTracker/SiPixelDigitizer/test/PixelDigisTest.cc index 1408a69517340..edd80756fe045 100644 --- a/SimTracker/SiPixelDigitizer/test/PixelDigisTest.cc +++ b/SimTracker/SiPixelDigitizer/test/PixelDigisTest.cc @@ -115,6 +115,10 @@ class PixelDigisTest : public edm::EDAnalyzer { // ----------member data --------------------------- bool PRINT; edm::EDGetTokenT> tPixelDigi; + + edm::ESGetToken trackerTopoToken; + edm::ESGetToken trackerGeomToken; + #ifdef USE_SIM_LINKS edm::EDGetTokenT> tPixelDigiSimLink; #endif @@ -172,6 +176,10 @@ PixelDigisTest::PixelDigisTest(const edm::ParameterSet &iConfig) { PRINT = iConfig.getUntrackedParameter("Verbosity", false); src_ = iConfig.getParameter("src"); tPixelDigi = consumes>(src_); + + trackerTopoToken = esConsumes(); + trackerGeomToken = esConsumes(); + #ifdef USE_SIM_LINKS tPixelDigiSimLink = consumes>(src_); #endif @@ -322,8 +330,7 @@ void PixelDigisTest::beginJob() { // ------------ method called to produce the data ------------ void PixelDigisTest::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { //Retrieve tracker topology from geometry - edm::ESHandle tTopo; - iSetup.get().get(tTopo); + edm::ESHandle tTopo = iSetup.getHandle(trackerTopoToken); using namespace edm; if (PRINT) @@ -394,8 +401,7 @@ void PixelDigisTest::analyze(const edm::Event &iEvent, const edm::EventSetup &iS #endif // Get event setup (to get global transformation) - edm::ESHandle geom; - iSetup.get().get(geom); + edm::ESHandle geom = iSetup.getHandle(trackerGeomToken); const TrackerGeometry &theTracker(*geom); int numberOfDetUnits = 0; diff --git a/SimTracker/SiPixelDigitizer/test/PixelMixedSimHitsTest.cc b/SimTracker/SiPixelDigitizer/test/PixelMixedSimHitsTest.cc index 4d5fb7ed4c4d7..05ba8843ba4bd 100644 --- a/SimTracker/SiPixelDigitizer/test/PixelMixedSimHitsTest.cc +++ b/SimTracker/SiPixelDigitizer/test/PixelMixedSimHitsTest.cc @@ -74,10 +74,11 @@ class PixelMixedSimHitsTest : public edm::EDAnalyzer { private: // ----------member data --------------------------- edm::ParameterSet conf_; - edm::InputTag src_; const static bool PRINT = false; typedef std::vector vstring; vstring trackerContainers; + edm::ESGetToken trackerTopoToken; + edm::ESGetToken trackerGeomToken; // Histograms TFile *hFile; TH1F *hBunchCrossing, *htof1m, *htof0, *htof1p, *htof2p; @@ -112,6 +113,8 @@ class PixelMixedSimHitsTest : public edm::EDAnalyzer { }; // PixelMixedSimHitsTest::PixelMixedSimHitsTest(const edm::ParameterSet &iConfig) : conf_(iConfig) { + trackerTopoToken = esConsumes(); + trackerGeomToken = esConsumes(); trackerContainers.clear(); trackerContainers = iConfig.getParameter >("ROUList"); cout << " Construct PixelSimHitsTest " << endl; @@ -253,8 +256,7 @@ void PixelMixedSimHitsTest::beginJob() { // ------------ method called to produce the data ------------ void PixelMixedSimHitsTest::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { //Retrieve tracker topology from geometry - edm::ESHandle tTopo; - iSetup.get().get(tTopo); + edm::ESHandle tTopo = iSetup.getHandle(trackerTopoToken); const double PI = 3.142; @@ -263,8 +265,7 @@ void PixelMixedSimHitsTest::analyze(const edm::Event &iEvent, const edm::EventSe cout << " Analyze PixelSimHitsTest " << endl; // Get event setup (to get global transformation) - edm::ESHandle geom; - iSetup.get().get(geom); + edm::ESHandle geom = iSetup.getHandle(trackerGeomToken); const TrackerGeometry &theTracker(*geom); // Get input data diff --git a/SimTracker/SiPixelDigitizer/test/PixelSimHitsTest.cc b/SimTracker/SiPixelDigitizer/test/PixelSimHitsTest.cc index 6b2ba0b54c531..07941c6df93fc 100644 --- a/SimTracker/SiPixelDigitizer/test/PixelSimHitsTest.cc +++ b/SimTracker/SiPixelDigitizer/test/PixelSimHitsTest.cc @@ -84,6 +84,8 @@ class PixelSimHitsTest : public edm::EDAnalyzer { bool PRINT; string mode_; // select bpix/fpix edm::EDGetTokenT tPixelSimHits; + edm::ESGetToken trackerTopoToken; + edm::ESGetToken trackerGeomToken; int numEvents; double numSimHits, numSimHitsGood; @@ -122,6 +124,9 @@ PixelSimHitsTest::PixelSimHitsTest(const edm::ParameterSet &iConfig) : conf_(iCo edm::InputTag tag(src_, list_); // for the ByToken tPixelSimHits = consumes(tag); + trackerTopoToken = esConsumes(); + trackerGeomToken = esConsumes(); + mode_ = iConfig.getUntrackedParameter("mode", "bpix"); // select bpix or fpix PRINT = iConfig.getUntrackedParameter("Verbosity", false); // printout cout << " Construct PixelSimHitsTest " << endl; @@ -262,13 +267,11 @@ void PixelSimHitsTest::analyze(const edm::Event &iEvent, const edm::EventSetup & cout << " Analyze PixelSimHitsTest " << endl; // Get event setup (to get global transformation) - edm::ESHandle geom; - iSetup.get().get(geom); + edm::ESHandle geom = iSetup.getHandle(trackerGeomToken); const TrackerGeometry &theTracker(*geom); //Retrieve tracker topology from geometry (for det id) - edm::ESHandle tTopo; - iSetup.get().get(tTopo); + edm::ESHandle tTopo = iSetup.getHandle(trackerTopoToken); // Get input data int totalNumOfSimHits = 0; diff --git a/SimTracker/SiPixelDigitizer/test/PixelSimHitsTestForward.cc b/SimTracker/SiPixelDigitizer/test/PixelSimHitsTestForward.cc index a82f3ed4643d9..7574adaaee6c9 100644 --- a/SimTracker/SiPixelDigitizer/test/PixelSimHitsTestForward.cc +++ b/SimTracker/SiPixelDigitizer/test/PixelSimHitsTestForward.cc @@ -74,6 +74,9 @@ class PixelSimHitsTestForward : public edm::EDAnalyzer { // ----------member data --------------------------- const static bool PRINT = true; + edm::ESGetToken trackerTopoToken; + edm::ESGetToken trackerGeomToken; + TFile *hFile; TH1F *heloss1, *heloss2, *heloss3, *hdetunit, *hpabs, *hpid, *htof, *htid; TH1F *hpixid, *hpixsubid, *hlayerid, *hladder1id, *hladder2id, *hladder3id, *hz1id, *hz2id, *hz3id; @@ -120,6 +123,9 @@ PixelSimHitsTestForward::PixelSimHitsTestForward(const edm::ParameterSet &iConfi //daemon.operator->(); cout << " Construct PixelSimHitsTestForward " << endl; + + trackerTopoToken = esConsumes(); + trackerGeomToken = esConsumes(); } PixelSimHitsTestForward::~PixelSimHitsTestForward() { @@ -252,8 +258,7 @@ void PixelSimHitsTestForward::beginJob() { // ------------ method called to produce the data ------------ void PixelSimHitsTestForward::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { //Retrieve tracker topology from geometry - edm::ESHandle tTopo; - iSetup.get().get(tTopo); + edm::ESHandle tTopo = iSetup.getHandle(trackerTopoToken); const double PI = 3.142; @@ -262,8 +267,7 @@ void PixelSimHitsTestForward::analyze(const edm::Event &iEvent, const edm::Event cout << " Analyze PixelSimHitsTestForward " << endl; // Get event setup (to get global transformation) - edm::ESHandle geom; - iSetup.get().get(geom); + edm::ESHandle geom = iSetup.getHandle(trackerGeomToken); const TrackerGeometry &theTracker(*geom); // Get input data diff --git a/Validation/SiPixelPhase1HitsV/interface/SiPixelPhase1HitsV.h b/Validation/SiPixelPhase1HitsV/interface/SiPixelPhase1HitsV.h index 79b8194b06aa3..2e1159d66c1c4 100644 --- a/Validation/SiPixelPhase1HitsV/interface/SiPixelPhase1HitsV.h +++ b/Validation/SiPixelPhase1HitsV/interface/SiPixelPhase1HitsV.h @@ -13,6 +13,8 @@ #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" namespace reco { class TrackToTrackingParticleAssociator; @@ -46,6 +48,8 @@ class SiPixelPhase1HitsV : public SiPixelPhase1Base { edm::EDGetTokenT> tracksToken_; edm::EDGetTokenT tpToken_; edm::EDGetTokenT trackAssociatorByHitsToken_; + + edm::ESGetToken trackerGeomToken_; }; #endif diff --git a/Validation/SiPixelPhase1HitsV/src/SiPixelPhase1HitsV.cc b/Validation/SiPixelPhase1HitsV/src/SiPixelPhase1HitsV.cc index 450530500abc2..80138d3da7a1b 100644 --- a/Validation/SiPixelPhase1HitsV/src/SiPixelPhase1HitsV.cc +++ b/Validation/SiPixelPhase1HitsV/src/SiPixelPhase1HitsV.cc @@ -15,8 +15,6 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "SimDataFormats/TrackingHit/interface/PSimHit.h" #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" @@ -33,7 +31,9 @@ SiPixelPhase1HitsV::SiPixelPhase1HitsV(const edm::ParameterSet &iConfig) tracksToken_(consumes>(iConfig.getParameter("tracksTag"))), tpToken_(consumes(iConfig.getParameter("tpTag"))), trackAssociatorByHitsToken_(consumes( - iConfig.getParameter("trackAssociatorByHitsTag"))) {} + iConfig.getParameter("trackAssociatorByHitsTag"))), + + trackerGeomToken_(esConsumes()) {} void SiPixelPhase1HitsV::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { edm::Handle barrelLowInput; @@ -60,8 +60,7 @@ void SiPixelPhase1HitsV::analyze(const edm::Event &iEvent, const edm::EventSetup // Get geometry information - edm::ESHandle tracker; - iSetup.get().get(tracker); + edm::ESHandle tracker = iSetup.getHandle(trackerGeomToken_); // get low barrel info for (it = barrelLowInput->begin(); it != barrelLowInput->end(); ++it) { diff --git a/Validation/SiPixelPhase1TrackClustersV/interface/SiPixelPhase1TrackClustersV.h b/Validation/SiPixelPhase1TrackClustersV/interface/SiPixelPhase1TrackClustersV.h index 0e9ee5f6417d2..beffc968e17c5 100644 --- a/Validation/SiPixelPhase1TrackClustersV/interface/SiPixelPhase1TrackClustersV.h +++ b/Validation/SiPixelPhase1TrackClustersV/interface/SiPixelPhase1TrackClustersV.h @@ -11,7 +11,6 @@ #include "DQM/SiPixelPhase1Common/interface/SiPixelPhase1Base.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" -#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" class SiPixelPhase1TrackClustersV : public SiPixelPhase1Base { enum { @@ -26,7 +25,6 @@ class SiPixelPhase1TrackClustersV : public SiPixelPhase1Base { private: edm::EDGetTokenT> clustersToken_; - edm::EDGetTokenT tracksToken_; }; #endif diff --git a/Validation/SiPixelPhase1TrackClustersV/src/SiPixelPhase1TrackClustersV.cc b/Validation/SiPixelPhase1TrackClustersV/src/SiPixelPhase1TrackClustersV.cc index 1500be075ae90..f01c1a85332d9 100644 --- a/Validation/SiPixelPhase1TrackClustersV/src/SiPixelPhase1TrackClustersV.cc +++ b/Validation/SiPixelPhase1TrackClustersV/src/SiPixelPhase1TrackClustersV.cc @@ -10,34 +10,12 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "Validation/SiPixelPhase1TrackClustersV/interface/SiPixelPhase1TrackClustersV.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/GeometryVector/interface/LocalPoint.h" -#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "Geometry/CommonTopologies/interface/PixelTopology.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" - SiPixelPhase1TrackClustersV::SiPixelPhase1TrackClustersV(const edm::ParameterSet &iConfig) : SiPixelPhase1Base(iConfig) { clustersToken_ = consumes>(iConfig.getParameter("clusters")); - tracksToken_ = consumes(iConfig.getParameter("tracks")); } void SiPixelPhase1TrackClustersV::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { - // get geometry - edm::ESHandle tracker; - iSetup.get().get(tracker); - assert(tracker.isValid()); - - // get the map - edm::Handle tracks; - iEvent.getByToken(tracksToken_, tracks); - // get clusters edm::Handle> clusterColl; iEvent.getByToken(clustersToken_, clusterColl);