Skip to content

Commit

Permalink
Migrate rest of SiStripMonitorDigi to EventSetup consumes
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel committed Oct 13, 2020
1 parent 4d4b10f commit 29204ea
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
8 changes: 7 additions & 1 deletion DQM/SiStripMonitorDigi/interface/SiStripMonitorDigi.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// Original Author: dkcira
// Created: Sat Feb 4 20:49:51 CET 2006
#include <memory>
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/LuminosityBlock.h"
Expand Down Expand Up @@ -146,7 +147,7 @@ class SiStripMonitorDigi : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<boo
std::vector<const edm::DetSetVector<SiStripDigi>*> digi_detset_handles;

unsigned long long m_cacheID_;
edm::ESHandle<SiStripDetCabling> SiStripDetCabling_;
const SiStripDetCabling* SiStripDetCabling_;
std::vector<uint32_t> ModulesToBeExcluded_;

//Global MEs to monitor APV Shots properties
Expand Down Expand Up @@ -227,6 +228,11 @@ class SiStripMonitorDigi : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<boo
edm::EDGetTokenT<EventWithHistory> historyProducerToken_;
edm::EDGetTokenT<APVCyclePhaseCollection> apvPhaseProducerToken_;
edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> gtEvmToken_;
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoTokenRun_;
edm::ESGetToken<TkDetMap, TrackerTopologyRcd> tkDetMapTokenRun_;
edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> SiStripDetCablingTokenRun_;
edm::ESGetToken<RunInfo, RunInfoRcd> runInfoTokenRun_;
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken_;

SiStripDCSStatus* dcsStatus_;
};
Expand Down
30 changes: 15 additions & 15 deletions DQM/SiStripMonitorDigi/src/SiStripMonitorDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GtFdlWord.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "Geometry/Records/interface/TrackerTopologyRcd.h"

/* mia: but is there not a smarter way ?!?!?! */
Expand Down Expand Up @@ -178,6 +177,16 @@ SiStripMonitorDigi::SiStripMonitorDigi(const edm::ParameterSet& iConfig)

gtEvmToken_ = consumes<L1GlobalTriggerEvmReadoutRecord>(edm::InputTag("gtEvmDigis"));

if (show_mechanical_structure_view) {
tTopoTokenRun_ = esConsumes<edm::Transition::BeginRun>();
tkDetMapTokenRun_ = esConsumes<edm::Transition::BeginRun>();
SiStripDetCablingTokenRun_ = esConsumes<edm::Transition::BeginRun>();
}
if (subdetswitchtotdigifailureon) {
runInfoTokenRun_ = esConsumes<edm::Transition::BeginRun>();
}
tTopoToken_ = esConsumes();

// Create DCS Status
bool checkDCS = conf_.getParameter<bool>("UseDCSFiltering");
if (checkDCS)
Expand Down Expand Up @@ -225,8 +234,6 @@ void SiStripMonitorDigi::dqmBeginRun(const edm::Run& run, const edm::EventSetup&
if (m_cacheID_ != cacheID) {
m_cacheID_ = cacheID;
}
edm::ESHandle<SiStripDetCabling> detCabling_;
es.get<SiStripDetCablingRcd>().get(detCabling_);

//nFEDConnected = 0;
nFedTIB = 0;
Expand All @@ -240,8 +247,7 @@ void SiStripMonitorDigi::dqmBeginRun(const edm::Run& run, const edm::EventSetup&
//const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;

if (auto runInfoRec = es.tryToGet<RunInfoRcd>()) {
edm::ESHandle<RunInfo> sumFED;
runInfoRec->get(sumFED);
edm::ESHandle<RunInfo> sumFED = runInfoRec->getHandle(runInfoTokenRun_);

if (sumFED.isValid()) {
std::vector<int> FedsInIds = sumFED->m_fed_in;
Expand Down Expand Up @@ -312,15 +318,11 @@ void SiStripMonitorDigi::globalEndLuminosityBlock(const edm::LuminosityBlock& lb
void SiStripMonitorDigi::createMEs(DQMStore::IBooker& ibooker, const edm::EventSetup& es) {
if (show_mechanical_structure_view) {
//Retrieve tracker topology from geometry
edm::ESHandle<TrackerTopology> tTopoHandle;
es.get<TrackerTopologyRcd>().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();
edm::ESHandle<TkDetMap> tkDetMapHandle;
es.get<TrackerTopologyRcd>().get(tkDetMapHandle);
const TkDetMap* tkDetMap = tkDetMapHandle.product();
const TrackerTopology* const tTopo = &es.getData(tTopoTokenRun_);
const TkDetMap* tkDetMap = &es.getData(tkDetMapTokenRun_);

// take from eventSetup the SiStripDetCabling object - here will use SiStripDetControl later on
es.get<SiStripDetCablingRcd>().get(SiStripDetCabling_);
SiStripDetCabling_ = &es.getData(SiStripDetCablingTokenRun_);

// get list of active detectors from SiStripDetCabling
std::vector<uint32_t> activeDets;
Expand Down Expand Up @@ -576,9 +578,7 @@ void SiStripMonitorDigi::analyze(const edm::Event& iEvent, const edm::EventSetup
return;

//Retrieve tracker topology from geometry
edm::ESHandle<TrackerTopology> tTopoHandle;
iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();
const TrackerTopology* const tTopo = &iSetup.getData(tTopoToken_);

TotalNShots = 0;

Expand Down

0 comments on commit 29204ea

Please sign in to comment.