5 #include "TDirectory.h"
25 gPrintViaErrorHandler = kTRUE;
26 gErrorIgnoreLevel = 3001;
27 TString hist_name = h2->GetName();
28 double ub = h2->GetYaxis()->GetXmax();
29 double lb = h2->GetYaxis()->GetXmin();
30 B2DEBUG(199,
"Axis: " << lb <<
" " << ub);
31 if ((h2->GetEntries() / h2->GetNbinsX()) < 30) {
32 B2WARNING(
"Low statictic: " << h2->GetEntries() <<
" Hits");
33 h2->Rebin2D(2, 2, hist_name);
36 B2DEBUG(199,
"Slice fit for histo " << hist_name);
37 B2DEBUG(199,
"Number of entries: " << h2->GetEntries());
38 TF1* g1 =
new TF1(
"g1",
"gaus", lb, ub);
39 h2->FitSlicesY(0, 0, -1, minHitCut);
42 TString m_name = hist_name +
"_1";
43 TH1D* hm = (TH1D*)gDirectory->Get(m_name)->Clone(
"hm");
46 B2DEBUG(199,
"Number of entries: " << hm->GetEntries());
47 TH1D* hlast = (TH1D*)hm->Clone(
"hlast");
49 hlast->SetName(m_name);
50 for (
int i = 1; i < h2->GetNbinsX(); ++i) {
54 TH1D* h1d = h2->ProjectionY(
"h1d", i, i);
56 sum = h1d->GetEntries();
57 if (sum < minHitCut)
continue;
58 mean = h1d->GetMean();
59 double sg = h1d->GetRMS();
60 double max = h1d->GetMaximum();
61 g1->SetParameters(max, mean, sg);
62 h1d->Fit(
"g1",
"QNR",
"");
64 mean = g1->GetParameter(1);
65 err = g1->GetParError(1);
67 double sg2 = g1->GetParameter(2);
68 h1d->Fit(
"g1",
"Q0",
"", mean - 1.1 * sg2, mean + 1.1 * sg2);
69 mean = g1->GetParameter(1);
72 hlast->SetBinContent(i, mean);
73 hlast->SetBinError(i, err);