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]);
95 rStepI[d] = std::max(0, rStepI[d]);
96 rStepI[d] = std::min(rStepI[d],
int(
GetSteps()[d]) - 2);
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};
123 std::string
msg =
"PhotonVoxelDef::GetNeighboringVoxelIDs():"
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>
188 return {{(relPos.X() / span.X()) *
fxSteps,
189 (relPos.Y() / span.Y()) *
fySteps,
190 (relPos.Z() / span.Z()) *
fzSteps}};
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"
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
std::array< unsigned int, 3U > GetSteps() const
Returns the number of voxels along each of the three dimensions.
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.
unsigned int GetNVoxels() const
Returns the total number of voxels in the volume.
bool isInside(geo::Point_t const &p) const
Returns whether point p is inside the region (upper border excluded).
Definitions of voxel data structures.
decltype(auto) GetRegionLowerCorner() const
Returns the volume vertex (type Point) with the lowest coordinates.
static bool isInsideRange(double value, double lower, double upper)
Utilities to extend the interface of geometry vectors.
decltype(auto) GetRegionUpperCorner() const
Returns the volume vertex (type Point) with the highest coordinates.
bool IsLegalVoxelID(int) const
std::array< int, 3U > GetVoxelCoords(int ID) const
geo::Point_t fLowerCorner
Representation of a single small volume (voxel).
geo::Point_t fUpperCorner
std::string to_string(WindowPattern const &pattern)
Vector GetVolumeSize() const
Returns a vector describing the full span in x, y an z [cm].
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
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
PhotonVoxel GetPhotonVoxel(int ID) const