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 unit test for HLT online-DQM plugins #40334

Merged
merged 6 commits into from
Jan 16, 2023
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
47 changes: 29 additions & 18 deletions DQM/HLTEvF/plugins/LumiMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ class LumiMonitor : public DQMGlobalEDAnalyzer<Histograms> {
public:
LumiMonitor(const edm::ParameterSet&);
~LumiMonitor() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
static void fillHistoPSetDescription(edm::ParameterSetDescription& pset);
static void fillHistoLSPSetDescription(edm::ParameterSetDescription& pset);

static void fillHistoPSetDescription(edm::ParameterSetDescription& pset,
int const nbins,
double const xmin,
double const xmax);
static void fillHistoLSPSetDescription(edm::ParameterSetDescription& pset, int const nbins);

private:
void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&, Histograms&) const override;
Expand Down Expand Up @@ -250,13 +255,18 @@ void LumiMonitor::dqmAnalyze(edm::Event const& event,
}
}

void LumiMonitor::fillHistoPSetDescription(edm::ParameterSetDescription& pset) {
pset.add<int>("nbins");
pset.add<double>("xmin");
pset.add<double>("xmax");
void LumiMonitor::fillHistoPSetDescription(edm::ParameterSetDescription& pset,
int const nbins,
double const xmin,
double const xmax) {
pset.add<int>("nbins", nbins);
pset.add<double>("xmin", xmin);
pset.add<double>("xmax", xmax);
}

void LumiMonitor::fillHistoLSPSetDescription(edm::ParameterSetDescription& pset) { pset.add<int>("nbins", 2500); }
void LumiMonitor::fillHistoLSPSetDescription(edm::ParameterSetDescription& pset, int const nbins) {
pset.add<int>("nbins", nbins);
}

void LumiMonitor::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
Expand All @@ -270,25 +280,26 @@ void LumiMonitor::fillDescriptions(edm::ConfigurationDescriptions& descriptions)
desc.add<double>("minPixelClusterCharge", 15000.);

edm::ParameterSetDescription histoPSet;
edm::ParameterSetDescription pixelClusterPSet;
LumiMonitor::fillHistoPSetDescription(pixelClusterPSet);
histoPSet.add("pixelClusterPSet", pixelClusterPSet);

edm::ParameterSetDescription lumiPSet;
fillHistoPSetDescription(lumiPSet);
histoPSet.add<edm::ParameterSetDescription>("lumiPSet", lumiPSet);
edm::ParameterSetDescription lsPSet;
fillHistoLSPSetDescription(lsPSet, 2500);
histoPSet.add<edm::ParameterSetDescription>("lsPSet", lsPSet);

edm::ParameterSetDescription puPSet;
fillHistoPSetDescription(puPSet);
fillHistoPSetDescription(puPSet, 130, 0, 130);
histoPSet.add<edm::ParameterSetDescription>("puPSet", puPSet);

edm::ParameterSetDescription lumiPSet;
fillHistoPSetDescription(lumiPSet, 5000, 0, 20000);
histoPSet.add<edm::ParameterSetDescription>("lumiPSet", lumiPSet);

edm::ParameterSetDescription pixellumiPSet;
fillHistoPSetDescription(pixellumiPSet);
fillHistoPSetDescription(pixellumiPSet, 300, 0, 3);
histoPSet.add<edm::ParameterSetDescription>("pixellumiPSet", pixellumiPSet);

edm::ParameterSetDescription lsPSet;
fillHistoLSPSetDescription(lsPSet);
histoPSet.add<edm::ParameterSetDescription>("lsPSet", lsPSet);
edm::ParameterSetDescription pixelClusterPSet;
fillHistoPSetDescription(pixelClusterPSet, 200, -0.5, 19999.5);
histoPSet.add("pixelClusterPSet", pixelClusterPSet);

desc.add<edm::ParameterSetDescription>("histoPSet", histoPSet);

Expand Down
10 changes: 5 additions & 5 deletions DQM/HLTEvF/plugins/PSMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class PSMonitor : public DQMGlobalEDAnalyzer<Histograms> {
// -----------------------------

PSMonitor::PSMonitor(const edm::ParameterSet& config)
: folderName_(config.getParameter<std::string>("FolderName")),
: folderName_(config.getParameter<std::string>("folderName")),
ugtBXToken_(consumes<GlobalAlgBlkBxCollection>(config.getParameter<edm::InputTag>("ugtBXInputTag"))) {
edm::ParameterSet histoPSet = config.getParameter<edm::ParameterSet>("histoPSet");
edm::ParameterSet psColumnPSet = histoPSet.getParameter<edm::ParameterSet>("psColumnPSet");
Expand Down Expand Up @@ -138,19 +138,19 @@ void PSMonitor::fillHistoPSetDescription(edm::ParameterSetDescription& pset, int
void PSMonitor::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("ugtBXInputTag", edm::InputTag("hltGtStage2Digis"));
desc.add<std::string>("FolderName", "HLT/PSMonitoring");
desc.add<std::string>("folderName", "HLT/PSMonitoring");

edm::ParameterSetDescription histoPSet;

edm::ParameterSetDescription psColumnPSet;
fillHistoPSetDescription(psColumnPSet, 8);
histoPSet.add<edm::ParameterSetDescription>("psColumnPSet", psColumnPSet);
histoPSet.add("psColumnPSet", psColumnPSet);

edm::ParameterSetDescription lsPSet;
fillHistoPSetDescription(lsPSet, 2500);
histoPSet.add<edm::ParameterSetDescription>("lsPSet", lsPSet);
histoPSet.add("lsPSet", lsPSet);

desc.add<edm::ParameterSetDescription>("histoPSet", histoPSet);
desc.add("histoPSet", histoPSet);

descriptions.add("psMonitoring", desc);
}
Expand Down
119 changes: 0 additions & 119 deletions DQM/HLTEvF/plugins/PSMonitorClient.cc

This file was deleted.

2 changes: 2 additions & 0 deletions DQM/HLTEvF/test/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- test of HLT monitoring plugins (DQM + Harvesting) -->
<test name="testTriggerMonitors" command="testTriggerMonitors.sh"/>
16 changes: 16 additions & 0 deletions DQM/HLTEvF/test/testTriggerMonitors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Pass in name and status
function die {
printf "\n%s: status %s\n" "$1" "$2"
exit $2
}

# run test job
TESTDIR="${LOCALTOP}"/src/DQM/HLTEvF/test

cmsRun "${TESTDIR}"/testTriggerMonitors_dqm_cfg.py \
|| die "Failure running testTriggerMonitors_dqm_cfg.py" $?

cmsRun "${TESTDIR}"/testTriggerMonitors_harvesting_cfg.py \
|| die "Failure running testTriggerMonitors_harvesting_cfg.py" $?
124 changes: 124 additions & 0 deletions DQM/HLTEvF/test/testTriggerMonitors_dqm_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import FWCore.ParameterSet.Config as cms

# VarParsing
import FWCore.ParameterSet.VarParsing as VarParsing
options = VarParsing.VarParsing('analysis')
options.register('nThreads', 4, options.multiplicity.singleton, options.varType.int, 'number of threads')
options.register('nStreams', 0, options.multiplicity.singleton, options.varType.int, 'number of streams')
options.register('globalTag', 'auto:run3_hlt_relval', options.multiplicity.singleton, options.varType.string, 'name of GlobalTag')
options.setDefault('inputFiles', [
'/store/data/Run2022B/HLTPhysics/RAW/v1/000/355/456/00000/69b26b27-4bd1-4524-bc18-45f7b9b5e076.root',
])
options.setDefault('maxEvents', 200)
options.setType('outputFile', options.varType.string)
options.setDefault('outputFile', 'DQMIO.root')
options.parseArguments()

# Process
process = cms.Process('DQM')

process.options.numberOfThreads = options.nThreads
process.options.numberOfStreams = options.nStreams
process.maxEvents.input = options.maxEvents

# Source (EDM input)
process.source = cms.Source('PoolSource',
fileNames = cms.untracked.vstring(options.inputFiles),
inputCommands = cms.untracked.vstring(
'drop *',
'keep FEDRawDataCollection_rawDataCollector__*',
'keep edmTriggerResults_TriggerResults__HLT',
)
)

# DQMStore (Service)
process.load('DQMServices.Core.DQMStore_cfi')

# MessageLogger (Service)
process.load('FWCore.MessageLogger.MessageLogger_cfi')
process.MessageLogger.cerr.FwkReport.reportEvery = 1

# FastTimerService (Service)
from HLTrigger.Timer.FastTimerService_cfi import FastTimerService as _FastTimerService
process.FastTimerService = _FastTimerService.clone(
dqmTimeRange = 2000,
enableDQM = True,
enableDQMTransitions = True,
enableDQMbyLumiSection = True,
enableDQMbyModule = True,
enableDQMbyPath = True,
enableDQMbyProcesses = True
)
process.MessageLogger.FastReport = dict()

# ThroughputService (Service)
from HLTrigger.Timer.ThroughputService_cfi import ThroughputService as _ThroughputService
process.ThroughputService = _ThroughputService.clone(
dqmPathByProcesses = True,
timeRange = 60000,
timeResolution = 5.828
)
process.MessageLogger.ThroughputService = dict()

# GlobalTag (ESSource)
from Configuration.AlCa.GlobalTag import GlobalTag as customiseGlobalTag
process.GlobalTag = customiseGlobalTag(globaltag = options.globalTag)

# EventData modules
from EventFilter.L1TRawToDigi.gtStage2Digis_cfi import gtStage2Digis as _gtStage2Digis
process.gtStage2Digis = _gtStage2Digis.clone()

from EventFilter.ScalersRawToDigi.ScalersRawToDigi_cfi import scalersRawToDigi as _scalersRawToDigi
process.scalersRawToDigi = _scalersRawToDigi.clone()

from EventFilter.OnlineMetaDataRawToDigi.onlineMetaDataRawToDigi_cfi import onlineMetaDataRawToDigi as _onlineMetaDataDigis
process.onlineMetaDataDigis = _onlineMetaDataDigis.clone()

from DQM.HLTEvF.triggerRatesMonitor_cfi import triggerRatesMonitor as _triggerRatesMonitor
process.triggerRatesMonitor = _triggerRatesMonitor.clone(
hltResults = 'TriggerResults::HLT'
)

from DQM.HLTEvF.triggerBxMonitor_cfi import triggerBxMonitor as _triggerBxMonitor
process.triggerBxMonitor = _triggerBxMonitor.clone(
hltResults = 'TriggerResults::HLT'
)

from DQM.HLTEvF.triggerBxVsOrbitMonitor_cfi import triggerBxVsOrbitMonitor as _triggerBxVsOrbitMonitor
process.triggerBxVsOrbitMonitor = _triggerBxVsOrbitMonitor.clone(
hltResults = 'TriggerResults::HLT'
)

from DQM.HLTEvF.lumiMonitor_cfi import lumiMonitor as _lumiMonitor
process.lumiMonitor = _lumiMonitor.clone(
scalers = 'scalersRawToDigi',
onlineMetaDataDigis = 'onlineMetaDataDigis'
)

from DQM.HLTEvF.psMonitoring_cfi import psMonitoring as _psColumnMonitor
process.psColumnMonitor = _psColumnMonitor.clone(
ugtBXInputTag = 'gtStage2Digis',
histoPSet = dict(
psColumnPSet = dict(
nbins = 20
)
)
)

# Output module (file in DQM format)
process.dqmOutput = cms.OutputModule('DQMRootOutputModule',
fileName = cms.untracked.string(options.outputFile)
)

# EndPath
process.endp = cms.EndPath(
process.gtStage2Digis
+ process.scalersRawToDigi
+ process.onlineMetaDataDigis
+ process.triggerRatesMonitor
+ process.triggerBxMonitor
+ process.triggerBxVsOrbitMonitor
+ process.lumiMonitor
+ process.psColumnMonitor
+ process.dqmOutput
)
Loading