617 int nx =
h->GetNbinsX(), ny =
h->GetNbinsY(), nz =
h->GetNbinsZ();
618 int ibx =
h->GetXaxis()->FindBin(
x), iby =
h->GetYaxis()->FindBin(
y), ibz =
h->GetZaxis()->FindBin(
z);
620 double z000,z010,z110,z100,z001,z011,z111,z101,xc,yc,zc,xc2,yc2,zc2,
u,
t,
v,
r;
621 if (ibx > nx) ibx = nx;
622 if (iby > ny) iby = ny;
623 if (ibz > nz) ibz = nz;
624 xc =
h->GetXaxis()->GetBinCenter(ibx);
625 yc =
h->GetYaxis()->GetBinCenter(iby);
626 zc =
h->GetZaxis()->GetBinCenter(ibz);
628 z111 =
h->GetBinContent(ibx,iby,ibz);
629 if ( (ibx > 1 || (ibx == 1 &&
x > xc) ) &&
630 (ibx < nx || (ibx == nx &&
x < xc) ) ) {
631 if (
x > xc) {ibx2 = ibx + 1;}
else {ibx2 = ibx - 1;}
632 xc2 =
h->GetXaxis()->GetBinCenter(ibx2);
633 if ( (iby > 1 || (iby == 1 &&
y > yc) ) &&
634 (iby < ny || (iby == ny &&
y < yc) ) ) {
635 if (
y > yc) {iby2 = iby + 1;}
else {iby2 = iby - 1;}
636 yc2 =
h->GetYaxis()->GetBinCenter(iby2);
637 if ( (ibz > 1 || (ibz == 1 &&
z > zc) ) &&
638 (ibz < nz || (ibz == nz &&
z < zc) ) ) {
639 if (
z > zc) {ibz2 = ibz + 1;}
else {ibz2 = ibz - 1;}
640 zc2 =
h->GetZaxis()->GetBinCenter(ibz2);
642 z000 =
h->GetBinContent(ibx2,iby2,ibz2);
643 z100 =
h->GetBinContent(ibx,iby2,ibz2);
644 z010 =
h->GetBinContent(ibx2,iby,ibz2);
645 z110 =
h->GetBinContent(ibx,iby,ibz2);
646 z001 =
h->GetBinContent(ibx2,iby2,ibz);
647 z101 =
h->GetBinContent(ibx,iby2,ibz);
648 z011 =
h->GetBinContent(ibx2,iby,ibz);
649 t = (
x - xc2)/(xc-xc2);
650 u = (
y - yc2)/(yc-yc2);
651 v = (
z - zc2)/(zc-zc2);
652 r = z111*
t*
u*
v + z001*(1.-
t)*(1.-
u)*
v
653 + z011*(1.-
t)*
u*
v + z101*
t*(1.-
u)*
v
654 + z110*
t*
u*(1.-
v) + z000*(1.-
t)*(1.-
u)*(1.-
v)
655 + z010*(1.-
t)*
u*(1.-
v) + z100*
t*(1.-
u)*(1.-
v);
657 z011 =
h->GetBinContent(ibx2,iby,ibz);
658 z001 =
h->GetBinContent(ibx2,iby2,ibz);
659 z101 =
h->GetBinContent(ibx,iby2,ibz);
660 t = (
x - xc2)/(xc-xc2);
661 u = (
y - yc2)/(yc-yc2);
662 r = z111*
t*
u + z011*(1.-
t)*
u + z101*
t*(1.-
u) + z001*(1.-
t)*(1.-
u) ;
664 }
else if ((ibz > 1 || (ibz == 1 &&
z > zc) ) &&
665 (ibz < nz || (ibz == nz &&
z < zc) ) ) {
666 if (
z > zc) {ibz2 = ibz + 1;}
else {ibz2 = ibz - 1;}
667 z110 =
h->GetBinContent(ibx,iby,ibz2);
668 z010 =
h->GetBinContent(ibx2,iby,ibz2);
669 z011 =
h->GetBinContent(ibx2,iby,ibz);
670 zc2 =
h->GetYaxis()->GetBinCenter(ibz2);
671 t = (
x - xc2)/(xc-xc2);
672 v = (
z - zc2)/(zc-zc2);
673 r = z111*
t*
v + z011*(1.-
t)*
v + z110*
t*(1.-
v) +z010*(1.-
t)*(1.-
v);
675 z011 =
h->GetBinContent(ibx2,iby,ibz);
676 t = (
x - xc2)/(xc-xc2);
677 r = z111*
t + z011*(1.-
t);
680 if ( (iby > 1 || (iby == 1 &&
y > yc) ) &&
681 (iby < ny || (iby == ny &&
y < yc) ) ) {
682 if (
y > yc) {iby2 = iby + 1;}
else {iby2 = iby - 1;}
683 yc2 =
h->GetYaxis()->GetBinCenter(iby2);
684 if ( (ibz > 1 || (ibz == 1 &&
z > zc) ) &&
685 (ibz < nz || (ibz == nz &&
z < zc) ) ) {
686 if (
z > zc) {ibz2 = ibz + 1;}
else {ibz2 = ibz - 1;}
687 zc2 =
h->GetZaxis()->GetBinCenter(ibz2);
689 z100 =
h->GetBinContent(ibx,iby2,ibz2);
690 z110 =
h->GetBinContent(ibx,iby,ibz2);
691 z101 =
h->GetBinContent(ibx,iby2,ibz);
692 u = (
y - yc2)/(yc-yc2);
693 v = (
z - zc2)/(zc-zc2);
694 r = z111*
u*
v + z101*(1.-
u)*
v
695 + z110*
u*(1.-
v) + z100*(1.-
u)*(1.-
v);
697 z101 =
h->GetBinContent(ibx,iby2,ibz);
698 u = (
y - yc2)/(yc-yc2);
699 r = z111*
u + z101*(1.-
u);
701 }
else if ((ibz > 1 || (ibz == 1 &&
z > zc) ) &&
702 (ibz < nz || (ibz == nz &&
z < zc) ) ) {
703 if (
z > zc) {ibz2 = ibz + 1;}
else {ibz2 = ibz - 1;}
704 z110 =
h->GetBinContent(ibx,iby,ibz2);
705 zc2 =
h->GetYaxis()->GetBinCenter(ibz2);
706 v = (
z - zc2)/(zc-zc2);
707 r = z111*
v + z110*(1.-
v);