Skip to content

Commit

Permalink
added esConsumes to modules in L1Trigger/CSCTrackFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
JamminJones committed Jun 8, 2020
1 parent c012e23 commit ec53604
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
18 changes: 6 additions & 12 deletions L1Trigger/CSCTrackFinder/plugins/CSCTFTrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@
#include "DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h"
#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h"
#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"

#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"

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

#include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
#include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
#include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
#include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"

CSCTFTrackProducer::CSCTFTrackProducer(const edm::ParameterSet& pset)
: my_dtrc{},
Expand All @@ -30,6 +23,9 @@ CSCTFTrackProducer::CSCTFTrackProducer(const edm::ParameterSet& pset)
dt_producer{consumes<L1MuDTChambPhContainer>(pset.getUntrackedParameter<edm::InputTag>("DTproducer"))},
directProd{
consumes<CSCTriggerContainer<csctf::TrackStub> >(pset.getUntrackedParameter<edm::InputTag>("DtDirectProd"))},
m_scalesToken(esConsumes<L1MuTriggerScales, L1MuTriggerScalesRcd>()),
m_ptScaleToken(esConsumes<L1MuTriggerPtScale, L1MuTriggerPtScaleRcd>()),
m_pDDToken(esConsumes<CSCGeometry, MuonGeometryRecord>()),
sp_pset{pset.getParameter<edm::ParameterSet>("SectorProcessor")} {
m_scalesCacheID = 0ULL;
m_ptScaleCacheID = 0ULL;
Expand All @@ -49,10 +45,9 @@ void CSCTFTrackProducer::produce(edm::Event& e, const edm::EventSetup& c) {
// EventSetup cacheIdentifier to tell when this has happened.
if (c.get<L1MuTriggerScalesRcd>().cacheIdentifier() != m_scalesCacheID ||
c.get<L1MuTriggerPtScaleRcd>().cacheIdentifier() != m_ptScaleCacheID) {
edm::ESHandle<L1MuTriggerScales> scales;
c.get<L1MuTriggerScalesRcd>().get(scales);
edm::ESHandle<L1MuTriggerScales> scales = c.getHandle(m_scalesToken);

edm::ESHandle<L1MuTriggerPtScale> ptScale;
edm::ESHandle<L1MuTriggerPtScale> ptScale = c.getHandle(m_ptScaleToken);
c.get<L1MuTriggerPtScaleRcd>().get(ptScale);

my_builder = std::make_unique<CSCTFTrackBuilder>(sp_pset, TMB07, scales.product(), ptScale.product());
Expand All @@ -63,8 +58,7 @@ void CSCTFTrackProducer::produce(edm::Event& e, const edm::EventSetup& c) {
}

// set geometry pointer
edm::ESHandle<CSCGeometry> pDD;
c.get<MuonGeometryRecord>().get(pDD);
edm::ESHandle<CSCGeometry> pDD = c.getHandle(m_pDDToken);

edm::Handle<CSCCorrelatedLCTDigiCollection> LCTs;
std::unique_ptr<L1CSCTrackCollection> track_product(new L1CSCTrackCollection);
Expand Down
8 changes: 8 additions & 0 deletions L1Trigger/CSCTrackFinder/plugins/CSCTFTrackProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "L1Trigger/CSCTrackFinder/src/CSCTFDTReceiver.h"
#include "L1Trigger/CSCTrackFinder/src/CSCTFTrackBuilder.h"
#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
#include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
#include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"

class CSCTFTrackBuilder;
class L1MuDTChambPhContainer;
Expand All @@ -33,6 +38,9 @@ class CSCTFTrackProducer : public edm::one::EDProducer<edm::one::SharedResources
const edm::EDGetTokenT<CSCCorrelatedLCTDigiCollection> input_module;
const edm::EDGetTokenT<L1MuDTChambPhContainer> dt_producer;
const edm::EDGetTokenT<CSCTriggerContainer<csctf::TrackStub> > directProd;
const edm::ESGetToken<L1MuTriggerScales, L1MuTriggerScalesRcd> m_scalesToken;
const edm::ESGetToken<L1MuTriggerPtScale, L1MuTriggerPtScaleRcd> m_ptScaleToken;
const edm::ESGetToken<CSCGeometry, MuonGeometryRecord> m_pDDToken;
const edm::ParameterSet sp_pset;
unsigned long long m_scalesCacheID;
unsigned long long m_ptScaleCacheID;
Expand Down
5 changes: 2 additions & 3 deletions L1Trigger/CSCTrackFinder/plugins/CSCTFanalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h"
#include "DataFormats/L1CSCTrackFinder/interface/L1CSCTrackCollection.h"
#include "DataFormats/L1CSCTrackFinder/interface/TrackStub.h"
#include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
#include <DataFormats/L1CSCTrackFinder/interface/CSCTriggerContainer.h>
#include <DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h>

Expand All @@ -12,6 +11,7 @@ CSCTFanalyzer::CSCTFanalyzer(edm::ParameterSet const& pset) : edm::EDAnalyzer()
emulTrackProducer = pset.getUntrackedParameter<edm::InputTag>("emulTrackProducer", edm::InputTag("csctfTrackDigis"));
lctProducer = pset.getUntrackedParameter<edm::InputTag>("lctProducer", edm::InputTag("csctfDigis"));
mbProducer = pset.getUntrackedParameter<edm::InputTag>("mbProducer", edm::InputTag("csctfDigis"));
scalesToken = esConsumes<L1MuTriggerScales, L1MuTriggerScalesRcd>();
file = new TFile("qwe.root", "RECREATE");
tree = new TTree("dy", "QWE");
tree->Branch("nDataMuons", &nDataMuons, "nDataMuons/I");
Expand Down Expand Up @@ -74,8 +74,7 @@ void CSCTFanalyzer::endJob(void) {

void CSCTFanalyzer::analyze(edm::Event const& e, edm::EventSetup const& es) {
if (!ts) {
edm::ESHandle<L1MuTriggerScales> scales;
es.get<L1MuTriggerScalesRcd>().get(scales);
edm::ESHandle<L1MuTriggerScales> scales = es.getHandle(scalesToken);
ts = scales.product();
}

Expand Down
3 changes: 3 additions & 0 deletions L1Trigger/CSCTrackFinder/plugins/CSCTFanalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
#include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"

#include "TTree.h"
#include "TFile.h"

class CSCTFanalyzer : public edm::EDAnalyzer {
private:
edm::InputTag lctProducer, mbProducer, dataTrackProducer, emulTrackProducer;
edm::ESGetToken<L1MuTriggerScales, L1MuTriggerScalesRcd> scalesToken;
TTree* tree;
TFile* file;
int nDataMuons, nEmulMuons, verbose;
Expand Down

0 comments on commit ec53604

Please sign in to comment.