Skip to content

Commit 7d2bb47

Browse files
committed
Minor improvements to EventT0 DQM analysis module.
1 parent 503b6a0 commit 7d2bb47

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

dqm/analysis/modules/include/DQMHistAnalysisEventT0.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace Belle2 {
4444

4545
private:
4646

47-
int m_nEntriesMin = 100; /**< minimum number of entries to process the histogram*/
47+
uint m_nEntriesMin = 100; /**< minimum number of entries to process the histogram*/
4848
/** process the EventT0 distribution
4949
* fitting with two gaussians
5050
* filling the MonitoringObject

dqm/analysis/modules/src/DQMHistAnalysisEventT0.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,16 +354,19 @@ bool DQMHistAnalysisEventT0Module::processHistogram(TH1* h, TString tag)
354354
return false;
355355
}
356356

357-
int nToFit = h->GetEntries();// - h->GetBinContent(0) - h->GetBinContent(h->GetNbinsX()+1);
358-
if (nToFit < m_nEntriesMin) {
357+
// The default value for the EventT0 value is -1000, but bins start at -100, so we might mostly fill the underflow bin if
358+
// EventT0 for a detector is not present. And also the nominal EventT0 might be too big or too small. Only use the content
359+
// of the actually useful bins to decide whether or not to fit the histogram.
360+
auto nValidEntries = h->GetEntries() - h->GetBinContent(0) - h->GetBinContent(h->GetNbinsX() + 1);
361+
if (static_cast<uint>(nValidEntries) < m_nEntriesMin) {
359362
B2DEBUG(20, "not enough entries");
360363
m_monObj->setVariable(Form("fit_%s", tag.Data()), 0);
361364
return false;
362365
}
363366

364367

365-
//scale the histogram
366-
h->Scale(1. / h->GetEntries());
368+
//scale the histogram only with content of valid bins, ignore over and underflow bins
369+
h->Scale(1. / nValidEntries);
367370
h->GetXaxis()->SetRangeUser(-50, 50);
368371

369372
//define the fitting function
@@ -400,7 +403,7 @@ bool DQMHistAnalysisEventT0Module::processHistogram(TH1* h, TString tag)
400403
gauss2.SetParameters(par[0] * (1 - par[1]), par[4], par[5]);
401404

402405
m_monObj->setVariable(Form("fit_%s", tag.Data()), 1);
403-
m_monObj->setVariable(Form("N_%s", tag.Data()), h->GetEntries(), TMath::Sqrt(h->GetEntries()));
406+
m_monObj->setVariable(Form("N_%s", tag.Data()), nValidEntries, TMath::Sqrt(nValidEntries));
404407
m_monObj->setVariable(Form("f_%s", tag.Data()), par[1], parErr[1]);
405408
m_monObj->setVariable(Form("mean1_%s", tag.Data()), par[2], parErr[2]);
406409
m_monObj->setVariable(Form("sigma1_%s", tag.Data()), par[3], parErr[3]);

0 commit comments

Comments
 (0)