Skip to content

Commit

Permalink
Test config.
Browse files Browse the repository at this point in the history
  • Loading branch information
schneiml committed Dec 12, 2019
1 parent 4261dd3 commit 78074b8
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 7 deletions.
89 changes: 82 additions & 7 deletions DQMServices/Demo/plugins/TestDQMEDAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TestDQMEDAnalyzer : public DQMEDAnalyzer {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "TEST")->setComment("Where to put all the histograms");
desc.add<std::string>("folder", "Normal/test")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("test", desc);
Expand Down Expand Up @@ -100,7 +100,7 @@ class TestDQMOneEDAnalyzer : public DQMOneEDAnalyzer<> {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "TEST")->setComment("Where to put all the histograms");
desc.add<std::string>("folder", "One/testone")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("testone", desc);
Expand Down Expand Up @@ -132,7 +132,7 @@ class TestDQMOneFillRunEDAnalyzer : public DQMOneEDAnalyzer<> {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "TEST")->setComment("Where to put all the histograms");
desc.add<std::string>("folder", "One/testonefillrun")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("testonefillrun", desc);
Expand Down Expand Up @@ -165,7 +165,7 @@ class TestDQMOneLumiEDAnalyzer : public DQMOneLumiEDAnalyzer<> {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "TEST")->setComment("Where to put all the histograms");
desc.add<std::string>("folder", "One/testonelumi")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("testonelumi", desc);
Expand Down Expand Up @@ -197,7 +197,7 @@ class TestDQMOneLumiFillLumiEDAnalyzer : public DQMOneLumiEDAnalyzer<> {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "TEST")->setComment("Where to put all the histograms");
desc.add<std::string>("folder", "One/testonelumifilllumi")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("testonelumifilllumi", desc);
Expand Down Expand Up @@ -235,7 +235,7 @@ class TestDQMGlobalEDAnalyzer : public DQMGlobalEDAnalyzer<TestHistograms> {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "TEST")->setComment("Where to put all the histograms");
desc.add<std::string>("folder", "Global/testglobal")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("testglobal", desc);
Expand Down Expand Up @@ -274,7 +274,7 @@ class TestLegacyEDAnalyzer : public edm::EDAnalyzer {

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "TEST")->setComment("Where to put all the histograms");
desc.add<std::string>("folder", "Legacy/testlegacy")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("testlegacy", desc);
Expand All @@ -295,3 +295,78 @@ class TestLegacyEDAnalyzer : public edm::EDAnalyzer {
double myvalue_;
};
DEFINE_FWK_MODULE(TestLegacyEDAnalyzer);

class TestLegacyFillRunEDAnalyzer : public edm::EDAnalyzer {
public:
typedef dqm::legacy::DQMStore DQMStore;
typedef dqm::legacy::MonitorElement MonitorElement;

explicit TestLegacyFillRunEDAnalyzer(const edm::ParameterSet& iConfig)
: mymes_(iConfig.getParameter<std::string>("folder"), iConfig.getParameter<int>("howmany"))
, myvalue_(iConfig.getParameter<double>("value")) {
}

~TestLegacyFillRunEDAnalyzer() override {};

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "Legacy/testlegacyfillrun")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("testlegacyfillrun", desc);
}

private:
void beginRun(edm::Run const& run, edm::EventSetup const&) override {
edm::Service<DQMStore> store;
mymes_.bookall(*store);
mymes_.fillall(0, run.run(), myvalue_);
}

void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override {
}


BookerFiller<DQMStore, MonitorElement> mymes_;
double myvalue_;
};
DEFINE_FWK_MODULE(TestLegacyFillRunEDAnalyzer);

class TestLegacyFillLumiEDAnalyzer : public edm::EDAnalyzer {
public:
typedef dqm::legacy::DQMStore DQMStore;
typedef dqm::legacy::MonitorElement MonitorElement;

explicit TestLegacyFillLumiEDAnalyzer(const edm::ParameterSet& iConfig)
: mymes_(iConfig.getParameter<std::string>("folder"), iConfig.getParameter<int>("howmany"))
, myvalue_(iConfig.getParameter<double>("value")) {
}

~TestLegacyFillLumiEDAnalyzer() override {};

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("folder", "Legacy/testlegacyfillrun")->setComment("Where to put all the histograms");
desc.add<int>("howmany", 1)->setComment("How many copies of each ME to put");
desc.add<double>("value", 1)->setComment("Which value to use on the third axis (first two are lumi and run)");
descriptions.add("testlegacyfilllumi", desc);
}

private:
void beginRun(edm::Run const&, edm::EventSetup const&) override {
edm::Service<DQMStore> store;
mymes_.bookall(*store);
}

void dqmBeginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const&) {
mymes_.fillall(lumi.luminosityBlock(), lumi.run(), myvalue_);
}

void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override {
}


BookerFiller<DQMStore, MonitorElement> mymes_;
double myvalue_;
};
DEFINE_FWK_MODULE(TestLegacyFillLumiEDAnalyzer);
43 changes: 43 additions & 0 deletions DQMServices/Demo/test/run_all_analyzers_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import FWCore.ParameterSet.Config as cms

process = cms.Process("TEST")
process.DQMStore = cms.Service("DQMStore")
process.MessageLogger = cms.Service("MessageLogger")

process.options = cms.untracked.PSet()
process.options.numberOfThreads = cms.untracked.uint32(1)
process.options.numberOfStreams = cms.untracked.uint32(1)

process.source = cms.Source("EmptySource", numberEventsInRun = cms.untracked.uint32(100),
firstLuminosityBlock = cms.untracked.uint32(1),
firstEvent = cms.untracked.uint32(1),
numberEventsInLuminosityBlock = cms.untracked.uint32(20))

process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(100) )

process.load("DQMServices.Demo.test_cfi")
process.load("DQMServices.Demo.testone_cfi")
process.load("DQMServices.Demo.testonefillrun_cfi")
process.load("DQMServices.Demo.testonelumi_cfi")
process.load("DQMServices.Demo.testonelumifilllumi_cfi")
process.load("DQMServices.Demo.testglobal_cfi")
process.load("DQMServices.Demo.testlegacy_cfi")
process.load("DQMServices.Demo.testlegacyfillrun_cfi")
process.load("DQMServices.Demo.testlegacyfilllumi_cfi")
process.test_reco_dqm = cms.Sequence(process.test
+ process.testone + process.testonefillrun + process.testonelumi + process.testonelumifilllumi
+ process.testglobal
+ process.testlegacy + process.testlegacyfillrun + process.testlegacyfilllumi)

process.p = cms.Path(process.test_reco_dqm)

process.out = cms.OutputModule(
"DQMRootOutputModule",
fileName = cms.untracked.string("dqm_out.root"),
outputCommands = cms.untracked.vstring(
'keep *'
)
)

process.o = cms.EndPath(process.out)

0 comments on commit 78074b8

Please sign in to comment.