21 (
double min,
double max,
double stepSize);
41 std::vector<recob::SpacePoint>& spacePoints,
51 int ID = spacePoints.empty()? 1: spacePoints.back().ID() + 1;
52 size_t const origNPoints = spacePoints.size();
53 double const error = stepSize / std::sqrt(12.);
57 std::array<double, 3>
const center 59 std::array<double, 3> point;
60 for (
int ix = indicesX.first; ix <= indicesX.second; ++ix) {
61 point[0] =
center[0] + ix * stepSize;
63 for (
int iy = indicesY.first; iy <= indicesY.second; ++iy) {
64 point[1] =
center[1] + iy * stepSize;
66 for (
int iz = indicesZ.first; iz <= indicesZ.second; ++iz) {
67 point[2] =
center[2] + iz * stepSize;
75 return spacePoints.size() - origNPoints;
81 (
double min,
double max,
double stepSize)
83 if (min >= max)
return { 0, 0 };
86 return { -
int((center - min) / stepSize),
int((max - center) / stepSize) };
Utilities for tests based on space points.
double MinX() const
Returns the world x coordinate of the start of the box.
double CenterX() const
Returns the world x coordinate of the center of the box.
double CenterZ() const
Returns the world z coordinate of the center of the box.
double MaxX() const
Returns the world x coordinate of the end of the box.
recob::SpacePoint MakeSpacePoint(int ID, double const *pos, double error=0.)
Creates and returns a new space point.
double MinZ() const
Returns the world z coordinate of the start of the box.
unsigned int FillSpacePointGrid(std::vector< recob::SpacePoint > &spacePoints, geo::BoxBoundedGeo const &box, double stepSize)
Creates space points distributed in a grid.
static int max(int a, int b)
void err(const char *fmt,...)
double MaxY() const
Returns the world y coordinate of the end of the box.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
double CenterY() const
Returns the world y coordinate of the center of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
std::pair< int, int > ComputeRangeIndices(double min, double max, double stepSize)
double MinY() const
Returns the world y coordinate of the start of the box.