6 #ifndef LARSIM_SIMULATION_PHOTONVOXELS_H 7 #define LARSIM_SIMULATION_PHOTONVOXELS_H 25 PhotonVoxel(
double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax)
26 :
PhotonVoxel({xMin, yMin, zMin}, {xMax, yMax, zMax})
42 template <
typename Po
int = DefaultPo
int>
64 unsigned int fxSteps = 1U;
65 unsigned int fySteps = 1U;
66 unsigned int fzSteps = 1U;
69 PhotonVoxelDef() =
default;
70 PhotonVoxelDef(
double xMin,
81 template <
typename Po
int = DefaultPo
int>
82 decltype(
auto) GetRegionLowerCorner() const;
86 decltype(auto) GetRegionUpperCorner() const;
89 std::
array<
unsigned int, 3U> GetSteps() const;
93 Vector GetVoxelSize() const;
97 Vector GetVolumeSize()
const 99 return GetRegionUpperCorner<Point>() - GetRegionLowerCorner<Point>();
103 unsigned int GetNVoxels()
const;
106 template <
typename Po
int>
107 int GetVoxelID(
Point const& p)
const;
109 int GetVoxelID(
double const*)
const;
110 bool IsLegalVoxelID(
int)
const;
130 template <
typename Po
int>
131 std::optional<std::array<NeiInfo, 8U>> GetNeighboringVoxelIDs(
Point const& v)
const;
134 std::array<int, 3U> GetVoxelCoords(
int ID)
const;
139 bool operator==(
const PhotonVoxelDef& rhs)
const;
140 bool operator!=(
const PhotonVoxelDef& rhs)
const {
return !((*this) == rhs); }
145 std::optional<std::array<NeiInfo, 8U>> GetNeighboringVoxelIDsImpl(
geo::Point_t const& v)
const;
148 std::array<double, 3U> GetVoxelStepCoordsUnchecked(
geo::Point_t const& p)
const;
153 return isInsideVolume(point, fLowerCorner, fUpperCorner);
159 static bool isInsideRange(
double value,
double lower,
double upper);
173 template <
typename Point >
176 return geo::vect::convertTo<Point>(
fVoxelMin);
179 template <
typename Point >
182 return geo::vect::convertTo<Point>(
fVoxelMax);
185 template <
typename Point >
194 template <
typename Point >
197 return geo::vect::convertTo<Point>(fLowerCorner);
200 template <
typename Point >
203 return geo::vect::convertTo<Point>(fUpperCorner);
207 template <
typename Vector >
210 return {(fUpperCorner.X() - fLowerCorner.X()) / fxSteps,
211 (fUpperCorner.Y() - fLowerCorner.Y()) / fySteps,
212 (fUpperCorner.Z() - fLowerCorner.Z()) / fzSteps};
216 template <
typename Po
int>
223 template <
typename Po
int>
224 std::optional<std::array<sim::PhotonVoxelDef::NeiInfo, 8U>>
232 #endif // LARSIM_SIMULATION_PHOTONVOXELS_H
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Vector GetVoxelSize() const
Returns a vector describing the span of a single voxel in x, y an z [cm].
PhotonVoxel(geo::Point_t const &min, geo::Point_t const &max)
Representation of a region of space diced into voxels.
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
int GetVoxelID(Point const &p) const
Returns the ID of the voxel containing p, or -1 if none.
bool isInside(geo::Point_t const &p) const
Returns whether point p is inside the region (upper border excluded).
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Definitions of geometry vector data types.
geo::Vector_t DefaultVector
decltype(auto) GetUpperCorner() const
Returns the voxel vertex (type Point) with the highest coordinates.
decltype(auto) GetRegionUpperCorner() const
Returns the volume vertex (type Point) with the highest coordinates.
Utilities to extend the interface of geometry vectors.
geo::Point_t fLowerCorner
geo::Point_t DefaultPoint
bool operator!=(const PhotonVoxelDef &rhs) const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
PhotonVoxel(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
std::optional< std::array< NeiInfo, 8U > > GetNeighboringVoxelIDs(Point const &v) const
Returns IDs of the eight neighboring voxels around v.
Representation of a single small volume (voxel).
geo::Point_t DefaultPoint
geo::Point_t fUpperCorner
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Point GetCenter() const
Returns the center of the voxel (type Point).
bool isInsideImpl(geo::Point_t const &point) const
Returns whether the specified point is within the volume.
std::ostream & operator<<(std::ostream &output, const LArVoxelData &data)
bool operator==(infinite_endcount_iterator< T > const &, count_iterator< T > const &)
geo::Point_t middlePoint(BeginIter begin, EndIter end)
Returns the middle of the specified points.
decltype(auto) GetLowerCorner() const
Returns the voxel vertex (type Point) with the lowest coordinates.
decltype(auto) GetRegionLowerCorner() const
Returns the volume vertex (type Point) with the lowest coordinates.