8 #ifndef LARCOREALG_GEOMETRY_TPCGEO_H 9 #define LARCOREALG_GEOMETRY_TPCGEO_H 22 #include "TGeoVolume.h" 23 #include "TGeoMatrix.h" 123 template <
typename Vector>
127 decltype(
auto)
WidthDir()
const {
return WidthDir<DefaultVector_t>(); }
130 template <
typename Vector>
134 decltype(
auto)
HeightDir()
const {
return HeightDir<DefaultVector_t>(); }
137 template <
typename Vector>
141 decltype(
auto)
LengthDir()
const {
return LengthDir<DefaultVector_t>(); }
147 template <
typename Vector>
215 {
return Plane(planeid); }
272 std::set<geo::View_t>
Views()
const;
280 template <
typename Po
int>
287 template <
typename Po
int>
293 {
return GetActiveVolumeCenter<DefaultPoint_t>(); }
297 template <
typename Po
int>
304 {
return GetCathodeCenter<DefaultPoint_t>(); }
307 template <
typename Po
int>
313 {
return GetFrontFaceCenter<geo::Point_t>(); }
329 unsigned int p2=1)
const;
330 double WirePitch(
unsigned plane = 0)
const;
371 template <
typename Vector>
387 template <
typename Vector>
459 template <
typename Po
int>
463 {
return ProjectionReferencePoint<DefaultPoint_t>(); }
523 template <
typename Po
int>
527 {
return ComposePoint<DefaultPoint_t>(decomp); }
549 template <
typename Po
int>
553 {
return ComposePoint<DefaultPoint_t>(
distance, proj); }
663 template <
typename Stream>
692 (
double c,
double min,
double max,
double wiggle = 1.)
694 return (c >= (min > 0? min / wiggle: min * wiggle))
695 && (c <= (max < 0? max / wiggle: max * wiggle));
699 (
double c,
double const* range,
double wiggle = 1.)
759 void SortPlanes(std::vector<geo::PlaneGeo>&)
const;
772 template <
typename Vector>
774 {
return geo::vect::convertTo<Vector>(
fDriftDir); }
778 template <
typename Po
int>
788 template <
typename Stream>
792 unsigned int verbosity
798 if (verbosity-- <= 0)
return;
803 << GetCenter<geo::Point_t>();
805 if (verbosity-- <= 0)
return;
809 out <<
"\n" << indent
810 <<
"drift direction " << DriftDir<geo::Vector_t>()
811 <<
" from cathode around " << GetCathodeCenter<geo::Point_t>()
816 if (verbosity-- <= 0)
return;
819 out <<
"\n" << indent
820 <<
"maximum wires on any plane: " <<
MaxWires();
822 if (verbosity-- <= 0)
return;
825 out <<
"\n" << indent
828 <<
") cm^3, front face at " << GetFrontFaceCenter<geo::Point_t>()
830 <<
"\n" << indent <<
"main directions:" 831 <<
" width " << WidthDir<geo::Vector_t>()
832 <<
" height " << HeightDir<geo::Vector_t>()
833 <<
" length " << LengthDir<geo::Vector_t>()
836 if (verbosity-- <= 0)
return;
841 out <<
"\n" << indent
842 <<
"bounding box: " << box.
Min() <<
" -- " << box.
Max();
849 out <<
"\n" << indent
850 <<
"active volume box: " << activeBox.
Min() <<
" -- " << activeBox.
Max();
857 #endif // LARCOREALG_GEOMETRY_TPCGEO_H geo::TPCID const & ID() const
Returns the identifier of this TPC.
void InitTPCBoundaries()
Recomputes the TPC boundary.
double DistanceFromReferencePlane(TVector3 const &point) const
geo::Point_t GetCathodeCenterImpl() const
DefaultPoint_t ComposePoint(DecomposedVector_t const &decomp) const
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the plane in planeid from this TPC.
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Utilities to extend the interface of geometry vectors.
const PlaneGeo & Plane(PlaneID const &planeid) const
Returns the plane in planeid from this TPC.
void DriftPoint(TVector3 &position, double distance) const
Vector DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
geo::BoxBoundedGeo fActiveBox
Box of the active volume.
std::vector< double > fPlane0Pitch
Pitch between planes.
double PlanePitch(unsigned int p1=0, unsigned int p2=1) const
WidthDepthProjection_t VectorWidthDepthProjection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
void UpdatePlaneCache()
Updates plane cached information.
void PrintTPCInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this TPC.
Point GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
void MakePlane(GeoNodePath_t &path, size_t depth)
Point ComposePoint(double distance, Projection_t const &proj) const
Returns the 3D point from composition of projection and distance.
std::vector< geo::PlaneGeo > PlaneCollection_t
void FindPlane(GeoNodePath_t &path, size_t depth)
geo::Vector_t toWorldCoords(LocalVector_t const &local) const
Transform direction vector from local to world.
double DistanceFromReferencePlane(geo::Point_t const &point) const
Returns the distance of the specified point from reference plane.
Projection_t VectorProjection(geo::Vector_t const &v) const
LocalVector_t toLocalCoords(geo::Vector_t const &world) const
Transform direction vector from world to local.
decltype(auto) LengthDir() const
Returns the direction Length() is measured on.
double fLength
Length of total volume.
geo::Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Point ComposePoint(DecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
DefaultPoint_t RefWidthDir() const
double ComputeDriftDistance() const
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
const TGeoVolume * TotalVolume() const
unsigned int Nplanes() const
Number of planes in this tpc.
double fActiveHalfWidth
Half width of active volume.
Projection_t PointProjection(TVector3 const &point) const
Point GetCathodeCenter() const
geo::Point_t GetFrontFaceCenterImpl() const
The data type to uniquely identify a Plane.
Geometry information for a single TPC.
geo::PlaneGeo const & FirstPlane() const
Returns the first wire plane (the closest to TPC center).
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
PlaneCollection_t fPlanes
List of planes in this plane.
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Point ComposePoint(WireDecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
WidthDepthProjection_t PointWidthDepthProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Vector RefWidthDir() const
Return the direction of reference plane width.
double ActiveMass() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
geo::Vector3DBase_t< TPCGeoCoordinatesTag > LocalVector_t
Type of displacement vectors in the local GDML TPC frame.
double HalfLength() const
Length is associated with z coordinate [cm].
void UpdateAfterSorting(geo::TPCID tpcid)
Performs all updates after cryostat has sorted TPCs.
TVector3 WorldToLocal(TVector3 const &world) const
Transform point from world frame to local TPC frame.
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
DefaultPoint_t ProjectionReferencePoint() const
void SortSubVolumes(geo::GeoObjectSorter const &sorter)
Apply sorting to the PlaneGeo objects.
geo::Vector_t fHeightDir
Direction height refers to.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
geo::TPCID fID
ID of this TPC.
double Width() const
Width is associated with x coordinate [cm].
double Height() const
Height is associated with y coordinate [cm].
DefaultPoint_t RefDepthDir() const
TVector3 LocalToWorld(const TVector3 &local) const
Transform point from local TPC frame to world frame.
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
double Length() const
Length is associated with z coordinate [cm].
Interface to algorithm class for sorting geo::XXXGeo objects.
TPCGeo(TGeoNode const &node, geo::TransformationMatrix &&trans, PlaneCollection_t &&planes)
Point ProjectionReferencePoint() const
Returns the reference point used by PointProjection().
Projection_t Projection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WidthDepthReferenceTag > WidthDepthProjection_t
geo::Vector_t fWidthDir
Direction width refers to.
double ActiveHalfLength() const
Length (associated with z coordinate) of active TPC volume [cm].
double fHalfWidth
Half width of total volume.
Vector RefDepthDir() const
Return the direction of reference plane depth.
WidthDepthDecomposer_t::DecomposedVector_t WDDecomposedVector_t
geo::PlaneGeo const & SmallestPlane() const
Returns the wire plane with the smallest surface.
enum geo::driftdir DriftDirection_t
Drift direction: positive or negative.
double fActiveLength
Length of active volume.
geo::PlaneGeo::WDDecomposedVector_t DecomposedVector_t
Data structure with plane and drift projections of a 3D vector.
PlaneCollection_t const & ElementIteratorBox
Type returned by IterateElements().
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
ElementIteratorBox IterateElements() const
Returns an object for iterating through all geo::PlaneGeo.
void WorldToLocal(const double *world, double *tpc) const
Transform point from world frame to local TPC frame.
Point GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
bool HasElement(geo::PlaneID const &planeid) const
geo::PlaneGeo::WidthDepthProjection_t Projection_t
Type of 2D vector projection on a plane.
void UpdatePlaneViewCache()
Refills the plane vs. view cache of the TPC.
bool HasPlane(geo::PlaneID const &planeid) const
Returns whether the plane in planeid is present in this TPC.
bool HasElement(unsigned int iplane) const
TGeoVolume * fTotalVolume
Total volume of TPC, called volTPC in GDML file.
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
const TGeoVolume * ActiveVolume() const
double WirePitch(unsigned plane=0) const
const PlaneGeo & GetElement(PlaneID const &planeid) const
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
double ActiveHeight() const
Height (associated with y coordinate) of active TPC volume [cm].
geo::Point_t Min() const
Returns the corner point with the smallest coordinates.
static int max(int a, int b)
The data type to uniquely identify a TPC.
PlaneID_t Plane
Index of the plane within its TPC.
DefaultVector_t DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
TVector3 WorldToLocalVect(TVector3 const &world) const
Transform direction vector from world to local.
unsigned int MaxWires() const
Returns the largest number of wires among the planes in this TPC.
Definition of data types for geometry description.
double Plane0Pitch(unsigned int p) const
DriftDirection_t DriftDirection() const
Returns an enumerator value describing the drift direction.
void SortPlanes(std::vector< geo::PlaneGeo > &) const
Sorts (in place) the specified PlaneGeo objects by drift distance.
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Provides a base class aware of world box coordinates.
Projection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
std::vector< std::vector< double > > fPlaneLocation
xyz locations of planes in the TPC.
Encapsulate the geometry of a wire.
Tag for vectors in the "local" GDML coordinate frame of the TPC.
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
double HalfHeight() const
Height is associated with y coordinate [cm].
Vector DepthDir() const
Return the direction of plane depth.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
DecomposedVector_t DecomposePoint(TVector3 const &point) const
std::string TPCInfo(std::string indent="", unsigned int verbosity=1) const
Returns a string with information about this TPC.
Projection_t VectorProjection(TVector3 const &v) const
void LocalToWorldVect(const double *tpc, double *world) const
Transform direction vector from local to world.
TGeoVolume * fActiveVolume
Active volume of LAr, called volTPCActive in GDML file.
double DriftDistance() const
decltype(auto) HeightDir() const
Returns the direction Height() is measured on.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
std::vector< TGeoNode const * > GeoNodePath_t
Encapsulate the construction of a single detector plane.
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
PlaneGeo const * GetElementPtr(PlaneID const &planeid) const
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Point GetFrontFaceCenter() const
Returns the center of the active TPC volume side facing negative z.
DefaultPoint_t GetCathodeCenter() const
double ActiveWidth() const
Width (associated with x coordinate) of active TPC volume [cm].
geo::PlaneID const & ID() const
Returns the identifier of this plane.
geo::PlaneGeo const & LastPlane() const
Returns the last wire plane (the farther from TPC center).
geo::Vector_t fLengthDir
Direction length refers to.
geo::BoxBoundedGeo const & BoundingBox() const
Returns the bounding box of this TPC.
unsigned int NElements() const
LocalTransformation_t fTrans
TPC-to-world transformation.
geo::WireGeo::GeoNodePath_t GeoNodePath_t
void ResetDriftDirection()
Recomputes the drift direction; needs planes to have been initialised.
DefaultPoint_t ComposePoint(double distance, Projection_t const &proj) const
DecomposedVector_t DecomposePoint(geo::Point_t const &point) const
Decomposes a 3D point in two components.
void WorldToLocalVect(const double *world, double *tpc) const
Transform direction vector from world to local.
Vector WidthDir() const
Return the direction of plane width.
WDDecomposedVector_t DecomposePointWidthDepth(geo::Point_t const &point) const
Decomposes a 3D point in two components.
geo::Vector_t fDriftDir
Direction electrons drift along.
GenPoint3DBase_t< double, C > Point3DBase_t
Type of 3D point with representation in double precision.
GenVector3DBase_t< double, C > Vector3DBase_t
std::set< geo::View_t > Views() const
Returns a set of all views covered in this TPC.
geo::PlaneID const & ReferencePlaneID() const
Returns the ID of the plane used for reference by projection methods.
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
ElementIteratorBox IteratePlanes() const
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintTPCInfo().
LArSoft geometry interface.
Projection_t PointProjection(geo::Point_t const &point) const
TVector3 LocalToWorldVect(const TVector3 &local) const
Transform direction vector from local to world.
geo::Point_t fActiveCenter
Center of the active volume, in world coordinates [cm].
DefaultPoint_t GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
geo::Point_t Max() const
Returns the corner point with the largest coordinates.
void LocalToWorld(const double *tpc, double *world) const
Transform point from local TPC frame to world frame.
LocalPoint_t toLocalCoords(geo::Point_t const &world) const
Transform point from world frame to local TPC frame.
const double * PlaneLocation(unsigned int p) const
geo::Point_t GetFrontFaceCenter() const
Returns the center of the active TPC volume side facing negative z.
double fHalfHeight
Half height of total volume.
double HalfWidth() const
Width is associated with x coordinate [cm].
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.
DefaultPoint_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
decltype(auto) WidthDir() const
Returns the direction Width() is measured on.
double fActiveHalfHeight
Half height of active volume.
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.