Skip to content

Commit

Permalink
Merge pull request #36159 from mrodozov/remove-deprecated-uses-CondTo…
Browse files Browse the repository at this point in the history
…ols-RPC

Modernize analyzers in CondTools/RPC
  • Loading branch information
cmsbuild authored Nov 17, 2021
2 parents 2c76b98 + 8e85bfb commit d4f2acf
Showing 4 changed files with 20 additions and 23 deletions.
13 changes: 6 additions & 7 deletions CondTools/RPC/plugins/CondReader.cc
Original file line number Diff line number Diff line change
@@ -3,10 +3,9 @@
#include <vector>

#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "CondTools/RPC/interface/RPCDBSimSetUp.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "CondFormats/RPCObjects/interface/RPCObCond.h"
@@ -16,7 +15,7 @@
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
#include "FWCore/ServiceRegistry/interface/Service.h"

class CondReader : public edm::EDAnalyzer {
class CondReader : public edm::one::EDAnalyzer<> {
public:
CondReader(const edm::ParameterSet& iConfig);

@@ -26,19 +25,20 @@ class CondReader : public edm::EDAnalyzer {
private:
unsigned long long since;
unsigned long long till;
edm::ESGetToken<RPCObImon, RPCObImonRcd> condRcd_token_;
};

CondReader::CondReader(const edm::ParameterSet& iConfig)
: since(iConfig.getUntrackedParameter<unsigned long long>("since", 0)),
till(iConfig.getUntrackedParameter<unsigned long long>("till", 0)) {}
till(iConfig.getUntrackedParameter<unsigned long long>("till", 0)),
condRcd_token_(esConsumes()) {}

CondReader::~CondReader() {}

void CondReader::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
edm::Service<cond::service::PoolDBOutputService> mydbservice;

edm::ESHandle<RPCObImon> condRcd;
evtSetup.get<RPCObImonRcd>().get(condRcd);
const RPCObImon* cond = &evtSetup.getData(condRcd_token_);
edm::LogInfo("CondReader") << "[CondReader::analyze] End Reading Cond" << std::endl;

std::cout << "Run start: " << since << " - Run stop: " << till << std::endl;
@@ -52,7 +52,6 @@ void CondReader::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup)
int ntimeT = (tTime.hour() * 10000) + (tTime.minute() * 100) + tTime.second();
std::cout << "Run start: " << ndateS << " " << ntimeS << " - Run stop: " << ndateT << " " << ntimeT << std::endl;

const RPCObImon* cond = condRcd.product();
std::vector<RPCObImon::I_Item> mycond = cond->ObImon_rpc;
std::vector<RPCObImon::I_Item>::iterator icond;

15 changes: 7 additions & 8 deletions CondTools/RPC/plugins/PVSSIDReader.cc
Original file line number Diff line number Diff line change
@@ -3,32 +3,31 @@
#include <vector>

#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "CondTools/RPC/interface/RPCDBSimSetUp.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "CondFormats/RPCObjects/interface/RPCObPVSSmap.h"
#include "CondFormats/DataRecord/interface/RPCObPVSSmapRcd.h"

class PVSSIDReader : public edm::EDAnalyzer {
class PVSSIDReader : public edm::one::EDAnalyzer<> {
public:
PVSSIDReader(const edm::ParameterSet& iConfig);
~PVSSIDReader() override;
void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;

private:
edm::ESGetToken<RPCObPVSSmap, RPCObPVSSmapRcd> pvssmap_token_;
};

PVSSIDReader::PVSSIDReader(const edm::ParameterSet& iConfig) {}
PVSSIDReader::PVSSIDReader(const edm::ParameterSet& iConfig) : pvssmap_token_(esConsumes()) {}

PVSSIDReader::~PVSSIDReader() {}

void PVSSIDReader::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
edm::ESHandle<RPCObPVSSmap> pvssmapRcd;
evtSetup.get<RPCObPVSSmapRcd>().get(pvssmapRcd);
const RPCObPVSSmap* pvssmap = &evtSetup.getData(pvssmap_token_);
edm::LogInfo("PVSSIDReader") << "[PVSSIDReader::analyze] End Reading Pvssmap" << std::endl;

const RPCObPVSSmap* pvssmap = pvssmapRcd.product();
std::vector<RPCObPVSSmap::Item> mypvssmap = pvssmap->ObIDMap_rpc;
std::vector<RPCObPVSSmap::Item>::iterator ipvssmap;

1 change: 0 additions & 1 deletion CondTools/RPC/src/RPCDBPerformanceHandler.cc
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
14 changes: 7 additions & 7 deletions CondTools/RPC/src/RPCStripNoisesRcdRead.cc
Original file line number Diff line number Diff line change
@@ -3,31 +3,31 @@
#include <vector>

#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "CondTools/RPC/interface/RPCDBSimSetUp.h"
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
#include "CondFormats/RPCObjects/interface/RPCStripNoises.h"
#include "CondFormats/DataRecord/interface/RPCStripNoisesRcd.h"

class RPCStripNoisesRcdRead : public edm::EDAnalyzer {
class RPCStripNoisesRcdRead : public edm::one::EDAnalyzer<> {
public:
RPCStripNoisesRcdRead(const edm::ParameterSet& iConfig);
~RPCStripNoisesRcdRead() override;
void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;

private:
edm::ESGetToken<RPCStripNoises, RPCStripNoisesRcd> noise_RcdToken_;
};

RPCStripNoisesRcdRead::RPCStripNoisesRcdRead(const edm::ParameterSet& iConfig) {}
RPCStripNoisesRcdRead::RPCStripNoisesRcdRead(const edm::ParameterSet& iConfig) : noise_RcdToken_(esConsumes()) {}

RPCStripNoisesRcdRead::~RPCStripNoisesRcdRead() {}

void RPCStripNoisesRcdRead::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) {
edm::ESHandle<RPCStripNoises> noiseRcd;
evtSetup.get<RPCStripNoisesRcd>().get(noiseRcd);
const RPCStripNoises* noiseRcd = &evtSetup.getData(noise_RcdToken_);
edm::LogInfo("RPCStripNoisesReader") << "[RPCStripNoisesReader::analyze] End Reading RPCStripNoises" << std::endl;

std::vector<RPCStripNoises::NoiseItem> vnoise = noiseRcd->getVNoise();
std::vector<float> vcls = noiseRcd->getCls();

0 comments on commit d4f2acf

Please sign in to comment.