18 void CorrFitHDFunc3D::SetMask(
const CorrFitMask& mask, TH1* denominator, Bool_t hd) {
19 TH3* den3d =
static_cast<TH3*
>(denominator);
21 Int_t maxBins = TMath::Max(mask3d->GetNbinsX(), TMath::Max(mask3d->GetNbinsY(), mask3d->GetNbinsZ()));
22 fDenominatorHD.MakeBigger(
23 den3d->GetNbinsX() * 2 + 1, den3d->GetNbinsY() * 2 + 1, den3d->GetNbinsZ() * 2 + 1);
24 fDenominatorSum.MakeBigger(
25 den3d->GetNbinsX() + 1, den3d->GetNbinsY() + 1, den3d->GetNbinsZ() + 1);
26 fMapHD.MakeBigger(den3d->GetNbinsX() * 2 + 1, den3d->GetNbinsY() * 2 + 1, den3d->GetNbinsZ() * 2 + 1);
27 fMins[0] = den3d->GetXaxis()->GetBinLowEdge(1);
28 fMins[1] = den3d->GetYaxis()->GetBinLowEdge(1);
29 fMins[2] = den3d->GetZaxis()->GetBinLowEdge(1);
30 fSteps[0] = den3d->GetXaxis()->GetBinWidth(1) * 0.5;
31 fSteps[1] = den3d->GetYaxis()->GetBinWidth(1) * 0.5;
32 fSteps[2] = den3d->GetZaxis()->GetBinWidth(1) * 0.5;
34 CalculateBinsArrays(*mask3d, hd);
36 for (
int i = 0; i < fBinsX.GetSize(); i++) {
37 Int_t binX = fBinsX[i];
38 Int_t binY = fBinsY[i];
39 Int_t binZ = fBinsZ[i];
40 fDenominatorHD[GetBinHD(binX)][GetBinHD(binY)][GetBinHD(binZ)] = den3d->GetBinContent(binX, binY, binZ);
41 fDenominatorSum[binX][binY][binZ] = 1;
50 std::cout <<
"REFIT START" << std::endl;
52 std::cout <<
"REFIT ENDL" << std::endl;
53 for (
int i = 0; i < fBinsHDX.GetSize(); i++) {
54 Double_t binX = fBinsHDX[i];
55 Double_t x = EvalHDX(binX);
56 Double_t binY = fBinsHDY[i];
57 Double_t y = EvalHDY(binY);
58 Double_t binZ = fBinsHDZ[i];
59 Double_t z = EvalHDZ(binZ);
60 fDenominatorHD[binX][binY][binZ] = spline.
Eval(x, y, z);
62 Int_t sizeX = fDenominatorSum.GetSize();
63 Int_t sizeY = fDenominatorSum[0].GetSize();
64 Int_t sizeZ = fDenominatorSum[0][0].GetSize();
65 for (
int i = 1; i < sizeX; i++) {
66 Int_t binX = GetBinHD(i);
67 for (
int j = 1; j < sizeY; j++) {
68 Int_t binY = GetBinHD(j);
69 for (
int k = 1; k < sizeZ; k++) {
70 Int_t binZ = GetBinHD(k);
71 if (!mask3d->GetBinFlag(i, j, k))
continue;
73 for (
int a = -1; a < 2; a++) {
74 for (
int b = -1; b < 2; b++) {
75 for (
int c = -1; c < 2; c++) {
76 sum += fDenominatorHD[binX + a][binY + b][binZ + c];
81 fDenominatorSum[i][j][k] = 0;
83 fDenominatorSum[i][j][k] = 1. / sum;
89 Double_t CorrFitHDFunc3D::GetBinCFVal(Int_t BinX, Int_t BinY, Int_t BinZ, Bool_t extrapolated)
const {
92 Int_t xbin0 = GetBinHD(BinX);
93 Int_t ybin0 = GetBinHD(BinY);
94 Int_t zbin0 = GetBinHD(BinZ);
95 for (
int i = -1; i < 2; i++) {
96 for (
int j = -1; j < 2; j++) {
97 for (
int k = -1; k < 2; k++) {
98 val += fDenominatorHD.Get(xbin0 + i, ybin0 + j, zbin0 + k) * fMapHD.Get(xbin0 + i, ybin0 + j, zbin0 + k);
102 return val * fDenominatorSum.Get(BinX, BinY, BinZ);
104 return fMapHD.Get(GetBinHD(BinX), GetBinHD(BinY), GetBinHD(BinZ));