31 : fLowerCorner(xMin, yMin, zMin)
32 , fUpperCorner(xMax, yMax, zMax)
63 return GetVoxelIDImpl(geo::vect::makeFromCoords<geo::Point_t>(Position));
67 std::optional<std::array<sim::PhotonVoxelDef::NeiInfo, 8U>>
72 std::array<sim::PhotonVoxelDef::NeiInfo, 8U> ret;
78 std::size_t iNeigh = 0U;
79 for (
int dx : {0, 1}) {
80 for (
int dy : {0, 1}) {
81 for (
int dz : {0, 1}) {
83 const int dr[3] = {dx, dy, dz};
87 for (
int d = 0;
d < 3; ++
d) {
89 rStepI[
d] = int(rStepD[
d]);
91 rStepI[
d] = std::max(0, rStepI[d]);
92 rStepI[
d] = std::min(rStepI[d],
int(
GetSteps()[d]) - 2);
98 for (
int d = 0;
d < 3; ++
d) {
102 w *= 1 + rStepI[
d] - rStepD[
d];
104 w *= 1 - rStepI[
d] + rStepD[
d];
109 ret[iNeigh++] = {id, w};
119 std::string msg =
"PhotonVoxelDef::GetNeighboringVoxelIDs():" 128 throw std::runtime_error(msg);
143 auto const VoxelSize = GetVoxelSize<geo::Vector_t>();
145 double const xMin = VoxelSize.X() * (xStep) +
fLowerCorner.X();
146 double const xMax = VoxelSize.X() * (xStep + 1) +
fLowerCorner.X();
147 double const yMin = VoxelSize.Y() * (yStep) +
fLowerCorner.Y();
148 double const yMax = VoxelSize.Y() * (yStep + 1) +
fLowerCorner.Y();
149 double const zMin = VoxelSize.Z() * (zStep) +
fLowerCorner.Z();
150 double const zMax = VoxelSize.Z() * (zStep + 1) +
fLowerCorner.Z();
152 return PhotonVoxel(xMin, xMax, yMin, yMax, zMin, zMax);
158 return ((ID >= 0) && (static_cast<unsigned int>(ID) <
GetNVoxels()));
163 std::array<int, 3U> ReturnVector;
164 ReturnVector[0] = ID %
fxSteps;
194 int xStep =
static_cast<int>(stepCoords[0]);
195 int yStep =
static_cast<int>(stepCoords[1]);
196 int zStep =
static_cast<int>(stepCoords[2]);
215 return (value >= lower) && (value < upper);
226 auto const& steps = voxelDef.
GetSteps();
231 <<
"\n - x axis: [ " << lower.X() <<
" ; " << upper.X() <<
" ] split in " << steps[0]
232 <<
"x " << stepSize.X() <<
" cm steps" 233 <<
"\n - y axis: [ " << lower.Y() <<
" ; " << upper.Y() <<
" ] split in " << steps[1]
234 <<
"x " << stepSize.Y() <<
" cm steps" 235 <<
"\n - z axis: [ " << lower.Z() <<
" ; " << upper.Z() <<
" ] split in " << steps[2]
236 <<
"x " << stepSize.Z() <<
" cm steps" Definitions of voxel data structures.
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
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.
constexpr auto abs(T v)
Returns the absolute value of the argument.
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) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
decltype(auto) GetRegionUpperCorner() const
Returns the volume vertex (type Point) with the highest coordinates.
Utilities to extend the interface of geometry vectors.
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).
geo::Point_t fUpperCorner
span(IterB &&b, IterE &&e, Adaptor &&adaptor) -> span< decltype(adaptor(std::forward< IterB >(b))), decltype(adaptor(std::forward< IterE >(e))) >
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
decltype(auto) GetRegionLowerCorner() const
Returns the volume vertex (type Point) with the lowest coordinates.
PhotonVoxel GetPhotonVoxel(int ID) const