Skip to content

Commit

Permalink
Merge pull request #33260 from missirol/devel_1130pre4_esConsumesHLTr…
Browse files Browse the repository at this point in the history
…igger

esConsumes migration of HLTrigger/
  • Loading branch information
cmsbuild committed Mar 25, 2021
2 parents 89c9f3e + 8e2ddbc commit 667fcee
Show file tree
Hide file tree
Showing 71 changed files with 390 additions and 522 deletions.
15 changes: 0 additions & 15 deletions HLTrigger/Egamma/plugins/HLTEgammaL1MatchFilterPairs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,12 @@
* \author Monica Vazquez Acosta (CERN)
*
*/

#include "HLTEgammaL1MatchFilterPairs.h"

//#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"

#include "DataFormats/Common/interface/Handle.h"

#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"

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

#include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
#include "CondFormats/DataRecord/interface/L1CaloGeometryRecord.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include <vector>
Expand Down Expand Up @@ -143,10 +132,6 @@ bool HLTEgammaL1MatchFilterPairs::hltFilter(edm::Event& iEvent,
}
}

// Get the CaloGeometry
edm::ESHandle<L1CaloGeometry> l1CaloGeom;
iSetup.get<L1CaloGeometryRecord>().get(l1CaloGeom);

// look at all candidates, check cuts and add to filter object
int n(0);

Expand Down
16 changes: 0 additions & 16 deletions HLTrigger/Egamma/plugins/HLTEgammaL1MatchFilterRegional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,14 @@
* \author Monica Vazquez Acosta (CERN)
*
*/

#include "HLTEgammaL1MatchFilterRegional.h"

//#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"

#include "DataFormats/Common/interface/Handle.h"

#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"

#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"

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

#include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
#include "CondFormats/DataRecord/interface/L1CaloGeometryRecord.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"

#define TWOPI 6.283185308
Expand Down Expand Up @@ -92,10 +80,6 @@ bool HLTEgammaL1MatchFilterRegional::hltFilter(edm::Event& iEvent,

edm::Ref<reco::RecoEcalCandidateCollection> ref;

// Get the CaloGeometry
edm::ESHandle<L1CaloGeometry> l1CaloGeom;
iSetup.get<L1CaloGeometryRecord>().get(l1CaloGeom);

// look at all candidates, check cuts and add to filter object
int n(0);

Expand Down
18 changes: 0 additions & 18 deletions HLTrigger/Egamma/plugins/HLTEgammaL1TMatchFilterRegional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,13 @@
* \author Monica Vazquez Acosta (CERN)
*
*/

#include "HLTEgammaL1TMatchFilterRegional.h"

//#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"

#include "DataFormats/Common/interface/Handle.h"

#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"

//#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
//#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
#include "DataFormats/L1Trigger/interface/Jet.h"

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

#include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
#include "CondFormats/DataRecord/interface/L1CaloGeometryRecord.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"

#define TWOPI 6.283185308
Expand Down Expand Up @@ -103,10 +89,6 @@ bool HLTEgammaL1TMatchFilterRegional::hltFilter(edm::Event& iEvent,

edm::Ref<reco::RecoEcalCandidateCollection> ref;

// Get the CaloGeometry
edm::ESHandle<L1CaloGeometry> l1CaloGeom;
iSetup.get<L1CaloGeometryRecord>().get(l1CaloGeom);

// look at all candidates, check cuts and add to filter object
int n(0);

Expand Down
16 changes: 6 additions & 10 deletions HLTrigger/Egamma/plugins/HLTPMMassFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
* Contact: Jeremy.Werner@cern.ch
* Date: February 21, 2007
*/

#include "FWCore/Framework/interface/ESHandle.h"

#include "HLTPMMassFilter.h"

//
// constructors and destructor
//
HLTPMMassFilter::HLTPMMassFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig) {
HLTPMMassFilter::HLTPMMassFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig), magFieldToken_(esConsumes()) {
candTag_ = iConfig.getParameter<edm::InputTag>("candTag");
beamSpot_ = iConfig.getParameter<edm::InputTag>("beamSpot");
l1EGTag_ = iConfig.getParameter<edm::InputTag>("l1EGCand");
Expand Down Expand Up @@ -60,8 +57,7 @@ bool HLTPMMassFilter::hltFilter(edm::Event& iEvent,
filterproduct.addCollectionTag(l1EGTag_);
}

edm::ESHandle<MagneticField> theMagField;
iSetup.get<IdealMagneticFieldRecord>().get(theMagField);
auto const& theMagField = iSetup.getData(magFieldToken_);

edm::Handle<trigger::TriggerFilterObjectWithRefs> PrevFilterOutput;
iEvent.getByToken(candToken_, PrevFilterOutput);
Expand Down Expand Up @@ -133,10 +129,10 @@ bool HLTPMMassFilter::hltFilter(edm::Event& iEvent,
for (auto& i : scs) {
refsc = i;
const reco::SuperClusterRef sc = refsc->superCluster();
TLorentzVector pscPos = approxMomAtVtx(theMagField.product(), vertexPos, sc, 1);
TLorentzVector pscPos = approxMomAtVtx(theMagField, vertexPos, sc, 1);
pEleCh1.push_back(pscPos);

TLorentzVector pscEle = approxMomAtVtx(theMagField.product(), vertexPos, sc, -1);
TLorentzVector pscEle = approxMomAtVtx(theMagField, vertexPos, sc, -1);
pEleCh2.push_back(pscEle);
etaOrig.push_back(sc->eta());
}
Expand Down Expand Up @@ -170,13 +166,13 @@ bool HLTPMMassFilter::hltFilter(edm::Event& iEvent,
return accept;
}

TLorentzVector HLTPMMassFilter::approxMomAtVtx(const MagneticField* magField,
TLorentzVector HLTPMMassFilter::approxMomAtVtx(const MagneticField& magField,
const GlobalPoint& xvert,
const reco::SuperClusterRef sc,
int charge) const {
GlobalPoint xsc(sc->position().x(), sc->position().y(), sc->position().z());
float energy = sc->energy();
auto theFTS = trackingTools::ftsFromVertexToPoint(*magField, xsc, xvert, energy, charge);
auto theFTS = trackingTools::ftsFromVertexToPoint(magField, xsc, xvert, energy, charge);
float theApproxMomMod = theFTS.momentum().x() * theFTS.momentum().x() +
theFTS.momentum().y() * theFTS.momentum().y() + theFTS.momentum().z() * theFTS.momentum().z();
TLorentzVector theApproxMom(
Expand Down
51 changes: 15 additions & 36 deletions HLTrigger/Egamma/plugins/HLTPMMassFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,25 @@
* Date: February 21, 2007
*/

#include "HLTrigger/HLTcore/interface/HLTFilter.h"

#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "TrackingTools/TrajectoryState/interface/ftsFromVertexToPoint.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
#include "DataFormats/Math/interface/Point3D.h"

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

#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "MagneticField/Engine/interface/MagneticField.h"

#include "DataFormats/Common/interface/Handle.h"

#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

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

#include "DataFormats/EgammaCandidates/interface/Electron.h"
#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
#include "DataFormats/EgammaReco/interface/SuperCluster.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"

#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "DataFormats/Math/interface/Point3D.h"
#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
#include "DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "HLTrigger/HLTcore/interface/HLTFilter.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "MagneticField/Engine/interface/MagneticField.h"
#include "TrackingTools/TrajectoryState/interface/ftsFromVertexToPoint.h"

#include "DataFormats/EgammaCandidates/interface/Electron.h"
#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"

// TEST
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"

#include "TFile.h"
#include "TDirectory.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TLorentzVector.h"
#include "TVector3.h"

//
// class declaration
//

class HLTPMMassFilter : public HLTFilter {
public:
Expand All @@ -62,7 +39,7 @@ class HLTPMMassFilter : public HLTFilter {
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
TLorentzVector approxMomAtVtx(const MagneticField* magField,
TLorentzVector approxMomAtVtx(const MagneticField& magField,
const GlobalPoint& xvert,
const reco::SuperClusterRef sc,
int charge) const;
Expand All @@ -79,6 +56,8 @@ class HLTPMMassFilter : public HLTFilter {
bool isElectron1_;
bool isElectron2_;
edm::InputTag l1EGTag_;

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> const magFieldToken_;
};

#endif //HLTPMMassFilter_h
1 change: 0 additions & 1 deletion HLTrigger/HLTanalyzers/plugins/HLTBitAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "DataFormats/L1TGlobal/interface/GlobalAlgBlk.h"
#include "DataFormats/L1TGlobal/interface/GlobalExtBlk.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"
Expand Down
8 changes: 3 additions & 5 deletions HLTrigger/HLTanalyzers/plugins/HLTGetDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <map>

#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/InputTag.h"
Expand All @@ -26,7 +25,7 @@ using namespace std;
//
// constructors and destructor
//
HLTGetDigi::HLTGetDigi(const edm::ParameterSet& ps) {
HLTGetDigi::HLTGetDigi(const edm::ParameterSet& ps) : l1GtParamsToken_(esConsumes()) {
EBdigiCollection_ = ps.getParameter<edm::InputTag>("EBdigiCollection");
EEdigiCollection_ = ps.getParameter<edm::InputTag>("EEdigiCollection");
ESdigiCollection_ = ps.getParameter<edm::InputTag>("ESdigiCollection");
Expand Down Expand Up @@ -295,9 +294,8 @@ void HLTGetDigi::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup
edm::Handle<L1GlobalTriggerObjectMapRecord> gtMap;
edm::Handle<L1GlobalTriggerReadoutRecord> gtRR;

edm::ESHandle<L1GtParameters> l1GtPar;
iSetup.get<L1GtParametersRcd>().get(l1GtPar);
int nBx = l1GtPar->gtTotalBxInEvent();
auto const& l1GtParamsHandle = iSetup.getHandle(l1GtParamsToken_);
auto const nBx = l1GtParamsHandle->gtTotalBxInEvent();

std::unique_ptr<L1GlobalTriggerEvmReadoutRecord> newGtEvm(new L1GlobalTriggerEvmReadoutRecord(nBx));
std::unique_ptr<L1GlobalTriggerObjectMapRecord> newGtMap(new L1GlobalTriggerObjectMapRecord());
Expand Down
2 changes: 2 additions & 0 deletions HLTrigger/HLTanalyzers/plugins/HLTGetDigi.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class HLTGetDigi : public edm::EDAnalyzer {
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
edm::ESGetToken<L1GtParameters, L1GtParametersRcd> const l1GtParamsToken_;

edm::InputTag EBdigiCollection_;
edm::EDGetTokenT<EBDigiCollection> EBdigiToken_;
edm::InputTag EEdigiCollection_;
Expand Down
4 changes: 2 additions & 2 deletions HLTrigger/HLTanalyzers/plugins/HLTInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ void HLTInfo::analyze(const edm::Handle<edm::TriggerResults>& hltresults,
if (id != cache_id_) {
cache_id_ = id;
*/
edm::ESHandle<L1TUtmTriggerMenu> menu;
eventSetup.get<L1TUtmTriggerMenuRcd>().get(menu);
auto const& menu = eventSetup.getHandle(l1tUtmTriggerMenuToken_);

//std::map<std::string, L1TUtmAlgorithm> const & algorithmMap_ = &(menu->getAlgorithmMap());
/*
// get the bit/name association
Expand Down
18 changes: 11 additions & 7 deletions HLTrigger/HLTanalyzers/plugins/HLTInfo.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef HLTINFO_H
#define HLTINFO_H

#include <memory>
#include <vector>
#include <map>

Expand All @@ -26,7 +27,6 @@
#include "DataFormats/L1TGlobal/interface/GlobalExtBlk.h"
#include "DataFormats/METReco/interface/CaloMETCollection.h"
#include "FWCore/Common/interface/Provenance.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventPrincipal.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "HLTrigger/HLTcore/interface/HLTPrescaleProvider.h"
Expand All @@ -41,13 +41,14 @@ namespace edm {
typedef std::vector<std::string> MyStrings;

/** \class HLTInfo
*
*
* $Date: November 2006
* $Revision:
* $Revision:
* \author P. Bargassa - Rice U.
* $Date: April 2016
* $Revision:
* \author G. Karapostoli - ULB
* $Date: April 2016
* $Revision:
* \author G. Karapostoli - ULB
*/
class HLTInfo {
public:
Expand All @@ -72,6 +73,8 @@ class HLTInfo {
private:
HLTInfo();

edm::ESGetToken<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd> l1tUtmTriggerMenuToken_;

// Tree variables
float *hltppt, *hltpeta;
int L1EvtCnt, HltEvtCnt, nhltpart;
Expand Down Expand Up @@ -109,7 +112,8 @@ HLTInfo::HLTInfo(edm::ParameterSet const& pset, edm::ConsumesCollector&& iC, T&

template <typename T>
HLTInfo::HLTInfo(edm::ParameterSet const& pset, edm::ConsumesCollector& iC, T& module) : HLTInfo() {
hltPrescaleProvider_.reset(new HLTPrescaleProvider(pset, iC, module));
l1tUtmTriggerMenuToken_ = iC.esConsumes<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd>();
hltPrescaleProvider_ = std::make_unique<HLTPrescaleProvider>(pset, iC, module);
}

#endif
3 changes: 2 additions & 1 deletion HLTrigger/HLTcore/interface/HLTPrescaleRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "DataFormats/HLTReco/interface/HLTPrescaleTable.h"
#include "CondFormats/HLTObjects/interface/HLTPrescaleTableCond.h"
#include "CondFormats/DataRecord/interface/HLTPrescaleTableRcd.h"

#include <map>
#include <string>
Expand Down Expand Up @@ -76,6 +77,7 @@ class HLTPrescaleRecorder : public edm::one::EDProducer<edm::EndRunProducer,
edm::EDGetTokenT<trigger::HLTPrescaleTable> hltInputToken_;
/// Tag of DB entry (HLT Key Name) (src=4)
std::string hltDBTag_;
edm::ESGetToken<trigger::HLTPrescaleTableCond, HLTPrescaleTableRcd> const hltPrescaleTableCondToken_;

/// Prescale service
edm::service::PrescaleService* ps_;
Expand All @@ -84,7 +86,6 @@ class HLTPrescaleRecorder : public edm::one::EDProducer<edm::EndRunProducer,

/// Handle and ESHandle for existing HLT object
edm::Handle<trigger::HLTPrescaleTable> hltHandle_;
edm::ESHandle<trigger::HLTPrescaleTableCond> hltESHandle_;

/// payload HLT object
trigger::HLTPrescaleTable hlt_;
Expand Down
Loading

0 comments on commit 667fcee

Please sign in to comment.