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

Added esConsumes to modules in RecoHI #35297

Merged
merged 2 commits into from
Sep 17, 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
10 changes: 1 addition & 9 deletions RecoHI/HiEgammaAlgos/interface/EcalClusterIsoCalculator.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
#ifndef HiEgammaAlgos_EcalClusterIsoCalculator_h
#define HiEgammaAlgos_EcalClusterIsoCalculator_h

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"

class EcalClusterIsoCalculator {
public:
EcalClusterIsoCalculator(const edm::Event &iEvent,
const edm::EventSetup &iSetup,
const edm::Handle<reco::BasicClusterCollection> barrel,
EcalClusterIsoCalculator(const edm::Handle<reco::BasicClusterCollection> barrel,
const edm::Handle<reco::BasicClusterCollection> endcap);

/// Return the ecal cluster energy in a cone around the SC
Expand Down
3 changes: 1 addition & 2 deletions RecoHI/HiEgammaAlgos/interface/HcalRechitIsoCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

class HcalRechitIsoCalculator {
public:
HcalRechitIsoCalculator(const edm::Event &iEvent,
const edm::EventSetup &iSetup,
HcalRechitIsoCalculator(const CaloGeometry *geometry,
const edm::Handle<HBHERecHitCollection> hbhe,
const edm::Handle<HFRecHitCollection> hfLabel,
const edm::Handle<HORecHitCollection> hoLabel);
Expand Down
12 changes: 10 additions & 2 deletions RecoHI/HiEgammaAlgos/plugins/photonIsolationHIProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/InputTag.h"
Expand Down Expand Up @@ -39,6 +40,7 @@ class photonIsolationHIProducer : public edm::stream::EDProducer<> {
edm::EDGetTokenT<reco::TrackCollection> tracks_;

const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_;
const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geometryToken_;

std::string trackQuality_;
};
Expand All @@ -54,6 +56,7 @@ photonIsolationHIProducer::photonIsolationHIProducer(const edm::ParameterSet& co
endcapClusters_(consumes(config.getParameter<edm::InputTag>("basicClusterEndcap"))),
tracks_(consumes(config.getParameter<edm::InputTag>("trackCollection"))),
ecalClusterToolsESGetTokens_{consumesCollector()},
geometryToken_{esConsumes()},
trackQuality_(config.getParameter<std::string>("trackQuality")) {
produces<reco::HIPhotonIsolationMap>();
}
Expand Down Expand Up @@ -82,8 +85,13 @@ void photonIsolationHIProducer::produce(edm::Event& evt, const edm::EventSetup&
reco::HIPhotonIsolationMap::Filler filler(*outputMap);
std::vector<reco::HIPhotonIsolation> isoVector;

EcalClusterIsoCalculator CxC(evt, es, barrelClusters, endcapClusters);
HcalRechitIsoCalculator RxC(evt, es, hbhe, hf, ho);
EcalClusterIsoCalculator CxC(barrelClusters, endcapClusters);
edm::ESHandle<CaloGeometry> geometryHandle = es.getHandle(geometryToken_);
const CaloGeometry* geometry = nullptr;
if (geometryHandle.isValid()) {
geometry = geometryHandle.product();
}
HcalRechitIsoCalculator RxC(geometry, hbhe, hf, ho);
TrackIsoCalculator TxC(*trackCollection, trackQuality_);
EcalClusterLazyTools lazyTool(evt, ecalClusterToolsESGetTokens_.get(es), barrelEcalHits_, endcapEcalHits_);

Expand Down
4 changes: 1 addition & 3 deletions RecoHI/HiEgammaAlgos/src/EcalClusterIsoCalculator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ using namespace edm;
using namespace reco;
using namespace std;

EcalClusterIsoCalculator::EcalClusterIsoCalculator(const edm::Event &iEvent,
const edm::EventSetup &iSetup,
const edm::Handle<BasicClusterCollection> pEBclusters,
EcalClusterIsoCalculator::EcalClusterIsoCalculator(const edm::Handle<BasicClusterCollection> pEBclusters,
const edm::Handle<BasicClusterCollection> pEEclusters) {
if (pEBclusters.isValid())
fEBclusters_ = pEBclusters.product();
Expand Down
12 changes: 2 additions & 10 deletions RecoHI/HiEgammaAlgos/src/HcalRechitIsoCalculator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"

#include "DataFormats/Common/interface/Handle.h"
Expand All @@ -13,8 +11,7 @@
using namespace edm;
using namespace reco;

HcalRechitIsoCalculator::HcalRechitIsoCalculator(const edm::Event &iEvent,
const edm::EventSetup &iSetup,
HcalRechitIsoCalculator::HcalRechitIsoCalculator(const CaloGeometry *geometry,
const edm::Handle<HBHERecHitCollection> hbhe,
const edm::Handle<HFRecHitCollection> hf,
const edm::Handle<HORecHitCollection> ho) {
Expand All @@ -33,12 +30,7 @@ HcalRechitIsoCalculator::HcalRechitIsoCalculator(const edm::Event &iEvent,
else
fHBHERecHits_ = nullptr;

ESHandle<CaloGeometry> geometryHandle;
iSetup.get<CaloGeometryRecord>().get(geometryHandle);
if (geometryHandle.isValid())
geometry_ = geometryHandle.product();
else
geometry_ = nullptr;
geometry_ = geometry;
}

double HcalRechitIsoCalculator::getHcalRechitIso(const reco::SuperClusterRef cluster,
Expand Down
7 changes: 4 additions & 3 deletions RecoHI/HiTracking/plugins/HIMultiTrackSelector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ HIMultiTrackSelector::HIMultiTrackSelector(const edm::ParameterSet &cfg)
}
mvaType_ = type;
}
if (useForestFromDB_) {
forestToken_ = esConsumes(edm::ESInputTag("", forestLabel_));
}
std::vector<edm::ParameterSet> trkSelectors(cfg.getParameter<std::vector<edm::ParameterSet>>("trackSelectors"));
qualityToSet_.reserve(trkSelectors.size());
vtxNumber_.reserve(trkSelectors.size());
Expand Down Expand Up @@ -730,9 +733,7 @@ void HIMultiTrackSelector::processMVA(edm::Event &evt,

GBRForest const *forest = forest_;
if (useForestFromDB_) {
edm::ESHandle<GBRForest> forestHandle;
es.get<GBRWrapperRcd>().get(forestLabel_, forestHandle);
forest = forestHandle.product();
forest = &es.getData(forestToken_);
}

auto gbrVal = forest->GetClassifier(&gbrValues[0]);
Expand Down
3 changes: 3 additions & 0 deletions RecoHI/HiTracking/plugins/HIMultiTrackSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ enum MVAVARIABLES {
etaerror = 14
};

class GBRWrapperRcd;

class dso_hidden HIMultiTrackSelector : public edm::stream::EDProducer<> {
private:
public:
Expand Down Expand Up @@ -175,6 +177,7 @@ class dso_hidden HIMultiTrackSelector : public edm::stream::EDProducer<> {
std::string forestLabel_;
std::vector<std::string> forestVars_;
GBRForest *forest_;
edm::ESGetToken<GBRForest, GBRWrapperRcd> forestToken_;
bool useForestFromDB_;
std::string dbFileName_;
};
Expand Down