39 Histo2d::Histo2d(
int nnx,
float mminx,
float mmaxx,
int nny,
float mminy,
float mmaxy) {
45 scalex = nx / (mmaxx - mminx);
47 LOGL_WARN(_log,
"Histo2d: minx = maxx requested");
51 scaley = ny / (mmaxy - mminy);
53 LOGL_WARN(_log,
"Histo2d: maxy = miny requested");
56 data.
reset(
new float[nx * ny]);
57 memset(data.
get(), 0, nx * ny *
sizeof(
float));
62 data.
reset(
new float[nx * ny]);
63 memcpy((data).get(),
other.data.get(), nx * ny *
sizeof(
float));
66 bool Histo2d::indices(
double x,
double y,
int &ix,
int &iy)
const {
68 if (ix < 0 || ix >= nx)
return false;
70 return (iy >= 0 && iy < ny);
75 if (indices(
x,
y, ix, iy)) data[iy + ny * ix] +=
weight;
83 for (p = data.
get(), pend = p + nx * ny; pend - p; p++) {
86 imax = p - (data.
get());
90 int iy = imax - ix * ny;
91 x = minx + ((float)ix + 0.5) / scalex;
92 y = miny + ((float)iy + 0.5) / scaley;
98 if (indices(
x,
y, ix, iy)) data[iy + ny * ix] = 0;
103 if (indices(
x,
y, ix, iy))
return data[iy + ny * ix];
104 LOGL_WARN(_log,
"Histo2D::binContent outside limits requested");