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

RPC DQM migration to use ESGetToken #33787

Merged
merged 3 commits into from May 21, 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
5 changes: 5 additions & 0 deletions DQM/RPCMonitorClient/interface/RPCDCSSummary.h
Expand Up @@ -3,6 +3,9 @@

#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "CondFormats/RunInfo/interface/RunSummary.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
#include <map>

class RPCDCSSummary : public DQMEDHarvester {
Expand All @@ -27,6 +30,8 @@ class RPCDCSSummary : public DQMEDHarvester {
void myBooker(DQMStore::IBooker &);
void checkDCSbit(edm::EventSetup const &);

edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;

bool init_;
double defaultValue_;

Expand Down
5 changes: 5 additions & 0 deletions DQM/RPCMonitorClient/interface/RPCDaqInfo.h
Expand Up @@ -8,6 +8,9 @@
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "CondFormats/RunInfo/interface/RunSummary.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"

class RPCDaqInfo : public DQMEDHarvester {
public:
Expand All @@ -25,6 +28,8 @@ class RPCDaqInfo : public DQMEDHarvester {
private:
void myBooker(DQMStore::IBooker &);

edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;

bool init_;

MonitorElement *DaqFraction_;
Expand Down
5 changes: 5 additions & 0 deletions DQM/RPCMonitorClient/interface/RPCDataCertification.h
Expand Up @@ -4,6 +4,9 @@
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "CondFormats/RunInfo/interface/RunSummary.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"

class RPCDataCertification : public DQMEDHarvester {
public:
Expand All @@ -25,6 +28,8 @@ class RPCDataCertification : public DQMEDHarvester {
void myBooker(DQMStore::IBooker&);
void checkFED(edm::EventSetup const&);

edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;

MonitorElement* CertMap_;
MonitorElement* totalCertFraction;
constexpr static int kNWheels = 5;
Expand Down
5 changes: 5 additions & 0 deletions DQM/RPCMonitorClient/interface/RPCDqmClient.h
Expand Up @@ -6,6 +6,9 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DQM/RPCMonitorClient/interface/RPCClient.h"

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

#include <string>
#include <vector>

Expand Down Expand Up @@ -44,5 +47,7 @@ class RPCDqmClient : public DQMEDHarvester {
std::vector<RPCClient *> clientModules_;

std::vector<int> clientTag_;

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeomToken_;
};
#endif
6 changes: 6 additions & 0 deletions DQM/RPCMonitorClient/interface/RPCEventSummary.h
Expand Up @@ -4,6 +4,9 @@
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/DQMEDHarvester.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "CondFormats/RunInfo/interface/RunSummary.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"

#include <string>

Expand All @@ -25,6 +28,9 @@ class RPCEventSummary : public DQMEDHarvester {

private:
void clientOperation(DQMStore::IGetter &igetter);

edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;

std::string eventInfoPath_, prefixDir_;

// bool tier0_;
Expand Down
2 changes: 2 additions & 0 deletions DQM/RPCMonitorClient/interface/RPCMonitorLinkSynchro.h
Expand Up @@ -9,6 +9,7 @@

#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "CondFormats/RPCObjects/interface/RPCEMap.h"
#include "CondFormats/DataRecord/interface/RPCEMapRcd.h"

#include "DQM/RPCMonitorClient/interface/RPCLinkSynchroStat.h"
Expand Down Expand Up @@ -40,6 +41,7 @@ class RPCMonitorLinkSynchro : public DQMOneEDAnalyzer<edm::one::WatchLuminosityB
protected:
edm::ParameterSet theConfig;
edm::ESWatcher<RPCEMapRcd> theCablingWatcher;
edm::ESGetToken<RPCEMap, RPCEMapRcd> rpcEMapToken_;
RPCLinkSynchroStat theSynchroStat;

MonitorElement* me_delaySummary;
Expand Down
9 changes: 4 additions & 5 deletions DQM/RPCMonitorClient/src/RPCDCSSummary.cc
Expand Up @@ -8,8 +8,6 @@
//#include "DQMServices/Core/interface/DQMStore.h"

//CondFormats
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"

RPCDCSSummary::RPCDCSSummary(const edm::ParameterSet& ps) {
numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
Expand All @@ -22,6 +20,8 @@ RPCDCSSummary::RPCDCSSummary(const edm::ParameterSet& ps) {
NumberOfFeds_ = FEDRange_.second - FEDRange_.first + 1;
init_ = false;
defaultValue_ = 1.;

runInfoToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();
}

RPCDCSSummary::~RPCDCSSummary() {}
Expand Down Expand Up @@ -52,9 +52,8 @@ void RPCDCSSummary::checkDCSbit(edm::EventSetup const& setup) {
if (auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
defaultValue_ = -1.;
//get fed summary information
edm::ESHandle<RunInfo> sumFED;
runInfoRec->get(sumFED);
std::vector<int> FedsInIds = sumFED->m_fed_in;
auto sumFED = runInfoRec->get(runInfoToken_);
const std::vector<int> FedsInIds = sumFED.m_fed_in;
unsigned int f = 0;
bool flag = false;
while (!flag && f < FedsInIds.size()) {
Expand Down
10 changes: 4 additions & 6 deletions DQM/RPCMonitorClient/src/RPCDaqInfo.cc
@@ -1,8 +1,5 @@
#include "DQM/RPCMonitorClient/interface/RPCDaqInfo.h"
#include "DataFormats/FEDRawData/interface/FEDNumbering.h"
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "CondFormats/RunInfo/interface/RunSummary.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"

Expand All @@ -14,6 +11,8 @@ RPCDaqInfo::RPCDaqInfo(const edm::ParameterSet& ps) {

numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);

runInfoToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();

init_ = false;
}

Expand All @@ -29,9 +28,8 @@ void RPCDaqInfo::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker,

if (auto runInfoRec = iSetup.tryToGet<RunInfoRcd>()) {
//get fed summary information
edm::ESHandle<RunInfo> sumFED;
runInfoRec->get(sumFED);
std::vector<int> FedsInIds = sumFED->m_fed_in;
auto sumFED = runInfoRec->get(runInfoToken_);
const std::vector<int> FedsInIds = sumFED.m_fed_in;

int FedCount = 0;

Expand Down
10 changes: 4 additions & 6 deletions DQM/RPCMonitorClient/src/RPCDataCertification.cc
Expand Up @@ -6,9 +6,6 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "DQMServices/Core/interface/DQMStore.h"
//CondFormats
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"

RPCDataCertification::RPCDataCertification(const edm::ParameterSet& ps) {
numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
Expand All @@ -17,6 +14,8 @@ RPCDataCertification::RPCDataCertification(const edm::ParameterSet& ps) {
NumberOfFeds_ = FEDRange_.second - FEDRange_.first + 1;
offlineDQM_ = ps.getUntrackedParameter<bool>("OfflineDQM", true);

runInfoToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();

init_ = false;
defaultValue_ = 1.;
}
Expand Down Expand Up @@ -50,9 +49,8 @@ void RPCDataCertification::checkFED(edm::EventSetup const& setup) {
if (auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
defaultValue = -1;
//get fed summary information
edm::ESHandle<RunInfo> sumFED;
runInfoRec->get(sumFED);
std::vector<int> FedsInIds = sumFED->m_fed_in;
auto sumFED = runInfoRec->get(runInfoToken_);
const std::vector<int> FedsInIds = sumFED.m_fed_in;
unsigned int f = 0;
bool flag = false;
while (!flag && f < FedsInIds.size()) {
Expand Down
6 changes: 3 additions & 3 deletions DQM/RPCMonitorClient/src/RPCDqmClient.cc
Expand Up @@ -11,7 +11,6 @@
#include "DQM/RPCMonitorClient/interface/RPCOccupancyTest.h"
#include "DQM/RPCMonitorClient/interface/RPCNoisyStripTest.h"
//Geometry
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"
#include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
//Framework
Expand Down Expand Up @@ -49,6 +48,8 @@ RPCDqmClient::RPCDqmClient(const edm::ParameterSet& parameters_) {

//clear counters
lumiCounter_ = 0;

rpcGeomToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();
}

RPCDqmClient::~RPCDqmClient() {}
Expand Down Expand Up @@ -180,8 +181,7 @@ void RPCDqmClient::getMonitorElements(DQMStore::IGetter& igetter) {
void RPCDqmClient::getRPCdetId(const edm::EventSetup& eventSetup) {
myDetIds_.clear();

edm::ESHandle<RPCGeometry> rpcGeo;
eventSetup.get<MuonGeometryRecord>().get(rpcGeo);
auto rpcGeo = eventSetup.getHandle(rpcGeomToken_);

for (auto& det : rpcGeo->dets()) {
const RPCChamber* ch = dynamic_cast<const RPCChamber*>(det);
Expand Down
10 changes: 4 additions & 6 deletions DQM/RPCMonitorClient/src/RPCEventSummary.cc
Expand Up @@ -2,9 +2,6 @@
#include <sstream>

#include <DQM/RPCMonitorClient/interface/RPCEventSummary.h>
//CondFormats
#include "CondFormats/RunInfo/interface/RunInfo.h"
#include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
// Framework
#include "FWCore/MessageLogger/interface/MessageLogger.h"
//#include "FWCore/Framework/interface/LuminosityBlock.h"
Expand Down Expand Up @@ -36,6 +33,8 @@ RPCEventSummary::RPCEventSummary(const edm::ParameterSet& ps) {
NumberOfFeds_ = FEDRange_.second - FEDRange_.first + 1;

offlineDQM_ = ps.getUntrackedParameter<bool>("OfflineDQM", true);

runInfoToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();
}

RPCEventSummary::~RPCEventSummary() { edm::LogVerbatim("rpceventsummary") << "[RPCEventSummary]: Destructor "; }
Expand Down Expand Up @@ -63,9 +62,8 @@ void RPCEventSummary::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker,
if (auto runInfoRec = setup.tryToGet<RunInfoRcd>()) {
defaultValue = -1;
//get fed summary information
edm::ESHandle<RunInfo> sumFED;
runInfoRec->get(sumFED);
std::vector<int> FedsInIds = sumFED->m_fed_in;
auto sumFED = runInfoRec->get(runInfoToken_);
const std::vector<int> FedsInIds = sumFED.m_fed_in;
unsigned int f = 0;
isIn_ = false;
while (!isIn_ && f < FedsInIds.size()) {
Expand Down
5 changes: 2 additions & 3 deletions DQM/RPCMonitorClient/src/RPCMonitorLinkSynchro.cc
Expand Up @@ -10,7 +10,6 @@
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESTransientHandle.h"

#include "CondFormats/RPCObjects/interface/RPCEMap.h"
#include "CondFormats/RPCObjects/interface/RPCReadOutMapping.h"

RPCMonitorLinkSynchro::RPCMonitorLinkSynchro(const edm::ParameterSet& cfg)
Expand All @@ -20,6 +19,7 @@ RPCMonitorLinkSynchro::RPCMonitorLinkSynchro(const edm::ParameterSet& cfg)
{
rpcRawSynchroProdItemTag_ =
consumes<RPCRawSynchro::ProdItem>(cfg.getParameter<edm::InputTag>("rpcRawSynchroProdItemTag"));
rpcEMapToken_ = esConsumes<edm::Transition::BeginRun>();
}

RPCMonitorLinkSynchro::~RPCMonitorLinkSynchro() {}
Expand All @@ -31,8 +31,7 @@ void RPCMonitorLinkSynchro::endLuminosityBlock(const edm::LuminosityBlock& ls, c

void RPCMonitorLinkSynchro::dqmBeginRun(const edm::Run& r, const edm::EventSetup& es) {
if (theCablingWatcher.check(es)) {
edm::ESTransientHandle<RPCEMap> readoutMapping;
es.get<RPCEMapRcd>().get(readoutMapping);
edm::ESTransientHandle<RPCEMap> readoutMapping = es.getTransientHandle(rpcEMapToken_);
std::unique_ptr<RPCReadOutMapping const> cabling{readoutMapping->convert()};
edm::LogInfo("RPCMonitorLinkSynchro")
<< "RPCMonitorLinkSynchro - record has CHANGED!!, read map, VERSION: " << cabling->version();
Expand Down
3 changes: 3 additions & 0 deletions DQM/RPCMonitorDigi/interface/RPCMonitorDigi.h
Expand Up @@ -9,6 +9,7 @@
#include "DQMServices/Core/interface/DQMStore.h"

#include "Geometry/RPCGeometry/interface/RPCGeometry.h"
#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "DataFormats/Scalers/interface/DcsStatus.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"
Expand Down Expand Up @@ -76,6 +77,8 @@ class RPCMonitorDigi : public DQMEDAnalyzer {
edm::EDGetTokenT<reco::CandidateView> muonLabel_;
edm::EDGetTokenT<RPCRecHitCollection> rpcRecHitLabel_;
edm::EDGetTokenT<DcsStatusCollection> scalersRawToDigiLabel_;

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeomToken_;
};

#endif
17 changes: 8 additions & 9 deletions DQM/RPCMonitorDigi/src/RPCMonitorDigi.cc
@@ -1,7 +1,6 @@
#include "DQM/RPCMonitorDigi/interface/RPCMonitorDigi.h"
#include "DQM/RPCMonitorDigi/interface/utils.h"

#include "Geometry/Records/interface/MuonGeometryRecord.h"
#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "Geometry/RPCGeometry/interface/RPCGeomServ.h"
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"
Expand Down Expand Up @@ -38,19 +37,19 @@ RPCMonitorDigi::RPCMonitorDigi(const edm::ParameterSet& pset)

noiseFolder_ = pset.getUntrackedParameter<std::string>("NoiseFolder", "AllHits");
muonFolder_ = pset.getUntrackedParameter<std::string>("MuonFolder", "Muon");

rpcGeomToken_ = esConsumes<edm::Transition::BeginRun>();
}

void RPCMonitorDigi::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& r, edm::EventSetup const& iSetup) {
edm::LogInfo("rpcmonitordigi") << "[RPCMonitorDigi]: Begin Run ";

std::set<int> disk_set, ring_set;
edm::ESHandle<RPCGeometry> rpcGeoHandle;
iSetup.get<MuonGeometryRecord>().get(rpcGeoHandle);
const RPCGeometry* rpcGeo = rpcGeoHandle.product();
const auto& rpcGeo = iSetup.getData(rpcGeomToken_);

//loop on geometry to book all MEs
edm::LogInfo("rpcmonitordigi") << "[RPCMonitorDigi]: Booking histograms per roll. ";
for (TrackingGeometry::DetContainer::const_iterator it = rpcGeo->dets().begin(); it < rpcGeo->dets().end(); it++) {
for (TrackingGeometry::DetContainer::const_iterator it = rpcGeo.dets().begin(); it < rpcGeo.dets().end(); it++) {
if (dynamic_cast<const RPCChamber*>(*it) != nullptr) {
const RPCChamber* ch = dynamic_cast<const RPCChamber*>(*it);
std::vector<const RPCRoll*> roles = (ch->rolls());
Expand All @@ -68,16 +67,16 @@ void RPCMonitorDigi::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&
RPCGeomServ rpcsrv(rpcId);
std::string nameID = rpcsrv.name();
if (useMuonDigis_)
bookRollME(ibooker, rpcId, rpcGeo, muonFolder_, meMuonCollection[nameID]);
bookRollME(ibooker, rpcId, rpcGeo, noiseFolder_, meNoiseCollection[nameID]);
bookRollME(ibooker, rpcId, &rpcGeo, muonFolder_, meMuonCollection[nameID]);
bookRollME(ibooker, rpcId, &rpcGeo, noiseFolder_, meNoiseCollection[nameID]);
}
} else {
RPCDetId rpcId = roles[0]->id(); //any roll would do - here I just take the first one
RPCGeomServ rpcsrv(rpcId);
std::string nameID = rpcsrv.chambername();
if (useMuonDigis_)
bookRollME(ibooker, rpcId, rpcGeo, muonFolder_, meMuonCollection[nameID]);
bookRollME(ibooker, rpcId, rpcGeo, noiseFolder_, meNoiseCollection[nameID]);
bookRollME(ibooker, rpcId, &rpcGeo, muonFolder_, meMuonCollection[nameID]);
bookRollME(ibooker, rpcId, &rpcGeo, noiseFolder_, meNoiseCollection[nameID]);
if (rpcId.region() != 0) {
disk_set.insert(rpcId.station());
ring_set.insert(rpcId.ring());
Expand Down