Skip to content

Commit 0412142

Browse files
committed
Merge branch 'feature/ecldqmanalysis-out-of-time-digits-rel8' into 'release/08-00'
DQMHistAnalysisECLOutOfTimeDigits adjustments for release-08-00 See merge request belle2/software/basf2!2509
2 parents 3fde711 + 8011f8b commit 0412142

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

dqm/analysis/modules/src/DQMHistAnalysisECLOutOfTimeDigits.cc

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#include <dqm/analysis/modules/DQMHistAnalysisECLOutOfTimeDigits.h>
1111

1212
//ROOT
13-
#include <TProfile.h>
13+
#include <TF1.h>
14+
#include <TH1F.h>
1415

1516
using namespace Belle2;
1617

@@ -56,11 +57,11 @@ void DQMHistAnalysisECLOutOfTimeDigitsModule::event()
5657
m_out_of_time_digits[pv_name] = 0;
5758

5859
std::string hist_name = "ECL/out_of_time_" + var_name;
59-
auto prof = (TProfile*)findHist(hist_name, m_onlyIfUpdated);
60+
auto hist = (TH1F*)findHist(hist_name, m_onlyIfUpdated);
6061

61-
if (!prof) continue;
62+
if (!hist) continue;
6263

63-
m_out_of_time_digits[pv_name] = prof->GetBinContent(1);
64+
m_out_of_time_digits[pv_name] = hist->GetMean();
6465

6566
//== Set EPICS PVs
6667

@@ -75,20 +76,37 @@ void DQMHistAnalysisECLOutOfTimeDigitsModule::endRun()
7576
{
7677
B2DEBUG(20, "DQMHistAnalysisECLOutOfTimeDigits: endRun called");
7778

78-
if (findHist("ECL/out_of_time_physics_All") == nullptr) {
79+
auto main_hist = (TH1F*)findHist("ECL/out_of_time_physics_All");
80+
81+
if (main_hist == nullptr) {
7982
m_monObj->setVariable("comment_out_of_time_digits", "No ECL out-of-time ECLCalDigits histograms available");
8083
B2INFO("Histogram named ECL/out_of_time_physics_All is not found.");
8184
return;
8285
}
8386

87+
TF1 gaus("fit_func", "gaus");
88+
8489
for (auto& event_type : {"rand", "dphy", "physics"}) {
8590
for (auto& ecl_part : {"All", "FWDEndcap", "Barrel", "BWDEndcap"}) {
86-
std::string pv_name = event_type + std::string(":") + ecl_part;
87-
std::string var_name = "out_of_time_digits_" + pv_name;
91+
std::string pv_name = event_type + std::string(":") + ecl_part;
92+
std::string hist_name = "ECL/out_of_time_" + pv_name;
93+
std::string var_name = "out_of_time_digits_" + pv_name;
94+
95+
std::replace(hist_name.begin(), hist_name.end(), ':', '_');
8896
std::replace(var_name.begin(), var_name.end(), ':', '_');
89-
// set values of monitoring variables (if variable already exists this will
90-
// change its value, otherwise it will insert new variable)
91-
m_monObj->setVariable(var_name, m_out_of_time_digits[pv_name]);
97+
98+
// If enough statistics, obtain more detailed information for MiraBelle
99+
auto hist = (TH1F*)findHist(hist_name);
100+
if (hist && hist->GetEntries() > 1000) {
101+
// Fit the histogram to get the peak of a distribution
102+
hist->Fit(&gaus);
103+
m_monObj->setVariable(var_name, gaus.GetParameter(1));
104+
m_monObj->setVariable(var_name + "_stddev", gaus.GetParameter(2));
105+
} else {
106+
// Use simple mean from the histogram
107+
m_monObj->setVariable(var_name, m_out_of_time_digits[pv_name]);
108+
m_monObj->setVariable(var_name + "_stddev", 0);
109+
}
92110
}
93111
}
94112
}

0 commit comments

Comments
 (0)