Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate ECAL DQMOffline codes to ESConsumes #34636

Merged
merged 2 commits into from Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions DQMOffline/Ecal/interface/EcalPileUpDepMonitor.h
Expand Up @@ -15,6 +15,9 @@

#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloTopology/interface/CaloTopology.h"
#include "Geometry/Records/interface/CaloTopologyRecord.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"

#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include "DataFormats/Common/interface/View.h"
Expand Down Expand Up @@ -85,8 +88,8 @@ class EcalPileUpDepMonitor : public DQMEDAnalyzer {
MonitorElement *r9_EB;
MonitorElement *r9_EE;

edm::ESHandle<CaloGeometry> geomH;
edm::ESHandle<CaloTopology> caloTop;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geomH;
edm::ESGetToken<CaloTopology, CaloTopologyRecord> caloTop;

edm::EDGetTokenT<reco::VertexCollection> VertexCollection_; // vertex collection

Expand Down
10 changes: 4 additions & 6 deletions DQMOffline/Ecal/plugins/ECALMultifitAnalyzer_HI.cc
Expand Up @@ -67,6 +67,7 @@ class ECALMultifitAnalyzer_HI : public DQMEDAnalyzer {
edm::EDGetTokenT<reco::CaloJetCollection> caloJetToken_;
edm::EDGetTokenT<EcalRecHitCollection> RecHitCollection_EB_;
edm::EDGetTokenT<EcalRecHitCollection> RecHitCollection_EE_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geomH;

double mRechitEnergyThreshold;
double mRecoPhotonPtThreshold;
Expand Down Expand Up @@ -105,12 +106,11 @@ class ECALMultifitAnalyzer_HI : public DQMEDAnalyzer {
// constructors and destructor
//
ECALMultifitAnalyzer_HI::ECALMultifitAnalyzer_HI(const edm::ParameterSet &iConfig)
:

recoPhotonsCollection_(consumes<std::vector<reco::Photon>>(iConfig.getParameter<edm::InputTag>("recoPhotonSrc"))),
: recoPhotonsCollection_(consumes<std::vector<reco::Photon>>(iConfig.getParameter<edm::InputTag>("recoPhotonSrc"))),
caloJetToken_(consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("recoJetSrc"))),
RecHitCollection_EB_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("RecHitCollection_EB"))),
RecHitCollection_EE_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("RecHitCollection_EE"))),
geomH(esConsumes()),
mRechitEnergyThreshold(iConfig.getParameter<double>("rechitEnergyThreshold")),
mRecoPhotonPtThreshold(iConfig.getParameter<double>("recoPhotonPtThreshold")),
mRecoJetPtThreshold(iConfig.getParameter<double>("recoJetPtThreshold")),
Expand All @@ -125,9 +125,7 @@ ECALMultifitAnalyzer_HI::ECALMultifitAnalyzer_HI(const edm::ParameterSet &iConfi
void ECALMultifitAnalyzer_HI::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) {
using namespace edm;

edm::ESHandle<CaloGeometry> geomH;
iSetup.get<CaloGeometryRecord>().get(geomH);
const CaloGeometry *geom = geomH.product();
const CaloGeometry *geom = &iSetup.getData(geomH);

Handle<std::vector<reco::Photon>> recoPhotonsHandle;
iEvent.getByToken(recoPhotonsCollection_, recoPhotonsHandle);
Expand Down
17 changes: 5 additions & 12 deletions DQMOffline/Ecal/plugins/EcalPileUpDepMonitor.cc
Expand Up @@ -14,10 +14,6 @@
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/VertexReco/interface/Vertex.h"

#include "Geometry/Records/interface/CaloTopologyRecord.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"

#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"

#include "FWCore/Framework/interface/Event.h"
Expand All @@ -30,7 +26,7 @@

// Framework

EcalPileUpDepMonitor::EcalPileUpDepMonitor(const edm::ParameterSet &ps) {
EcalPileUpDepMonitor::EcalPileUpDepMonitor(const edm::ParameterSet &ps) : geomH(esConsumes()), caloTop(esConsumes()) {
VertexCollection_ = consumes<reco::VertexCollection>(ps.getParameter<edm::InputTag>("VertexCollection"));

if (ps.existsAs<edm::InputTag>("basicClusterCollection") &&
Expand Down Expand Up @@ -58,9 +54,6 @@ EcalPileUpDepMonitor::~EcalPileUpDepMonitor() {}
void EcalPileUpDepMonitor::bookHistograms(DQMStore::IBooker &ibooker,
edm::Run const &,
edm::EventSetup const &eventSetup) {
eventSetup.get<CaloGeometryRecord>().get(geomH);
eventSetup.get<CaloTopologyRecord>().get(caloTop);

ibooker.cd();
ibooker.setCurrentFolder("Ecal/EcalPileUpDepMonitor");

Expand Down Expand Up @@ -229,8 +222,8 @@ void EcalPileUpDepMonitor::bookHistograms(DQMStore::IBooker &ibooker,
recHitEtEE->setAxisTitle("Events", 2);
}

void EcalPileUpDepMonitor::analyze(const edm::Event &e, const edm::EventSetup &) {
const CaloGeometry *geom = geomH.product();
void EcalPileUpDepMonitor::analyze(const edm::Event &e, const edm::EventSetup &es) {
const CaloGeometry *geom = &es.getData(geomH);
// Vertex collection:
//-----------------------------------------
edm::Handle<reco::VertexCollection> PVCollection_h;
Expand Down Expand Up @@ -336,7 +329,7 @@ void EcalPileUpDepMonitor::analyze(const edm::Event &e, const edm::EventSetup &)

// get sigma eta_eta etc

CaloTopology const *p_topology = caloTop.product(); // get calo topology
CaloTopology const *p_topology = &es.getData(caloTop); // get calo topology
const EcalRecHitCollection *eeRecHits = RecHitsEE.product();

reco::BasicCluster const &seedCluster(*itSC->seed());
Expand Down Expand Up @@ -379,7 +372,7 @@ void EcalPileUpDepMonitor::analyze(const edm::Event &e, const edm::EventSetup &)

// sigma ietaieta etc

CaloTopology const *p_topology = caloTop.product(); // get calo topology
CaloTopology const *p_topology = &es.getData(caloTop); // get calo topology
const EcalRecHitCollection *ebRecHits = RecHitsEB.product();

reco::BasicCluster const &seedCluster(*itSC->seed());
Expand Down