12 int nx =
h->GetNbinsX(), ny =
h->GetNbinsY(), nz =
h->GetNbinsZ();
13 int ibx =
h->GetXaxis()->FindBin(
x), iby =
h->GetYaxis()->FindBin(
y), ibz =
h->GetZaxis()->FindBin(
z);
14 int ibx2{0}, iby2{0}, ibz2{0};
15 double z000{0.}, z010{0.}, z110{0.}, z100{0.}, z001{0.}, z011{0.}, z111{0.}, z101{0.}, xc{0.}, yc{0.}, zc{0.}, xc2{0.}, yc2{0.},
16 zc2{0.},
u{0.},
t{0.},
v{0.},
r{0.};
29 xc =
h->GetXaxis()->GetBinCenter(ibx);
30 yc =
h->GetYaxis()->GetBinCenter(iby);
31 zc =
h->GetZaxis()->GetBinCenter(ibz);
33 z111 =
h->GetBinContent(ibx, iby, ibz);
40 for (
auto rangeX : itr->second.xRange) {
41 if (
x > rangeX.first &&
x < rangeX.second) doX =
false;
43 double ay = std::abs(
y);
44 for (
auto rangeY : itr->second.yRange) {
45 if (
ay > rangeY.first &&
ay < rangeY.second) doY =
false;
49 std::cout <<
"Isolation type = " <<
h->GetName() <<
" pT = " <<
x <<
" pT interp ? " << doX <<
" eta = " <<
y <<
" eta interp ? "
50 << doY <<
" No interp cut = " << z111 << std::endl;
52 if (!doX && !doY)
return z111;
54 if ((ibx > 1 || (ibx == 1 &&
x > xc)) && (ibx < nx || (ibx == nx &&
x < xc))) {
60 xc2 =
h->GetXaxis()->GetBinCenter(ibx2);
61 if ((iby > 1 || (iby == 1 &&
y > yc)) && (iby < ny || (iby == ny &&
y < yc))) {
67 yc2 =
h->GetYaxis()->GetBinCenter(iby2);
68 if ((ibz > 1 || (ibz == 1 &&
z > zc)) && (ibz < nz || (ibz == nz &&
z < zc))) {
74 zc2 =
h->GetZaxis()->GetBinCenter(ibz2);
78 std::cout <<
"Normal situation " <<
x <<
" " << ibx <<
" " << ibx2 <<
" " <<
y <<
" " << iby <<
" " << iby2 <<
" " <<
z
79 <<
" " << ibz <<
" " << ibz2 << std::endl;
80 std::cout <<
"Bin centers " << xc <<
" " << xc2 <<
" " << yc <<
" " << yc2 <<
" " << zc <<
" " << zc2 << std::endl;
83 z000 =
h->GetBinContent(ibx2, iby2, ibz2);
84 z100 =
h->GetBinContent(ibx, iby2, ibz2);
85 z010 =
h->GetBinContent(ibx2, iby, ibz2);
86 z110 =
h->GetBinContent(ibx, iby, ibz2);
87 z001 =
h->GetBinContent(ibx2, iby2, ibz);
88 z101 =
h->GetBinContent(ibx, iby2, ibz);
89 z011 =
h->GetBinContent(ibx2, iby, ibz);
91 t = (
x - xc2) / (xc - xc2);
92 u = (
y - yc2) / (yc - yc2);
93 v = (
z - zc2) / (zc - zc2);
98 std::cout <<
"Cuts " << z000 <<
" " << z100 <<
" " << z010 <<
" " << z110 <<
" " << z001 <<
" " << z101 <<
" " << z011
99 <<
" " << z111 << std::endl;
100 std::cout <<
"interp coeff " <<
t <<
" " <<
u <<
" " <<
v << std::endl;
103 r = z111 *
t *
u *
v + z001 * (1. -
t) * (1. -
u) *
v + z011 * (1. -
t) *
u *
v + z101 *
t * (1. -
u) *
v +
104 z110 *
t *
u * (1. -
v) + z000 * (1. -
t) * (1. -
u) * (1. -
v) + z010 * (1. -
t) *
u * (1. -
v) +
105 z100 *
t * (1. -
u) * (1. -
v);
107 z011 =
h->GetBinContent(ibx2, iby, ibz);
108 z001 =
h->GetBinContent(ibx2, iby2, ibz);
109 z101 =
h->GetBinContent(ibx, iby2, ibz);
110 t = (
x - xc2) / (xc - xc2);
111 u = (
y - yc2) / (yc - yc2);
114 r = z111 *
t *
u + z011 * (1. -
t) *
u + z101 *
t * (1. -
u) + z001 * (1. -
t) * (1. -
u);
116 }
else if ((ibz > 1 || (ibz == 1 &&
z > zc)) && (ibz < nz || (ibz == nz &&
z < zc))) {
123 z110 =
h->GetBinContent(ibx, iby, ibz2);
124 z010 =
h->GetBinContent(ibx2, iby, ibz2);
125 z011 =
h->GetBinContent(ibx2, iby, ibz);
126 zc2 =
h->GetYaxis()->GetBinCenter(ibz2);
128 t = (
x - xc2) / (xc - xc2);
130 v = (
z - zc2) / (zc - zc2);
131 r = z111 *
t *
v + z011 * (1. -
t) *
v + z110 *
t * (1. -
v) + z010 * (1. -
t) * (1. -
v);
134 z011 =
h->GetBinContent(ibx2, iby, ibz);
135 t = (
x - xc2) / (xc - xc2);
137 r = z111 *
t + z011 * (1. -
t);
140 if ((iby > 1 || (iby == 1 &&
y > yc)) && (iby < ny || (iby == ny &&
y < yc))) {
146 yc2 =
h->GetYaxis()->GetBinCenter(iby2);
147 if ((ibz > 1 || (ibz == 1 &&
z > zc)) && (ibz < nz || (ibz == nz &&
z < zc))) {
153 zc2 =
h->GetZaxis()->GetBinCenter(ibz2);
155 z100 =
h->GetBinContent(ibx, iby2, ibz2);
156 z110 =
h->GetBinContent(ibx, iby, ibz2);
157 z101 =
h->GetBinContent(ibx, iby2, ibz);
158 u = (
y - yc2) / (yc - yc2);
160 v = (
z - zc2) / (zc - zc2);
161 r = z111 *
u *
v + z101 * (1. -
u) *
v + z110 *
u * (1. -
v) + z100 * (1. -
u) * (1. -
v);
163 z101 =
h->GetBinContent(ibx, iby2, ibz);
164 u = (
y - yc2) / (yc - yc2);
166 r = z111 *
u + z101 * (1. -
u);
168 }
else if ((ibz > 1 || (ibz == 1 &&
z > zc)) && (ibz < nz || (ibz == nz &&
z < zc))) {
174 z110 =
h->GetBinContent(ibx, iby, ibz2);
175 zc2 =
h->GetYaxis()->GetBinCenter(ibz2);
176 v = (
z - zc2) / (zc - zc2);
177 r = z111 *
v + z110 * (1. -
v);
183 if (
m_debug) std::cout <<
"Cut " <<
r << std::endl;