31 : fLowerCorner(xMin, yMin, zMin)
32 , fUpperCorner(xMax, yMax, zMax)
39 std::array<unsigned int, 3U>
67 return GetVoxelIDImpl(geo::vect::makeFromCoords<geo::Point_t>(Position));
71 std::optional<std::array<sim::PhotonVoxelDef::NeiInfo, 8U>>
76 std::array<sim::PhotonVoxelDef::NeiInfo, 8U> ret;
82 std::size_t iNeigh = 0U;
83 for (
int dx : {0, 1}) {
84 for (
int dy : {0, 1}) {
85 for (
int dz : {0, 1}) {
87 const int dr[3] = {dx, dy, dz};
91 for (
int d = 0;
d < 3; ++
d) {
93 rStepI[
d] =
int(rStepD[
d]);
102 for (
int d = 0;
d < 3; ++
d) {
106 w *= 1 + rStepI[
d] - rStepD[
d];
108 w *= 1 - rStepI[
d] + rStepD[
d];
113 ret[iNeigh++] = {id, w};
132 throw std::runtime_error(msg);
148 auto const VoxelSize = GetVoxelSize<geo::Vector_t>();
150 double const xMin = VoxelSize.X() * (xStep) +
fLowerCorner.X();
151 double const xMax = VoxelSize.X() * (xStep + 1) +
fLowerCorner.X();
152 double const yMin = VoxelSize.Y() * (yStep) +
fLowerCorner.Y();
153 double const yMax = VoxelSize.Y() * (yStep + 1) +
fLowerCorner.Y();
154 double const zMin = VoxelSize.Z() * (zStep) +
fLowerCorner.Z();
155 double const zMax = VoxelSize.Z() * (zStep + 1) +
fLowerCorner.Z();
157 return PhotonVoxel(xMin, xMax, yMin, yMax, zMin, zMax);
164 return ((ID >= 0) && (static_cast<unsigned int>(ID) <
GetNVoxels()));
170 std::array<int, 3U> ReturnVector;
171 ReturnVector[0] = ID %
fxSteps;
179 std::array<double, 3U>
203 int xStep =
static_cast<int>(stepCoords[0]);
204 int yStep =
static_cast<int>(stepCoords[1]);
205 int zStep =
static_cast<int>(stepCoords[2]);
226 return (value >= lower) && (value < upper);
238 auto const& steps = voxelDef.
GetSteps();
243 <<
"\n - x axis: [ " << lower.X() <<
" ; " << upper.X() <<
" ] split in " << steps[0]
244 <<
"x " << stepSize.X() <<
" cm steps" 245 <<
"\n - y axis: [ " << lower.Y() <<
" ; " << upper.Y() <<
" ] split in " << steps[1]
246 <<
"x " << stepSize.Y() <<
" cm steps" 247 <<
"\n - z axis: [ " << lower.Z() <<
" ; " << upper.Z() <<
" ] split in " << steps[2]
248 <<
"x " << stepSize.Z() <<
" cm steps" Definitions of voxel data structures.
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
Utilities to extend the interface of geometry vectors.
void msg(const char *fmt,...)
Vector GetVoxelSize() const
Returns a vector describing the span of a single voxel in x, y an z [cm].
int GetVoxelIDImpl(geo::Point_t const &p) const
bool operator==(const PhotonVoxelDef &rhs) const
Representation of a region of space diced into voxels.
std::array< double, 3U > GetVoxelStepCoordsUnchecked(geo::Point_t const &p) const
Returns the coordinates of the cvoxel containing p in step units.
int GetVoxelID(Point const &p) const
Returns the ID of the voxel containing p, or -1 if none.
std::array< int, 3U > GetVoxelCoords(int ID) const
bool isInside(geo::Point_t const &p) const
Returns whether point p is inside the region (upper border excluded).
static bool isInsideRange(double value, double lower, double upper)
decltype(auto) GetRegionUpperCorner() const
Returns the volume vertex (type Point) with the highest coordinates.
static int max(int a, int b)
Code to link reconstructed objects back to the MC truth information.
bool IsLegalVoxelID(int) const
geo::Point_t fLowerCorner
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Representation of a single small volume (voxel).
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
geo::Point_t fUpperCorner
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
std::array< unsigned int, 3U > GetSteps() const
Returns the number of voxels along each of the three dimensions.
Vector GetVolumeSize() const
Returns a vector describing the full span in x, y an z [cm].
std::ostream & operator<<(std::ostream &output, const LArVoxelData &data)
static bool isInsideVolume(geo::Point_t const &point, geo::Point_t const &lower, geo::Point_t const &upper)
std::optional< std::array< NeiInfo, 8U > > GetNeighboringVoxelIDsImpl(geo::Point_t const &v) const
std::string to_string(ModuleType const mt)
decltype(auto) GetRegionLowerCorner() const
Returns the volume vertex (type Point) with the lowest coordinates.
PhotonVoxel GetPhotonVoxel(int ID) const