Skip to content

Commit

Permalink
Merge pull request #43569 from jfernan2/fixDtDQMNoisePlot
Browse files Browse the repository at this point in the history
[DQM DT] Changes to put back DT Noise plot in Online DQM
  • Loading branch information
cmsbuild authored Feb 9, 2024
2 parents 149e512 + 7d42231 commit 324a5aa
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 27 deletions.
4 changes: 3 additions & 1 deletion DQM/DTMonitorClient/python/dtNoiseAnalysis_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)

Expand Down
13 changes: 0 additions & 13 deletions DQM/DTMonitorClient/python/dtNoiseTest_cfi.py

This file was deleted.

25 changes: 21 additions & 4 deletions DQM/DTMonitorClient/src/DTNoiseAnalysisTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ DTNoiseAnalysisTest::DTNoiseAnalysisTest(const edm::ParameterSet& ps)
LogTrace("DTDQM|DTMonitorClient|DTNoiseAnalysisTest") << "[DTNoiseAnalysisTest]: Constructor";

// get the cfi parameters
noisyCellDef = ps.getUntrackedParameter<int>("noisyCellDef", 500);
noisyCellDef = ps.getUntrackedParameter<int>("noisyCellDef",
500); //value set in DQM/DTMonitorClient/python/dtNoiseAnalysis_cfi.py
isCosmics = ps.getUntrackedParameter<bool>("isCosmics", false);

// switch on/off the summaries for the Synchronous noise
doSynchNoise = ps.getUntrackedParameter<bool>("doSynchNoise", false);
detailedAnalysis = ps.getUntrackedParameter<bool>("detailedAnalysis", false);
maxSynchNoiseRate = ps.getUntrackedParameter<double>("maxSynchNoiseRate", 0.001);
noiseSafetyFactor = ps.getUntrackedParameter<double>("noiseSafetyFactor", 5.); //for collisions
nMinEvts = ps.getUntrackedParameter<int>("nEventsCert", 5000);

nevents = 0;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
17 changes: 14 additions & 3 deletions DQM/DTMonitorClient/src/DTNoiseAnalysisTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, MonitorElement*> noiseHistos;
Expand All @@ -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<std::array<float, 4>, 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<std::array<float, 4>, 2> lenghtSL_MB = {
{{{206, 252, 302, 0}}, {{240, 240, 240, 240}}}}; //Theta and Phi SL1 SL3
};

#endif
6 changes: 3 additions & 3 deletions DQM/DTMonitorModule/src/DTNoiseTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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: "
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
#----------------------------

if (process.runType.getRunType() == process.runType.cosmic_run):
pass
process.dtNoiseAnalysisMonitor.isCosmics = True



#----------------------------
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
#----------------------------

if (process.runType.getRunType() == process.runType.cosmic_run):
pass
process.dtNoiseAnalysisMonitor.isCosmics = True


#----------------------------
Expand Down

0 comments on commit 324a5aa

Please sign in to comment.