LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geo::TPCGeo Class Reference

Geometry information for a single TPC. More...

#include "TPCGeo.h"

Inheritance diagram for geo::TPCGeo:
geo::BoxBoundedGeo

Classes

struct  TPCGeoCoordinatesTag
 Tag for vectors in the "local" GDML coordinate frame of the TPC. More...
 

Public Types

using ID_t = TPCID
 
using Coords_t = Point_t
 Type of the coordinate triplet. More...
 
using Coord_t = Coords_t::Scalar
 Type of the coordinate. More...
 
Types for geometry-local reference vectors.

These types represents points and displacement vectors in the reference frame defined in the TPC geometry box from the GDML geometry description.

No alias is explicitly defined for the LArSoft global vector types, geo::Point_t and geo::Vector_t.

Remember the LocalPoint_t and LocalVector_t vectors from different instances of geo::TPCGeo have the same type but are not compatible.

using LocalPoint_t = Point3DBase_t< TPCGeoCoordinatesTag >
 Type of points in the local GDML TPC frame. More...
 
using LocalVector_t = Vector3DBase_t< TPCGeoCoordinatesTag >
 Type of displacement vectors in the local GDML TPC frame. More...
 

Public Member Functions

 TPCGeo (TGeoNode const *tpc_node, std::size_t hash_value, TransformationMatrix &&trans, DriftAxis driftAxis, double driftDistance)
 
void UpdateAfterSorting (TPCID tpcid)
 Performs all updates after cryostat has sorted TPCs. More...
 
template<typename Stream >
void PrintTPCInfo (Stream &&out, std::string indent="", unsigned int verbosity=1) const
 Prints information about this TPC. More...
 
std::string TPCInfo (std::string indent="", unsigned int verbosity=1) const
 Returns a string with information about this TPC. More...
 
std::size_t Hash () const
 
TPC properties
DriftAxis DriftAxisWithSign () const
 Returns the expected drift direction based on geometry. More...
 
geo::DriftSign DriftSign () const
 Returns the expected drift direction based on geometry. More...
 
Point_t GetCathodeCenter () const
 Returns the expected drift direction based on geometry. More...
 
Vector_t DriftDir () const
 Returns the direction of the drift (vector pointing toward the planes). More...
 
double DriftDistance () const
 Drift distance is defined as the distance between the anode and the cathode, in centimeters. More...
 
double ActiveHalfWidth () const
 Half width (associated with x coordinate) of active TPC volume [cm]. More...
 
double ActiveWidth () const
 Width (associated with x coordinate) of active TPC volume [cm]. More...
 
double ActiveHalfHeight () const
 Half height (associated with y coordinate) of active TPC volume [cm]. More...
 
double ActiveHeight () const
 Height (associated with y coordinate) of active TPC volume [cm]. More...
 
double ActiveLength () const
 Length (associated with z coordinate) of active TPC volume [cm]. More...
 
double ActiveHalfLength () const
 Length (associated with z coordinate) of active TPC volume [cm]. More...
 
double HalfWidth () const
 Width is associated with x coordinate [cm]. More...
 
double Width () const
 Width is associated with x coordinate [cm]. More...
 
double HalfHeight () const
 Height is associated with y coordinate [cm]. More...
 
double Height () const
 Height is associated with y coordinate [cm]. More...
 
double Length () const
 Length is associated with z coordinate [cm]. More...
 
double HalfLength () const
 Length is associated with z coordinate [cm]. More...
 
double ActiveMass () const
 Returns the expected drift direction based on geometry. More...
 
const TGeoVolume * ActiveVolume () const
 Returns the expected drift direction based on geometry. More...
 
const TGeoVolume * TotalVolume () const
 Returns the expected drift direction based on geometry. More...
 
decltype(auto) WidthDir () const
 Returns the direction Width() is measured on. More...
 
decltype(auto) HeightDir () const
 Returns the direction Height() is measured on. More...
 
decltype(auto) LengthDir () const
 Returns the direction Length() is measured on. More...
 
TPC geometry properties
Point_t GetCenter () const
 Returns the center of the TPC volume in world coordinates [cm]. More...
 
Point_t GetActiveVolumeCenter () const
 Returns the center of the TPC active volume in world coordinates [cm]. More...
 
Point_t GetFrontFaceCenter () const
 Returns the center of the active TPC volume side facing negative z. More...
 
BoxBoundedGeo const & BoundingBox () const
 Returns the bounding box of this TPC. More...
 
BoxBoundedGeo const & ActiveBoundingBox () const
 Returns the box of the active volume of this TPC. More...
 
TPCID const & ID () const
 Returns the identifier of this TPC. More...
 
Coordinate transformation
Point_t toWorldCoords (LocalPoint_t const &local) const
 Transform point from local TPC frame to world frame. More...
 
Vector_t toWorldCoords (LocalVector_t const &local) const
 Transform direction vector from local to world. More...
 
LocalPoint_t toLocalCoords (Point_t const &world) const
 Transform point from world frame to local TPC frame. More...
 
LocalVector_t toLocalCoords (Vector_t const &world) const
 Transform direction vector from world to local. More...
 
Dimension queries
double MinX () const
 Returns the world x coordinate of the start of the box. More...
 
double MaxX () const
 Returns the world x coordinate of the end of the box. More...
 
double CenterX () const
 Returns the world x coordinate of the center of the box. More...
 
double SizeX () const
 Returns the full size in the X dimension. More...
 
double HalfSizeX () const
 Returns the size from the center to the border on X dimension. More...
 
double MinY () const
 Returns the world y coordinate of the start of the box. More...
 
double MaxY () const
 Returns the world y coordinate of the end of the box. More...
 
double CenterY () const
 Returns the world y coordinate of the center of the box. More...
 
double SizeY () const
 Returns the full size in the Y dimension. More...
 
double HalfSizeY () const
 Returns the size from the center to the border on Y dimension. More...
 
double MinZ () const
 Returns the world z coordinate of the start of the box. More...
 
double MaxZ () const
 Returns the world z coordinate of the end of the box. More...
 
double CenterZ () const
 Returns the world z coordinate of the center of the box. More...
 
double SizeZ () const
 Returns the full size in the Z dimension. More...
 
double HalfSizeZ () const
 Returns the size from the center to the border on Z dimension. More...
 
Point_t Min () const
 Returns the corner point with the smallest coordinates. More...
 
Point_t Max () const
 Returns the corner point with the largest coordinates. More...
 
Point_t Center () const
 Returns the center point of the box. More...
 
Containment in the full volume
bool ContainsX (double x, double const wiggle=1) const
 Returns whether this TPC contains the specified world x coordinate. More...
 
bool ContainsY (double y, double const wiggle=1) const
 Returns whether this TPC contains the specified world y coordinate. More...
 
bool ContainsZ (double z, double const wiggle=1) const
 Returns whether this TPC contains the specified world z coordinate. More...
 
bool ContainsYZ (double y, double z, double const wiggle=1) const
 Returns if TPC contains the specified world y and z coordinates. More...
 
bool ContainsPosition (Point_t const &point, double wiggle=1.0) const
 Returns whether this volume contains the specified point. More...
 
bool ContainsPosition (TVector3 const &point, double wiggle=1.0) const
 
bool ContainsPosition (double const *point, double wiggle=1.0) const
 
Containment in a fiducial volume
bool InFiducialX (double x, double neg_margin, double pos_margin) const
 Returns whether TPC fiducial volume contains world x coordinate. More...
 
bool InFiducialX (double x, double margin) const
 Returns whether TPC fiducial volume contains world x coordinate. More...
 
bool InFiducialY (double y, double neg_margin, double pos_margin) const
 Returns whether TPC fiducial volume contains world y coordinate. More...
 
bool InFiducialY (double y, double margin) const
 Returns whether TPC fiducial volume contains world y coordinate. More...
 
bool InFiducialZ (double z, double neg_margin, double pos_margin) const
 Returns whether TPC fiducial volume contains world z coordinate. More...
 
bool InFiducialZ (double z, double margin) const
 Returns whether TPC fiducial volume contains world z coordinate. More...
 
Overlaps
bool OverlapsX (BoxBoundedGeo const &other) const
 Returns if the x coordinates covered by this and other box overlap. More...
 
bool OverlapsY (BoxBoundedGeo const &other) const
 Returns if the y coordinates covered by this and other box overlap. More...
 
bool OverlapsZ (BoxBoundedGeo const &other) const
 Returns if the z coordinates covered by this and other box overlap. More...
 
bool Overlaps (BoxBoundedGeo const &other) const
 Returns if this and other box overlap. More...
 
Setting dimensions
void SetBoundaries (Coord_t x_min, Coord_t x_max, Coord_t y_min, Coord_t y_max, Coord_t z_min, Coord_t z_max)
 Sets the boundaries in world coordinates as specified. More...
 
void SetBoundaries (Coords_t lower, Coords_t upper)
 Sets the boundaries in world coordinates as specified. More...
 
void ExtendToInclude (Coord_t x, Coord_t y, Coord_t z)
 Extends the current box to also include the specified point. More...
 
void ExtendToInclude (Point_t const &point)
 Extends the current box to also include the specified point. More...
 
void ExtendToInclude (BoxBoundedGeo const &box)
 Extends the current box to also include the specified one. More...
 
std::vector< TVector3 > GetIntersections (TVector3 const &TrajectoryStart, TVector3 const &TrajectoryDirect) const
 Calculates the entry and exit points of a trajectory on the box surface. More...
 
std::vector< Point_tGetIntersections (Point_t const &TrajectoryStart, Vector_t const &TrajectoryDirect) const
 Calculates the entry and exit points of a trajectory on the box surface. More...
 

Static Public Member Functions

static bool CoordinateContained (double c, double min, double max, double wiggle=1.)
 Returns whether the specified coordinate is in a range. More...
 
static bool CoordinateContained (double c, double const *range, double wiggle=1.)
 
static TGeoNode const * NodeForActiveVolume (TGeoNode const *tpc)
 
static void set_min (Coord_t &var, Coord_t value)
 Sets var to value if value is smaller than the current var value. More...
 
static void set_min (Coords_t &var, Point_t const &value)
 Sets each coordinate of var to the one in value if the latter is smaller. More...
 
static void set_max (Coord_t &var, Coord_t value)
 Sets var to value if value is larger than the current var value. More...
 
static void set_max (Coords_t &var, Point_t const &value)
 Sets each coordinate of var to the one in value if the latter is larger. More...
 

Static Public Attributes

static constexpr unsigned int MaxVerbosity = 6
 Maximum verbosity supported by PrintTPCInfo(). More...
 

Private Types

using LocalTransformation_t = LocalTransformationGeo< ROOT::Math::Transform3D, LocalPoint_t, LocalVector_t >
 

Private Member Functions

void InitTPCBoundaries ()
 Recomputes the TPC boundary. More...
 

Private Attributes

std::size_t fHash
 Uniquely identifies TPC before sorting has been performed. More...
 
LocalTransformation_t fTrans
 TPC-to-world transformation. More...
 
DriftAxis fDriftAxis
 
Vector_t fDriftDir
 
double fDriftDistance
 
TGeoVolume * fActiveVolume {nullptr}
 Active volume of LAr, called volTPCActive in GDML file. More...
 
TGeoVolume * fTotalVolume {nullptr}
 Total volume of TPC, called volTPC in GDML file. More...
 
Point_t fActiveCenter
 Center of the active volume, in world coordinates [cm]. More...
 
double fActiveHalfWidth
 Half width of active volume. More...
 
double fActiveHalfHeight
 Half height of active volume. More...
 
double fActiveLength
 Length of active volume. More...
 
double fHalfWidth
 Half width of total volume. More...
 
double fHalfHeight
 Half height of total volume. More...
 
double fLength
 Length of total volume. More...
 
Vector_t fWidthDir {Xaxis()}
 Direction width refers to. More...
 
Vector_t fHeightDir {Yaxis()}
 Direction height refers to. More...
 
Vector_t fLengthDir {Zaxis()}
 Direction length refers to. More...
 
BoxBoundedGeo fActiveBox
 Box of the active volume. More...
 
TPCID fID
 ID of this TPC. More...
 

Detailed Description

Geometry information for a single TPC.

Definition at line 33 of file TPCGeo.h.

Member Typedef Documentation

using geo::BoxBoundedGeo::Coord_t = Coords_t::Scalar
inherited

Type of the coordinate.

Definition at line 34 of file BoxBoundedGeo.h.

Type of the coordinate triplet.

Definition at line 33 of file BoxBoundedGeo.h.

Definition at line 35 of file TPCGeo.h.

Type of points in the local GDML TPC frame.

Definition at line 55 of file TPCGeo.h.

Definition at line 233 of file TPCGeo.h.

Type of displacement vectors in the local GDML TPC frame.

Definition at line 58 of file TPCGeo.h.

Constructor & Destructor Documentation

geo::TPCGeo::TPCGeo ( TGeoNode const *  tpc_node,
std::size_t  hash_value,
TransformationMatrix &&  trans,
DriftAxis  driftAxis,
double  driftDistance 
)

Definition at line 47 of file TPCGeo.cxx.

References util::abs(), fActiveCenter, fActiveHalfHeight, fActiveHalfWidth, fActiveLength, fActiveVolume, fDriftAxis, fDriftDir, fDriftDistance, fHalfHeight, fHalfWidth, fHeightDir, fLength, fLengthDir, fTotalVolume, fTrans, fWidthDir, InitTPCBoundaries(), geo::makeTransformationMatrix(), geo::LocalTransformation< StoredMatrix >::Matrix(), MF_LOG_DEBUG, NodeForActiveVolume(), geo::vect::toPoint(), geo::Xaxis(), geo::Yaxis(), and geo::Zaxis().

52  : fHash{hash_value}
53  , fTrans{std::move(trans)}
54  , fDriftAxis{driftAxis}
55  , fDriftDir{to_vector(driftAxis)}
56  , fDriftDistance{driftDistance}
57  {
58  // all planes are going to be contained in the volume named volTPC
59  // now get the total volume of the TPC
60  TGeoVolume* vc = tpc_node->GetVolume();
61  if (!vc) {
62  throw cet::exception("Geometry")
63  << "cannot find detector outline volume - bail ungracefully\n";
64  }
65 
66  fTotalVolume = vc;
67 
68  auto* active_node = NodeForActiveVolume(tpc_node);
69  // compute the active volume transformation too
70  auto ActiveHMatrix(fTrans.Matrix());
71  if (active_node) { ActiveHMatrix *= makeTransformationMatrix(*active_node->GetMatrix()); }
72 
74  fActiveVolume = active_node->GetVolume();
75 
76  MF_LOG_DEBUG("Geometry") << "detector total volume is " << fTotalVolume->GetName()
77  << "\ndetector active volume is " << fActiveVolume->GetName();
78 
79  // set the width, height, and lengths
80  auto const* active_volume_box = static_cast<TGeoBBox const*>(fActiveVolume->GetShape());
81  fActiveHalfWidth = active_volume_box->GetDX();
82  fActiveHalfHeight = active_volume_box->GetDY();
83  fActiveLength = 2.0 * active_volume_box->GetDZ();
84 
85  auto const* total_volume_box = static_cast<TGeoBBox const*>(fTotalVolume->GetShape());
86  fHalfWidth = total_volume_box->GetDX();
87  fHalfHeight = total_volume_box->GetDY();
88  fLength = 2.0 * total_volume_box->GetDZ();
89 
90  // Check that the rotation matrix to the world is the identity, if not we need to
91  // change the width, height and length values; the correspondence of these to x, y and
92  // z are not guaranteed to be trivial, so we store the two independently (cartesian
93  // dimensions in the bounding boxes, the sizes in data members directly).
94 
95  // TODO: there must be a more general way to do this...
96  double Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz;
97  fTrans.Matrix().Rotation().GetComponents(Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz);
98  if (Rxx != 1) {
99  if (std::abs(Rxz) == 1) {
100  fActiveHalfWidth = active_volume_box->GetDZ();
101  fHalfWidth = total_volume_box->GetDZ();
102  fWidthDir = Zaxis();
103  }
104  if (std::abs(Rxy) == 1) {
105  fActiveHalfWidth = active_volume_box->GetDY();
106  fHalfWidth = total_volume_box->GetDY();
107  fWidthDir = Yaxis();
108  }
109  }
110  if (Ryy != 1) {
111  if (std::abs(Rxy) == 1) {
112  fActiveHalfHeight = active_volume_box->GetDX();
113  fHalfHeight = total_volume_box->GetDX();
114  fHeightDir = Xaxis();
115  }
116  if (std::abs(Rzy) == 1) {
117  fActiveHalfHeight = active_volume_box->GetDZ();
118  fHalfHeight = total_volume_box->GetDZ();
119  fHeightDir = Zaxis();
120  }
121  }
122  if (Rzz != 1) {
123  if (std::abs(Rzx) == 1) {
124  fActiveLength = 2. * active_volume_box->GetDX();
125  fLength = 2. * total_volume_box->GetDX();
126  fLengthDir = Xaxis();
127  }
128  if (std::abs(Ryz) == 1) {
129  fActiveLength = 2. * active_volume_box->GetDY();
130  fLength = 2. * total_volume_box->GetDY();
131  fLengthDir = Yaxis();
132  }
133  }
134 
136  }
void InitTPCBoundaries()
Recomputes the TPC boundary.
Definition: TPCGeo.cxx:179
double fLength
Length of total volume.
Definition: TPCGeo.h:251
double fActiveHalfWidth
Half width of active volume.
Definition: TPCGeo.h:246
TransformationMatrix_t const & Matrix() const
Direct access to the transformation matrix.
constexpr Vector Yaxis()
Returns a y axis vector of the specified type.
Definition: geo_vectors.h:215
constexpr auto abs(T v)
Returns the absolute value of the argument.
double fHalfWidth
Half width of total volume.
Definition: TPCGeo.h:249
double fActiveLength
Length of active volume.
Definition: TPCGeo.h:248
constexpr Vector Xaxis()
Returns a x axis vector of the specified type.
Definition: geo_vectors.h:208
decltype(auto) makeTransformationMatrix(Trans &&trans)
Converts a transformation matrix into a geo::TransformationMatrix.
TGeoVolume * fTotalVolume
Total volume of TPC, called volTPC in GDML file.
Definition: TPCGeo.h:243
Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
static TGeoNode const * NodeForActiveVolume(TGeoNode const *tpc)
Definition: TPCGeo.cxx:213
constexpr Vector Zaxis()
Returns a z axis vector of the specified type.
Definition: geo_vectors.h:222
TGeoVolume * fActiveVolume
Active volume of LAr, called volTPCActive in GDML file.
Definition: TPCGeo.h:242
std::size_t fHash
Uniquely identifies TPC before sorting has been performed.
Definition: TPCGeo.h:235
Vector_t fWidthDir
Direction width refers to.
Definition: TPCGeo.h:253
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:42
#define MF_LOG_DEBUG(id)
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:236
DriftAxis fDriftAxis
Definition: TPCGeo.h:238
Vector_t fHeightDir
Direction height refers to.
Definition: TPCGeo.h:254
Vector_t fLengthDir
Direction length refers to.
Definition: TPCGeo.h:255
Point_t fActiveCenter
Center of the active volume, in world coordinates [cm].
Definition: TPCGeo.h:244
double fHalfHeight
Half height of total volume.
Definition: TPCGeo.h:250
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double fDriftDistance
Definition: TPCGeo.h:240
Vector_t fDriftDir
Definition: TPCGeo.h:239
double fActiveHalfHeight
Half height of active volume.
Definition: TPCGeo.h:247

Member Function Documentation

BoxBoundedGeo const& geo::TPCGeo::ActiveBoundingBox ( ) const
inline

Returns the box of the active volume of this TPC.

Definition at line 144 of file TPCGeo.h.

References fActiveBox.

Referenced by GetFrontFaceCenter(), PrintTPCInfo(), and phot::PhotonVisibilityService::reconfigure().

144 { return fActiveBox; }
BoxBoundedGeo fActiveBox
Box of the active volume.
Definition: TPCGeo.h:257
double geo::TPCGeo::ActiveHalfHeight ( ) const
inline

Half height (associated with y coordinate) of active TPC volume [cm].

Definition at line 94 of file TPCGeo.h.

References fActiveHalfHeight.

Referenced by ActiveHeight(), evd_tool::StandardDrawer::DrawActiveTPCoutline(), evd_tool::ProtoDUNEDrawer::DrawActiveTPCoutline(), GetCathodeCenter(), and InitTPCBoundaries().

94 { return fActiveHalfHeight; }
double fActiveHalfHeight
Half height of active volume.
Definition: TPCGeo.h:247
double geo::TPCGeo::ActiveHalfLength ( ) const
inline

Length (associated with z coordinate) of active TPC volume [cm].

Definition at line 100 of file TPCGeo.h.

References fActiveLength.

Referenced by evd_tool::ProtoDUNEDrawer::DrawActiveTPCoutline(), evd_tool::StandardDrawer::DrawActiveTPCoutline(), and InitTPCBoundaries().

100 { return fActiveLength / 2.0; }
double fActiveLength
Length of active volume.
Definition: TPCGeo.h:248
double geo::TPCGeo::ActiveHalfWidth ( ) const
inline

Half width (associated with x coordinate) of active TPC volume [cm].

Definition at line 90 of file TPCGeo.h.

References fActiveHalfWidth.

Referenced by ActiveWidth(), evd_tool::StandardDrawer::DrawActiveTPCoutline(), evd_tool::ProtoDUNEDrawer::DrawActiveTPCoutline(), GetCathodeCenter(), and InitTPCBoundaries().

90 { return fActiveHalfWidth; }
double fActiveHalfWidth
Half width of active volume.
Definition: TPCGeo.h:246
double geo::TPCGeo::ActiveHeight ( ) const
inline

Height (associated with y coordinate) of active TPC volume [cm].

Definition at line 96 of file TPCGeo.h.

References ActiveHalfHeight().

Referenced by PrintTPCInfo().

96 { return 2.0 * ActiveHalfHeight(); }
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:94
double geo::TPCGeo::ActiveLength ( ) const
inline

Length (associated with z coordinate) of active TPC volume [cm].

Definition at line 98 of file TPCGeo.h.

References fActiveLength.

Referenced by GetCathodeCenter(), and PrintTPCInfo().

98 { return fActiveLength; }
double fActiveLength
Length of active volume.
Definition: TPCGeo.h:248
double geo::TPCGeo::ActiveMass ( ) const
inline

Returns the expected drift direction based on geometry.

The current implementation is based on the assumption that electrons in the middle of TPC will drift toward the wire planes, and it "never fails".

Definition at line 113 of file TPCGeo.h.

References fActiveVolume.

113 { return fActiveVolume->Weight(); }
TGeoVolume * fActiveVolume
Active volume of LAr, called volTPCActive in GDML file.
Definition: TPCGeo.h:242
const TGeoVolume* geo::TPCGeo::ActiveVolume ( ) const
inline

Returns the expected drift direction based on geometry.

The current implementation is based on the assumption that electrons in the middle of TPC will drift toward the wire planes, and it "never fails".

Definition at line 114 of file TPCGeo.h.

References fActiveVolume.

Referenced by trkf::SpacePts::produce().

114 { return fActiveVolume; }
TGeoVolume * fActiveVolume
Active volume of LAr, called volTPCActive in GDML file.
Definition: TPCGeo.h:242
double geo::TPCGeo::ActiveWidth ( ) const
inline

Width (associated with x coordinate) of active TPC volume [cm].

Definition at line 92 of file TPCGeo.h.

References ActiveHalfWidth().

Referenced by PrintTPCInfo().

92 { return 2.0 * ActiveHalfWidth(); }
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:90
BoxBoundedGeo const& geo::TPCGeo::BoundingBox ( ) const
inline

Returns the bounding box of this TPC.

Definition at line 141 of file TPCGeo.h.

Referenced by PrintTPCInfo().

141 { return *this; }
Point_t geo::BoxBoundedGeo::Center ( ) const
inlineinherited

Returns the center point of the box.

Definition at line 139 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CenterX(), geo::BoxBoundedGeo::CenterY(), and geo::BoxBoundedGeo::CenterZ().

Referenced by geo::CryostatGeo::GetCenter(), and geo::PlaneGeo::UpdatePlaneNormal().

139 { return {CenterX(), CenterY(), CenterZ()}; }
double CenterX() const
Returns the world x coordinate of the center of the box.
Definition: BoxBoundedGeo.h:94
double CenterZ() const
Returns the world z coordinate of the center of the box.
double CenterY() const
Returns the world y coordinate of the center of the box.
double geo::BoxBoundedGeo::CenterX ( ) const
inlineinherited

Returns the world x coordinate of the center of the box.

Definition at line 94 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxX(), and geo::BoxBoundedGeo::MinX().

Referenced by geo::BoxBoundedGeo::Center().

94 { return (MinX() + MaxX()) / 2.; }
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
double geo::BoxBoundedGeo::CenterY ( ) const
inlineinherited

Returns the world y coordinate of the center of the box.

Definition at line 109 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxY(), and geo::BoxBoundedGeo::MinY().

Referenced by geo::BoxBoundedGeo::Center().

109 { return (MinY() + MaxY()) / 2.; }
double MaxY() const
Returns the world y coordinate of the end of the box.
double MinY() const
Returns the world y coordinate of the start of the box.
double geo::BoxBoundedGeo::CenterZ ( ) const
inlineinherited

Returns the world z coordinate of the center of the box.

Definition at line 124 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxZ(), and geo::BoxBoundedGeo::MinZ().

Referenced by geo::BoxBoundedGeo::Center().

124 { return (MinZ() + MaxZ()) / 2.; }
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
bool geo::BoxBoundedGeo::ContainsPosition ( Point_t const &  point,
double  wiggle = 1.0 
) const
inlineinherited

Returns whether this volume contains the specified point.

Parameters
pointthe point [cm]
wiggleexpansion factor for the range
Returns
whether the specified coordinate is in this volume

If the wiggle is larger than 1, each size of the volume is expanded by the wiggle factor. If the wiggle is less than 1, each size is shrinked.

Definition at line 208 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::ContainsX(), and geo::BoxBoundedGeo::ContainsYZ().

Referenced by geo::BoxBoundedGeo::ContainsPosition(), and geo::GeometryCore::MaterialName().

209  {
210  return ContainsX(point.X(), wiggle) && ContainsYZ(point.Y(), point.Z(), wiggle);
211  } // ContainsPosition()
bool ContainsX(double x, double const wiggle=1) const
Returns whether this TPC contains the specified world x coordinate.
bool ContainsYZ(double y, double z, double const wiggle=1) const
Returns if TPC contains the specified world y and z coordinates.
bool geo::BoxBoundedGeo::ContainsPosition ( TVector3 const &  point,
double  wiggle = 1.0 
) const
inherited
See also
ContainsPosition(Point_t const&, double) const.

Definition at line 22 of file BoxBoundedGeo.cxx.

References geo::BoxBoundedGeo::ContainsPosition(), and geo::vect::toPoint().

23  {
24  return ContainsPosition(vect::toPoint(point), wiggle);
25  }
Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
bool ContainsPosition(Point_t const &point, double wiggle=1.0) const
Returns whether this volume contains the specified point.
bool geo::BoxBoundedGeo::ContainsPosition ( double const *  point,
double  wiggle = 1.0 
) const
inherited
See also
ContainsPosition(Point_t const&, double) const.

Definition at line 28 of file BoxBoundedGeo.cxx.

References geo::BoxBoundedGeo::ContainsPosition(), and geo::vect::makePointFromCoords().

29  {
30  return ContainsPosition(vect::makePointFromCoords(point), wiggle);
31  }
GENVECTOR_CONSTEXPR Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
bool ContainsPosition(Point_t const &point, double wiggle=1.0) const
Returns whether this volume contains the specified point.
bool geo::BoxBoundedGeo::ContainsX ( double  x,
double const  wiggle = 1 
) const
inlineinherited

Returns whether this TPC contains the specified world x coordinate.

Parameters
xthe absolute ("world") coordinate x
wiggleexpansion factor for the range (see ContainsPosition())
Returns
whether the specified coordinate is in this TPC
See also
ContainsPosition()

Note that x is by definition the drift direction, and a reconstructed x typically depends on an assumption respect to the event time.

Definition at line 156 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CoordinateContained(), geo::BoxBoundedGeo::MaxX(), and geo::BoxBoundedGeo::MinX().

Referenced by geo::BoxBoundedGeo::ContainsPosition().

157  {
158  return CoordinateContained(x, MinX(), MaxX(), wiggle);
159  }
Float_t x
Definition: compare.C:6
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
bool geo::BoxBoundedGeo::ContainsY ( double  y,
double const  wiggle = 1 
) const
inlineinherited

Returns whether this TPC contains the specified world y coordinate.

Parameters
ythe absolute ("world") coordinate y
wiggleexpansion factor for the range (see ContainsPosition())
Returns
whether the specified coordinate is in this TPC
See also
ContainsPosition()

Definition at line 168 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CoordinateContained(), geo::BoxBoundedGeo::MaxY(), and geo::BoxBoundedGeo::MinY().

Referenced by geo::BoxBoundedGeo::ContainsYZ().

169  {
170  return CoordinateContained(y, MinY(), MaxY(), wiggle);
171  }
Float_t y
Definition: compare.C:6
double MaxY() const
Returns the world y coordinate of the end of the box.
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
double MinY() const
Returns the world y coordinate of the start of the box.
bool geo::BoxBoundedGeo::ContainsYZ ( double  y,
double  z,
double const  wiggle = 1 
) const
inlineinherited

Returns if TPC contains the specified world y and z coordinates.

Parameters
ythe absolute ("world") coordinate y
zthe absolute ("world") coordinate z
wiggleexpansion factor for the range (see ContainsPosition())
Returns
whether the specified coordinate is in this TPC
See also
ContainsPosition()

Definition at line 193 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::ContainsY(), and geo::BoxBoundedGeo::ContainsZ().

Referenced by geo::BoxBoundedGeo::ContainsPosition().

194  {
195  return ContainsY(y, wiggle) && ContainsZ(z, wiggle);
196  }
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
bool ContainsY(double y, double const wiggle=1) const
Returns whether this TPC contains the specified world y coordinate.
bool ContainsZ(double z, double const wiggle=1) const
Returns whether this TPC contains the specified world z coordinate.
bool geo::BoxBoundedGeo::ContainsZ ( double  z,
double const  wiggle = 1 
) const
inlineinherited

Returns whether this TPC contains the specified world z coordinate.

Parameters
zthe absolute ("world") coordinate z
wiggleexpansion factor for the range (see ContainsPosition())
Returns
whether the specified coordinate is in this TPC
See also
ContainsPosition()

Definition at line 180 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CoordinateContained(), geo::BoxBoundedGeo::MaxZ(), and geo::BoxBoundedGeo::MinZ().

Referenced by geo::BoxBoundedGeo::ContainsYZ().

181  {
182  return CoordinateContained(z, MinZ(), MaxZ(), wiggle);
183  }
Double_t z
Definition: plot.C:276
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
static bool geo::TPCGeo::CoordinateContained ( double  c,
double  min,
double  max,
double  wiggle = 1. 
)
inlinestatic

Returns whether the specified coordinate is in a range.

Parameters
cthe coordinate
minlower boundary of the range
maxupper boundary of the range
wiggleexpansion factor for the range
Returns
whether the specified coordinate is in a range

If the wiggle is larger than 1, the range is expanded by the wiggle factor. If the wiggle is less than 1, the range is shrinked.

Definition at line 217 of file TPCGeo.h.

Referenced by CoordinateContained().

218  {
219  return (c >= (min > 0 ? min / wiggle : min * wiggle)) &&
220  (c <= (max < 0 ? max / wiggle : max * wiggle));
221  }
static bool geo::TPCGeo::CoordinateContained ( double  c,
double const *  range,
double  wiggle = 1. 
)
inlinestatic

Definition at line 223 of file TPCGeo.h.

References CoordinateContained().

224  {
225  return CoordinateContained(c, range[0], range[1], wiggle);
226  }
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
Definition: TPCGeo.h:217
Vector_t geo::TPCGeo::DriftDir ( ) const
inline

Returns the direction of the drift (vector pointing toward the planes).

Definition at line 84 of file TPCGeo.h.

References DriftDistance(), and fDriftDir.

Referenced by PrintTPCInfo(), calo::GnocchiCalorimetry::TrajectoryToWirePosition(), and geo::WireReadoutGeom::UpdateAfterSorting().

84 { return fDriftDir; }
Vector_t fDriftDir
Definition: TPCGeo.h:239
double geo::TPCGeo::DriftDistance ( ) const

Drift distance is defined as the distance between the anode and the cathode, in centimeters.

Definition at line 165 of file TPCGeo.cxx.

References fDriftDistance.

Referenced by DriftDir(), phot::PDFastSimPAR::PDFastSimPAR(), PrintTPCInfo(), and phot::SemiAnalyticalModel::SemiAnalyticalModel().

166  {
167  return fDriftDistance;
168  }
double fDriftDistance
Definition: TPCGeo.h:240
geo::DriftSign geo::TPCGeo::DriftSign ( ) const
inline

Returns the expected drift direction based on geometry.

The current implementation is based on the assumption that electrons in the middle of TPC will drift toward the wire planes, and it "never fails".

Definition at line 79 of file TPCGeo.h.

References DriftAxisWithSign(), GetCathodeCenter(), and geo::DriftAxis::sign.

Referenced by detinfo::DetectorPropertiesStandard::DataFor(), lar_pandora::LArPandoraGeometry::ShouldSwitchUV(), lar_pandora::ICARUS::TargetViewU(), and lar_pandora::ICARUS::TargetViewV().

79 { return DriftAxisWithSign().sign; }
DriftSign sign
Definition: geo_types.h:174
DriftAxis DriftAxisWithSign() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.h:78
void geo::BoxBoundedGeo::ExtendToInclude ( Coord_t  x,
Coord_t  y,
Coord_t  z 
)
inlineinherited

Extends the current box to also include the specified point.

Parameters
xx coordinate of the point to include
yy coordinate of the point to include
zz coordinate of the point to include

Definition at line 421 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::ExtendToInclude().

Referenced by geo::PlaneGeo::BoundingBox(), evd_tool::StandardDrawer::DetOutline3D(), evd_tool::ProtoDUNEDrawer::DetOutline3D(), geo::BoxBoundedGeo::ExtendToInclude(), larg4::ISTPC::extractActiveLArVolume(), larg4::OpFastScintillation::extractActiveVolumes(), and phot::PhotonVisibilityService::reconfigure().

421 { ExtendToInclude(Point_t(x, y, z)); }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
void ExtendToInclude(Coord_t x, Coord_t y, Coord_t z)
Extends the current box to also include the specified point.
void geo::BoxBoundedGeo::ExtendToInclude ( Point_t const &  point)
inlineinherited

Extends the current box to also include the specified point.

Parameters
pointcoordinates of the point to include

Definition at line 427 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::c_max, geo::BoxBoundedGeo::c_min, geo::BoxBoundedGeo::set_max(), and geo::BoxBoundedGeo::set_min().

428  {
429  set_min(c_min, point);
430  set_max(c_max, point);
431  }
static void set_min(Coord_t &var, Coord_t value)
Sets var to value if value is smaller than the current var value.
static void set_max(Coord_t &var, Coord_t value)
Sets var to value if value is larger than the current var value.
Coords_t c_max
maximum coordinates (x, y, z)
Coords_t c_min
minimum coordinates (x, y, z)
void geo::BoxBoundedGeo::ExtendToInclude ( BoxBoundedGeo const &  box)
inlineinherited

Extends the current box to also include the specified one.

Parameters
boxthe box to include

It is assumed that the box has its boundaries properly sorted.

Definition at line 439 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::c_max, geo::BoxBoundedGeo::c_min, geo::BoxBoundedGeo::GetIntersections(), geo::BoxBoundedGeo::Max(), geo::BoxBoundedGeo::Min(), geo::BoxBoundedGeo::set_max(), and geo::BoxBoundedGeo::set_min().

440  {
441  set_min(c_min, box.Min());
442  set_max(c_max, box.Max());
443  } // ExtendToInclude()
static void set_min(Coord_t &var, Coord_t value)
Sets var to value if value is smaller than the current var value.
static void set_max(Coord_t &var, Coord_t value)
Sets var to value if value is larger than the current var value.
Coords_t c_max
maximum coordinates (x, y, z)
Coords_t c_min
minimum coordinates (x, y, z)
Point_t geo::TPCGeo::GetActiveVolumeCenter ( ) const
inline

Returns the center of the TPC active volume in world coordinates [cm].

Definition at line 135 of file TPCGeo.h.

References fActiveCenter, and GetFrontFaceCenter().

Referenced by evd_tool::ProtoDUNEDrawer::DrawActiveTPCoutline(), evd_tool::StandardDrawer::DrawActiveTPCoutline(), GetCathodeCenter(), and InitTPCBoundaries().

135 { return fActiveCenter; }
Point_t fActiveCenter
Center of the active volume, in world coordinates [cm].
Definition: TPCGeo.h:244
Point_t geo::TPCGeo::GetCathodeCenter ( ) const

Returns the expected drift direction based on geometry.

The current implementation is based on the assumption that electrons in the middle of TPC will drift toward the wire planes, and it "never fails".

Definition at line 139 of file TPCGeo.cxx.

References ActiveHalfHeight(), ActiveHalfWidth(), ActiveLength(), DriftAxisWithSign(), GetActiveVolumeCenter(), pmtana::sign(), geo::to_int(), geo::X, geo::Y, and geo::Z.

Referenced by phot::PropagationTimeModel::cathodeCentre(), DriftSign(), larg4::OpFastScintillation::OpFastScintillation(), PrintTPCInfo(), and phot::SemiAnalyticalModel::SemiAnalyticalModel().

140  {
141  // 1. find the center of the face of the TPC opposite to the anode
142  // 2. compute the distance of it from the last wire plane
143 
144  //
145  // find the cathode center
146  //
147  Point_t cathodeCenter = GetActiveVolumeCenter();
148  auto const [axis, sign] = DriftAxisWithSign();
149  switch (axis) {
150  case Coordinate::X:
151  cathodeCenter.SetX(cathodeCenter.X() - to_int(sign) * ActiveHalfWidth());
152  break;
153  case Coordinate::Y:
154  cathodeCenter.SetY(cathodeCenter.Y() - to_int(sign) * ActiveHalfHeight());
155  break;
156  case Coordinate::Z:
157  cathodeCenter.SetZ(cathodeCenter.Z() - to_int(sign) * ActiveLength() / 2.0);
158  break;
159  }
160 
161  return cathodeCenter;
162  }
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:94
DriftAxis DriftAxisWithSign() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.h:78
recob::tracking::Point_t Point_t
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:90
constexpr int to_int(Coordinate const coord) noexcept
Enumerate the possible plane projections.
Definition: geo_types.h:124
Point_t GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Definition: TPCGeo.h:135
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:98
int sign(double val)
Definition: UtilFunc.cxx:104
Point_t geo::TPCGeo::GetCenter ( ) const
inline

Returns the center of the TPC volume in world coordinates [cm].

Definition at line 132 of file TPCGeo.h.

References toWorldCoords().

Referenced by geo::GeoObjectSorterStandard::compareTPCs(), evd_tool::ICARUSDrawer::DetOutline3D(), cluster::ClusterCrawlerAlg::FindHammerClusters(), PrintTPCInfo(), geo::WireReadoutGeom::SortPlanes(), trkf::CCTrackMaker::TagCosmics(), apa::DisambigAlg::TrivialDisambig(), apa::DisambigAlg::UseEndPts(), evd::RecoBaseDrawer::Vertex2D(), and cluster::ClusterCrawlerAlg::VtxMatch().

132 { return toWorldCoords(LocalPoint_t{}); }
Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:155
Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: TPCGeo.h:55
geo::Point_t geo::TPCGeo::GetFrontFaceCenter ( ) const

Returns the center of the active TPC volume side facing negative z.

Definition at line 200 of file TPCGeo.cxx.

References ActiveBoundingBox().

Referenced by GetActiveVolumeCenter(), and PrintTPCInfo().

201  {
202  auto const& activeBox = ActiveBoundingBox();
203  return {activeBox.CenterX(), activeBox.CenterY(), activeBox.MinZ()};
204  }
BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:144
std::vector< TVector3 > geo::BoxBoundedGeo::GetIntersections ( TVector3 const &  TrajectoryStart,
TVector3 const &  TrajectoryDirect 
) const
inherited

Calculates the entry and exit points of a trajectory on the box surface.

Parameters
TrajectoryStartposition of the trajectory source
TrajectoryDirectdirection vector of the trajectory

This member is public since it just gives an output and does not change any member. The algorithm works only for a box shaped active volume with facing walls parallel to axis. If the return std::vector is empty the trajectory does not intersect with the box. Normally the return value should have one (if the trajectory originates in the box) or two (else) entries. If the return value has two entries the first represents the entry point and the second the exit point

Definition at line 123 of file BoxBoundedGeo.cxx.

Referenced by geo::BoxBoundedGeo::ExtendToInclude().

125  {
126  std::vector<TVector3> intersections;
127  for (auto const& point : GetIntersections(Point_t(TrajectoryStart), Vector_t(TrajectoryDirect)))
128  intersections.emplace_back(point.X(), point.Y(), point.Z());
129  return intersections;
130  }
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:160
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:180
std::vector< TVector3 > GetIntersections(TVector3 const &TrajectoryStart, TVector3 const &TrajectoryDirect) const
Calculates the entry and exit points of a trajectory on the box surface.
std::vector< Point_t > geo::BoxBoundedGeo::GetIntersections ( Point_t const &  TrajectoryStart,
Vector_t const &  TrajectoryDirect 
) const
inherited

Calculates the entry and exit points of a trajectory on the box surface.

Parameters
TrajectoryStartposition of the trajectory source
TrajectoryDirectdirection vector of the trajectory

This member is public since it just gives an output and does not change any member. The algorithm works only for a box shaped active volume with facing walls parallel to axis. If the return std::vector is empty the trajectory does not intersect with the box. Normally the return value should have one (if the trajectory originates in the box) or two (else) entries. If the return value has two entries the first represents the entry point and the second the exit point

Definition at line 34 of file BoxBoundedGeo.cxx.

References geo::vect::bindCoord(), geo::BoxBoundedGeo::c_max, geo::BoxBoundedGeo::c_min, geo::vect::coord(), geo::BoxBoundedGeo::Max(), and geo::BoxBoundedGeo::Min().

36  {
37  std::vector<Point_t> IntersectionPoints;
38  std::vector<double> LineParameters;
39 
40  // Generate normal vectors and offsets for every plane of the box
41  // All normal vectors are headed outwards
42  // BUG the double brace syntax is required to work around clang bug 21629
43  // (https://bugs.llvm.org/show_bug.cgi?id=21629)
44  static std::array<Vector_t, 6U> const NormalVectors = {{
45  -Xaxis<Vector_t>(),
46  Xaxis<Vector_t>(), // anode, cathode,
47  -Yaxis<Vector_t>(),
48  Yaxis<Vector_t>(), // bottom, top,
49  -Zaxis<Vector_t>(),
50  Zaxis<Vector_t>() // upstream, downstream
51  }};
52  // BUG the double brace syntax is required to work around clang bug 21629
53  // (https://bugs.llvm.org/show_bug.cgi?id=21629)
54  std::array<Point_t, 6U> const NormalVectorOffsets = {{
55  Point_t{Min().X(), Min().Y(), Min().Z()}, // Anode offset
56  Point_t{Max().X(), Min().Y(), Min().Z()}, // Cathode
57  Point_t{Min().X(), Min().Y(), Min().Z()}, // Bottom
58  Point_t{Min().X(), Max().Y(), Min().Z()}, // Top
59  Point_t{Min().X(), Min().Y(), Min().Z()}, // upstream
60  Point_t{Min().X(), Min().Y(), Max().Z()} // downstream
61  }};
62 
63  // Loop over all surfaces of the box
64  for (unsigned int face_no = 0; face_no < NormalVectors.size(); face_no++) {
65  // Check if trajectory and surface are not parallel
66  if (NormalVectors[face_no].Dot(TrajectoryDirect)) {
67  // Calculate the line parameter for the intersection points
68  LineParameters.push_back(
69  NormalVectors[face_no].Dot(NormalVectorOffsets.at(face_no) - TrajectoryStart) /
70  NormalVectors[face_no].Dot(TrajectoryDirect));
71  }
72  else
73  continue;
74 
75  // Calculate intersection point using the line parameter
76  IntersectionPoints.push_back(TrajectoryStart + LineParameters.back() * TrajectoryDirect);
77 
78  // Coordinate which should be ignored when checking for limits added by Christoph
79  // Rudolf von Rohr 05/21/2016
80  unsigned int NoCheckCoord;
81 
82  // Calculate NoCheckCoord out of the face_no
83  if (face_no % 2) {
84  // Convert odd face number to coordinate
85  NoCheckCoord = (face_no - 1) / 2;
86  }
87  else {
88  // Convert even face number to coordinate
89  NoCheckCoord = face_no / 2;
90  }
91 
92  // Loop over all three space coordinates
93  unsigned int coord = 0;
94  for (auto extractCoord : vect::coordReaders<Point_t>()) {
95  auto const lastPointCoord = vect::bindCoord(IntersectionPoints.back(), extractCoord);
96  auto const minCoord = vect::bindCoord(c_min, extractCoord);
97  auto const maxCoord = vect::bindCoord(c_max, extractCoord);
98 
99  // Changed by Christoph Rudolf von Rohr 05/21/2016 Then check if point is not
100  // within the surface limits at this coordinate, without looking at the plane
101  // normal vector coordinate. We can assume, that our algorithm already found this
102  // coordinate correctily. In rare cases, looking for boundaries in this
103  // coordinate causes unexpected behavior due to floating point inaccuracies.
104  if (coord++ != NoCheckCoord &&
105  ((lastPointCoord() > maxCoord()) || (lastPointCoord() < minCoord))) {
106  // if off limits, get rid of the useless data and break the coordinate loop
107  LineParameters.pop_back();
108  IntersectionPoints.pop_back();
109  break;
110  }
111  } // coordinate loop
112  } // Surcaces loop
113 
114  // sort points according to their parameter value (first is entry, second is exit)
115  if (LineParameters.size() == 2 && LineParameters.front() > LineParameters.back()) {
116  std::swap(IntersectionPoints.front(), IntersectionPoints.back());
117  }
118 
119  return IntersectionPoints;
120  } // GetIntersections()
Point_t Max() const
Returns the corner point with the largest coordinates.
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
constexpr auto bindCoord(Vector const &v, CoordReader_t< Vector > helper)
Binds the specified constant vector to the coordinate reader.
recob::tracking::Point_t Point_t
Coords_t c_max
maximum coordinates (x, y, z)
Point_t Min() const
Returns the corner point with the smallest coordinates.
Coords_t c_min
minimum coordinates (x, y, z)
void swap(lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &a, lar::deep_const_fwd_iterator_nested< CITER, INNERCONTEXTRACT > &b)
double geo::TPCGeo::HalfHeight ( ) const
inline

Height is associated with y coordinate [cm].

Definition at line 106 of file TPCGeo.h.

References fHalfHeight.

Referenced by evd_tool::ICARUSDrawer::DetOutline3D(), cluster::ClusterCrawlerAlg::FindHammerClusters(), Height(), InitTPCBoundaries(), vertex::VertexFinder2D::produce(), trkf::CCTrackMaker::TagCosmics(), and cluster::ClusterCrawlerAlg::VtxMatch().

106 { return fHalfHeight; }
double fHalfHeight
Half height of total volume.
Definition: TPCGeo.h:250
double geo::TPCGeo::HalfLength ( ) const
inline

Length is associated with z coordinate [cm].

Definition at line 112 of file TPCGeo.h.

References fLength.

Referenced by InitTPCBoundaries().

112 { return fLength / 2.0; }
double fLength
Length of total volume.
Definition: TPCGeo.h:251
double geo::BoxBoundedGeo::HalfSizeX ( ) const
inlineinherited

Returns the size from the center to the border on X dimension.

Definition at line 100 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::SizeX().

100 { return SizeX() / 2.0; }
double SizeX() const
Returns the full size in the X dimension.
Definition: BoxBoundedGeo.h:97
double geo::BoxBoundedGeo::HalfSizeY ( ) const
inlineinherited

Returns the size from the center to the border on Y dimension.

Definition at line 115 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::SizeY().

115 { return SizeY() / 2.0; }
double SizeY() const
Returns the full size in the Y dimension.
double geo::BoxBoundedGeo::HalfSizeZ ( ) const
inlineinherited

Returns the size from the center to the border on Z dimension.

Definition at line 130 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::SizeZ().

130 { return SizeZ() / 2.0; }
double SizeZ() const
Returns the full size in the Z dimension.
double geo::TPCGeo::HalfWidth ( ) const
inline
std::size_t geo::TPCGeo::Hash ( ) const
inline

Definition at line 228 of file TPCGeo.h.

References fHash, and NodeForActiveVolume().

228 { return fHash; }
std::size_t fHash
Uniquely identifies TPC before sorting has been performed.
Definition: TPCGeo.h:235
double geo::TPCGeo::Height ( ) const
inline

Height is associated with y coordinate [cm].

Definition at line 108 of file TPCGeo.h.

References HalfHeight().

Referenced by PrintTPCInfo().

108 { return 2.0 * HalfHeight(); }
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:106
decltype(auto) geo::TPCGeo::HeightDir ( ) const
inline

Returns the direction Height() is measured on.

Definition at line 121 of file TPCGeo.h.

References fHeightDir.

Referenced by PrintTPCInfo().

121 { return fHeightDir; }
Vector_t fHeightDir
Direction height refers to.
Definition: TPCGeo.h:254
bool geo::BoxBoundedGeo::InFiducialX ( double  x,
double  neg_margin,
double  pos_margin 
) const
inlineinherited

Returns whether TPC fiducial volume contains world x coordinate.

Parameters
xthe absolute ("world") coordinate x
neg_marginhow far within the TPC the fiducial region starts
pos_marginhow far before the TPC the fiducial region ends
Returns
whether the specified coordinate is in this TPC fiducial volume

The fiducial volume is defined by the specified margins, that denote how much of the coordinate is not fiducial. For example,

bool bWithin = tpc->InFiducialX(x, 5., 8.);

on a TPC with x from 0 to 100 (cm, presumably) will return true for all x between 5 and 92. If positive margin is not specified, it's assumed to be the same as the negative one. Specifying a negative mergin effectively extends the TPC volume. Note that x is by definition the drift direction, and a reconstructed x typically depends on an assumption respect to the event time.

Definition at line 241 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CoordinateContained(), geo::BoxBoundedGeo::MaxX(), and geo::BoxBoundedGeo::MinX().

242  {
243  return CoordinateContained(x, MinX() + neg_margin, MaxX() - pos_margin);
244  }
Float_t x
Definition: compare.C:6
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
bool geo::BoxBoundedGeo::InFiducialX ( double  x,
double  margin 
) const
inlineinherited

Returns whether TPC fiducial volume contains world x coordinate.

See also
InFiducialX(double, double, double) const

Margins are symmetric.

Definition at line 251 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialX().

Referenced by geo::BoxBoundedGeo::InFiducialX().

251 { return InFiducialX(x, margin, margin); }
Float_t x
Definition: compare.C:6
bool InFiducialX(double x, double neg_margin, double pos_margin) const
Returns whether TPC fiducial volume contains world x coordinate.
bool geo::BoxBoundedGeo::InFiducialY ( double  y,
double  neg_margin,
double  pos_margin 
) const
inlineinherited

Returns whether TPC fiducial volume contains world y coordinate.

Parameters
ythe absolute ("world") coordinate y
neg_marginhow far within the TPC the fiducial region starts
pos_marginhow far before the TPC the fiducial region ends
Returns
whether the specified coordinate is in this TPC fiducial volume

The fiducial volume is defined by the specified margins, that denote how much of the coordinate is not fiducial. For example,

bool bWithin = tpc->InFiducialY(y, 5., 8.);

on a TPC with y from 0 to 100 (cm, presumably) will return true for all y between 5 and 92. If positive margin is not specified, it's assumed to be the same as the negative one. Specifying a negative mergin effectively extends the TPC volume.

Definition at line 271 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CoordinateContained(), geo::BoxBoundedGeo::MaxY(), and geo::BoxBoundedGeo::MinY().

272  {
273  return CoordinateContained(y, MinY() + neg_margin, MaxY() - pos_margin);
274  }
Float_t y
Definition: compare.C:6
double MaxY() const
Returns the world y coordinate of the end of the box.
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
double MinY() const
Returns the world y coordinate of the start of the box.
bool geo::BoxBoundedGeo::InFiducialY ( double  y,
double  margin 
) const
inlineinherited

Returns whether TPC fiducial volume contains world y coordinate.

See also
InFiducialY(double, double, double) const

Margins are symmetric.

Definition at line 281 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialY().

Referenced by geo::BoxBoundedGeo::InFiducialY().

281 { return InFiducialY(y, margin, margin); }
Float_t y
Definition: compare.C:6
bool InFiducialY(double y, double neg_margin, double pos_margin) const
Returns whether TPC fiducial volume contains world y coordinate.
bool geo::BoxBoundedGeo::InFiducialZ ( double  z,
double  neg_margin,
double  pos_margin 
) const
inlineinherited

Returns whether TPC fiducial volume contains world z coordinate.

Parameters
zthe absolute ("world") coordinate y
neg_marginhow far within the TPC the fiducial region starts
pos_marginhow far before the TPC the fiducial region ends
Returns
whether the specified coordinate is in this TPC fiducial volume

The fiducial volume is defined by the specified margins, that denote how much of the coordinate is not fiducial. For example,

bool bWithin = tpc->InFiducialZ(z, 5., 8.);

on a TPC with z from 0 to 100 (cm, presumably) will return true for all z between 5 and 92. If positive margin is not specified, it's assumed to be the same as the negative one. Specifying a negative mergin effectively extends the TPC volume.

Definition at line 301 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CoordinateContained(), geo::BoxBoundedGeo::MaxZ(), and geo::BoxBoundedGeo::MinZ().

302  {
303  return CoordinateContained(z, MinZ() + neg_margin, MaxZ() - pos_margin);
304  }
Double_t z
Definition: plot.C:276
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
bool geo::BoxBoundedGeo::InFiducialZ ( double  z,
double  margin 
) const
inlineinherited

Returns whether TPC fiducial volume contains world z coordinate.

See also
InFiducialZ(double, double, double) const

Margins are symmetric.

Definition at line 311 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialZ().

Referenced by geo::BoxBoundedGeo::InFiducialZ().

311 { return InFiducialZ(z, margin, margin); }
Double_t z
Definition: plot.C:276
bool InFiducialZ(double z, double neg_margin, double pos_margin) const
Returns whether TPC fiducial volume contains world z coordinate.
void geo::TPCGeo::InitTPCBoundaries ( )
private

Recomputes the TPC boundary.

Definition at line 179 of file TPCGeo.cxx.

References ActiveHalfHeight(), ActiveHalfLength(), ActiveHalfWidth(), fActiveBox, GetActiveVolumeCenter(), HalfHeight(), HalfLength(), HalfWidth(), geo::BoxBoundedGeo::SetBoundaries(), and toWorldCoords().

Referenced by TPCGeo().

180  {
181  // note that this assumes no rotations of the TPC (except for rotations of a flat
182  // angle around one of the three main axes); to avoid this, we should transform the
183  // six vertices rather than just the centre
184 
185  // we rely on the asumption that the center of TPC is at the local origin
188 
189  // the center of the active volume may be elsewhere than the local origin:
190  auto const& activeCenter = GetActiveVolumeCenter();
191  fActiveBox.SetBoundaries(activeCenter.X() - ActiveHalfWidth(),
192  activeCenter.X() + ActiveHalfWidth(),
193  activeCenter.Y() - ActiveHalfHeight(),
194  activeCenter.Y() + ActiveHalfHeight(),
195  activeCenter.Z() - ActiveHalfLength(),
196  activeCenter.Z() + ActiveHalfLength());
197  }
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:94
BoxBoundedGeo fActiveBox
Box of the active volume.
Definition: TPCGeo.h:257
double HalfLength() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:112
Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:155
double ActiveHalfLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:100
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:90
Point_t GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Definition: TPCGeo.h:135
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:106
void SetBoundaries(Coord_t x_min, Coord_t x_max, Coord_t y_min, Coord_t y_max, Coord_t z_min, Coord_t z_max)
Sets the boundaries in world coordinates as specified.
Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: TPCGeo.h:55
double HalfWidth() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:102
decltype(auto) geo::TPCGeo::LengthDir ( ) const
inline

Returns the direction Length() is measured on.

Definition at line 124 of file TPCGeo.h.

References fLengthDir.

Referenced by PrintTPCInfo().

124 { return fLengthDir; }
Vector_t fLengthDir
Direction length refers to.
Definition: TPCGeo.h:255
Point_t geo::BoxBoundedGeo::Max ( ) const
inlineinherited

Returns the corner point with the largest coordinates.

Definition at line 136 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::c_max.

Referenced by geo::WireReadoutDumper::dumpDetectorInfo(), geo::BoxBoundedGeo::ExtendToInclude(), geo::BoxBoundedGeo::GetIntersections(), geo::GeometryCore::MaterialName(), geo::CryostatGeo::PrintCryostatInfo(), and PrintTPCInfo().

136 { return c_max; }
Coords_t c_max
maximum coordinates (x, y, z)
Point_t geo::BoxBoundedGeo::Min ( ) const
inlineinherited

Returns the corner point with the smallest coordinates.

Definition at line 133 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::c_min.

Referenced by geo::WireReadoutDumper::dumpDetectorInfo(), geo::BoxBoundedGeo::ExtendToInclude(), geo::BoxBoundedGeo::GetIntersections(), geo::GeometryCore::MaterialName(), geo::CryostatGeo::PrintCryostatInfo(), and PrintTPCInfo().

133 { return c_min; }
Coords_t c_min
minimum coordinates (x, y, z)
TGeoNode const * geo::TPCGeo::NodeForActiveVolume ( TGeoNode const *  tpc)
static

Definition at line 213 of file TPCGeo.cxx.

Referenced by Hash(), geo::GeometryBuilderStandard::makeTPC(), and TPCGeo().

214  {
215  for (int i = 0, nd = tpc->GetNdaughters(); i < nd; ++i) {
216  auto daughter = tpc->GetDaughter(i);
217  if (daughter && strncmp(daughter->GetName(), "volTPCActive", 12) == 0) return daughter;
218  }
219  return nullptr;
220  }
bool geo::BoxBoundedGeo::Overlaps ( BoxBoundedGeo const &  other) const
inlineinherited

Returns if this and other box overlap.

Definition at line 338 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::OverlapsX(), geo::BoxBoundedGeo::OverlapsY(), and geo::BoxBoundedGeo::OverlapsZ().

339  {
340  return OverlapsX(other) && OverlapsY(other) && OverlapsZ(other);
341  }
bool OverlapsZ(BoxBoundedGeo const &other) const
Returns if the z coordinates covered by this and other box overlap.
bool OverlapsY(BoxBoundedGeo const &other) const
Returns if the y coordinates covered by this and other box overlap.
bool OverlapsX(BoxBoundedGeo const &other) const
Returns if the x coordinates covered by this and other box overlap.
bool geo::BoxBoundedGeo::OverlapsX ( BoxBoundedGeo const &  other) const
inlineinherited

Returns if the x coordinates covered by this and other box overlap.

Definition at line 320 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxX(), and geo::BoxBoundedGeo::MinX().

Referenced by geo::BoxBoundedGeo::Overlaps().

321  {
322  return std::min(MaxX(), other.MaxX()) > std::max(MinX(), other.MinX());
323  }
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
bool geo::BoxBoundedGeo::OverlapsY ( BoxBoundedGeo const &  other) const
inlineinherited

Returns if the y coordinates covered by this and other box overlap.

Definition at line 326 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxY(), and geo::BoxBoundedGeo::MinY().

Referenced by geo::BoxBoundedGeo::Overlaps().

327  {
328  return std::min(MaxY(), other.MaxY()) > std::max(MinY(), other.MinY());
329  }
double MaxY() const
Returns the world y coordinate of the end of the box.
double MinY() const
Returns the world y coordinate of the start of the box.
bool geo::BoxBoundedGeo::OverlapsZ ( BoxBoundedGeo const &  other) const
inlineinherited

Returns if the z coordinates covered by this and other box overlap.

Definition at line 332 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxZ(), and geo::BoxBoundedGeo::MinZ().

Referenced by geo::BoxBoundedGeo::Overlaps().

333  {
334  return std::min(MaxZ(), other.MaxZ()) > std::max(MinZ(), other.MinZ());
335  }
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
template<typename Stream >
void geo::TPCGeo::PrintTPCInfo ( Stream &&  out,
std::string  indent = "",
unsigned int  verbosity = 1 
) const

Prints information about this TPC.

Template Parameters
Streamtype of output stream to use
Parameters
outstream to send the information to
indentprepend each line with this string
verbosityamount of information printed

Note that the first line out the output is not indented.

Verbosity levels

  • 0: only TPC ID
  • 1 _(default)_: also center and size
  • 2: also drift direction, cathode position and number of planes
  • 3: also maximum number of wires per plane
  • 4: also information on main direction
  • 5: also information on bounding box

The constant MaxVerbosity is set to the highest supported verbosity level.

Definition at line 271 of file TPCGeo.h.

References ActiveBoundingBox(), ActiveHeight(), ActiveLength(), ActiveWidth(), BoundingBox(), DriftDir(), DriftDistance(), GetCathodeCenter(), GetCenter(), GetFrontFaceCenter(), Height(), HeightDir(), ID(), Length(), LengthDir(), geo::BoxBoundedGeo::Max(), geo::BoxBoundedGeo::Min(), Width(), and WidthDir().

Referenced by geo::GeometryCore::Print(), toLocalCoords(), and TPCInfo().

275 {
276 
277  //----------------------------------------------------------------------------
278  out << "TPC " << std::string(ID());
279 
280  if (verbosity-- <= 0) return; // 0
281 
282  //----------------------------------------------------------------------------
283  out << " (" << Width() << " x " << Height() << " x " << Length() << ") cm^3 at " << GetCenter();
284 
285  if (verbosity-- <= 0) return; // 1
286 
287  //----------------------------------------------------------------------------
288  out << "\n"
289  << indent << "drift direction " << DriftDir() << " from cathode around " << GetCathodeCenter()
290  << " through " << DriftDistance() << " cm";
291 
292  if (verbosity-- <= 0) return; // 2
293 
294  if (verbosity-- <= 0) return; // 3
295 
296  //----------------------------------------------------------------------------
297  out << "\n"
298  << indent << "active volume (" << ActiveWidth() << " x " << ActiveHeight() << " x "
299  << ActiveLength() << ") cm^3, front face at " << GetFrontFaceCenter() << " cm;"
300  << "\n"
301  << indent << "main directions:"
302  << " width " << WidthDir() << " height " << HeightDir() << " length " << LengthDir();
303 
304  if (verbosity-- <= 0) return; // 4
305 
306  //----------------------------------------------------------------------------
307  // print also the containing box
308  BoxBoundedGeo const& box = BoundingBox();
309  out << "\n" << indent << "bounding box: " << box.Min() << " -- " << box.Max();
310 
311  //----------------------------------------------------------------------------
312  // print also the active box
313  BoxBoundedGeo const& activeBox = ActiveBoundingBox();
314  out << "\n" << indent << "active volume box: " << activeBox.Min() << " -- " << activeBox.Max();
315 
316  //----------------------------------------------------------------------------
317 } // geo::TPCGeo::PrintTPCInfo()
decltype(auto) LengthDir() const
Returns the direction Length() is measured on.
Definition: TPCGeo.h:124
decltype(auto) WidthDir() const
Returns the direction Width() is measured on.
Definition: TPCGeo.h:118
Point_t GetCathodeCenter() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:139
decltype(auto) HeightDir() const
Returns the direction Height() is measured on.
Definition: TPCGeo.h:121
BoxBoundedGeo()=default
Default constructor: sets an empty volume.
double Width() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:104
double Height() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:108
double Length() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:110
Point_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:132
BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:144
std::string indent(std::size_t const i)
double ActiveHeight() const
Height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:96
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:98
double DriftDistance() const
Drift distance is defined as the distance between the anode and the cathode, in centimeters.
Definition: TPCGeo.cxx:165
BoxBoundedGeo const & BoundingBox() const
Returns the bounding box of this TPC.
Definition: TPCGeo.h:141
double ActiveWidth() const
Width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:92
Vector_t DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
Definition: TPCGeo.h:84
TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:147
Point_t GetFrontFaceCenter() const
Returns the center of the active TPC volume side facing negative z.
Definition: TPCGeo.cxx:200
static void geo::BoxBoundedGeo::set_max ( Coord_t var,
Coord_t  value 
)
inlinestaticinherited

Sets var to value if value is larger than the current var value.

Definition at line 472 of file BoxBoundedGeo.h.

References value.

Referenced by geo::BoxBoundedGeo::ExtendToInclude().

473  {
474  if (value > var) var = value;
475  }
double value
Definition: spectrum.C:18
static void geo::BoxBoundedGeo::set_max ( Coords_t var,
Point_t const &  value 
)
inlinestaticinherited

Sets each coordinate of var to the one in value if the latter is larger.

Definition at line 486 of file BoxBoundedGeo.h.

487  {
488  if (value.X() > var.X()) var.SetX(value.X());
489  if (value.Y() > var.Y()) var.SetY(value.Y());
490  if (value.Z() > var.Z()) var.SetZ(value.Z());
491  }
double value
Definition: spectrum.C:18
static void geo::BoxBoundedGeo::set_min ( Coord_t var,
Coord_t  value 
)
inlinestaticinherited

Sets var to value if value is smaller than the current var value.

Definition at line 466 of file BoxBoundedGeo.h.

References value.

Referenced by geo::BoxBoundedGeo::ExtendToInclude().

467  {
468  if (value < var) var = value;
469  }
double value
Definition: spectrum.C:18
static void geo::BoxBoundedGeo::set_min ( Coords_t var,
Point_t const &  value 
)
inlinestaticinherited

Sets each coordinate of var to the one in value if the latter is smaller.

Definition at line 478 of file BoxBoundedGeo.h.

479  {
480  if (value.X() < var.X()) var.SetX(value.X());
481  if (value.Y() < var.Y()) var.SetY(value.Y());
482  if (value.Z() < var.Z()) var.SetZ(value.Z());
483  }
double value
Definition: spectrum.C:18
void geo::BoxBoundedGeo::SetBoundaries ( Coord_t  x_min,
Coord_t  x_max,
Coord_t  y_min,
Coord_t  y_max,
Coord_t  z_min,
Coord_t  z_max 
)
inlineinherited

Sets the boundaries in world coordinates as specified.

Parameters
x_minlower x coordinate
x_maxupper x coordinate
y_minlower y coordinate
y_maxupper y coordinate
z_minlower z coordinate
z_maxupper z coordinate

Definition at line 391 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::c_max, geo::BoxBoundedGeo::c_min, and geo::BoxBoundedGeo::SortCoordinates().

Referenced by geo::PlaneGeo::BoundingBox(), geo::CryostatGeo::InitCryoBoundaries(), and InitTPCBoundaries().

397  {
398  c_min.SetXYZ(x_min, y_min, z_min);
399  c_max.SetXYZ(x_max, y_max, z_max);
400  SortCoordinates();
401  }
double x_min
Definition: berger.C:15
Coords_t c_max
maximum coordinates (x, y, z)
double x_max
Definition: berger.C:16
Coords_t c_min
minimum coordinates (x, y, z)
void SortCoordinates()
Makes sure each coordinate of the minimum point is smaller than maximum.
void geo::BoxBoundedGeo::SetBoundaries ( Coords_t  lower,
Coords_t  upper 
)
inlineinherited

Sets the boundaries in world coordinates as specified.

Parameters
lowerlower coordinates (x, y, z)
upperupper coordinates (x, y, z)

Definition at line 408 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::c_max, geo::BoxBoundedGeo::c_min, and geo::BoxBoundedGeo::SortCoordinates().

409  {
410  c_min = lower;
411  c_max = upper;
412  SortCoordinates();
413  }
Coords_t c_max
maximum coordinates (x, y, z)
Coords_t c_min
minimum coordinates (x, y, z)
void SortCoordinates()
Makes sure each coordinate of the minimum point is smaller than maximum.
double geo::BoxBoundedGeo::SizeX ( ) const
inlineinherited

Returns the full size in the X dimension.

Definition at line 97 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxX(), and geo::BoxBoundedGeo::MinX().

Referenced by geo::WireReadoutDumper::dumpDetectorInfo(), and geo::BoxBoundedGeo::HalfSizeX().

97 { return MaxX() - MinX(); }
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:88
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:91
double geo::BoxBoundedGeo::SizeY ( ) const
inlineinherited

Returns the full size in the Y dimension.

Definition at line 112 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxY(), and geo::BoxBoundedGeo::MinY().

Referenced by geo::WireReadoutDumper::dumpDetectorInfo(), and geo::BoxBoundedGeo::HalfSizeY().

112 { return MaxY() - MinY(); }
double MaxY() const
Returns the world y coordinate of the end of the box.
double MinY() const
Returns the world y coordinate of the start of the box.
double geo::BoxBoundedGeo::SizeZ ( ) const
inlineinherited

Returns the full size in the Z dimension.

Definition at line 127 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::MaxZ(), and geo::BoxBoundedGeo::MinZ().

Referenced by geo::WireReadoutDumper::dumpDetectorInfo(), and geo::BoxBoundedGeo::HalfSizeZ().

127 { return MaxZ() - MinZ(); }
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
LocalPoint_t geo::TPCGeo::toLocalCoords ( Point_t const &  world) const
inline

Transform point from world frame to local TPC frame.

Definition at line 161 of file TPCGeo.h.

References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toLocalCoords().

161 { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:236
LocalVector_t geo::TPCGeo::toLocalCoords ( Vector_t const &  world) const
inline

Transform direction vector from world to local.

Definition at line 164 of file TPCGeo.h.

References fTrans, art::detail::indent(), PrintTPCInfo(), geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toLocalCoords(), TPCInfo(), and UpdateAfterSorting().

164 { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:236
const TGeoVolume* geo::TPCGeo::TotalVolume ( ) const
inline

Returns the expected drift direction based on geometry.

The current implementation is based on the assumption that electrons in the middle of TPC will drift toward the wire planes, and it "never fails".

Definition at line 115 of file TPCGeo.h.

References fTotalVolume.

115 { return fTotalVolume; }
TGeoVolume * fTotalVolume
Total volume of TPC, called volTPC in GDML file.
Definition: TPCGeo.h:243
Point_t geo::TPCGeo::toWorldCoords ( LocalPoint_t const &  local) const
inline

Transform point from local TPC frame to world frame.

Definition at line 155 of file TPCGeo.h.

References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toWorldCoords().

Referenced by GetCenter(), and InitTPCBoundaries().

155 { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:236
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
Vector_t geo::TPCGeo::toWorldCoords ( LocalVector_t const &  local) const
inline

Transform direction vector from local to world.

Definition at line 158 of file TPCGeo.h.

References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toWorldCoords().

158 { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:236
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
std::string geo::TPCGeo::TPCInfo ( std::string  indent = "",
unsigned int  verbosity = 1 
) const

Returns a string with information about this TPC.

See also
PrintTPCInfo()

Arguments and provided information are the same as in PrintTPCInfo().

Definition at line 171 of file TPCGeo.cxx.

References PrintTPCInfo().

Referenced by toLocalCoords().

172  {
173  std::ostringstream sstr;
174  PrintTPCInfo(sstr, indent, verbosity);
175  return sstr.str();
176  }
void PrintTPCInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this TPC.
Definition: TPCGeo.h:271
std::string indent(std::size_t const i)
void geo::TPCGeo::UpdateAfterSorting ( TPCID  tpcid)

Performs all updates after cryostat has sorted TPCs.

Definition at line 207 of file TPCGeo.cxx.

References fID.

Referenced by toLocalCoords().

208  {
209  fID = tpcid;
210  }
TPCID fID
ID of this TPC.
Definition: TPCGeo.h:259
double geo::TPCGeo::Width ( ) const
inline

Width is associated with x coordinate [cm].

Definition at line 104 of file TPCGeo.h.

References HalfWidth().

Referenced by PrintTPCInfo().

104 { return 2.0 * HalfWidth(); }
double HalfWidth() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:102
decltype(auto) geo::TPCGeo::WidthDir ( ) const
inline

Returns the direction Width() is measured on.

Definition at line 118 of file TPCGeo.h.

References fWidthDir.

Referenced by PrintTPCInfo().

118 { return fWidthDir; }
Vector_t fWidthDir
Direction width refers to.
Definition: TPCGeo.h:253

Member Data Documentation

BoxBoundedGeo geo::TPCGeo::fActiveBox
private

Box of the active volume.

Definition at line 257 of file TPCGeo.h.

Referenced by ActiveBoundingBox(), and InitTPCBoundaries().

Point_t geo::TPCGeo::fActiveCenter
private

Center of the active volume, in world coordinates [cm].

Definition at line 244 of file TPCGeo.h.

Referenced by GetActiveVolumeCenter(), and TPCGeo().

double geo::TPCGeo::fActiveHalfHeight
private

Half height of active volume.

Definition at line 247 of file TPCGeo.h.

Referenced by ActiveHalfHeight(), and TPCGeo().

double geo::TPCGeo::fActiveHalfWidth
private

Half width of active volume.

Definition at line 246 of file TPCGeo.h.

Referenced by ActiveHalfWidth(), and TPCGeo().

double geo::TPCGeo::fActiveLength
private

Length of active volume.

Definition at line 248 of file TPCGeo.h.

Referenced by ActiveHalfLength(), ActiveLength(), and TPCGeo().

TGeoVolume* geo::TPCGeo::fActiveVolume {nullptr}
private

Active volume of LAr, called volTPCActive in GDML file.

Definition at line 242 of file TPCGeo.h.

Referenced by ActiveMass(), ActiveVolume(), and TPCGeo().

DriftAxis geo::TPCGeo::fDriftAxis
private

Definition at line 238 of file TPCGeo.h.

Referenced by DriftAxisWithSign(), and TPCGeo().

Vector_t geo::TPCGeo::fDriftDir
private

Definition at line 239 of file TPCGeo.h.

Referenced by DriftDir(), and TPCGeo().

double geo::TPCGeo::fDriftDistance
private

Definition at line 240 of file TPCGeo.h.

Referenced by DriftDistance(), and TPCGeo().

double geo::TPCGeo::fHalfHeight
private

Half height of total volume.

Definition at line 250 of file TPCGeo.h.

Referenced by HalfHeight(), and TPCGeo().

double geo::TPCGeo::fHalfWidth
private

Half width of total volume.

Definition at line 249 of file TPCGeo.h.

Referenced by HalfWidth(), and TPCGeo().

std::size_t geo::TPCGeo::fHash
private

Uniquely identifies TPC before sorting has been performed.

Definition at line 235 of file TPCGeo.h.

Referenced by Hash().

Vector_t geo::TPCGeo::fHeightDir {Yaxis()}
private

Direction height refers to.

Definition at line 254 of file TPCGeo.h.

Referenced by HeightDir(), and TPCGeo().

TPCID geo::TPCGeo::fID
private

ID of this TPC.

Definition at line 259 of file TPCGeo.h.

Referenced by ID(), and UpdateAfterSorting().

double geo::TPCGeo::fLength
private

Length of total volume.

Definition at line 251 of file TPCGeo.h.

Referenced by HalfLength(), Length(), and TPCGeo().

Vector_t geo::TPCGeo::fLengthDir {Zaxis()}
private

Direction length refers to.

Definition at line 255 of file TPCGeo.h.

Referenced by LengthDir(), and TPCGeo().

TGeoVolume* geo::TPCGeo::fTotalVolume {nullptr}
private

Total volume of TPC, called volTPC in GDML file.

Definition at line 243 of file TPCGeo.h.

Referenced by TotalVolume(), and TPCGeo().

LocalTransformation_t geo::TPCGeo::fTrans
private

TPC-to-world transformation.

Definition at line 236 of file TPCGeo.h.

Referenced by toLocalCoords(), toWorldCoords(), and TPCGeo().

Vector_t geo::TPCGeo::fWidthDir {Xaxis()}
private

Direction width refers to.

Definition at line 253 of file TPCGeo.h.

Referenced by TPCGeo(), and WidthDir().

constexpr unsigned int geo::TPCGeo::MaxVerbosity = 6
static

Maximum verbosity supported by PrintTPCInfo().

Definition at line 204 of file TPCGeo.h.

Referenced by geo::GeometryCore::Print().


The documentation for this class was generated from the following files: