diff --git a/Validation/EcalClusters/interface/ContainmentCorrectionAnalyzer.h b/Validation/EcalClusters/interface/ContainmentCorrectionAnalyzer.h index 32c793cc89fc9..1a75a8bb865a5 100644 --- a/Validation/EcalClusters/interface/ContainmentCorrectionAnalyzer.h +++ b/Validation/EcalClusters/interface/ContainmentCorrectionAnalyzer.h @@ -5,7 +5,7 @@ #include // user include files -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -45,7 +45,7 @@ class TFile; class EcalSimPhotonMCTruth; -class ContainmentCorrectionAnalyzer : public edm::EDAnalyzer { +class ContainmentCorrectionAnalyzer : public edm::one::EDAnalyzer<> { public: explicit ContainmentCorrectionAnalyzer(const edm::ParameterSet &); ~ContainmentCorrectionAnalyzer() override; @@ -66,6 +66,7 @@ class ContainmentCorrectionAnalyzer : public edm::EDAnalyzer { edm::EDGetTokenT EndcapSuperClusterCollection_; edm::EDGetTokenT reducedBarrelRecHitCollection_; edm::EDGetTokenT reducedEndcapRecHitCollection_; + edm::ESGetToken pTopologyToken; int nMCphotons; std::vector mcEnergy, mcEta, mcPhi, mcPt; diff --git a/Validation/EcalClusters/src/ContainmentCorrectionAnalyzer.cc b/Validation/EcalClusters/src/ContainmentCorrectionAnalyzer.cc index 23cb747c440a7..2f6df96dfeee5 100644 --- a/Validation/EcalClusters/src/ContainmentCorrectionAnalyzer.cc +++ b/Validation/EcalClusters/src/ContainmentCorrectionAnalyzer.cc @@ -8,7 +8,7 @@ using namespace edm; using namespace std; using namespace reco; -ContainmentCorrectionAnalyzer::ContainmentCorrectionAnalyzer(const ParameterSet &ps) { +ContainmentCorrectionAnalyzer::ContainmentCorrectionAnalyzer(const ParameterSet &ps) : pTopologyToken(esConsumes()) { BarrelSuperClusterCollection_ = consumes(ps.getParameter("BarrelSuperClusterCollection")); EndcapSuperClusterCollection_ = @@ -111,10 +111,9 @@ void ContainmentCorrectionAnalyzer::analyze(const Event &evt, const EventSetup & } const CaloTopology *topology = nullptr; - ESHandle pTopology; - es.get().get(pTopology); + auto pTopology = es.getHandle(pTopologyToken); if (pTopology.isValid()) - topology = pTopology.product(); + topology = &es.getData(pTopologyToken); std::vector photons = findMcTruth(theSimTracks, theSimVertexes); diff --git a/Validation/EcalDigis/interface/EcalBarrelDigisValidation.h b/Validation/EcalDigis/interface/EcalBarrelDigisValidation.h index 27158961de97d..e4189daacf201 100644 --- a/Validation/EcalDigis/interface/EcalBarrelDigisValidation.h +++ b/Validation/EcalDigis/interface/EcalBarrelDigisValidation.h @@ -31,6 +31,9 @@ #include #include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include +#include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" + class EcalBarrelDigisValidation : public DQMEDAnalyzer { typedef std::map > MapType; @@ -55,7 +58,7 @@ class EcalBarrelDigisValidation : public DQMEDAnalyzer { std::string outputFile_; edm::EDGetTokenT EBdigiCollection_; - + edm::ESGetToken pAgc; std::map > gainConv_; double barrelADCtoGeV_; diff --git a/Validation/EcalDigis/interface/EcalDigisValidation.h b/Validation/EcalDigis/interface/EcalDigisValidation.h index 503343585c528..66e4cf56b20cd 100644 --- a/Validation/EcalDigis/interface/EcalDigisValidation.h +++ b/Validation/EcalDigis/interface/EcalDigisValidation.h @@ -37,6 +37,8 @@ #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" #include "SimDataFormats/CrossingFrame/interface/MixCollection.h" +#include +#include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" #include #include @@ -75,6 +77,7 @@ class EcalDigisValidation : public DQMEDAnalyzer { edm::EDGetTokenT EBdigiCollectionToken_; edm::EDGetTokenT EEdigiCollectionToken_; edm::EDGetTokenT ESdigiCollectionToken_; + edm::ESGetToken pAgc; edm::EDGetTokenT > crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_; diff --git a/Validation/EcalDigis/interface/EcalEndcapDigisValidation.h b/Validation/EcalDigis/interface/EcalEndcapDigisValidation.h index 71d7e9dac5538..333fa60b5dfc9 100644 --- a/Validation/EcalDigis/interface/EcalEndcapDigisValidation.h +++ b/Validation/EcalDigis/interface/EcalEndcapDigisValidation.h @@ -25,6 +25,9 @@ #include "DataFormats/EcalDigi/interface/EEDataFrame.h" #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" +#include +#include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" + #include #include #include @@ -56,6 +59,7 @@ class EcalEndcapDigisValidation : public DQMEDAnalyzer { std::string outputFile_; edm::EDGetTokenT EEdigiCollectionToken_; + edm::ESGetToken pAgc; std::map > gainConv_; diff --git a/Validation/EcalDigis/interface/EcalMixingModuleValidation.h b/Validation/EcalDigis/interface/EcalMixingModuleValidation.h index a4da896263116..2f47e0dbbfaa0 100644 --- a/Validation/EcalDigis/interface/EcalMixingModuleValidation.h +++ b/Validation/EcalDigis/interface/EcalMixingModuleValidation.h @@ -55,6 +55,9 @@ #include "CondFormats/ESObjects/interface/ESPedestals.h" #include "CondFormats/DataRecord/interface/ESPedestalsRcd.h" #include "CondFormats/ESObjects/interface/ESIntercalibConstants.h" +#include +#include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include #include @@ -106,10 +109,17 @@ class EcalMixingModuleValidation : public DQMOneEDAnalyzer<> { edm::EDGetTokenT EBdigiCollectionToken_; edm::EDGetTokenT EEdigiCollectionToken_; edm::EDGetTokenT ESdigiCollectionToken_; - edm::EDGetTokenT > crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_; + edm::ESGetToken pAgc; + edm::ESGetToken esgain_; + edm::ESGetToken esMIPToGeV_; + edm::ESGetToken esPedestals_; + edm::ESGetToken esMIPs_; + edm::ESGetToken dbPed; + edm::ESGetToken hGeometry; + std::map > gainConv_; double barrelADCtoGeV_; diff --git a/Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h b/Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h index 5e3fceb76f3ea..d732bf4eaa6e4 100644 --- a/Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h +++ b/Validation/EcalDigis/interface/EcalSelectiveReadoutValidation.h @@ -19,6 +19,18 @@ #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/EcalDetId/interface/EcalScDetId.h" #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" + +#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" +#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" +#include "CondFormats/EcalObjects/interface/EcalTPGPhysicsConst.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" +#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" #include "Validation/EcalDigis/src/CollHandle.h" @@ -393,6 +405,13 @@ class EcalSelectiveReadoutValidation : public DQMOneEDAnalyzer<> { bool gain12; //all MGPA samples at gain 12? }; + edm::ESGetToken geoToken; + edm::ESGetToken ecalmapping; + edm::ESGetToken hTriggerTowerMap; + edm::ESGetToken physHandle; + edm::ESGetToken lutGrpHandle; + edm::ESGetToken lutMapHandle; + /// number of bytes in 1 kByte: static const int kByte_ = 1024; diff --git a/Validation/EcalDigis/src/EcalBarrelDigisValidation.cc b/Validation/EcalDigis/src/EcalBarrelDigisValidation.cc index ea9c7e334bdb3..50a2a3e9e65a2 100644 --- a/Validation/EcalDigis/src/EcalBarrelDigisValidation.cc +++ b/Validation/EcalDigis/src/EcalBarrelDigisValidation.cc @@ -14,7 +14,8 @@ using namespace edm; using namespace std; EcalBarrelDigisValidation::EcalBarrelDigisValidation(const ParameterSet& ps) - : EBdigiCollection_(consumes(ps.getParameter("EBdigiCollection"))) { + : EBdigiCollection_(consumes(ps.getParameter("EBdigiCollection"))), + pAgc(esConsumes()) { // verbosity switch verbose_ = ps.getUntrackedParameter("verbose", false); @@ -249,9 +250,7 @@ void EcalBarrelDigisValidation::analyze(Event const& e, EventSetup const& c) { void EcalBarrelDigisValidation::checkCalibrations(edm::EventSetup const& eventSetup) { // ADC -> GeV Scale - edm::ESHandle pAgc; - eventSetup.get().get(pAgc); - const EcalADCToGeVConstant* agc = pAgc.product(); + const EcalADCToGeVConstant* agc = &eventSetup.getData(pAgc); EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio(); diff --git a/Validation/EcalDigis/src/EcalDigisValidation.cc b/Validation/EcalDigis/src/EcalDigisValidation.cc index 7df0c0f660486..b686d162cdf43 100644 --- a/Validation/EcalDigis/src/EcalDigisValidation.cc +++ b/Validation/EcalDigis/src/EcalDigisValidation.cc @@ -18,6 +18,7 @@ EcalDigisValidation::EcalDigisValidation(const edm::ParameterSet& ps) EBdigiCollectionToken_(consumes(ps.getParameter("EBdigiCollection"))), EEdigiCollectionToken_(consumes(ps.getParameter("EEdigiCollection"))), ESdigiCollectionToken_(consumes(ps.getParameter("ESdigiCollection"))), + pAgc(esConsumes()), crossingFramePCaloHitEBToken_(consumes >(edm::InputTag( std::string("mix"), ps.getParameter("moduleLabelG4") + std::string("EcalHitsEB")))), crossingFramePCaloHitEEToken_(consumes >(edm::InputTag( @@ -382,9 +383,7 @@ void EcalDigisValidation::analyze(edm::Event const& e, edm::EventSetup const& c) void EcalDigisValidation::checkCalibrations(edm::EventSetup const& eventSetup) { // ADC -> GeV Scale - edm::ESHandle pAgc; - eventSetup.get().get(pAgc); - const EcalADCToGeVConstant* agc = pAgc.product(); + const EcalADCToGeVConstant* agc = &eventSetup.getData(pAgc); EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio(); diff --git a/Validation/EcalDigis/src/EcalEndcapDigisValidation.cc b/Validation/EcalDigis/src/EcalEndcapDigisValidation.cc index e5aac59433bdb..5559830376041 100644 --- a/Validation/EcalDigis/src/EcalEndcapDigisValidation.cc +++ b/Validation/EcalDigis/src/EcalEndcapDigisValidation.cc @@ -13,7 +13,8 @@ using namespace edm; using namespace std; EcalEndcapDigisValidation::EcalEndcapDigisValidation(const ParameterSet& ps) - : EEdigiCollectionToken_(consumes(ps.getParameter("EEdigiCollection"))) { + : EEdigiCollectionToken_(consumes(ps.getParameter("EEdigiCollection"))), + pAgc(esConsumes()) { // verbosity switch verbose_ = ps.getUntrackedParameter("verbose", false); @@ -258,9 +259,7 @@ void EcalEndcapDigisValidation::analyze(Event const& e, EventSetup const& c) { void EcalEndcapDigisValidation::checkCalibrations(edm::EventSetup const& eventSetup) { // ADC -> GeV Scale - edm::ESHandle pAgc; - eventSetup.get().get(pAgc); - const EcalADCToGeVConstant* agc = pAgc.product(); + const EcalADCToGeVConstant* agc = &eventSetup.getData(pAgc); EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio(); diff --git a/Validation/EcalDigis/src/EcalMixingModuleValidation.cc b/Validation/EcalDigis/src/EcalMixingModuleValidation.cc index 78678bb754f19..b1b255d48ab22 100644 --- a/Validation/EcalDigis/src/EcalMixingModuleValidation.cc +++ b/Validation/EcalDigis/src/EcalMixingModuleValidation.cc @@ -25,8 +25,15 @@ EcalMixingModuleValidation::EcalMixingModuleValidation(const edm::ParameterSet& edm::InputTag(std::string("mix"), ps.getParameter("hitsProducer") + std::string("EcalHitsEB")))), crossingFramePCaloHitEEToken_(consumes >( edm::InputTag(std::string("mix"), ps.getParameter("hitsProducer") + std::string("EcalHitsEE")))), - crossingFramePCaloHitESToken_(consumes >(edm::InputTag( - std::string("mix"), ps.getParameter("hitsProducer") + std::string("EcalHitsES")))) { + crossingFramePCaloHitESToken_(consumes >( + edm::InputTag(std::string("mix"), ps.getParameter("hitsProducer") + std::string("EcalHitsES")))), + pAgc(esConsumes()), + esgain_(esConsumes()), + esMIPToGeV_(esConsumes()), + esPedestals_(esConsumes()), + esMIPs_(esConsumes()), + dbPed(esConsumes()), + hGeometry(esConsumes()) { // needed for MixingModule checks double simHitToPhotoelectronsBarrel = ps.getParameter("simHitToPhotoelectronsBarrel"); @@ -605,9 +612,7 @@ void EcalMixingModuleValidation::analyze(edm::Event const& e, edm::EventSetup co void EcalMixingModuleValidation::checkCalibrations(edm::EventSetup const& eventSetup) { // ADC -> GeV Scale - edm::ESHandle pAgc; - eventSetup.get().get(pAgc); - const EcalADCToGeVConstant* agc = pAgc.product(); + const EcalADCToGeVConstant* agc = &eventSetup.getData(pAgc); EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio(); @@ -630,20 +635,10 @@ void EcalMixingModuleValidation::checkCalibrations(edm::EventSetup const& eventS LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_; // ES condition objects - edm::ESHandle esgain_; - edm::ESHandle esMIPToGeV_; - edm::ESHandle esPedestals_; - edm::ESHandle esMIPs_; - - eventSetup.get().get(esgain_); - eventSetup.get().get(esMIPToGeV_); - eventSetup.get().get(esPedestals_); - eventSetup.get().get(esMIPs_); - - const ESGain* esgain = esgain_.product(); - m_ESpeds = esPedestals_.product(); - m_ESmips = esMIPs_.product(); - const ESMIPToGeVConstant* esMipToGeV = esMIPToGeV_.product(); + const ESGain* esgain = &eventSetup.getData(esgain_); + m_ESpeds = &eventSetup.getData(esPedestals_); + m_ESmips = &eventSetup.getData(esMIPs_); + const ESMIPToGeVConstant* esMipToGeV = &eventSetup.getData(esMIPToGeV_); m_ESgain = (int)esgain->getESGain(); const double valESMIPToGeV = (m_ESgain == 1) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh(); @@ -657,9 +652,7 @@ void EcalMixingModuleValidation::checkCalibrations(edm::EventSetup const& eventS void EcalMixingModuleValidation::checkPedestals(const edm::EventSetup& eventSetup) { // Pedestals from event setup - edm::ESHandle dbPed; - eventSetup.get().get(dbPed); - thePedestals = dbPed.product(); + thePedestals = &eventSetup.getData(dbPed); } void EcalMixingModuleValidation::findPedestal(const DetId& detId, int gainId, double& ped) const { @@ -708,10 +701,8 @@ void EcalMixingModuleValidation::computeSDBunchDigi(const edm::EventSetup& event // load the geometry - edm::ESHandle hGeometry; - eventSetup.get().get(hGeometry); - - const CaloGeometry* pGeometry = &*hGeometry; + auto hGeomHandle = eventSetup.getHandle(hGeometry); + const CaloGeometry* pGeometry = &*hGeomHandle; // see if we need to update if (pGeometry != theGeometry) { diff --git a/Validation/EcalDigis/src/EcalSelectiveReadoutValidation.cc b/Validation/EcalDigis/src/EcalSelectiveReadoutValidation.cc index 92e8da2475eda..2a20282ca1fa1 100644 --- a/Validation/EcalDigis/src/EcalSelectiveReadoutValidation.cc +++ b/Validation/EcalDigis/src/EcalSelectiveReadoutValidation.cc @@ -25,13 +25,6 @@ #include "DataFormats/Common/interface/Handle.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLutIdMap.h" -#include "CondFormats/EcalObjects/interface/EcalTPGLutGroup.h" -#include "CondFormats/EcalObjects/interface/EcalTPGPhysicsConst.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutIdMapRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGLutGroupRcd.h" -#include "CondFormats/DataRecord/interface/EcalTPGPhysicsConstRcd.h" - using namespace cms; using namespace edm; using namespace std; @@ -103,7 +96,13 @@ const int EcalSelectiveReadoutValidation::nDccRus_[nDccs_] = { 34}; EcalSelectiveReadoutValidation::EcalSelectiveReadoutValidation(const ParameterSet& ps) - : collNotFoundWarn_(ps.getUntrackedParameter("warnIfCollectionNotFound", true)), + : geoToken(esConsumes()), + ecalmapping(esConsumes()), + hTriggerTowerMap(esConsumes()), + physHandle(esConsumes()), + lutGrpHandle(esConsumes()), + lutMapHandle(esConsumes()), + collNotFoundWarn_(ps.getUntrackedParameter("warnIfCollectionNotFound", true)), ebDigis_(ps.getParameter("EbDigiCollection"), false, collNotFoundWarn_), eeDigis_(ps.getParameter("EeDigiCollection"), false, collNotFoundWarn_), ebNoZsDigis_(ps.getParameter("EbUnsuppressedDigiCollection"), false, false /*collNotFoundWarn_*/), @@ -305,8 +304,7 @@ void EcalSelectiveReadoutValidation::analyzeEE(const edm::Event& event, const ed } // gets the endcap geometry: - edm::ESHandle geoHandle; - es.get().get(geoHandle); + auto geoHandle = es.getHandle(geoToken); const CaloSubdetectorGeometry* geometry_p = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalEndcap); //CaloSubdetectorGeometry const& geometry = *geometry_p; @@ -575,9 +573,7 @@ void EcalSelectiveReadoutValidation::analyzeEB(const edm::Event& event, const ed } // get the barrel geometry: - edm::ESHandle geoHandle; - - es.get().get(geoHandle); + auto geoHandle = es.getHandle(geoToken); const CaloSubdetectorGeometry* geometry_p = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalBarrel); //CaloSubdetectorGeometry const& geometry = *geometry_p; @@ -836,14 +832,10 @@ EcalSelectiveReadoutValidation::~EcalSelectiveReadoutValidation() {} void EcalSelectiveReadoutValidation::dqmBeginRun(edm::Run const& r, edm::EventSetup const& es) { // endcap mapping - edm::ESHandle hTriggerTowerMap; - es.get().get(hTriggerTowerMap); - triggerTowerMap_ = hTriggerTowerMap.product(); + triggerTowerMap_ = &es.getData(hTriggerTowerMap); //electronics map - ESHandle ecalmapping; - es.get().get(ecalmapping); - elecMap_ = ecalmapping.product(); + elecMap_ = &es.getData(ecalmapping); initAsciiFile(); } @@ -1503,17 +1495,11 @@ void EcalSelectiveReadoutValidation::analyzeTP(edm::Event const& event, edm::Eve tpEtCount[iEt] = 0; } - edm::ESHandle physHandle; - es.get().get(physHandle); - const EcalTPGPhysicsConstMap& physMap = physHandle.product()->getMap(); + const EcalTPGPhysicsConstMap& physMap = es.getData(physHandle).getMap(); - edm::ESHandle lutGrpHandle; - es.get().get(lutGrpHandle); - const EcalTPGGroups::EcalTPGGroupsMap& lutGrpMap = lutGrpHandle.product()->getMap(); + const EcalTPGGroups::EcalTPGGroupsMap& lutGrpMap = es.getData(lutGrpHandle).getMap(); - edm::ESHandle lutMapHandle; - es.get().get(lutMapHandle); - const EcalTPGLutIdMap::EcalTPGLutMap& lutMap = lutMapHandle.product()->getMap(); + const EcalTPGLutIdMap::EcalTPGLutMap& lutMap = es.getData(lutMapHandle).getMap(); EcalTPGPhysicsConstMapIterator ebItr(physMap.find(DetId(DetId::Ecal, EcalBarrel).rawId())); double lsb10bitsEB(ebItr == physMap.end() ? 0. : ebItr->second.EtSat / 1024.); @@ -1870,8 +1856,8 @@ void EcalSelectiveReadoutValidation::setTtEtSums(const edm::EventSetup& es, const CaloSubdetectorGeometry* eeGeometry = nullptr; const CaloSubdetectorGeometry* ebGeometry = nullptr; if (eeGeometry == nullptr || ebGeometry == nullptr) { - edm::ESHandle geoHandle; - es.get().get(geoHandle); + es.getData(geoToken); + auto geoHandle = es.getHandle(geoToken); eeGeometry = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalEndcap); ebGeometry = (*geoHandle).getSubdetectorGeometry(DetId::Ecal, EcalBarrel); } diff --git a/Validation/EcalRecHits/interface/EcalBarrelRecHitsValidation.h b/Validation/EcalRecHits/interface/EcalBarrelRecHitsValidation.h index 87874a98b034b..dd23f02b2e03d 100644 --- a/Validation/EcalRecHits/interface/EcalBarrelRecHitsValidation.h +++ b/Validation/EcalRecHits/interface/EcalBarrelRecHitsValidation.h @@ -53,6 +53,7 @@ class EcalBarrelRecHitsValidation : public DQMEDAnalyzer { // fix for consumes edm::EDGetTokenT EBdigiCollection_token_; edm::EDGetTokenT EBuncalibrechitCollection_token_; + edm::ESGetToken ecalPeds; MonitorElement *meEBUncalibRecHitsOccupancy_; MonitorElement *meEBUncalibRecHitsAmplitude_; diff --git a/Validation/EcalRecHits/interface/EcalEndcapRecHitsValidation.h b/Validation/EcalRecHits/interface/EcalEndcapRecHitsValidation.h index 3cdd378d7ac80..f62cd8accd055 100644 --- a/Validation/EcalRecHits/interface/EcalEndcapRecHitsValidation.h +++ b/Validation/EcalRecHits/interface/EcalEndcapRecHitsValidation.h @@ -54,6 +54,7 @@ class EcalEndcapRecHitsValidation : public DQMEDAnalyzer { // fix for consumes edm::EDGetTokenT EEdigiCollection_token_; edm::EDGetTokenT EEuncalibrechitCollection_token_; + edm::ESGetToken ecalPeds; MonitorElement *meEEUncalibRecHitsOccupancyPlus_; MonitorElement *meEEUncalibRecHitsOccupancyMinus_; diff --git a/Validation/EcalRecHits/interface/EcalRecHitsValidation.h b/Validation/EcalRecHits/interface/EcalRecHitsValidation.h index 10a6616c81a47..6dc829da40a27 100644 --- a/Validation/EcalRecHits/interface/EcalRecHitsValidation.h +++ b/Validation/EcalRecHits/interface/EcalRecHitsValidation.h @@ -34,6 +34,12 @@ #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h" #include "SimDataFormats/CrossingFrame/interface/MixCollection.h" +#include +#include "CalibCalorimetry/EcalTrivialCondModules/interface/EcalTrivialConditionRetriever.h" +#include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" +#include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h" + #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include #include @@ -83,6 +89,9 @@ class EcalRecHitsValidation : public DQMEDAnalyzer { edm::EDGetTokenT> EBHits_Token_; edm::EDGetTokenT> EEHits_Token_; edm::EDGetTokenT> ESHits_Token_; + edm::ESGetToken pAgc; + edm::ESGetToken pEcsToken; + edm::ESGetToken pttMapToken; MonitorElement *meGunEnergy_; MonitorElement *meGunEta_; diff --git a/Validation/EcalRecHits/src/EcalBarrelRecHitsValidation.cc b/Validation/EcalRecHits/src/EcalBarrelRecHitsValidation.cc index 4e70972f97550..535622fa35d5b 100644 --- a/Validation/EcalRecHits/src/EcalBarrelRecHitsValidation.cc +++ b/Validation/EcalRecHits/src/EcalBarrelRecHitsValidation.cc @@ -13,7 +13,7 @@ using namespace cms; using namespace edm; using namespace std; -EcalBarrelRecHitsValidation::EcalBarrelRecHitsValidation(const ParameterSet &ps) { +EcalBarrelRecHitsValidation::EcalBarrelRecHitsValidation(const ParameterSet &ps) : ecalPeds(esConsumes()) { // ---------------------- EBdigiCollection_token_ = consumes(ps.getParameter("EBdigiCollection")); EBuncalibrechitCollection_token_ = @@ -124,9 +124,6 @@ void EcalBarrelRecHitsValidation::analyze(const Event &e, const EventSetup &c) { skipDigis = true; } - edm::ESHandle ecalPeds; - c.get().get(ecalPeds); - // ---------------------- // loop over UncalibRecHits for (EcalUncalibratedRecHitCollection::const_iterator uncalibRecHit = EBUncalibRecHit->begin(); @@ -194,7 +191,7 @@ void EcalBarrelRecHitsValidation::analyze(const Event &e, const EventSetup &c) { continue; // ratio uncalibratedRecHit amplitude + ped / max energy digi - const EcalPedestals *myped = ecalPeds.product(); + const EcalPedestals *myped = &c.getData(ecalPeds); EcalPedestalsMap::const_iterator it = myped->getMap().find(EBid); if (it != myped->getMap().end()) { if (eMax > (*it).mean_x1 + 5 * (*it).rms_x1 && eMax != 0) { // only real signal RecHit diff --git a/Validation/EcalRecHits/src/EcalEndcapRecHitsValidation.cc b/Validation/EcalRecHits/src/EcalEndcapRecHitsValidation.cc index 629203bff18d2..c083047eac1e6 100644 --- a/Validation/EcalRecHits/src/EcalEndcapRecHitsValidation.cc +++ b/Validation/EcalRecHits/src/EcalEndcapRecHitsValidation.cc @@ -13,7 +13,7 @@ using namespace cms; using namespace edm; using namespace std; -EcalEndcapRecHitsValidation::EcalEndcapRecHitsValidation(const ParameterSet &ps) { +EcalEndcapRecHitsValidation::EcalEndcapRecHitsValidation(const ParameterSet &ps) : ecalPeds(esConsumes()) { // ---------------------- EEdigiCollection_token_ = consumes(ps.getParameter("EEdigiCollection")); EEuncalibrechitCollection_token_ = @@ -120,9 +120,6 @@ void EcalEndcapRecHitsValidation::analyze(const Event &e, const EventSetup &c) { skipDigis = true; } - edm::ESHandle ecalPeds; - c.get().get(ecalPeds); - // ---------------------- // loop over UncalibRecHits for (EcalUncalibratedRecHitCollection::const_iterator uncalibRecHit = EEUncalibRecHit->begin(); @@ -192,7 +189,7 @@ void EcalEndcapRecHitsValidation::analyze(const Event &e, const EventSetup &c) { continue; // ratio uncalibratedRecHit amplitude + ped / max energy digi - const EcalPedestals *myped = ecalPeds.product(); + const EcalPedestals *myped = &c.getData(ecalPeds); EcalPedestalsMap::const_iterator it = myped->getMap().find(EEid); if (it != myped->getMap().end()) { if (eMax > (*it).mean_x1 + 5 * (*it).rms_x1 && eMax != 0) { // only real signal RecHit diff --git a/Validation/EcalRecHits/src/EcalRecHitsValidation.cc b/Validation/EcalRecHits/src/EcalRecHitsValidation.cc index 0eefce6096a77..7682e1340b134 100644 --- a/Validation/EcalRecHits/src/EcalRecHitsValidation.cc +++ b/Validation/EcalRecHits/src/EcalRecHitsValidation.cc @@ -20,7 +20,8 @@ using namespace cms; using namespace edm; using namespace std; -EcalRecHitsValidation::EcalRecHitsValidation(const ParameterSet &ps) { +EcalRecHitsValidation::EcalRecHitsValidation(const ParameterSet &ps) + : pAgc(esConsumes()), pEcsToken(esConsumes()), pttMapToken(esConsumes()) { // ---------------------- HepMCLabel = ps.getParameter("moduleLabelMC"); hitsProducer_ = ps.getParameter("hitsProducer"); @@ -294,9 +295,7 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { LogInfo("EcalRecHitsTask, EventInfo: ") << " Run = " << e.id().run() << " Event = " << e.id().event(); // ADC -> GeV Scale - edm::ESHandle pAgc; - c.get().get(pAgc); - const EcalADCToGeVConstant *agc = pAgc.product(); + const EcalADCToGeVConstant *agc = &c.getData(pAgc); const double barrelADCtoGeV_ = agc->getEBValue(); const double endcapADCtoGeV_ = agc->getEEValue(); @@ -470,11 +469,13 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { meEBRecHitSimHitRatioGt35_->Fill(myRecHit->energy() / ebSimMap[EBid.rawId()]); } uint16_t sc = 0; - edm::ESHandle pEcs; - c.get().get(pEcs); + + c.getData(pEcsToken); + auto pEcs = c.getHandle(pEcsToken); const EcalChannelStatus *ecs = nullptr; if (pEcs.isValid()) - ecs = pEcs.product(); + ecs = &c.getData(pEcsToken); + ; if (ecs != nullptr) { EcalChannelStatusMap::const_iterator csmi = ecs->find(EBid.rawId()); EcalChannelStatusCode csc = 0; @@ -490,11 +491,10 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { meEBRecHitSimHitRatio12_->Fill(myRecHit->energy() / ebSimMap[EBid.rawId()]); } - edm::ESHandle pttMap; - c.get().get(pttMap); + auto pttMap = c.getHandle(pttMapToken); const EcalTrigTowerConstituentsMap *ttMap = nullptr; if (pttMap.isValid()) - ttMap = pttMap.product(); + ttMap = &c.getData(pttMapToken); double ttSimEnergy = 0; if (ttMap != nullptr) { EcalTrigTowerDetId ttDetId = EBid.tower(); @@ -643,11 +643,10 @@ void EcalRecHitsValidation::analyze(const Event &e, const EventSetup &c) { meEERecHitSimHitRatioGt35_->Fill(myRecHit->energy() / eeSimMap[EEid.rawId()]); } - edm::ESHandle pEcs; - c.get().get(pEcs); + auto pEcs = c.getHandle(pEcsToken); const EcalChannelStatus *ecs = nullptr; if (pEcs.isValid()) - ecs = pEcs.product(); + ecs = &c.getData(pEcsToken); if (ecs != nullptr) { EcalChannelStatusMap::const_iterator csmi = ecs->find(EEid.rawId()); EcalChannelStatusCode csc = 0;