14 void CorrFitHDFunc1D::SetMask(
const CorrFitMask& mask, TH1* denominator, Bool_t hd) {
16 Int_t maxBins = mask1d->GetNBins() * 2 + 1;
17 fDenominatorHD.Resize(maxBins);
18 fDenominatorSum.Resize(denominator->GetNbinsX() + 1);
19 fMapHD.Resize(maxBins);
20 fMins[0] = denominator->GetXaxis()->GetBinLowEdge(1);
21 fSteps[0] = denominator->GetXaxis()->GetBinWidth(1) * 0.5;
22 RecalcHDBin(mask1d->GetNBins());
23 CalculateBinsArrays(*mask1d, hd);
25 for (
int i = 0; i < fBins.GetSize(); i++) {
27 fDenominatorHD[GetBinHD(bin)] = denominator->GetBinContent(bin);
28 fDenominatorSum[bin] = 1;
34 Spline1D spline(denominator, denominator->GetBinContent(1), denominator->GetBinContent(denominator->GetNbinsX()));
36 for (
int i = 0; i < fBinsHD.GetSize(); i++) {
37 Double_t bin = fBinsHD[i];
38 Double_t x = EvalHD(bin);
39 fDenominatorHD[bin] = spline.
Eval(x);
41 for (
int i = 1; i < fDenominatorSum.GetSize(); i++) {
42 if (!mask1d->GetBinFlag(i))
continue;
43 Int_t bin = GetBinHD(i);
44 Double_t prev = fDenominatorHD[bin - 1];
45 Double_t curr = fDenominatorHD[bin];
46 Double_t next = fDenominatorHD[bin + 1];
47 Double_t sum = prev + curr + next;
49 fDenominatorSum[i] = 0;
51 fDenominatorSum[i] = 1.0 / sum;
56 Double_t CorrFitHDFunc1D::GetBinCFVal(Int_t BinX, Bool_t extrapolated)
const {
57 Int_t bin = GetBinHD(BinX);
60 Double_t low = fMapHD.Get(bin - 1) * fDenominatorHD.Get(bin - 1);
61 Double_t med = fMapHD.Get(bin) * fDenominatorHD.Get(bin);
62 Double_t high = fMapHD.Get(bin + 1) * fDenominatorHD.Get(bin + 1);
63 Double_t scale = fDenominatorSum.Get(BinX);
64 return scale * (low + med + high);
66 return fMapHD.Get(bin);