Skip to content

Commit 63a7335

Browse files
committed
Merge pull request #1056 in B2/basf2 from feature/dqm_pxd_add_debug_output6 to release/06-01
* commit 'c3a7742759e99e942fa839f7bc90b8eded9b7956': remove cm63 from state calculation simplify naming string, fraction in percent use correct modulename, adjust coordinates moved definition added the Draw fix outside ratio & add info-box add debug output
2 parents f8253ff + c3a7742 commit 63a7335

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

dqm/analysis/modules/src/DQMHistAnalysisPXDCM.cc

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <dqm/analysis/modules/DQMHistAnalysisPXDCM.h>
1515
#include <TROOT.h>
1616
#include <TLatex.h>
17+
#include <TPaveText.h>
1718
#include <vxd/geometry/GeoCache.h>
1819
#include <framework/core/ModuleParam.templateDetails.h>
1920

@@ -186,8 +187,13 @@ void DQMHistAnalysisPXDCMModule::event()
186187
if (!m_cCommonMode) return;
187188
m_hCommonMode->Reset(); // dont sum up!!!
188189

190+
auto leg = new TPaveText(0.1, 0.6, 0.90, 0.95, "NDC");
191+
leg->SetFillStyle(0);
192+
leg->SetBorderSize(0);
193+
189194
for (unsigned int i = 0; i < m_PXDModules.size(); i++) {
190-
std::string name = "PXDDAQCM_" + (std::string)m_PXDModules[i ];
195+
auto modname = (std::string)m_PXDModules[i];
196+
std::string name = "PXDDAQCM_" + modname;
191197
// std::replace( name.begin(), name.end(), '.', '_');
192198

193199
TH1* hh1 = findHist(name);
@@ -255,6 +261,7 @@ void DQMHistAnalysisPXDCMModule::event()
255261
Double_t mean_adhoc = 0.;
256262
Double_t entries_adhoc = 0.;
257263
Double_t outside_adhoc = 0.;
264+
258265
// Attention, Bins
259266
// we do not need to re-scale it as the scale is the same for all bins
260267
for (int cm_y = 0; cm_y < m_upperLineAdhoc; cm_y++) {
@@ -263,21 +270,39 @@ void DQMHistAnalysisPXDCMModule::event()
263270
mean_adhoc += v * (cm_y + 1);
264271
}
265272
// Attention, Bins
266-
for (int cm_y = m_upperLineAdhoc; cm_y < 64; cm_y++) {
273+
// We ignore CM63 in outside and overall count
274+
for (int cm_y = m_upperLineAdhoc; cm_y < 63; cm_y++) {
267275
auto v = m_hCommonModeDelta->GetBinContent(m_hCommonModeDelta->GetBin(i + 1, cm_y + 1));
268276
entries_adhoc += v;
269277
outside_adhoc += v;
270278
}
271-
if (entries_adhoc > 0) { // ignore 1.3.2
279+
if (entries_adhoc > 0 && scale < 1e-3) { // ignore 1.3.2 and minimum events
280+
// scale <1e-3 == >1000 events
272281
mean_adhoc /= entries_adhoc; // calculate mean
273-
// scale <1e-3 == >1000 entries
274-
warn_adhoc_flag |= scale < 1e-3 && (fabs(10.0 - mean_adhoc) > m_warnMeanAdhoc || outside_adhoc > m_warnOutsideAdhoc);
275-
error_adhoc_flag |= scale < 1e-3 && (fabs(10.0 - mean_adhoc) > m_errorMeanAdhoc || outside_adhoc > m_errorOutsideAdhoc);
276-
m_monObj->setVariable(("cm_" + (std::string)m_PXDModules[i]).c_str(), mean_adhoc);
282+
auto warn_tmp_m = fabs(10.0 - mean_adhoc) > m_warnMeanAdhoc;
283+
auto err_tmp_m = fabs(10.0 - mean_adhoc) > m_errorMeanAdhoc;
284+
auto warn_tmp_os = outside_adhoc / entries_adhoc > m_warnOutsideAdhoc;
285+
auto err_tmp_os = outside_adhoc / entries_adhoc > m_errorOutsideAdhoc;
286+
warn_adhoc_flag |= warn_tmp_m || warn_tmp_os;
287+
error_adhoc_flag |= err_tmp_m || err_tmp_os;
288+
289+
if (warn_tmp_m || err_tmp_m) {
290+
TString tmp;
291+
tmp.Form("%s: Mean %f", modname.c_str(), mean_adhoc);
292+
leg->AddText(tmp);
293+
B2INFO(name << " Mean " << mean_adhoc << " " << warn_tmp_m << err_tmp_m);
294+
}
295+
if (warn_tmp_os || err_tmp_os) {
296+
TString tmp;
297+
tmp.Form("%s: Outside %f %%", modname.c_str(), 100. * outside_adhoc / entries_adhoc);
298+
leg->AddText(tmp);
299+
B2INFO(name << " Outside " << outside_adhoc / entries_adhoc << " (" << outside_adhoc << "/" << entries_adhoc << ") " << warn_tmp_os
300+
<< err_tmp_os);
301+
}
302+
m_monObj->setVariable(("cm_" + modname).c_str(), mean_adhoc);
277303
#ifdef _BELLE2_EPICS
278304
if (m_useEpics) {
279305
auto my = mychid_mean[m_PXDModules[i]];
280-
// B2ERROR("Mean "<< name << " " << mean_adhoc << " " << outside_adhoc << " " << entries_adhoc << " " <<warn_adhoc_flag <<error_adhoc_flag );
281306
if (my) SEVCHK(ca_put(DBR_DOUBLE, my, (void*)&mean_adhoc), "ca_set failure");
282307
}
283308
#endif
@@ -302,6 +327,7 @@ void DQMHistAnalysisPXDCMModule::event()
302327
m_cCommonMode->Pad()->SetFillColor(kYellow);// Yellow
303328
status = 3;
304329
} else if (all_outside == 0. /*&& all_cm == 0.*/) {
330+
// do not react on all_cm, we better monitor it elsewhere for clearity
305331
m_cCommonMode->Pad()->SetFillColor(kGreen);// Green
306332
status = 2;
307333
} else { // between 0 and 50 ...
@@ -354,6 +380,7 @@ void DQMHistAnalysisPXDCMModule::event()
354380
#endif
355381
if (m_hCommonModeDelta) {
356382
m_hCommonModeDelta->Draw("colz");
383+
leg->Draw();
357384
m_line1->Draw();
358385
m_lineA->Draw();
359386
}

0 commit comments

Comments
 (0)