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

[13.2.X] Add pixelgpu online DQM client and augment DQM/Integration unit tests #42583

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
### Load cfis ###

if unitTest:
process.load("DQM.Integration.config.unittestinputsource_cfi")
from DQM.Integration.config.unittestinputsource_cfi import options
process.load("DQM.Integration.config.unitteststreamerinputsource_cfi")
from DQM.Integration.config.unitteststreamerinputsource_cfi import options
else:
process.load("DQM.Integration.config.inputsource_cfi")
from DQM.Integration.config.inputsource_cfi import options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
else:
process.load('DQM.Integration.config.FrontierCondition_GT_cfi')
if unitTest:
process.load("DQM.Integration.config.unittestinputsource_cfi")
from DQM.Integration.config.unittestinputsource_cfi import options
process.load("DQM.Integration.config.unitteststreamerinputsource_cfi")
from DQM.Integration.config.unitteststreamerinputsource_cfi import options
elif useFileInput:
process.load("DQM.Integration.config.fileinputsource_cfi")
from DQM.Integration.config.fileinputsource_cfi import options
Expand Down
127 changes: 127 additions & 0 deletions DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#-------------------------------------
# Pixel DQM Application using New DQM Sources/Clients
#-------------------------------------

#-------------------------------------
# Standard Python Imports
#-------------------------------------
import os, sys, socket, string

#-------------------------------------
# Standard CMSSW Imports/Definitions
#-------------------------------------
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process('PIXELDQMLIVE', Run3)
subsystem = 'Pixel'
cmssw = os.getenv("CMSSW_VERSION").split("_")
debugstr = "### PixelDQM::cfg::DEBUG: "
warnstr = "### PixelDQM::cfg::WARN: "
errorstr = "### PixelDQM::cfg::ERROR:"
useOfflineGT = False
useFileInput = False
useMap = False

unitTest = False
if 'unitTest=True' in sys.argv:
unitTest=True
useFileInput=False

#-------------------------------------
# Central DQM Stuff imports
#-------------------------------------
from DQM.Integration.config.online_customizations_cfi import *
if useOfflineGT:
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.GlobalTag.globaltag = autoCond['run3_data_prompt']
else:
process.load('DQM.Integration.config.FrontierCondition_GT_cfi')
if unitTest:
process.load("DQM.Integration.config.unitteststreamerinputsource_cfi")
from DQM.Integration.config.unitteststreamerinputsource_cfi import options
elif useFileInput:
process.load("DQM.Integration.config.fileinputsource_cfi")
from DQM.Integration.config.fileinputsource_cfi import options
else:
process.load('DQM.Integration.config.inputsource_cfi')
from DQM.Integration.config.inputsource_cfi import options
process.load('DQM.Integration.config.environment_cfi')

#-------------------------------------
# Central DQM Customization
#-------------------------------------
process.source.streamLabel = cms.untracked.string("streamDQMGPUvsCPU")
process.dqmEnv.subSystemFolder = subsystem
process.dqmSaver.tag = 'PixelGPU'
process.dqmSaver.runNumber = options.runNumber
process.dqmSaverPB.tag = 'PixelGPU'
process.dqmSaverPB.runNumber = options.runNumber
process = customise(process)
process.DQMStore.verbose = 0
if not unitTest and not useFileInput :
if not options.BeamSplashRun :
process.source.minEventsPerLumi = 100

#-------------------------------------
# CMSSW/Pixel non-DQM Related Module import
#-------------------------------------
process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
process.load('FWCore.MessageLogger.MessageLogger_cfi')

#-------------------------------------
# CMSSW non-DQM Related Module Settings
#-------------------------------------
runType = process.runType.getRunType()
runTypeName = process.runType.getRunTypeName()
isCosmicRun = runTypeName=="cosmic_run" or runTypeName=="cosmic_run_stage1"
isHeavyIon = runTypeName=="hi_run"
cmssw = os.getenv("CMSSW_VERSION").split("_")

#-------------------------------------
# Pixel DQM Tasks and Harvesters import
#-------------------------------------
process.load('DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff')

#-------------------------------------
# Some Settings before Finishing up
#-------------------------------------
process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = cms.InputTag('hltSiPixelDigisFromSoA')
process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = cms.InputTag('hltSiPixelDigisLegacy')

#-------------------------------------
# Some Debug
#-------------------------------------
process.dump = cms.EDAnalyzer("EventContentAnalyzer")
process.dumpPath = cms.Path(process.dump)

#-------------------------------------
# Hcal DQM Tasks/Clients Sequences Definition
#-------------------------------------
process.tasksPath = cms.Path(process.siPixelPhase1RawDataErrorComparator)

#-------------------------------------
# Paths/Sequences Definitions
#-------------------------------------
process.dqmPath = cms.EndPath(process.dqmEnv)
process.dqmPath1 = cms.EndPath(process.dqmSaver*process.dqmSaverPB)
process.schedule = cms.Schedule(process.tasksPath,
#process.dumpPath, # for debug
process.dqmPath,
process.dqmPath1)

#-------------------------------------
# Scheduling and Process Customizations
#-------------------------------------
process.options = cms.untracked.PSet(
Rethrow = cms.untracked.vstring(
"ProductNotFound",
"TooManyProducts",
"TooFewProducts"
)
)
process.options.wantSummary = True

# tracer
#process.Tracer = cms.Service("Tracer")
print("Final Source settings:", process.source)
process = customise(process)
3 changes: 3 additions & 0 deletions DQM/Integration/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<test name="TestDQMOnlineClient-scal_dqm_sourceclient" command="runtest.sh scal_dqm_sourceclient-live_cfg.py"/>
<test name="TestDQMOnlineClient-sistrip_dqm_sourceclient" command="runtest.sh sistrip_dqm_sourceclient-live_cfg.py"/>
<test name="TestDQMOnlineClient-onlinebeammonitor_dqm_sourceclient" command="runtest.sh onlinebeammonitor_dqm_sourceclient-live_cfg.py"/>
<test name="TestDQMOnlineClient-ecalgpu_dqm_sourceclient" command="runtest.sh ecalgpu_dqm_sourceclient-live_cfg.py 369956"/>
<test name="TestDQMOnlineClient-hcalgpu_dqm_sourceclient" command="runtest.sh hcalgpu_dqm_sourceclient-live_cfg.py 369956"/>
<test name="TestDQMOnlineClient-pixelgpu_dqm_sourceclient" command="runtest.sh pixelgpu_dqm_sourceclient-live_cfg.py 369956"/>
<!-- streamDQMCalibration is required -->
<!-- <test name="TestDQMOnlineClient-ecalcalib_dqm_sourceclient" command="runtest.sh ecalcalib_dqm_sourceclient-live_cfg.py" /> -->
<!-- streamDQMCalibration is required -->
Expand Down
8 changes: 7 additions & 1 deletion DQM/Integration/test/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ if [[ -z ${CLIENTS_DIR} ]]; then
fi

mkdir -p $LOCAL_TEST_DIR/upload
cmsRun $CLIENTS_DIR/$1 unitTest=True

if [[ $# -eq 1 ]]; then
cmsRun $CLIENTS_DIR/$1 unitTest=True
else
echo "Will use streamers files for run $2"
cmsRun $CLIENTS_DIR/$1 unitTest=True runNumber=$2
fi
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,26 @@
//
// Author: Marco Musich
//
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Math/interface/deltaR.h"
#include "DataFormats/Math/interface/deltaPhi.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
// DQM Histograming
#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h"
#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/DetId/interface/DetIdCollection.h"
#include "DataFormats/FEDRawData/interface/FEDNumbering.h"
#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h"
#include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
#include "DataFormats/SiPixelRawData/interface/SiPixelErrorsSoA.h"
#include "EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "Geometry/CommonTopologies/interface/SimplePixelTopology.h"

#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
#include "DQMServices/Core/interface/DQMStore.h"
// for string manipulations
#include <fmt/printf.h>

Expand Down Expand Up @@ -84,8 +78,7 @@ namespace {
k_FED31 = 31, // 31 indicates an event number error (TBM and FED event number mismatch)
k_FED32 = 32, // 32 indicates an incorrectly formatted Slink Header
k_FED33 = 33, // 33 indicates an incorrectly formatted Slink Trailer
k_FED34 =
34, // 34 indicates the event size encoded in the Slink Trailer is different than size found at raw2digi conversion
k_FED34 = 34, // 34 indicates the evt size encoded in Slink Trailer is different than size found at raw2digi
k_FED35 = 35, // 35 indicates an invalid FED channel number
k_FED36 = 36, // 36 indicates an invalid ROC value
k_FED37 = 37, // 37 indicates an invalid dcol or pixel value
Expand Down Expand Up @@ -125,6 +118,8 @@ class SiPixelPhase1RawDataErrorComparator : public DQMEDAnalyzer {
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
const edm::InputTag pixelErrorSrcGPU_;
const edm::InputTag pixelErrorSrcCPU_;
const edm::EDGetTokenT<edm::DetSetVector<SiPixelRawDataError>> tokenErrorsGPU_;
const edm::EDGetTokenT<edm::DetSetVector<SiPixelRawDataError>> tokenErrorsCPU_;
const std::string topFolderName_;
Expand All @@ -133,6 +128,9 @@ class SiPixelPhase1RawDataErrorComparator : public DQMEDAnalyzer {
MonitorElement* h_FEDerrorVsFEDIdUnbalance_;
std::unordered_map<SiPixelFEDErrorCodes, MonitorElement*> h_nFEDErrors_;

// name of the plugins
static constexpr const char* kName = "SiPixelPhase1RawDataErrorComparator";

// Define the dimensions of the 2D array
static constexpr int nFEDs = FEDNumbering::MAXSiPixeluTCAFEDID - FEDNumbering::MINSiPixeluTCAFEDID;
static constexpr int nErrors = k_FED38 - k_FED25;
Expand All @@ -142,10 +140,10 @@ class SiPixelPhase1RawDataErrorComparator : public DQMEDAnalyzer {
// constructors
//
SiPixelPhase1RawDataErrorComparator::SiPixelPhase1RawDataErrorComparator(const edm::ParameterSet& iConfig)
: tokenErrorsGPU_(
consumes<edm::DetSetVector<SiPixelRawDataError>>(iConfig.getParameter<edm::InputTag>("pixelErrorSrcGPU"))),
tokenErrorsCPU_(
consumes<edm::DetSetVector<SiPixelRawDataError>>(iConfig.getParameter<edm::InputTag>("pixelErrorSrcCPU"))),
: pixelErrorSrcGPU_(iConfig.getParameter<edm::InputTag>("pixelErrorSrcGPU")),
pixelErrorSrcCPU_(iConfig.getParameter<edm::InputTag>("pixelErrorSrcCPU")),
tokenErrorsGPU_(consumes<edm::DetSetVector<SiPixelRawDataError>>(pixelErrorSrcGPU_)),
tokenErrorsCPU_(consumes<edm::DetSetVector<SiPixelRawDataError>>(pixelErrorSrcCPU_)),
topFolderName_(iConfig.getParameter<std::string>("topFolderName")) {}

//
Expand All @@ -172,14 +170,26 @@ void SiPixelPhase1RawDataErrorComparator::analyze(const edm::Event& iEvent, cons
countsOnGPU[j] = 0.;
}

// check upfront if the error collection is present
edm::Handle<edm::DetSetVector<SiPixelRawDataError>> inputFromCPU;
iEvent.getByToken(tokenErrorsCPU_, inputFromCPU);
if (!inputFromCPU.isValid()) {
edm::LogWarning("SiPixelCompareTrackSoA") << "reference (cpu) SiPixelRawDataErrors not found; \n"
<< "the comparison will not run.";
edm::LogError(kName) << "reference (cpu) SiPixelRawDataErrors collection (" << pixelErrorSrcCPU_.encode()
<< ") not found; \n"
<< "the comparison will not run.";
return;
}

edm::Handle<edm::DetSetVector<SiPixelRawDataError>> inputFromGPU;
iEvent.getByToken(tokenErrorsGPU_, inputFromGPU);
if (!inputFromGPU.isValid()) {
edm::LogError(kName) << "target (gpu) SiPixelRawDataErrors collection (" << pixelErrorSrcGPU_.encode()
<< ") not found; \n"
<< "the comparison will not run.";
return;
}

// fill the counters on host
uint errorsOnCPU{0};
for (auto it = inputFromCPU->begin(); it != inputFromCPU->end(); ++it) {
for (auto& siPixelRawDataError : *it) {
Expand All @@ -191,20 +201,12 @@ void SiPixelPhase1RawDataErrorComparator::analyze(const edm::Event& iEvent, cons
countsOnCPU[type] += 1;
countsMatrixOnCPU[fed - FEDNumbering::MINSiPixeluTCAFEDID][type - k_FED25] += 1;

edm::LogInfo("SiPixelPhase1RawDataErrorComparator")
<< __PRETTY_FUNCTION__ << " on cpu: FED: " << fed << " detid: " << id.rawId() << " type:" << type;
LogDebug(kName) << " (on cpu) FED: " << fed << " detid: " << id.rawId() << " type:" << type;
errorsOnCPU++;
}
}

edm::Handle<edm::DetSetVector<SiPixelRawDataError>> inputFromGPU;
iEvent.getByToken(tokenErrorsGPU_, inputFromGPU);
if (!inputFromGPU.isValid()) {
edm::LogWarning("SiPixelCompareTrackSoA") << "target (gpu) SiPixelRawDataErrors not found; \n"
<< "the comparison will not run.";
return;
}

// fill the counters on device
uint errorsOnGPU{0};
for (auto it = inputFromGPU->begin(); it != inputFromGPU->end(); ++it) {
for (auto& siPixelRawDataError : *it) {
Expand All @@ -216,30 +218,28 @@ void SiPixelPhase1RawDataErrorComparator::analyze(const edm::Event& iEvent, cons
countsOnGPU[type] += 1;
countsMatrixOnGPU[fed - FEDNumbering::MINSiPixeluTCAFEDID][type - k_FED25] += 1;

edm::LogInfo("SiPixelPhase1RawDataErrorComparator")
<< __PRETTY_FUNCTION__ << " on gpu: FED: " << fed << " detid: " << id.rawId() << " type:" << type;
LogDebug(kName) << " (on gpu) FED: " << fed << " detid: " << id.rawId() << " type:" << type;
errorsOnGPU++;
}
}

edm::LogInfo("SiPixelPhase1RawDataErrorComparator")
<< __PRETTY_FUNCTION__ << " on gpu found: " << errorsOnGPU << " on cpu found: " << errorsOnCPU << std::endl;
edm::LogPrint(kName) << " on gpu found: " << errorsOnGPU << " on cpu found: " << errorsOnCPU << std::endl;

h_totFEDErrors_->Fill(errorsOnCPU, errorsOnGPU);

// fill the correlations per error type
for (unsigned int j = k_FED25; j <= k_FED31; j++) {
SiPixelFEDErrorCodes code = static_cast<SiPixelFEDErrorCodes>(j);
h_nFEDErrors_[code]->Fill(countsOnCPU[j], countsOnGPU[j]);
h_nFEDErrors_[code]->Fill(std::min(1000, countsOnCPU[j]), std::min(1000, countsOnGPU[j]));
}

// fill the error unbalance per FEDid per error type
for (int i = 0; i < nFEDs; i++) {
for (int j = 0; j < nErrors; j++) {
if (countsMatrixOnGPU[i][j] != 0 || countsMatrixOnCPU[i][j] != 0) {
edm::LogInfo("SiPixelPhase1RawDataErrorComparator")
<< "FED: " << i + FEDNumbering::MINSiPixeluTCAFEDID << " error: " << j + k_FED25
<< " | GPU counts: " << countsMatrixOnGPU[i][j] << " CPU counts:" << countsMatrixOnCPU[i][j] << std::endl;
edm::LogVerbatim(kName) << "FED: " << i + FEDNumbering::MINSiPixeluTCAFEDID << " error: " << j + k_FED25
<< " | GPU counts: " << countsMatrixOnGPU[i][j]
<< " CPU counts:" << countsMatrixOnCPU[i][j] << std::endl;
h_FEDerrorVsFEDIdUnbalance_->Fill(
j, i + FEDNumbering::MINSiPixeluTCAFEDID, countsMatrixOnGPU[i][j] - countsMatrixOnCPU[i][j]);
}
Expand All @@ -258,7 +258,7 @@ void SiPixelPhase1RawDataErrorComparator::bookHistograms(DQMStore::IBooker& iBoo

h_FEDerrorVsFEDIdUnbalance_ =
iBook.book2I("FEErrorVsFEDIdUnbalance",
"difference (GPU-CPE) of FED errors per FEDid per error type;;FED Id number;GPU counts - CPU counts",
"difference (GPU-CPU) of FED errors per FEDid per error type;;FED Id number;GPU counts - CPU counts",
nErrors,
-0.5,
nErrors - 0.5,
Expand All @@ -277,26 +277,25 @@ void SiPixelPhase1RawDataErrorComparator::bookHistograms(DQMStore::IBooker& iBoo
"n. of total Pixel FEDError per event; CPU; GPU",
500,
log10(0.5),
log10(500.5),
log10(5000.5),
500,
log10(0.5),
log10(500.5));
log10(5000.5));

for (const auto& element : errorCodeToStringMap) {
h_nFEDErrors_[element.first] = iBook.book2I(fmt::sprintf("nFED%i_Errors", element.first),
fmt::sprintf("n. of %ss per event; CPU; GPU", element.second),
501,
1000,
-0.5,
500.5,
501,
1000.5,
1000,
-0.5,
500.5);
1000.5);
}
}

void SiPixelPhase1RawDataErrorComparator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
//desc.add<edm::InputTag>("pixelErrorSrcGPU", edm::InputTag("siPixelDigiErrors"));
desc.add<edm::InputTag>("pixelErrorSrcGPU", edm::InputTag("siPixelDigis@cuda"))
->setComment("input GPU SiPixel FED errors");
desc.add<edm::InputTag>("pixelErrorSrcCPU", edm::InputTag("siPixelDigis@cpu"))
Expand Down