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)
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;
100 return GetRegionUpperCorner<Point>() - GetRegionLowerCorner<Point>();
104 unsigned int GetNVoxels()
const;
107 template <
typename Po
int>
108 int GetVoxelID(
Point const&
p)
const;
110 int GetVoxelID(
double const*)
const;
111 bool IsLegalVoxelID(
int)
const;
131 template <
typename Po
int>
132 std::optional<std::array<NeiInfo, 8U>> GetNeighboringVoxelIDs(
Point const& v)
const;
135 std::array<int, 3U> GetVoxelCoords(
int ID)
const;
141 return isInsideImpl(p);
144 bool operator==(
const PhotonVoxelDef& rhs)
const;
148 return !((*this) == rhs);
154 std::optional<std::array<NeiInfo, 8U>> GetNeighboringVoxelIDsImpl(
geo::Point_t const& v)
const;
157 std::array<double, 3U> GetVoxelStepCoordsUnchecked(
geo::Point_t const&
p)
const;
163 return isInsideVolume(point, fLowerCorner, fUpperCorner);
169 static bool isInsideRange(
double value,
double lower,
double upper);
183 template <
typename Point >
187 return geo::vect::convertTo<Point>(fVoxelMin);
190 template <
typename Point >
194 return geo::vect::convertTo<Point>(fVoxelMax);
197 template <
typename Point >
207 template <
typename Point >
211 return geo::vect::convertTo<Point>(fLowerCorner);
214 template <
typename Point >
218 return geo::vect::convertTo<Point>(fUpperCorner);
222 template <
typename Vector >
226 return {(fUpperCorner.X() - fLowerCorner.X()) / fxSteps,
227 (fUpperCorner.Y() - fLowerCorner.Y()) / fySteps,
228 (fUpperCorner.Z() - fLowerCorner.Z()) / fzSteps};
232 template <
typename Po
int>
240 template <
typename Po
int>
241 std::optional<std::array<sim::PhotonVoxelDef::NeiInfo, 8U>>
249 #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.
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
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).
Definitions of geometry vector data types.
geo::Vector_t DefaultVector
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).
decltype(auto) GetLowerCorner() const
Returns the voxel vertex (type Point) with the lowest coordinates.
Utilities to extend the interface of geometry vectors.
geo::Point_t fLowerCorner
geo::Point_t DefaultPoint
bool operator!=(const PhotonVoxelDef &rhs) const
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
bool isInsideImpl(geo::Point_t const &point) const
Returns whether the specified point is within the volume.
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)
decltype(auto) GetUpperCorner() const
Returns the voxel vertex (type Point) with the highest coordinates.
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.