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;
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 Utilities to extend the interface of geometry vectors.
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.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
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).
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.
static int max(int a, int b)
Code to link reconstructed objects back to the MC truth information.
geo::Point_t fLowerCorner
geo::Point_t DefaultPoint
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
bool operator!=(const PhotonVoxelDef &rhs) const
PhotonVoxel(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
auto array(Array const &a)
Returns a manipulator which will print the specified array.
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).
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
geo::Point_t DefaultPoint
geo::Point_t fUpperCorner
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.
Definitions of geometry vector data types.
std::ostream & operator<<(std::ostream &output, const LArVoxelData &data)
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.
bool operator==(ModuleKeyAndType const &a, ModuleKeyAndType const &b) noexcept