diff --git a/Validation/EventGenerator/interface/BasicHepMCValidation.h b/Validation/EventGenerator/interface/BasicHepMCValidation.h index dc41b8cf069ed..8823b459e0b7c 100644 --- a/Validation/EventGenerator/interface/BasicHepMCValidation.h +++ b/Validation/EventGenerator/interface/BasicHepMCValidation.h @@ -46,6 +46,7 @@ class BasicHepMCValidation : public DQMEDAnalyzer { /// PDT table edm::ESHandle fPDGTable; + edm::ESGetToken fPDGTableToken; class ParticleMonitor { public: diff --git a/Validation/EventGenerator/interface/DQMHelper.h b/Validation/EventGenerator/interface/DQMHelper.h index 5324e19f82ec2..8c371b2f7cfc7 100644 --- a/Validation/EventGenerator/interface/DQMHelper.h +++ b/Validation/EventGenerator/interface/DQMHelper.h @@ -14,24 +14,29 @@ class DQMHelper { public: - typedef dqm::legacy::DQMStore DQMStore; - typedef dqm::legacy::MonitorElement MonitorElement; + typedef DQMEDAnalyzer::DQMStore DQMStore; + typedef DQMEDAnalyzer::MonitorElement MonitorElement; DQMHelper(DQMStore::IBooker *i); virtual ~DQMHelper(); - MonitorElement *book1dHisto( - std::string name, std::string title, int n, double xmin, double xmax, std::string xaxis, std::string yaxis); - MonitorElement *book2dHisto(std::string name, - std::string title, + MonitorElement *book1dHisto(const std::string &name, + const std::string &title, + int n, + double xmin, + double xmax, + const std::string &xaxis, + const std::string &yaxis); + MonitorElement *book2dHisto(const std::string &name, + const std::string &title, int nx, double xmin, double xmax, int ny, double ymin, double ymax, - std::string xaxis, - std::string yaxis); + const std::string &xaxis, + const std::string &yaxis); MonitorElement *book1dHisto(const std::string &name, const std::string &title, int n, double xmin, double xmax); MonitorElement *book2dHisto(const std::string &name, diff --git a/Validation/EventGenerator/interface/DrellYanValidation.h b/Validation/EventGenerator/interface/DrellYanValidation.h index 1ef8bfb4067e8..bfd24cd41b86b 100644 --- a/Validation/EventGenerator/interface/DrellYanValidation.h +++ b/Validation/EventGenerator/interface/DrellYanValidation.h @@ -44,6 +44,7 @@ class DrellYanValidation : public DQMEDAnalyzer { /// PDT table edm::ESHandle fPDGTable; + edm::ESGetToken fPDGTableToken; MonitorElement *nEvt; MonitorElement *Zmass, *ZmassPeak, *Zpt, *ZptLog, *Zrap, *Zdaughters; diff --git a/Validation/EventGenerator/interface/HiggsValidation.h b/Validation/EventGenerator/interface/HiggsValidation.h index 2e92aa4467a7e..e82cda6ca0577 100644 --- a/Validation/EventGenerator/interface/HiggsValidation.h +++ b/Validation/EventGenerator/interface/HiggsValidation.h @@ -170,6 +170,7 @@ class HiggsValidation : public DQMEDAnalyzer { /// PDT table edm::ESHandle fPDGTable; + edm::ESGetToken fPDGTableToken; MonitorElement *nEvt; MonitorElement *HiggsDecayChannels; diff --git a/Validation/EventGenerator/interface/TauValidation.h b/Validation/EventGenerator/interface/TauValidation.h index b74dbbc24660e..b83477567cce9 100644 --- a/Validation/EventGenerator/interface/TauValidation.h +++ b/Validation/EventGenerator/interface/TauValidation.h @@ -75,6 +75,7 @@ class TauValidation : public DQMEDAnalyzer { /// PDT table edm::ESHandle fPDGTable; + edm::ESGetToken fPDGTableToken; MonitorElement *nTaus, *nPrimeTaus; MonitorElement *TauPt, *TauEta, *TauPhi, *TauProngs, *TauDecayChannels, *TauMothers, *TauSpinEffectsW_X, diff --git a/Validation/EventGenerator/interface/WValidation.h b/Validation/EventGenerator/interface/WValidation.h index fd36e1b16a765..250242f7d58b1 100644 --- a/Validation/EventGenerator/interface/WValidation.h +++ b/Validation/EventGenerator/interface/WValidation.h @@ -44,6 +44,7 @@ class WValidation : public DQMEDAnalyzer { /// PDT table edm::ESHandle fPDGTable; + edm::ESGetToken fPDGTableToken; MonitorElement *nEvt; MonitorElement *Wmass, *WmassPeak, /* *WmT, *WmTPeak, */ *Wpt, *WptLog, *Wrap, *Wdaughters; diff --git a/Validation/EventGenerator/plugins/BasicHepMCValidation.cc b/Validation/EventGenerator/plugins/BasicHepMCValidation.cc index 2343a994aec77..d4f6a429b1add 100644 --- a/Validation/EventGenerator/plugins/BasicHepMCValidation.cc +++ b/Validation/EventGenerator/plugins/BasicHepMCValidation.cc @@ -14,11 +14,14 @@ using namespace edm; BasicHepMCValidation::BasicHepMCValidation(const edm::ParameterSet &iPSet) : wmanager_(iPSet, consumesCollector()), hepmcCollection_(iPSet.getParameter("hepmcCollection")) { hepmcCollectionToken_ = consumes(hepmcCollection_); + fPDGTableToken = esConsumes(); } BasicHepMCValidation::~BasicHepMCValidation() {} -void BasicHepMCValidation::dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) { c.getData(fPDGTable); } +void BasicHepMCValidation::dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) { + fPDGTable = c.getHandle(fPDGTableToken); +} namespace { // Set upper bound & lower bound for PDF & Scale related histograms diff --git a/Validation/EventGenerator/plugins/DrellYanValidation.cc b/Validation/EventGenerator/plugins/DrellYanValidation.cc index e0880ff490442..d45376c0a17b3 100644 --- a/Validation/EventGenerator/plugins/DrellYanValidation.cc +++ b/Validation/EventGenerator/plugins/DrellYanValidation.cc @@ -22,11 +22,14 @@ DrellYanValidation::DrellYanValidation(const edm::ParameterSet& iPSet) _flavor(iPSet.getParameter("decaysTo")), _name(iPSet.getParameter("name")) { hepmcCollectionToken_ = consumes(hepmcCollection_); + fPDGTableToken = esConsumes(); } DrellYanValidation::~DrellYanValidation() {} -void DrellYanValidation::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) { c.getData(fPDGTable); } +void DrellYanValidation::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) { + fPDGTable = c.getHandle(fPDGTableToken); +} void DrellYanValidation::bookHistograms(DQMStore::IBooker& i, edm::Run const&, edm::EventSetup const&) { ///Setting the DQM top directories diff --git a/Validation/EventGenerator/plugins/HiggsValidation.cc b/Validation/EventGenerator/plugins/HiggsValidation.cc index d164fb7092ea6..a7c257fd0a89d 100644 --- a/Validation/EventGenerator/plugins/HiggsValidation.cc +++ b/Validation/EventGenerator/plugins/HiggsValidation.cc @@ -25,11 +25,14 @@ HiggsValidation::HiggsValidation(const edm::ParameterSet& iPSet) particle_name(iPSet.getParameter("particleName")) { monitoredDecays = new MonitoredDecays(iPSet); hepmcCollectionToken_ = consumes(hepmcCollection_); + fPDGTableToken = esConsumes(); } HiggsValidation::~HiggsValidation() {} -void HiggsValidation::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) { c.getData(fPDGTable); } +void HiggsValidation::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) { + fPDGTable = c.getHandle(fPDGTableToken); +} void HiggsValidation::bookHistograms(DQMStore::IBooker& i, edm::Run const&, edm::EventSetup const&) { ///Setting the DQM top directories diff --git a/Validation/EventGenerator/plugins/MBUEandQCDValidation.cc b/Validation/EventGenerator/plugins/MBUEandQCDValidation.cc index 206c91742f121..e4e5d34279e77 100644 --- a/Validation/EventGenerator/plugins/MBUEandQCDValidation.cc +++ b/Validation/EventGenerator/plugins/MBUEandQCDValidation.cc @@ -32,11 +32,14 @@ MBUEandQCDValidation::MBUEandQCDValidation(const edm::ParameterSet& iPSet) hepmcCollectionToken_ = consumes(hepmcCollection_); genjetCollectionToken_ = consumes(genjetCollection_); genchjetCollectionToken_ = consumes(genchjetCollection_); + fPDGTableToken = esConsumes(); } MBUEandQCDValidation::~MBUEandQCDValidation() { delete theCalo; } -void MBUEandQCDValidation::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) { c.getData(fPDGTable); } +void MBUEandQCDValidation::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) { + fPDGTable = c.getHandle(fPDGTableToken); +} void MBUEandQCDValidation::bookHistograms(DQMStore::IBooker& i, edm::Run const&, edm::EventSetup const&) { ///Setting the DQM top directories diff --git a/Validation/EventGenerator/plugins/MBUEandQCDValidation.h b/Validation/EventGenerator/plugins/MBUEandQCDValidation.h index fb782a151ee8c..2701758ed737c 100644 --- a/Validation/EventGenerator/plugins/MBUEandQCDValidation.h +++ b/Validation/EventGenerator/plugins/MBUEandQCDValidation.h @@ -53,6 +53,7 @@ class MBUEandQCDValidation : public DQMEDAnalyzer { /// PDT table edm::ESHandle fPDGTable; + edm::ESGetToken fPDGTableToken; /// status 1 GenParticle collection std::vector hepmcGPCollection; diff --git a/Validation/EventGenerator/plugins/TauValidation.cc b/Validation/EventGenerator/plugins/TauValidation.cc index 8d32e01889fb8..96d4c553461c4 100644 --- a/Validation/EventGenerator/plugins/TauValidation.cc +++ b/Validation/EventGenerator/plugins/TauValidation.cc @@ -23,11 +23,14 @@ TauValidation::TauValidation(const edm::ParameterSet &iPSet) zsmin(-0.5), zsmax(0.5) { genparticleCollectionToken_ = consumes(genparticleCollection_); + fPDGTableToken = esConsumes(); } TauValidation::~TauValidation() {} -void TauValidation::dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) { c.getData(fPDGTable); } +void TauValidation::dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) { + fPDGTable = c.getHandle(fPDGTableToken); +} void TauValidation::bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) { ///Setting the DQM top directories diff --git a/Validation/EventGenerator/plugins/WValidation.cc b/Validation/EventGenerator/plugins/WValidation.cc index 1c7bf4f10e8f8..611a6faef52b3 100644 --- a/Validation/EventGenerator/plugins/WValidation.cc +++ b/Validation/EventGenerator/plugins/WValidation.cc @@ -21,6 +21,7 @@ WValidation::WValidation(const edm::ParameterSet& iPSet) _flavor(iPSet.getParameter("decaysTo")), _name(iPSet.getParameter("name")) { hepmcCollectionToken_ = consumes(hepmcCollection_); + fPDGTableToken = esConsumes(); } WValidation::~WValidation() {} @@ -84,7 +85,7 @@ void WValidation::bookHistograms(DQMStore::IBooker& i, edm::Run const&, edm::Eve return; } -void WValidation::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) { c.getData(fPDGTable); } +void WValidation::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) { fPDGTable = c.getHandle(fPDGTableToken); } void WValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // we *DO NOT* rely on a Z entry in the particle listings! diff --git a/Validation/EventGenerator/src/DQMHelper.cc b/Validation/EventGenerator/src/DQMHelper.cc index 2b7811997ec44..d22f232db3add 100644 --- a/Validation/EventGenerator/src/DQMHelper.cc +++ b/Validation/EventGenerator/src/DQMHelper.cc @@ -4,8 +4,13 @@ DQMHelper::DQMHelper(DQMStore::IBooker* i) : ibooker(i) {} DQMHelper::~DQMHelper() {} -DQMHelper::MonitorElement* DQMHelper::book1dHisto( - std::string name, std::string title, int n, double xmin, double xmax, std::string xaxis, std::string yaxis) { +DQMHelper::MonitorElement* DQMHelper::book1dHisto(const std::string& name, + const std::string& title, + int n, + double xmin, + double xmax, + const std::string& xaxis, + const std::string& yaxis) { MonitorElement* dqm = ibooker->book1D(name, title, n, xmin, xmax, [](TH1* th1) { th1->Sumw2(); }); dqm->setAxisTitle(xaxis, 1); dqm->setAxisTitle(yaxis, 2); @@ -18,16 +23,16 @@ DQMHelper::MonitorElement* DQMHelper::book1dHisto( return dqm; } -DQMHelper::MonitorElement* DQMHelper::book2dHisto(std::string name, - std::string title, +DQMHelper::MonitorElement* DQMHelper::book2dHisto(const std::string& name, + const std::string& title, int nx, double xmin, double xmax, int ny, double ymin, double ymax, - std::string xaxis, - std::string yaxis) { + const std::string& xaxis, + const std::string& yaxis) { MonitorElement* dqm = ibooker->book2D(name, title, nx, xmin, xmax, ny, ymin, ymax, [](TH1* th1) { th1->Sumw2(); }); dqm->setAxisTitle(xaxis, 1); dqm->setAxisTitle(yaxis, 2);