From 8f00fa9d549028e4aa689638cb2352819d64fc7f Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 12 Feb 2024 13:43:24 +0100 Subject: [PATCH] Changes from pr43569 --- .../python/dtNoiseAnalysis_cfi.py | 4 ++- DQM/DTMonitorClient/python/dtNoiseTest_cfi.py | 13 ---------- .../src/DTNoiseAnalysisTest.cc | 25 ++++++++++++++++--- DQM/DTMonitorClient/src/DTNoiseAnalysisTest.h | 17 ++++++++++--- DQM/DTMonitorModule/src/DTNoiseTask.cc | 6 ++--- .../dt4ml_dqm_sourceclient-live_cfg.py | 4 +-- .../clients/dt_dqm_sourceclient-live_cfg.py | 2 +- 7 files changed, 44 insertions(+), 27 deletions(-) delete mode 100644 DQM/DTMonitorClient/python/dtNoiseTest_cfi.py diff --git a/DQM/DTMonitorClient/python/dtNoiseAnalysis_cfi.py b/DQM/DTMonitorClient/python/dtNoiseAnalysis_cfi.py index 592e71b894842..b70b9ae2ff80b 100644 --- a/DQM/DTMonitorClient/python/dtNoiseAnalysis_cfi.py +++ b/DQM/DTMonitorClient/python/dtNoiseAnalysis_cfi.py @@ -2,10 +2,12 @@ from DQMServices.Core.DQMEDHarvester import DQMEDHarvester dtNoiseAnalysisMonitor = DQMEDHarvester("DTNoiseAnalysisTest", - noisyCellDef = cms.untracked.int32(1500), + noisyCellDef = cms.untracked.int32(500), # (in Hz): for cosmics 500 Hz, based on runs 341052 and 339579, variable chamber by chamber for collisions + isCosmics = cms.untracked.bool(False), doSynchNoise = cms.untracked.bool(False), detailedAnalysis = cms.untracked.bool(False), maxSynchNoiseRate = cms.untracked.double(0.001), + noiseSafetyFactor = cms.untracked.double(5.), nEventsCert = cms.untracked.int32(1000) ) diff --git a/DQM/DTMonitorClient/python/dtNoiseTest_cfi.py b/DQM/DTMonitorClient/python/dtNoiseTest_cfi.py deleted file mode 100644 index c4037cd4c1f45..0000000000000 --- a/DQM/DTMonitorClient/python/dtNoiseTest_cfi.py +++ /dev/null @@ -1,13 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -noiseTest = cms.EDAnalyzer("DTNoiseTest", - HzThreshold = cms.untracked.int32(300), - runningStandalone = cms.untracked.bool(True), - meanTestName = cms.untracked.string('NoiseMeanInRange'), - folderTag = cms.untracked.string('Occupancies'), - folderRoot = cms.untracked.string(''), - debug = cms.untracked.bool(False), - diagnosticPrescale = cms.untracked.int32(1000) -) - - diff --git a/DQM/DTMonitorClient/src/DTNoiseAnalysisTest.cc b/DQM/DTMonitorClient/src/DTNoiseAnalysisTest.cc index e09f32f97c5e9..5eff54ccd3989 100644 --- a/DQM/DTMonitorClient/src/DTNoiseAnalysisTest.cc +++ b/DQM/DTMonitorClient/src/DTNoiseAnalysisTest.cc @@ -34,12 +34,15 @@ DTNoiseAnalysisTest::DTNoiseAnalysisTest(const edm::ParameterSet& ps) LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") << "[DTNoiseAnalysisTest]: Constructor"; // get the cfi parameters - noisyCellDef = ps.getUntrackedParameter("noisyCellDef", 500); + noisyCellDef = ps.getUntrackedParameter("noisyCellDef", + 500); //value set in DQM/DTMonitorClient/python/dtNoiseAnalysis_cfi.py + isCosmics = ps.getUntrackedParameter("isCosmics", false); // switch on/off the summaries for the Synchronous noise doSynchNoise = ps.getUntrackedParameter("doSynchNoise", false); detailedAnalysis = ps.getUntrackedParameter("detailedAnalysis", false); maxSynchNoiseRate = ps.getUntrackedParameter("maxSynchNoiseRate", 0.001); + noiseSafetyFactor = ps.getUntrackedParameter("noiseSafetyFactor", 5.); //for collisions nMinEvts = ps.getUntrackedParameter("nEventsCert", 5000); nevents = 0; @@ -94,7 +97,7 @@ void DTNoiseAnalysisTest::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker, if (histo) { // check the pointer - TH2F* histo_root = histo->getTH2F(); + TH2D* histo_root = histo->getTH2D(); for (int sl = 1; sl != 4; ++sl) { // loop over SLs // skip theta SL in MB4 chambers @@ -120,6 +123,20 @@ void DTNoiseAnalysisTest::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker, noiseHistos[chID.wheel()]->Fill(noise); noiseHistos[3]->Fill(noise); int sector = chID.sector(); + + if (!isCosmics) { // for collisions + float k = kW_MB[2 - abs(chID.wheel())][chID.station() - 1]; + if (chID.station() == 4) { //special geometry cases for MB4 + if (sector == 9 || sector == 10 || sector == 11) + k = 0.05; + else if (sector == 4 && chID.wheel() == 0) + k = 0.25; + } + noisyCellDef = + cellW * instLumi * k * lenghtSL_MB[(sl % 2)][chID.station() - 1]; // background expected per chamber + noisyCellDef = noisyCellDef * noiseSafetyFactor; + } //else value read from DQM/DTMonitorClient/python/dtNoiseAnalysis_cfi.py + if (noise > noisyCellDef) { if (sector == 13) { sector = 4; @@ -224,13 +241,13 @@ void DTNoiseAnalysisTest::bookHistos(DQMStore::IBooker& ibooker) { wheel << wh; histoName = "NoiseRateSummary_W" + wheel.str(); - noiseHistos[wh] = ibooker.book1D(histoName.c_str(), histoName.c_str(), 100, 0, 2000); + noiseHistos[wh] = ibooker.book1D(histoName.c_str(), histoName.c_str(), 500, 0, 10000); noiseHistos[wh]->setAxisTitle("rate (Hz)", 1); noiseHistos[wh]->setAxisTitle("entries", 2); } histoName = "NoiseRateSummary"; - noiseHistos[3] = ibooker.book1D(histoName.c_str(), histoName.c_str(), 100, 0, 2000); + noiseHistos[3] = ibooker.book1D(histoName.c_str(), histoName.c_str(), 500, 0, 10000); noiseHistos[3]->setAxisTitle("rate (Hz)", 1); noiseHistos[3]->setAxisTitle("entries", 2); diff --git a/DQM/DTMonitorClient/src/DTNoiseAnalysisTest.h b/DQM/DTMonitorClient/src/DTNoiseAnalysisTest.h index 3424ebe44fd32..862b46cb3c404 100644 --- a/DQM/DTMonitorClient/src/DTNoiseAnalysisTest.h +++ b/DQM/DTMonitorClient/src/DTNoiseAnalysisTest.h @@ -66,6 +66,11 @@ class DTNoiseAnalysisTest : public DQMEDHarvester { // paramaters from cfg int noisyCellDef; + bool isCosmics; + bool doSynchNoise; + bool detailedAnalysis; + double maxSynchNoiseRate; + double noiseSafetyFactor; // wheel summary histograms std::map noiseHistos; @@ -75,9 +80,15 @@ class DTNoiseAnalysisTest : public DQMEDHarvester { MonitorElement* summarySynchNoiseHisto; MonitorElement* glbSummarySynchNoiseHisto; - bool doSynchNoise; - bool detailedAnalysis; - double maxSynchNoiseRate; + //values based on F. Romana research, estimate the background rate per chamber and set a threshold to spot noisy wires with a safety factor + static constexpr float cellW = 4.2; //cm + static constexpr float instLumi = 20; //E33 cm-2 s-1, reference for Run3 + static constexpr std::array, 3> kW_MB = { + {{{0.41, 0.08, 0.01, 0.15}}, + {{0.17, 0.04, 0.01, 0.15}}, + {{0.06, 0.02, 0.01, 0.15}}}}; // in units of E33 cm-2 s-1, 3 wheel types x 4 MB stations + static constexpr std::array, 2> lenghtSL_MB = { + {{{206, 252, 302, 0}}, {{240, 240, 240, 240}}}}; //Theta and Phi SL1 SL3 }; #endif diff --git a/DQM/DTMonitorModule/src/DTNoiseTask.cc b/DQM/DTMonitorModule/src/DTNoiseTask.cc index 9a466569f9715..378054965c28f 100644 --- a/DQM/DTMonitorModule/src/DTNoiseTask.cc +++ b/DQM/DTMonitorModule/src/DTNoiseTask.cc @@ -106,7 +106,7 @@ void DTNoiseTask::analyze(const edm::Event& e, const edm::EventSetup& c) { // fill the occupancy histo // FIXME: needs to be optimized: no need to rescale the histo for each digi - TH2F* noise_root = noiseHistos[(*dtLayerId_It).first.superlayerId().chamberId()]->getTH2F(); + TH2D* noise_root = noiseHistos[(*dtLayerId_It).first.superlayerId().chamberId()]->getTH2D(); double normalization = 0; if (mapEvt.find((*dtLayerId_It).first.superlayerId().chamberId()) != mapEvt.end()) { LogVerbatim("DTNoiseTask") << " Last fill: # of events: " @@ -172,7 +172,7 @@ void DTNoiseTask::bookHistos(DQMStore::IBooker& ibooker, DTChamberId chId) { } noiseHistos[chId] = - ibooker.book2D(histoName, "Noise rate (Hz) per channel", nWires_max, 1, nWires_max + 1, 12, 1, 13); + ibooker.book2DD(histoName, "Noise rate (Hz) per channel", nWires_max, 1, nWires_max + 1, 12, 1, 13); noiseHistos[chId]->setAxisTitle("wire number", 1); noiseHistos[chId]->setBinLabel(1, "SL1-L1", 2); noiseHistos[chId]->setBinLabel(2, "SL1-L2", 2); @@ -262,7 +262,7 @@ void DTNoiseTask::endLuminosityBlock(const LuminosityBlock& lumiSeg, const Event meAndChamber != noiseHistos.end(); ++meAndChamber) { DTChamberId chId = (*meAndChamber).first; - TH2F* noise_root = (*meAndChamber).second->getTH2F(); + TH2D* noise_root = (*meAndChamber).second->getTH2D(); double upperLimit = tTrigStMap[chId] - safeMargin; double normalization = 0; diff --git a/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py index dc57b66793022..10b808f976069 100644 --- a/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/dt4ml_dqm_sourceclient-live_cfg.py @@ -105,7 +105,8 @@ #---------------------------- if (process.runType.getRunType() == process.runType.cosmic_run): - pass + process.dtNoiseAnalysisMonitor.isCosmics = True + #---------------------------- @@ -121,7 +122,6 @@ process.dtDigiMonitor.ResetCycle = 9999 - ### process customizations included here from DQM.Integration.config.online_customizations_cfi import * print("Final Source settings:", process.source) diff --git a/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py index 69b68a5808f4e..a1c4010ec064d 100644 --- a/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/dt_dqm_sourceclient-live_cfg.py @@ -86,7 +86,7 @@ #---------------------------- if (process.runType.getRunType() == process.runType.cosmic_run): - pass + process.dtNoiseAnalysisMonitor.isCosmics = True #----------------------------