Skip to content

Commit

Permalink
esConsumes migration of HLTrigger/special
Browse files Browse the repository at this point in the history
  • Loading branch information
missirol committed Mar 23, 2021
1 parent 94f18a4 commit 8e2ddbc
Show file tree
Hide file tree
Showing 18 changed files with 132 additions and 139 deletions.
35 changes: 19 additions & 16 deletions HLTrigger/special/plugins/EcalMIPRecHitFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ class EcalMIPRecHitFilter : public edm::EDFilter {
bool filter(edm::Event&, edm::EventSetup const&) override;

// ----------member data ---------------------------
const edm::ESGetToken<CaloTopology, CaloTopologyRecord> caloTopologyRecordToken_;
const edm::ESGetToken<EcalIntercalibConstants, EcalIntercalibConstantsRcd> ecalIntercalibConstantsRcdToken_;
const edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> ecalLaserDbRecordToken_;
const edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> ecalADCToGeVConstantRcdToken_;

const edm::EDGetTokenT<EcalRecHitCollection> EcalRecHitToken_;
const double minAmp1_;
const double minAmp2_;
Expand All @@ -75,7 +80,11 @@ class EcalMIPRecHitFilter : public edm::EDFilter {
// constructors and destructor
//
EcalMIPRecHitFilter::EcalMIPRecHitFilter(const edm::ParameterSet& iConfig)
: EcalRecHitToken_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("EcalRecHitCollection"))),
: caloTopologyRecordToken_(esConsumes()),
ecalIntercalibConstantsRcdToken_(esConsumes()),
ecalLaserDbRecordToken_(esConsumes()),
ecalADCToGeVConstantRcdToken_(esConsumes()),
EcalRecHitToken_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("EcalRecHitCollection"))),
minAmp1_(iConfig.getUntrackedParameter<double>("AmpMinSeed", 0.063)),
minAmp2_(iConfig.getUntrackedParameter<double>("AmpMin2", 0.045)),
minSingleAmp_(iConfig.getUntrackedParameter<double>("SingleAmpMin", 0.108)),
Expand Down Expand Up @@ -109,23 +118,17 @@ bool EcalMIPRecHitFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet
return false;
}

edm::ESHandle<CaloTopology> caloTopo;
iSetup.get<CaloTopologyRecord>().get(caloTopo);
auto const& caloTopo = iSetup.getHandle(caloTopologyRecordToken_);

// Intercalib constants
edm::ESHandle<EcalIntercalibConstants> pIcal;
iSetup.get<EcalIntercalibConstantsRcd>().get(pIcal);
const EcalIntercalibConstants* ical = pIcal.product();
const EcalIntercalibConstantMap& icalMap = ical->getMap();

edm::ESHandle<EcalLaserDbService> pLaser;
iSetup.get<EcalLaserDbRecord>().get(pLaser);

edm::ESHandle<EcalADCToGeVConstant> pAgc;
iSetup.get<EcalADCToGeVConstantRcd>().get(pAgc);
const EcalADCToGeVConstant* agc = pAgc.product();
//std::cout << "Global EB ADC->GeV scale: " << agc->getEBValue() << " GeV/ADC count" ;
float adcconst = agc->getEBValue();
auto const& ical = iSetup.getData(ecalIntercalibConstantsRcdToken_);
const EcalIntercalibConstantMap& icalMap = ical.getMap();

auto const& pLaser = iSetup.getHandle(ecalLaserDbRecordToken_);

auto const& agc = iSetup.getData(ecalADCToGeVConstantRcdToken_);
//std::cout << "Global EB ADC->GeV scale: " << agc.getEBValue() << " GeV/ADC count" ;
float adcconst = agc.getEBValue();

bool thereIsSignal = false;
// loop on rechits
Expand Down
15 changes: 7 additions & 8 deletions HLTrigger/special/plugins/HLTCSCOverlapFilter.cc
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#include "HLTCSCOverlapFilter.h"

#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "DataFormats/MuonDetId/interface/CSCDetId.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"

HLTCSCOverlapFilter::HLTCSCOverlapFilter(const edm::ParameterSet& iConfig)
: HLTFilter(iConfig),
muonGeometryRecordToken_(esConsumes()),
m_input(iConfig.getParameter<edm::InputTag>("input")),
m_minHits(iConfig.getParameter<unsigned int>("minHits")),
m_xWindow(iConfig.getParameter<double>("xWindow")),
Expand Down Expand Up @@ -101,7 +100,7 @@ bool HLTCSCOverlapFilter::hltFilter(edm::Event& iEvent,
std::map<int, std::vector<const CSCRecHit2D*> >::const_iterator chamber_next = chamber_tohit.find(next_id);
if (chamber_next != chamber_tohit.end() && chamber_next->second.size() >= m_minHits) {
if (!got_cscGeometry) {
iSetup.get<MuonGeometryRecord>().get(cscGeometry);
cscGeometry = iSetup.getHandle(muonGeometryRecordToken_);
got_cscGeometry = true;
}

Expand Down
4 changes: 4 additions & 0 deletions HLTrigger/special/plugins/HLTCSCOverlapFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include "HLTrigger/HLTcore/interface/HLTFilter.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"

#include "TH1F.h"

namespace edm {
Expand All @@ -23,6 +26,7 @@ class HLTCSCOverlapFilter : public HLTFilter {
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);

private:
edm::ESGetToken<CSCGeometry, MuonGeometryRecord> const muonGeometryRecordToken_;
edm::InputTag m_input;
edm::EDGetTokenT<CSCRecHit2DCollection> cscrechitsToken;
unsigned int m_minHits;
Expand Down
10 changes: 3 additions & 7 deletions HLTrigger/special/plugins/HLTCSCRing2or3Filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "DataFormats/MuonDetId/interface/CSCDetId.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "DataFormats/MuonDetId/interface/CSCDetId.h"

HLTCSCRing2or3Filter::HLTCSCRing2or3Filter(const edm::ParameterSet& iConfig)
: HLTFilter(iConfig),
muonGeometryRecordToken_(esConsumes()),
m_input(iConfig.getParameter<edm::InputTag>("input")),
m_minHits(iConfig.getParameter<unsigned int>("minHits")),
m_xWindow(iConfig.getParameter<double>("xWindow")),
Expand Down Expand Up @@ -65,7 +61,7 @@ bool HLTCSCRing2or3Filter::hltFilter(edm::Event& iEvent,
++chamber_iter) {
if (chamber_iter->second.size() >= m_minHits) {
if (!got_cscGeometry) {
iSetup.get<MuonGeometryRecord>().get(cscGeometry);
cscGeometry = iSetup.getHandle(muonGeometryRecordToken_);
got_cscGeometry = true;
}

Expand Down
6 changes: 4 additions & 2 deletions HLTrigger/special/plugins/HLTCSCRing2or3Filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include <map>

#include "HLTrigger/HLTcore/interface/HLTFilter.h"
#include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "TH1F.h"
#include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"

namespace edm {
class ConfigurationDescriptions;
Expand All @@ -23,6 +24,7 @@ class HLTCSCRing2or3Filter : public HLTFilter {
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
edm::ESGetToken<CSCGeometry, MuonGeometryRecord> const muonGeometryRecordToken_;
edm::EDGetTokenT<CSCRecHit2DCollection> cscrechitsToken;
edm::InputTag m_input;
unsigned int m_minHits;
Expand Down
9 changes: 3 additions & 6 deletions HLTrigger/special/plugins/HLTDTActivityFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ Description: Filter to select events with activity in the muon barrel system
// Fwk header files
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"
#include "DataFormats/GeometryVector/interface/Pi.h"

// Typedefs
Expand All @@ -40,7 +37,8 @@ typedef std::map<uint32_t, std::bitset<4> > activityMap; // bitset map accordin
//
// constructors and destructor
//
HLTDTActivityFilter::HLTDTActivityFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig) {
HLTDTActivityFilter::HLTDTActivityFilter(const edm::ParameterSet& iConfig)
: HLTFilter(iConfig), muonGeometryRecordToken_(esConsumes()) {
using namespace std;

inputTag_[DCC] = iConfig.getParameter<edm::InputTag>("inputDCC");
Expand Down Expand Up @@ -206,8 +204,7 @@ bool HLTDTActivityFilter::hltFilter(edm::Event& iEvent,
}

if (process_[RPC]) {
edm::ESHandle<DTGeometry> dtGeom;
iSetup.get<MuonGeometryRecord>().get(dtGeom);
auto const& dtGeom = iSetup.getHandle(muonGeometryRecordToken_);

edm::Handle<L1MuGMTReadoutCollection> gmtrc;
iEvent.getByToken(inputRPCToken_, gmtrc);
Expand Down
6 changes: 4 additions & 2 deletions HLTrigger/special/plugins/HLTDTActivityFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Description: Filter to select events with activity in the muon barrel system
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "HLTrigger/HLTcore/interface/HLTFilter.h"

#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
#include "DataFormats/DTDigi/interface/DTLocalTriggerCollection.h"
#include "DataFormats/DTDigi/interface/DTDigiCollection.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/DTGeometry/interface/DTGeometry.h"

// c++ header files
#include <bitset>
Expand Down Expand Up @@ -65,6 +65,8 @@ class HLTDTActivityFilter : public HLTFilter {

// ----------member data ---------------------------

edm::ESGetToken<DTGeometry, MuonGeometryRecord> const muonGeometryRecordToken_;

edm::InputTag inputTag_[4];
bool process_[4];
std::bitset<15> activeSecs_;
Expand Down
21 changes: 9 additions & 12 deletions HLTrigger/special/plugins/HLTEcalPhiSymFilter.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#include "HLTEcalPhiSymFilter.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Calibration/Tools/interface/EcalRingCalibrationTools.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"

HLTEcalPhiSymFilter::HLTEcalPhiSymFilter(const edm::ParameterSet& config)
: barrelDigisToken_(consumes<EBDigiCollection>(config.getParameter<edm::InputTag>("barrelDigiCollection"))),
: ecalChannelStatusRcdToken_(esConsumes()),
caloGeometryRecordToken_(esConsumes()),
barrelDigisToken_(consumes<EBDigiCollection>(config.getParameter<edm::InputTag>("barrelDigiCollection"))),
endcapDigisToken_(consumes<EEDigiCollection>(config.getParameter<edm::InputTag>("endcapDigiCollection"))),
barrelUncalibHitsToken_(
consumes<EcalUncalibratedRecHitCollection>(config.getParameter<edm::InputTag>("barrelUncalibHitCollection"))),
Expand Down Expand Up @@ -72,15 +70,14 @@ bool HLTEcalPhiSymFilter::filter(edm::StreamID, edm::Event& event, const edm::Ev
using namespace edm;
using namespace std;

//Get ChannelStatus from DB
// Get ChannelStatus from DB
edm::ESHandle<EcalChannelStatus> csHandle;
if (!useRecoFlag_)
setup.get<EcalChannelStatusRcd>().get(csHandle);
csHandle = setup.getHandle(ecalChannelStatusRcdToken_);
const EcalChannelStatus& channelStatus = *csHandle;

//Get iRing-geometry
edm::ESHandle<CaloGeometry> geoHandle;
setup.get<CaloGeometryRecord>().get(geoHandle);
// Get iRing-geometry
auto const& geoHandle = setup.getHandle(caloGeometryRecordToken_);
EcalRingCalibrationTools::setCaloGeometry(geoHandle.product());
EcalRingCalibrationTools CalibRing;

Expand Down
8 changes: 7 additions & 1 deletion HLTrigger/special/plugins/HLTEcalPhiSymFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@
#include "FWCore/Framework/interface/global/EDFilter.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"

namespace edm {
class ConfigurationDescriptions;
Expand All @@ -57,6 +60,9 @@ class HLTEcalPhiSymFilter : public edm::global::EDFilter<> {
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> const ecalChannelStatusRcdToken_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> const caloGeometryRecordToken_;

const edm::EDGetTokenT<EBDigiCollection> barrelDigisToken_;
const edm::EDGetTokenT<EEDigiCollection> endcapDigisToken_;
const edm::EDGetTokenT<EcalUncalibratedRecHitCollection> barrelUncalibHitsToken_;
Expand Down
14 changes: 8 additions & 6 deletions HLTrigger/special/plugins/HLTEcalResonanceFilter.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#include "HLTEcalResonanceFilter.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "TLorentzVector.h"

using namespace std;
using namespace edm;

HLTEcalResonanceFilter::HLTEcalResonanceFilter(const edm::ParameterSet &iConfig) {
HLTEcalResonanceFilter::HLTEcalResonanceFilter(const edm::ParameterSet &iConfig)
: caloTopologyRecordToken_(esConsumes()),
ecalChannelStatusRcdToken_(esConsumes()),
caloGeometryRecordToken_(esConsumes()) {
barrelHits_ = iConfig.getParameter<edm::InputTag>("barrelHits");
barrelClusters_ = iConfig.getParameter<edm::InputTag>("barrelClusters");
barrelHitsToken_ = consumes<EBRecHitCollection>(barrelHits_);
Expand Down Expand Up @@ -202,13 +206,11 @@ bool HLTEcalResonanceFilter::filter(edm::Event &iEvent, const edm::EventSetup &i
vector<DetId> selectedEBDetIds;
vector<DetId> selectedEEDetIds;

edm::ESHandle<CaloTopology> pTopology;
iSetup.get<CaloTopologyRecord>().get(pTopology);
auto const &pTopology = iSetup.getHandle(caloTopologyRecordToken_);
const CaloSubdetectorTopology *topology_eb = pTopology->getSubdetectorTopology(DetId::Ecal, EcalBarrel);
const CaloSubdetectorTopology *topology_ee = pTopology->getSubdetectorTopology(DetId::Ecal, EcalEndcap);

edm::ESHandle<CaloGeometry> geoHandle;
iSetup.get<CaloGeometryRecord>().get(geoHandle);
auto const &geoHandle = iSetup.getHandle(caloGeometryRecordToken_);
const CaloSubdetectorGeometry *geometry_es = geoHandle->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
std::unique_ptr<CaloSubdetectorTopology> topology_es;
if (geometry_es) {
Expand All @@ -220,7 +222,7 @@ bool HLTEcalResonanceFilter::filter(edm::Event &iEvent, const edm::EventSetup &i
///get status from DB
edm::ESHandle<EcalChannelStatus> csHandle;
if (useDBStatus_)
iSetup.get<EcalChannelStatusRcd>().get(csHandle);
csHandle = iSetup.getHandle(ecalChannelStatusRcdToken_);
const EcalChannelStatus &channelStatus = *csHandle;

///==============Start to process barrel part==================///
Expand Down
18 changes: 8 additions & 10 deletions HLTrigger/special/plugins/HLTEcalResonanceFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Description: Producer for EcalRecHits to be used for pi0/eta ECAL calibration.

// system include files
#include <memory>
#include <algorithm>
#include <utility>
#include <vector>

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
Expand Down Expand Up @@ -53,19 +56,10 @@ Description: Producer for EcalRecHits to be used for pi0/eta ECAL calibration.
#include "Geometry/CaloTopology/interface/EcalPreshowerTopology.h"
#include "DataFormats/EgammaReco/interface/PreshowerClusterFwd.h"

//
//Ecal status
// Ecal status
#include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"

// class declaration
//
#include <algorithm>
#include <utility>

#include "TLorentzVector.h"
#include <vector>

namespace edm {
class ConfigurationDescriptions;
}
Expand Down Expand Up @@ -118,6 +112,10 @@ class HLTEcalResonanceFilter : public edm::EDFilter {
static float DeltaPhi(float phi1, float phi2);
static float GetDeltaR(float eta1, float eta2, float phi1, float phi2);

edm::ESGetToken<CaloTopology, CaloTopologyRecord> const caloTopologyRecordToken_;
edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> const ecalChannelStatusRcdToken_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> const caloGeometryRecordToken_;

// Input hits & clusters
edm::InputTag barrelHits_;
edm::InputTag endcapHits_;
Expand Down
Loading

0 comments on commit 8e2ddbc

Please sign in to comment.