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

Add esConsumes to modules in Validation/EventGenerator #35716

Merged
merged 2 commits into from
Oct 19, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Validation/EventGenerator/interface/BasicHepMCValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class BasicHepMCValidation : public DQMEDAnalyzer {

/// PDT table
edm::ESHandle<HepPDT::ParticleDataTable> fPDGTable;
edm::ESGetToken<HepPDT::ParticleDataTable, edm::DefaultRecord> fPDGTableToken;

class ParticleMonitor {
public:
Expand Down
21 changes: 13 additions & 8 deletions Validation/EventGenerator/interface/DQMHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions Validation/EventGenerator/interface/DrellYanValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class DrellYanValidation : public DQMEDAnalyzer {

/// PDT table
edm::ESHandle<HepPDT::ParticleDataTable> fPDGTable;
edm::ESGetToken<HepPDT::ParticleDataTable, edm::DefaultRecord> fPDGTableToken;

MonitorElement *nEvt;
MonitorElement *Zmass, *ZmassPeak, *Zpt, *ZptLog, *Zrap, *Zdaughters;
Expand Down
1 change: 1 addition & 0 deletions Validation/EventGenerator/interface/HiggsValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class HiggsValidation : public DQMEDAnalyzer {

/// PDT table
edm::ESHandle<HepPDT::ParticleDataTable> fPDGTable;
edm::ESGetToken<HepPDT::ParticleDataTable, edm::DefaultRecord> fPDGTableToken;

MonitorElement *nEvt;
MonitorElement *HiggsDecayChannels;
Expand Down
1 change: 1 addition & 0 deletions Validation/EventGenerator/interface/TauValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class TauValidation : public DQMEDAnalyzer {

/// PDT table
edm::ESHandle<HepPDT::ParticleDataTable> fPDGTable;
edm::ESGetToken<HepPDT::ParticleDataTable, edm::DefaultRecord> fPDGTableToken;

MonitorElement *nTaus, *nPrimeTaus;
MonitorElement *TauPt, *TauEta, *TauPhi, *TauProngs, *TauDecayChannels, *TauMothers, *TauSpinEffectsW_X,
Expand Down
1 change: 1 addition & 0 deletions Validation/EventGenerator/interface/WValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class WValidation : public DQMEDAnalyzer {

/// PDT table
edm::ESHandle<HepPDT::ParticleDataTable> fPDGTable;
edm::ESGetToken<HepPDT::ParticleDataTable, edm::DefaultRecord> fPDGTableToken;

MonitorElement *nEvt;
MonitorElement *Wmass, *WmassPeak, /* *WmT, *WmTPeak, */ *Wpt, *WptLog, *Wrap, *Wdaughters;
Expand Down
5 changes: 4 additions & 1 deletion Validation/EventGenerator/plugins/BasicHepMCValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ using namespace edm;
BasicHepMCValidation::BasicHepMCValidation(const edm::ParameterSet &iPSet)
: wmanager_(iPSet, consumesCollector()), hepmcCollection_(iPSet.getParameter<edm::InputTag>("hepmcCollection")) {
hepmcCollectionToken_ = consumes<HepMCProduct>(hepmcCollection_);
fPDGTableToken = esConsumes<edm::Transition::BeginRun>();
}

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
Expand Down
5 changes: 4 additions & 1 deletion Validation/EventGenerator/plugins/DrellYanValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ DrellYanValidation::DrellYanValidation(const edm::ParameterSet& iPSet)
_flavor(iPSet.getParameter<int>("decaysTo")),
_name(iPSet.getParameter<std::string>("name")) {
hepmcCollectionToken_ = consumes<HepMCProduct>(hepmcCollection_);
fPDGTableToken = esConsumes<edm::Transition::BeginRun>();
}

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
Expand Down
5 changes: 4 additions & 1 deletion Validation/EventGenerator/plugins/HiggsValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ HiggsValidation::HiggsValidation(const edm::ParameterSet& iPSet)
particle_name(iPSet.getParameter<std::string>("particleName")) {
monitoredDecays = new MonitoredDecays(iPSet);
hepmcCollectionToken_ = consumes<HepMCProduct>(hepmcCollection_);
fPDGTableToken = esConsumes<edm::Transition::BeginRun>();
}

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
Expand Down
5 changes: 4 additions & 1 deletion Validation/EventGenerator/plugins/MBUEandQCDValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ MBUEandQCDValidation::MBUEandQCDValidation(const edm::ParameterSet& iPSet)
hepmcCollectionToken_ = consumes<HepMCProduct>(hepmcCollection_);
genjetCollectionToken_ = consumes<reco::GenJetCollection>(genjetCollection_);
genchjetCollectionToken_ = consumes<reco::GenJetCollection>(genchjetCollection_);
fPDGTableToken = esConsumes<edm::Transition::BeginRun>();
}

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
Expand Down
1 change: 1 addition & 0 deletions Validation/EventGenerator/plugins/MBUEandQCDValidation.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MBUEandQCDValidation : public DQMEDAnalyzer {

/// PDT table
edm::ESHandle<HepPDT::ParticleDataTable> fPDGTable;
edm::ESGetToken<HepPDT::ParticleDataTable, edm::DefaultRecord> fPDGTableToken;

/// status 1 GenParticle collection
std::vector<const HepMC::GenParticle*> hepmcGPCollection;
Expand Down
5 changes: 4 additions & 1 deletion Validation/EventGenerator/plugins/TauValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ TauValidation::TauValidation(const edm::ParameterSet &iPSet)
zsmin(-0.5),
zsmax(0.5) {
genparticleCollectionToken_ = consumes<reco::GenParticleCollection>(genparticleCollection_);
fPDGTableToken = esConsumes<edm::Transition::BeginRun>();
}

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
Expand Down
3 changes: 2 additions & 1 deletion Validation/EventGenerator/plugins/WValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ WValidation::WValidation(const edm::ParameterSet& iPSet)
_flavor(iPSet.getParameter<int>("decaysTo")),
_name(iPSet.getParameter<std::string>("name")) {
hepmcCollectionToken_ = consumes<HepMCProduct>(hepmcCollection_);
fPDGTableToken = esConsumes<edm::Transition::BeginRun>();
}

WValidation::~WValidation() {}
Expand Down Expand Up @@ -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!
Expand Down
17 changes: 11 additions & 6 deletions Validation/EventGenerator/src/DQMHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down