LArSoft  v09_90_00
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 PlaneCollection_t = std::vector< geo::PlaneGeo >
 
using GeoNodePath_t = geo::WireGeo::GeoNodePath_t
 
using ElementIteratorBox = PlaneCollection_t const &
 Type returned by IterateElements(). More...
 
using Projection_t = geo::PlaneGeo::WidthDepthProjection_t
 Type of 2D vector projection on a plane. More...
 
using DecomposedVector_t = geo::PlaneGeo::WDDecomposedVector_t
 Data structure with plane and drift projections of a 3D vector. More...
 
using Coords_t = geo::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 = geo::Point3DBase_t< TPCGeoCoordinatesTag >
 Type of points in the local GDML TPC frame. More...
 
using LocalVector_t = geo::Vector3DBase_t< TPCGeoCoordinatesTag >
 Type of displacement vectors in the local GDML TPC frame. More...
 

Public Member Functions

 TPCGeo (TGeoNode const &node, geo::TransformationMatrix &&trans, PlaneCollection_t &&planes)
 
PlaneGeo const & Plane (geo::View_t view) const
 Return the plane in the tpc with View_t view. More...
 
PlaneGeo const & Plane (unsigned int iplane) const
 
PlaneGeo const * PlanePtr (unsigned int iplane) const
 Returns the plane number iplane from this TPC. More...
 
geo::PlaneGeo const & SmallestPlane () const
 Returns the wire plane with the smallest surface. More...
 
geo::PlaneGeo const & FirstPlane () const
 Returns the first wire plane (the closest to TPC center). More...
 
geo::PlaneGeo const & LastPlane () const
 Returns the last wire plane (the farther from TPC center). More...
 
unsigned int MaxWires () const
 Returns the largest number of wires among the planes in this TPC. More...
 
std::set< geo::View_tViews () const
 Returns a set of all views covered in this TPC. More...
 
short int DetectDriftDirection () const
 Returns the expected drift direction based on geometry. More...
 
void SortSubVolumes (geo::GeoObjectSorter const &sorter)
 Apply sorting to the PlaneGeo objects. More...
 
void UpdateAfterSorting (geo::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...
 
TPC properties
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
 Half width (associated with x coordinate) of active TPC volume [cm]. More...
 
const TGeoVolume * ActiveVolume () const
 Half width (associated with x coordinate) of active TPC volume [cm]. More...
 
const TGeoVolume * TotalVolume () const
 Half width (associated with x coordinate) of active TPC volume [cm]. 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...
 
DriftDirection_t DriftDirection () const
 Returns an enumerator value describing the drift direction. More...
 
Vector_t DriftDir () const
 Returns the direction of the drift (vector pointing toward the planes). More...
 
double DriftDistance () const
 
Plane access
unsigned int Nplanes () const
 Number of planes in this tpc. More...
 
unsigned int NElements () const
 Number of planes in this tpc. More...
 
bool HasPlane (unsigned int iplane) const
 Returns whether a plane with index iplane is present in this TPC. More...
 
bool HasElement (unsigned int iplane) const
 Returns whether a plane with index iplane is present in this TPC. More...
 
bool HasPlane (geo::PlaneID const &planeid) const
 Returns whether the plane in planeid is present in this TPC. More...
 
bool HasElement (geo::PlaneID const &planeid) const
 Returns whether the plane in planeid is present in this TPC. More...
 
const PlaneGeoPlane (PlaneID const &planeid) const
 Returns the plane in planeid from this TPC. More...
 
const PlaneGeoGetElement (PlaneID const &planeid) const
 Returns the plane in planeid from this TPC. More...
 
PlaneGeo const * PlanePtr (PlaneID const &planeid) const
 Returns the plane in planeid from this TPC. More...
 
PlaneGeo const * GetElementPtr (PlaneID const &planeid) const
 Returns the plane in planeid from this TPC. More...
 
ElementIteratorBox IterateElements () const
 Returns an object for iterating through all geo::PlaneGeo. More...
 
ElementIteratorBox IteratePlanes () const
 Returns an object for iterating through all geo::PlaneGeo. 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 GetCathodeCenter () const
 
geo::Point_t GetFrontFaceCenter () const
 Returns the center of the active TPC volume side facing negative z. More...
 
geo::BoxBoundedGeo const & BoundingBox () const
 Returns the bounding box of this TPC. More...
 
geo::BoxBoundedGeo const & ActiveBoundingBox () const
 Returns the box of the active volume of this TPC. More...
 
double Plane0Pitch (unsigned int p) const
 Returns the center of the TPC volume in world coordinates [cm]. More...
 
double PlanePitch (unsigned int p1=0, unsigned int p2=1) const
 Returns the center of the TPC volume in world coordinates [cm]. More...
 
double WirePitch (unsigned plane=0) const
 Returns the center of the TPC volume in world coordinates [cm]. More...
 
geo::TPCID const & ID () const
 Returns the identifier of this TPC. More...
 
Projection on a wire plane

These methods deal with projection of points and vectors on a plane, using a geometric reference base which is not dependent on the wire direction. Technically, the objects are projected on the reference plane, that happens to be the first wire plane. In practice, the important bit is that all entities are consistently decomposed into a drift component and a remaining component. If which plane the projection happens on should matter, then geo::PlaneGeo can be used directly (but note that geo::PlaneGeo defines two different frames, and the names of the frame equivalent to the one used here are different).

geo::PlaneGeo const & ReferencePlane () const
 Returns the plane used for reference by projection methods. More...
 
geo::PlaneID const & ReferencePlaneID () const
 Returns the ID of the plane used for reference by projection methods. More...
 
Vector_t RefWidthDir () const
 Return the direction of reference plane width. More...
 
Vector_t RefDepthDir () const
 Return the direction of reference plane depth. More...
 
double DistanceFromReferencePlane (geo::Point_t const &point) const
 Returns the distance of the specified point from reference plane. More...
 
void DriftPoint (geo::Point_t &position, double distance) const
 Shifts the position of an electron drifted by a distance. More...
 
DecomposedVector_t DecomposePoint (geo::Point_t const &point) const
 Decomposes a 3D point in two components. More...
 
Point_t ProjectionReferencePoint () const
 Returns the reference point used by PointProjection(). More...
 
Projection_t Projection (geo::Point_t const &point) const
 Returns the projection of the specified point on the plane. More...
 
Projection_t PointProjection (geo::Point_t const &point) const
 Returns the projection of the specified point on the plane. More...
 
Projection_t Projection (geo::Vector_t const &v) const
 Returns the projection of the specified vector on the plane. More...
 
Projection_t VectorProjection (geo::Vector_t const &v) const
 Returns the projection of the specified vector on the plane. More...
 
Point_t ComposePoint (DecomposedVector_t const &decomp) const
 Returns the 3D vector from composition of projection and distance. More...
 
Point_t ComposePoint (double distance, Projection_t const &proj) const
 Returns the 3D point from composition of projection and distance. More...
 
Coordinate transformation
geo::Point_t toWorldCoords (LocalPoint_t const &local) const
 Transform point from local TPC frame to world frame. More...
 
geo::Vector_t toWorldCoords (LocalVector_t const &local) const
 Transform direction vector from local to world. More...
 
LocalPoint_t toLocalCoords (geo::Point_t const &world) const
 Transform point from world frame to local TPC frame. More...
 
LocalVector_t toLocalCoords (geo::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...
 
geo::Point_t Min () const
 Returns the corner point with the smallest coordinates. More...
 
geo::Point_t Max () const
 Returns the corner point with the largest coordinates. More...
 
geo::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 (geo::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 (geo::BoxBoundedGeo const &other) const
 Returns if the x coordinates covered by this and other box overlap. More...
 
bool OverlapsY (geo::BoxBoundedGeo const &other) const
 Returns if the y coordinates covered by this and other box overlap. More...
 
bool OverlapsZ (geo::BoxBoundedGeo const &other) const
 Returns if the z coordinates covered by this and other box overlap. More...
 
bool Overlaps (geo::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 (geo::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< geo::Point_tGetIntersections (geo::Point_t const &TrajectoryStart, geo::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 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, geo::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, geo::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 = geo::LocalTransformationGeo< ROOT::Math::Transform3D, LocalPoint_t, LocalVector_t >
 

Private Member Functions

void FindPlane (GeoNodePath_t &path, size_t depth)
 
void MakePlane (GeoNodePath_t &path, size_t depth)
 
void ResetDriftDirection ()
 Recomputes the drift direction; needs planes to have been initialised. More...
 
double ComputeDriftDistance () const
 
void UpdatePlaneViewCache ()
 Refills the plane vs. view cache of the TPC. More...
 
void UpdatePlaneCache ()
 Updates plane cached information. More...
 
void InitTPCBoundaries ()
 Recomputes the TPC boundary. More...
 
void SortPlanes (std::vector< geo::PlaneGeo > &) const
 Sorts (in place) the specified PlaneGeo objects by drift distance. More...
 
geo::Point_t GetFrontFaceCenterImpl () const
 
geo::Point_t GetCathodeCenterImpl () const
 

Private Attributes

LocalTransformation_t fTrans
 TPC-to-world transformation. More...
 
PlaneCollection_t fPlanes
 List of planes in this plane. More...
 
TGeoVolume * fActiveVolume
 Active volume of LAr, called volTPCActive in GDML file. More...
 
TGeoVolume * fTotalVolume
 Total volume of TPC, called volTPC in GDML file. More...
 
DriftDirection_t fDriftDirection
 Direction of the electron drift in the TPC. More...
 
std::vector< double > fPlane0Pitch
 Pitch between planes. More...
 
std::vector< std::vector< double > > fPlaneLocation
 xyz locations of planes in the TPC. More...
 
geo::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...
 
geo::Vector_t fWidthDir
 Direction width refers to. More...
 
geo::Vector_t fHeightDir
 Direction height refers to. More...
 
geo::Vector_t fLengthDir
 Direction length refers to. More...
 
geo::Vector_t fDriftDir
 Direction electrons drift along. More...
 
geo::BoxBoundedGeo fActiveBox
 Box of the active volume. More...
 
geo::TPCID fID
 ID of this TPC. More...
 
std::vector< geo::PlaneID::PlaneID_tfViewToPlaneNumber
 Index of the plane for each view (InvalidID if none). More...
 

Detailed Description

Geometry information for a single TPC.

Definition at line 36 of file TPCGeo.h.

Member Typedef Documentation

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

Type of the coordinate.

Definition at line 36 of file BoxBoundedGeo.h.

Type of the coordinate triplet.

Definition at line 35 of file BoxBoundedGeo.h.

Data structure with plane and drift projections of a 3D vector.

Definition at line 75 of file TPCGeo.h.

Type returned by IterateElements().

Definition at line 43 of file TPCGeo.h.

Definition at line 38 of file TPCGeo.h.

Type of points in the local GDML TPC frame.

Definition at line 64 of file TPCGeo.h.

Definition at line 596 of file TPCGeo.h.

Type of displacement vectors in the local GDML TPC frame.

Definition at line 67 of file TPCGeo.h.

Definition at line 39 of file TPCGeo.h.

Type of 2D vector projection on a plane.

Definition at line 72 of file TPCGeo.h.

Constructor & Destructor Documentation

geo::TPCGeo::TPCGeo ( TGeoNode const &  node,
geo::TransformationMatrix &&  trans,
PlaneCollection_t &&  planes 
)

Definition at line 38 of file TPCGeo.cxx.

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

41  : BoxBoundedGeo() // we initialize boundaries at the end of construction
42  , fTrans(std::move(trans))
43  , fPlanes(std::move(planes))
44  , fActiveVolume(0)
45  , fTotalVolume(0)
50  , fDriftDir() // null until known
51  {
52 
53  // all planes are going to be contained in the volume named volTPC
54  // now get the total volume of the TPC
55  TGeoVolume* vc = node.GetVolume();
56  if (!vc) {
57  throw cet::exception("Geometry")
58  << "cannot find detector outline volume - bail ungracefully\n";
59  }
60 
61  fTotalVolume = vc;
62 
63  // loop over the daughters of this node and look for the active volume
64  int nd = vc->GetNdaughters();
65  TGeoNode const* pActiveVolNode = nullptr;
66  for (int i = 0; i < nd; ++i) {
67  if (strncmp(vc->GetNode(i)->GetName(), "volTPCActive", 12) != 0) continue;
68 
69  pActiveVolNode = vc->GetNode(i);
70  TGeoVolume* vca = pActiveVolNode->GetVolume();
71  if (vca) fActiveVolume = vca;
72  break;
73 
74  } // end loop over daughters of the volume
75 
77 
78  MF_LOG_DEBUG("Geometry") << "detector total volume is " << fTotalVolume->GetName()
79  << "\ndetector active volume is " << fActiveVolume->GetName();
80 
81  // compute the active volume transformation too
82  auto ActiveHMatrix(fTrans.Matrix());
83  if (pActiveVolNode) {
84  ActiveHMatrix *= geo::makeTransformationMatrix(*(pActiveVolNode->GetMatrix()));
85  }
86  // we don't keep the active volume information... just store its center:
88 
89  // set the width, height, and lengths
90  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
91  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDY();
92  fActiveLength = 2.0 * ((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
93 
94  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
95  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
96  fLength = 2.0 * ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
97 
98  // check that the rotation matrix to the world is the identity, if not
99  // we need to change the width, height and length values;
100  // the correspondence of these to x, y and z are not guaranteed to be
101  // trivial, so we store the two independently (cartesian dimensions in the
102  // bounding boxes, the sizes in data members directly);
103  // TODO: there must be a more general way to do this...
104  double Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz;
105  fTrans.Matrix().Rotation().GetComponents(Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz);
106  if (Rxx != 1) {
107  if (std::abs(Rxz) == 1) {
108  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
109  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
110  fWidthDir = Zaxis();
111  }
112  if (std::abs(Rxy) == 1) {
113  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDY();
114  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
115  fWidthDir = Yaxis();
116  }
117  }
118  if (Ryy != 1) {
119  if (std::abs(Rxy) == 1) {
120  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
121  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
122  fHeightDir = Xaxis();
123  }
124  if (std::abs(Rzy) == 1) {
125  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
126  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
127  fHeightDir = Zaxis();
128  }
129  }
130  if (Rzz != 1) {
131  if (std::abs(Rzx) == 1) {
132  fActiveLength = 2. * ((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
133  fLength = 2. * ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
134  fLengthDir = Xaxis();
135  }
136  if (std::abs(Ryz) == 1) {
137  fActiveLength = 2. * ((TGeoBBox*)fActiveVolume->GetShape())->GetDY();
138  fLength = 2. * ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
139  fLengthDir = Yaxis();
140  }
141  }
142 
145 
146  } // TPCGeo::TPCGeo()
void InitTPCBoundaries()
Recomputes the TPC boundary.
Definition: TPCGeo.cxx:435
Drift direction is unknown.
Definition: geo_types.h:163
double fLength
Length of total volume.
Definition: TPCGeo.h:613
double fActiveHalfWidth
Half width of active volume.
Definition: TPCGeo.h:608
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
BoxBoundedGeo()=default
Default constructor: sets an empty volume.
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
constexpr auto abs(T v)
Returns the absolute value of the argument.
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
geo::Vector_t fHeightDir
Direction height refers to.
Definition: TPCGeo.h:616
geo::Vector_t fWidthDir
Direction width refers to.
Definition: TPCGeo.h:615
double fHalfWidth
Half width of total volume.
Definition: TPCGeo.h:611
double fActiveLength
Length of active volume.
Definition: TPCGeo.h:610
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:602
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
Definition: TPCGeo.h:603
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:601
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:42
geo::Vector_t fLengthDir
Direction length refers to.
Definition: TPCGeo.h:617
#define MF_LOG_DEBUG(id)
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:598
void ResetDriftDirection()
Recomputes the drift direction; needs planes to have been initialised.
Definition: TPCGeo.cxx:374
geo::Vector_t fDriftDir
Direction electrons drift along.
Definition: TPCGeo.h:618
geo::Point_t fActiveCenter
Center of the active volume, in world coordinates [cm].
Definition: TPCGeo.h:606
double fHalfHeight
Half height of total volume.
Definition: TPCGeo.h:612
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double fActiveHalfHeight
Half height of active volume.
Definition: TPCGeo.h:609

Member Function Documentation

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

Returns the box of the active volume of this TPC.

Definition at line 263 of file TPCGeo.h.

References fActiveBox, Plane0Pitch(), PlanePitch(), and WirePitch().

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

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

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

Definition at line 88 of file TPCGeo.h.

References fActiveHalfHeight.

Referenced by ActiveHeight(), geo::GeometryCore::DetHalfHeight(), evd_tool::ProtoDUNEDrawer::DrawActiveTPCoutline(), evd_tool::StandardDrawer::DrawActiveTPCoutline(), GetCathodeCenterImpl(), and InitTPCBoundaries().

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

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

Definition at line 94 of file TPCGeo.h.

References fActiveLength.

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

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

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

Definition at line 84 of file TPCGeo.h.

References fActiveHalfWidth.

Referenced by ActiveWidth(), geo::GeometryCore::DetHalfWidth(), evd_tool::ProtoDUNEDrawer::DrawActiveTPCoutline(), evd_tool::StandardDrawer::DrawActiveTPCoutline(), GetCathodeCenterImpl(), and InitTPCBoundaries().

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

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

Definition at line 90 of file TPCGeo.h.

References ActiveHalfHeight().

Referenced by PrintTPCInfo().

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

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

Definition at line 92 of file TPCGeo.h.

References fActiveLength.

Referenced by geo::GeometryCore::DetLength(), GetCathodeCenterImpl(), and PrintTPCInfo().

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

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

Definition at line 107 of file TPCGeo.h.

References fActiveVolume.

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

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

Definition at line 108 of file TPCGeo.h.

References fActiveVolume.

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

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

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

Definition at line 86 of file TPCGeo.h.

References ActiveHalfWidth().

Referenced by PrintTPCInfo().

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

Returns the bounding box of this TPC.

Definition at line 260 of file TPCGeo.h.

Referenced by PrintTPCInfo().

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

Returns the center point of the box.

Definition at line 141 of file BoxBoundedGeo.h.

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

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

141 { return {CenterX(), CenterY(), CenterZ()}; }
double CenterX() const
Returns the world x coordinate of the center of the box.
Definition: BoxBoundedGeo.h:96
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 96 of file BoxBoundedGeo.h.

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

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

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

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

Definition at line 111 of file BoxBoundedGeo.h.

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

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

111 { 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 126 of file BoxBoundedGeo.h.

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

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

126 { 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.
Point_t geo::TPCGeo::ComposePoint ( DecomposedVector_t const &  decomp) const
inline

Returns the 3D vector from composition of projection and distance.

Template Parameters
Pointtype of point to be returned
Parameters
decompdecomposed point
Returns
the 3D vector from composition of projection and distance
See also
DecomposePoint(), ComposePoint(double, Projection_t const&)

This is the "inverse" operation respect to DecomposePoint(). The argument stores the two components, orthogonal and parallel to the plane, and compose them into a 3D point which departs from the reference point (ProjectionReferencePoint()) by those components. See ComposePoint(double, Projection_t const&) for more details.

Definition at line 445 of file TPCGeo.h.

References geo::PlaneGeo::ComposePoint(), and ReferencePlane().

446  {
447  return ReferencePlane().ComposePoint(decomp);
448  }
Point_t ComposePoint(WireDecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: PlaneGeo.h:924
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
Point_t geo::TPCGeo::ComposePoint ( double  distance,
Projection_t const &  proj 
) const
inline

Returns the 3D point from composition of projection and distance.

Template Parameters
Pointtype of point to be returned
Parameters
distancedistance of the target point from the reference plane
projprojection of the target point on the reference plane
Returns
the 3D point from composition of projection and distance
See also
DecomposePoint()

The returned point is the reference point, translated by two 3D vectors:

  1. a vector parallel to the plane normal, with norm the input distance
  2. a vector lying on the plane, whose projection via PointProjection() gives the input projection

The choice of the projection reference point embodies the same convention used in PointProjection() and DecomposePoint().

Definition at line 470 of file TPCGeo.h.

References geo::PlaneGeo::ComposePoint(), and ReferencePlane().

471  {
472  return ReferencePlane().ComposePoint(distance, proj);
473  }
Point_t ComposePoint(WireDecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: PlaneGeo.h:924
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
Float_t proj
Definition: plot.C:35
double geo::TPCGeo::ComputeDriftDistance ( ) const
private

Computes the distance between the cathode and the last wire plane (last respect to the sorting order).

Definition at line 421 of file TPCGeo.cxx.

References util::abs(), geo::PlaneGeo::DistanceFromPlane(), fPlanes, and GetCathodeCenter().

Referenced by DriftDistance().

422  {
423 
424  //
425  // 1. find the center of the face of the TPC opposite to the anode
426  // 2. compute the distance of it from the last wire plane
427  //
428 
429  geo::PlaneGeo const& plane = fPlanes.back();
431 
432  } // TPCGeo::ComputeDriftDistance()
Point_t GetCathodeCenter() const
Definition: TPCGeo.h:254
constexpr auto abs(T v)
Returns the absolute value of the argument.
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:558
bool geo::BoxBoundedGeo::ContainsPosition ( geo::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 210 of file BoxBoundedGeo.h.

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

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

211  {
212  return ContainsX(point.X(), wiggle) && ContainsYZ(point.Y(), point.Z(), wiggle);
213  } // 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(geo::Point_t const&, double) const.

Definition at line 24 of file BoxBoundedGeo.cxx.

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

25  {
26  return ContainsPosition(geo::vect::toPoint(point), wiggle);
27  }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
bool ContainsPosition(geo::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(geo::Point_t const&, double) const.

Definition at line 30 of file BoxBoundedGeo.cxx.

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

31  {
32  return ContainsPosition(geo::vect::makePointFromCoords(point), wiggle);
33  }
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
bool ContainsPosition(geo::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 158 of file BoxBoundedGeo.h.

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

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

159  {
160  return CoordinateContained(x, MinX(), MaxX(), wiggle);
161  }
Float_t x
Definition: compare.C:6
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:90
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:93
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 170 of file BoxBoundedGeo.h.

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

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

171  {
172  return CoordinateContained(y, MinY(), MaxY(), wiggle);
173  }
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 195 of file BoxBoundedGeo.h.

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

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

196  {
197  return ContainsY(y, wiggle) && ContainsZ(z, wiggle);
198  }
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 182 of file BoxBoundedGeo.h.

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

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

183  {
184  return CoordinateContained(z, MinZ(), MaxZ(), wiggle);
185  }
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 579 of file TPCGeo.h.

Referenced by CoordinateContained().

580  {
581  return (c >= (min > 0 ? min / wiggle : min * wiggle)) &&
582  (c <= (max < 0 ? max / wiggle : max * wiggle));
583  } // CoordinateContained()
static bool geo::TPCGeo::CoordinateContained ( double  c,
double const *  range,
double  wiggle = 1. 
)
inlinestatic

Definition at line 585 of file TPCGeo.h.

References CoordinateContained(), FindPlane(), and MakePlane().

586  {
587  return CoordinateContained(c, range[0], range[1], wiggle);
588  }
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
Definition: TPCGeo.h:579
DecomposedVector_t geo::TPCGeo::DecomposePoint ( geo::Point_t const &  point) const
inline

Decomposes a 3D point in two components.

Parameters
pointthe point to be decomposed
Returns
the two components of point, on the plane and orthogonal to it

The point is decomposed in:

  1. a component orthogonal to the reference plane, expressed as a signed real number
  2. a component lying on the reference plane, expressed as a 2D vector

The distance is from the reference plane (DistanceFromReferencePlane()). The projection on the plane is obtained following the same convention as PointProjection().

Definition at line 373 of file TPCGeo.h.

References geo::PlaneGeo::DecomposePointWidthDepth(), and ReferencePlane().

374  {
376  }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
WDDecomposedVector_t DecomposePointWidthDepth(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:982
short int geo::TPCGeo::DetectDriftDirection ( ) const

Returns the expected drift direction based on geometry.

The return value is coded as follow:

  • +1: positive x
  • +2: positive y
  • +3: positive z
  • -1: negative x
  • -2: negative y
  • -3: negative z
  • 0: other (or algorithm failed)

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 149 of file TPCGeo.cxx.

References util::abs(), geo::PlaneGeo::GetBoxCenter(), GetCenter(), ID(), Nplanes(), and Plane().

Referenced by larg4::ISCalcCorrelated::AngleToEFieldAtStep(), sce::SCECorrection::applyT0Shift(), larg4::ISCalcCorrelated::EFieldAtStep(), GetCathodeCenterImpl(), nnet::TrainingDataAlg::getProjection(), pma::PMAlgTracker::mergeCoLinear(), detsim::DriftElectronstoPlane::produce(), detsim::SimDriftElectrons::produce(), ResetDriftDirection(), and toLocalCoords().

150  {
151 
152  //
153  // 1. determine the drift axis
154  // 2. determine the drift direction on it
155  //
156  // We assume that all the planes cover most of the TPC face; therefore,
157  // the centre of the plane and the one of the TPC should be very close
158  // to each other, when projected on the same drift plane.
159  // Here we find which is the largest coordinate difference.
160 
161  if (Nplanes() == 0) {
162  // chances are that we get this because stuff is not initialised yet,
163  // and then even the ID might be wrong
164  throw cet::exception("TPCGeo")
165  << "DetectDriftDirection(): no planes in TPC " << std::string(ID()) << "\n";
166  }
167 
168  auto const TPCcenter = GetCenter();
169  auto const PlaneCenter = Plane(0).GetBoxCenter(); // any will do
170 
171  auto const driftVector = PlaneCenter - TPCcenter; // approximation!
172 
173  if ((std::abs(driftVector.X()) > std::abs(driftVector.Y())) &&
174  (std::abs(driftVector.X()) > std::abs(driftVector.Z()))) {
175  // x is the solution
176  return (driftVector.X() > 0) ? +1 : -1;
177  }
178  else if (std::abs(driftVector.Y()) > std::abs(driftVector.Z())) {
179  // y is the man
180  return (driftVector.Y() > 0) ? +2 : -2;
181  }
182  else {
183  // z is the winner
184  return (driftVector.Z() > 0) ? +3 : -3;
185  }
186 
187  } // TPCGeo::DetectDriftDirection()
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:270
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
constexpr auto abs(T v)
Returns the absolute value of the argument.
Point_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:247
Point_t GetBoxCenter() const
Returns the centre of the box representing the plane.
Definition: PlaneGeo.h:449
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:252
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double geo::TPCGeo::DistanceFromReferencePlane ( geo::Point_t const &  point) const
inline

Returns the distance of the specified point from reference plane.

Parameters
pointa point in world coordinates [cm]
Returns
the signed distance from the plane

The distance is defined positive if the point lies in the inner side with respect to the reference plane.

It should match the drift distance from that plane.

Definition at line 334 of file TPCGeo.h.

References geo::PlaneGeo::DistanceFromPlane(), and ReferencePlane().

335  {
336  return ReferencePlane().DistanceFromPlane(point);
337  }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:558
Vector_t geo::TPCGeo::DriftDir ( ) const
inline

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

Definition at line 124 of file TPCGeo.h.

References fDriftDir.

Referenced by checkTPCcoords(), groupTPCsByDriftDir(), PrintTPCInfo(), calo::GnocchiCalorimetry::TrajectoryToWirePosition(), and UpdateAfterSorting().

124 { return fDriftDir; }
geo::Vector_t fDriftDir
Direction electrons drift along.
Definition: TPCGeo.h:618
DriftDirection_t geo::TPCGeo::DriftDirection ( ) const
inline

Returns an enumerator value describing the drift direction.

Definition at line 121 of file TPCGeo.h.

References fDriftDirection.

Referenced by detinfo::DetectorPropertiesStandard::DataFor(), larg4::LArVoxelReadout::DriftIonizationElectrons(), lar_pandora::LArPandoraInput::GetTrueX0(), lar_pandora::VintageLArTPCThreeView::TargetViewU(), and lar_pandora::VintageLArTPCThreeView::TargetViewV().

121 { return fDriftDirection; }
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
Definition: TPCGeo.h:603
double geo::TPCGeo::DriftDistance ( ) const
inline

Drift distance is defined as the distance between the last anode plane and the opposite face of the TPC, in centimeters.

Definition at line 128 of file TPCGeo.h.

References ComputeDriftDistance(), fPlanes, and Nplanes().

Referenced by PrintTPCInfo().

128 { return ComputeDriftDistance(); }
double ComputeDriftDistance() const
Definition: TPCGeo.cxx:421
void geo::TPCGeo::DriftPoint ( geo::Point_t position,
double  distance 
) const
inline

Shifts the position of an electron drifted by a distance.

Parameters
position_(modified)_ the position of the electron
distancedrift distance to shift the electron by [cm]
See also
geo::Plane::DriftPoint(), ReferencePlane()

This operation is delegated to the reference plane (see geo::Plane::DriftPoint()).

Definition at line 350 of file TPCGeo.h.

References geo::PlaneGeo::DriftPoint(), and ReferencePlane().

351  {
352  ReferencePlane().DriftPoint(position, distance);
353  }
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: PlaneGeo.h:579
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
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 423 of file BoxBoundedGeo.h.

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

424  {
426  }
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 ( geo::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 432 of file BoxBoundedGeo.h.

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

433  {
434  set_min(c_min, point);
435  set_max(c_max, point);
436  }
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 444 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().

445  {
446  set_min(c_min, box.Min());
447  set_max(c_max, box.Max());
448  } // 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)
void geo::TPCGeo::FindPlane ( GeoNodePath_t path,
size_t  depth 
)
private

Referenced by CoordinateContained().

geo::PlaneGeo const& geo::TPCGeo::FirstPlane ( ) const
inline

Returns the first wire plane (the closest to TPC center).

Definition at line 212 of file TPCGeo.h.

References fPlanes.

Referenced by ReferencePlane(), and phot::SemiAnalyticalModel::SemiAnalyticalModel().

212 { return fPlanes[0]; }
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
Point_t geo::TPCGeo::GetActiveVolumeCenter ( ) const
inline

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

Definition at line 250 of file TPCGeo.h.

References fActiveCenter.

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

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

Returns the center of the active volume face opposite to the wire planes [cm]

Definition at line 254 of file TPCGeo.h.

References GetCathodeCenterImpl().

Referenced by phot::PropagationTimeModel::cathodeCentre(), geo::DriftPartitions::computeCoverage(), ComputeDriftDistance(), larg4::OpFastScintillation::OpFastScintillation(), PrintTPCInfo(), and phot::SemiAnalyticalModel::SemiAnalyticalModel().

254 { return GetCathodeCenterImpl(); }
geo::Point_t GetCathodeCenterImpl() const
Definition: TPCGeo.cxx:320
geo::Point_t geo::TPCGeo::GetCathodeCenterImpl ( ) const
private

Definition at line 320 of file TPCGeo.cxx.

References ActiveHalfHeight(), ActiveHalfWidth(), ActiveLength(), DetectDriftDirection(), GetActiveVolumeCenter(), and geo::vect::Xcoord().

Referenced by GetCathodeCenter().

321  {
322 
323  //
324  // 1. find the center of the face of the TPC opposite to the anode
325  // 2. compute the distance of it from the last wire plane
326  //
327 
328  //
329  // find the cathode center
330  //
331  geo::Point_t cathodeCenter = GetActiveVolumeCenter();
332  switch (DetectDriftDirection()) {
333  case -1:
334  geo::vect::Xcoord(cathodeCenter) += ActiveHalfWidth();
335  // cathodeCenter.SetX(cathodeCenter.X() + ActiveHalfWidth());
336  break;
337  case +1: cathodeCenter.SetX(cathodeCenter.X() - ActiveHalfWidth()); break;
338  case -2: cathodeCenter.SetY(cathodeCenter.Y() + ActiveHalfHeight()); break;
339  case +2: cathodeCenter.SetY(cathodeCenter.Y() - ActiveHalfHeight()); break;
340  case -3: cathodeCenter.SetZ(cathodeCenter.Z() + ActiveLength() / 2.0); break;
341  case +3: cathodeCenter.SetZ(cathodeCenter.Z() - ActiveLength() / 2.0); break;
342  case 0:
343  default:
344  // in this case, a better algorithm is probably needed
345  throw cet::exception("TPCGeo")
346  << "CathodeCenter(): Can't determine the cathode plane (code=" << DetectDriftDirection()
347  << ")\n";
348  } // switch
349  return cathodeCenter;
350 
351  } // TPCGeo::GetCathodeCenterImpl()
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:88
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:84
Point_t GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Definition: TPCGeo.h:250
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:92
auto Xcoord(Vector &v)
Returns an object to manage the coordinate X of the vector v.
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
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:149
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
Point_t geo::TPCGeo::GetCenter ( ) const
inline

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

Definition at line 247 of file TPCGeo.h.

References toWorldCoords().

Referenced by DetectDriftDirection(), evd_tool::ICARUSDrawer::DetOutline3D(), cluster::ClusterCrawlerAlg::FindHammerClusters(), pma::PMAlgStitching::GetTPCXOffsets(), PrintTPCInfo(), ResetDriftDirection(), SortPlanes(), trkf::CCTrackMaker::TagCosmics(), apa::DisambigAlg::TrivialDisambig(), apa::DisambigAlg::UseEndPts(), evd::RecoBaseDrawer::Vertex2D(), and cluster::ClusterCrawlerAlg::VtxMatch().

247 { return toWorldCoords(LocalPoint_t{}); }
geo::Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: TPCGeo.h:64
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:482
const PlaneGeo& geo::TPCGeo::GetElement ( PlaneID const &  planeid) const
inline

Returns the plane in planeid from this TPC.

Parameters
planeidfull plane ID
Returns
a constant reference to the plane in planeid
Exceptions
cet::exception(category "PlaneOutOfRange") if no such plane

The cryostat and TPC numbers in planeid are ignored, as it is ignored whether planeid is invalid.

Definition at line 182 of file TPCGeo.h.

References Plane().

182 { return Plane(planeid); }
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:252
PlaneGeo const* geo::TPCGeo::GetElementPtr ( PlaneID const &  planeid) const
inline

Returns the plane in planeid from this TPC.

Parameters
planeidfull plane ID
Returns
a constant pointer to the plane, or nullptr if it does not exist

The cryostat and TPC numbers in planeid are ignored, as it is ignored whether planeid is invalid.

Definition at line 205 of file TPCGeo.h.

References PlanePtr(), and SmallestPlane().

205 { return PlanePtr(planeid); }
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
Definition: TPCGeo.h:190
geo::Point_t geo::TPCGeo::GetFrontFaceCenter ( ) const
inline

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

Definition at line 257 of file TPCGeo.h.

References GetFrontFaceCenterImpl().

Referenced by geo::GeometryCore::GetTPCFrontFaceCenter(), and PrintTPCInfo().

257 { return GetFrontFaceCenterImpl(); }
geo::Point_t GetFrontFaceCenterImpl() const
Definition: TPCGeo.cxx:354
geo::Point_t geo::TPCGeo::GetFrontFaceCenterImpl ( ) const
private

Definition at line 354 of file TPCGeo.cxx.

References ActiveBoundingBox().

Referenced by GetFrontFaceCenter().

355  {
356  auto const& activeBox = ActiveBoundingBox();
357  return {activeBox.CenterX(), activeBox.CenterY(), activeBox.MinZ()};
358  } // TPCGeo::GetFrontFaceCenterImpl()
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:263
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.

Author
Christoph Rudolf von Rohr (crohr.nosp@m.@fna.nosp@m.l.gov)
Date
July 27th, 2015
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 125 of file BoxBoundedGeo.cxx.

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

127  {
128  std::vector<TVector3> intersections;
129  for (auto const& point :
130  GetIntersections(geo::Point_t(TrajectoryStart), geo::Vector_t(TrajectoryDirect)))
131  intersections.emplace_back(point.X(), point.Y(), point.Z());
132  return intersections;
133  } // GetIntersections(TVector3)
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< geo::Point_t > geo::BoxBoundedGeo::GetIntersections ( geo::Point_t const &  TrajectoryStart,
geo::Vector_t const &  TrajectoryDirect 
) const
inherited

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

Author
Christoph Rudolf von Rohr (crohr.nosp@m.@fna.nosp@m.l.gov)
Date
July 27th, 2015
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 36 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().

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

Height is associated with y coordinate [cm].

Definition at line 100 of file TPCGeo.h.

References fHalfHeight.

Referenced by evd_tool::ICARUSDrawer::DetOutline3D(), cluster::ClusterCrawlerAlg::FindHammerClusters(), pma::PMAlgStitching::GetTPCXOffsets(), Height(), InitTPCBoundaries(), trkf::CCTrackMaker::TagCosmics(), and cluster::ClusterCrawlerAlg::VtxMatch().

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

Length is associated with z coordinate [cm].

Definition at line 106 of file TPCGeo.h.

References fLength.

Referenced by InitTPCBoundaries().

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

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

Definition at line 102 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::SizeX().

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

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

Definition at line 117 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::SizeY().

117 { 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 132 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::SizeZ().

132 { return SizeZ() / 2.0; }
double SizeZ() const
Returns the full size in the Z dimension.
double geo::TPCGeo::HalfWidth ( ) const
inline
bool geo::TPCGeo::HasElement ( unsigned int  iplane) const
inline

Returns whether a plane with index iplane is present in this TPC.

Parameters
iplaneindex of plane in this TPC
Returns
whether the plane with index iplane is present in this TPC

Definition at line 148 of file TPCGeo.h.

References HasPlane().

148 { return HasPlane(iplane); }
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:147
bool geo::TPCGeo::HasElement ( geo::PlaneID const &  planeid) const
inline

Returns whether the plane in planeid is present in this TPC.

Parameters
planeidfull plane ID
Returns
whether the plane in planeid is present in this TPC

The cryostat and TPC numbers in planeid are ignored, as it is ignored whether planeid is invalid.

Definition at line 161 of file TPCGeo.h.

References HasPlane(), and Plane().

161 { return HasPlane(planeid); }
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:147
bool geo::TPCGeo::HasPlane ( unsigned int  iplane) const
inline

Returns whether a plane with index iplane is present in this TPC.

Parameters
iplaneindex of plane in this TPC
Returns
whether the plane with index iplane is present in this TPC

Definition at line 147 of file TPCGeo.h.

References Nplanes().

Referenced by pma::ProjectionMatchingAlg::buildShowerSeg(), pma::PMAlgStitching::GetTPCXOffsets(), pma::ProjectionMatchingAlg::guideEndpoints(), HasElement(), geo::GeometryCore::HasPlane(), pma::PMAlgTracker::matchCluster(), pma::Node3D::Node3D(), PlanePtr(), and pma::ProjectionMatchingAlg::TestTrk_().

147 { return iplane < Nplanes(); }
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
bool geo::TPCGeo::HasPlane ( geo::PlaneID const &  planeid) const
inline

Returns whether the plane in planeid is present in this TPC.

Parameters
planeidfull plane ID
Returns
whether the plane in planeid is present in this TPC

The cryostat and TPC numbers in planeid are ignored, as it is ignored whether planeid is invalid.

Definition at line 160 of file TPCGeo.h.

References HasPlane(), and geo::PlaneID::Plane.

Referenced by HasPlane().

160 { return HasPlane(planeid.Plane); }
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:147
double geo::TPCGeo::Height ( ) const
inline

Height is associated with y coordinate [cm].

Definition at line 102 of file TPCGeo.h.

References HalfHeight().

Referenced by PrintTPCInfo().

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

Returns the direction Height() is measured on.

Definition at line 115 of file TPCGeo.h.

References fHeightDir.

Referenced by PrintTPCInfo().

115 { return fHeightDir; }
geo::Vector_t fHeightDir
Direction height refers to.
Definition: TPCGeo.h:616
geo::TPCID const& geo::TPCGeo::ID ( ) const
inline

Returns the identifier of this TPC.

Definition at line 270 of file TPCGeo.h.

References fID.

Referenced by checkTPCcoords(), DetectDriftDirection(), evd_tool::ICARUSDrawer::DetOutline3D(), geo::CryostatGeo::PositionToTPCID(), geo::GeometryCore::PositionToTPCID(), PrintTPCInfo(), and trkf::CosmicTrackerAlg::TrackTrajectory().

270 { return fID; }
geo::TPCID fID
ID of this TPC.
Definition: TPCGeo.h:622
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 243 of file BoxBoundedGeo.h.

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

244  {
245  return CoordinateContained(x, MinX() + neg_margin, MaxX() - pos_margin);
246  }
Float_t x
Definition: compare.C:6
double MinX() const
Returns the world x coordinate of the start of the box.
Definition: BoxBoundedGeo.h:90
double MaxX() const
Returns the world x coordinate of the end of the box.
Definition: BoxBoundedGeo.h:93
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 253 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialX().

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

253 { 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 273 of file BoxBoundedGeo.h.

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

274  {
275  return CoordinateContained(y, MinY() + neg_margin, MaxY() - pos_margin);
276  }
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 283 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialY().

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

283 { 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 303 of file BoxBoundedGeo.h.

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

304  {
305  return CoordinateContained(z, MinZ() + neg_margin, MaxZ() - pos_margin);
306  }
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 313 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialZ().

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

313 { 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 435 of file TPCGeo.cxx.

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

Referenced by TPCGeo().

436  {
437  // note that this assumes no rotations of the TPC
438  // (except for rotations of a flat angle around one of the three main axes);
439  // to avoid this, we should transform the six vertices
440  // rather than just the centre
441 
442  // we rely on the asumption that the center of TPC is at the local origin
445 
446  // the center of the active volume may be elsewhere than the local origin:
447  auto const& activeCenter = GetActiveVolumeCenter();
448  fActiveBox.SetBoundaries(activeCenter.X() - ActiveHalfWidth(),
449  activeCenter.X() + ActiveHalfWidth(),
450  activeCenter.Y() - ActiveHalfHeight(),
451  activeCenter.Y() + ActiveHalfHeight(),
452  activeCenter.Z() - ActiveHalfLength(),
453  activeCenter.Z() + ActiveHalfLength());
454 
455  } // CryostatGeo::InitTPCBoundaries()
geo::BoxBoundedGeo fActiveBox
Box of the active volume.
Definition: TPCGeo.h:620
geo::Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: TPCGeo.h:64
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:88
double HalfLength() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:106
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:482
double ActiveHalfLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:94
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:84
Point_t GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Definition: TPCGeo.h:250
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:100
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.
double HalfWidth() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:96
auto geo::TPCGeo::IterateElements ( ) const

Returns an object for iterating through all geo::PlaneGeo.

Returns
an (undisclosed) object for iterating through all geo::PlaneGeo

For example, this snippet computes MaxWires() of TPC (a TPCGeo):

unsigned int maxWires = 0U;
for (geo::PlaneGeo const& plane: TPC.IteratePlanes())
maxWires = std::max(maxWires, plane.Nwires());

The resulting sequence exposes the planes within the TPC in their ID order, from plane 0 to Nplanes() - 1.

Definition at line 295 of file TPCGeo.cxx.

References fPlanes.

Referenced by IteratePlanes(), and LastPlane().

296  {
297  return fPlanes;
298  }
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
ElementIteratorBox geo::TPCGeo::IteratePlanes ( ) const
inline

Returns an object for iterating through all geo::PlaneGeo.

Returns
an (undisclosed) object for iterating through all geo::PlaneGeo

For example, this snippet computes MaxWires() of TPC (a TPCGeo):

unsigned int maxWires = 0U;
for (geo::PlaneGeo const& plane: TPC.IteratePlanes())
maxWires = std::max(maxWires, plane.Nwires());

The resulting sequence exposes the planes within the TPC in their ID order, from plane 0 to Nplanes() - 1.

Definition at line 235 of file TPCGeo.h.

References IterateElements(), and Views().

235 { return IterateElements(); }
ElementIteratorBox IterateElements() const
Returns an object for iterating through all geo::PlaneGeo.
Definition: TPCGeo.cxx:295
geo::PlaneGeo const& geo::TPCGeo::LastPlane ( ) const
inline

Returns the last wire plane (the farther from TPC center).

Definition at line 215 of file TPCGeo.h.

References fPlanes, IterateElements(), MaxWires(), and Nplanes().

Referenced by geo::DriftPartitions::computeCoverage().

215 { return fPlanes[Nplanes() - 1]; }
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
double geo::TPCGeo::Length ( ) const
inline
decltype(auto) geo::TPCGeo::LengthDir ( ) const
inline

Returns the direction Length() is measured on.

Definition at line 118 of file TPCGeo.h.

References fLengthDir.

Referenced by PrintTPCInfo().

118 { return fLengthDir; }
geo::Vector_t fLengthDir
Direction length refers to.
Definition: TPCGeo.h:617
void geo::TPCGeo::MakePlane ( GeoNodePath_t path,
size_t  depth 
)
private

Referenced by CoordinateContained().

geo::Point_t geo::BoxBoundedGeo::Max ( ) const
inlineinherited

Returns the corner point with the largest coordinates.

Definition at line 138 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::c_max.

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

138 { return c_max; }
Coords_t c_max
maximum coordinates (x, y, z)
unsigned int geo::TPCGeo::MaxWires ( ) const

Returns the largest number of wires among the planes in this TPC.

Definition at line 284 of file TPCGeo.cxx.

References fPlanes.

Referenced by geo::GeometryCore::GetEndWireID(), LastPlane(), geo::CryostatGeo::MaxWires(), and PrintTPCInfo().

285  {
286  unsigned int maxWires = 0;
287  for (geo::PlaneGeo const& plane : fPlanes) {
288  unsigned int maxWiresInPlane = plane.Nwires();
289  if (maxWiresInPlane > maxWires) maxWires = maxWiresInPlane;
290  } // for
291  return maxWires;
292  } // TPCGeo::MaxWires()
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
geo::Point_t geo::BoxBoundedGeo::Min ( ) const
inlineinherited

Returns the corner point with the smallest coordinates.

Definition at line 135 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::c_min.

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

135 { return c_min; }
Coords_t c_min
minimum coordinates (x, y, z)
unsigned int geo::TPCGeo::NElements ( ) const
inline

Number of planes in this tpc.

Definition at line 138 of file TPCGeo.h.

References fPlanes.

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

138 { return fPlanes.size(); }
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
bool geo::BoxBoundedGeo::Overlaps ( geo::BoxBoundedGeo const &  other) const
inlineinherited

Returns if this and other box overlap.

Definition at line 340 of file BoxBoundedGeo.h.

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

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

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

Definition at line 322 of file BoxBoundedGeo.h.

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

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

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

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

Definition at line 328 of file BoxBoundedGeo.h.

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

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

329  {
330  return std::min(MaxY(), other.MaxY()) > std::max(MinY(), other.MinY());
331  }
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 ( geo::BoxBoundedGeo const &  other) const
inlineinherited

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

Definition at line 334 of file BoxBoundedGeo.h.

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

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

335  {
336  return std::min(MaxZ(), other.MaxZ()) > std::max(MinZ(), other.MinZ());
337  }
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.
const PlaneGeo & geo::TPCGeo::Plane ( geo::View_t  view) const

Return the plane in the tpc with View_t view.

Definition at line 252 of file TPCGeo.cxx.

References fPlanes, fViewToPlaneNumber, and geo::PlaneID::InvalidID.

Referenced by detinfo::DetectorPropertiesStandard::DataFor(), DetectDriftDirection(), larg4::LArVoxelReadout::DriftIonizationElectrons(), lar_pandora::detector_functions::GetDetectorType(), GetElement(), pma::PMAlgStitching::GetTPCXOffsets(), HasElement(), geo::ChannelMapStandardAlg::Initialize(), geo::GeometryCore::Plane(), geo::GeometryCore::Print(), detsim::DriftElectronstoPlane::produce(), detsim::SimDriftElectrons::produce(), ResetDriftDirection(), geo::GeometryCore::ThirdPlane_dTdW(), geo::GeometryCore::ThirdPlaneSlope(), DUNE::NeutrinoTrackingEff::truthLength(), pma::Node3D::UpdateProj2D(), pma::ProjectionMatchingAlg::validate(), pma::ProjectionMatchingAlg::validate_on_adc_test(), geo::GeometryCore::WireAngleToVertical(), and WirePitch().

253  {
254  geo::PlaneID::PlaneID_t const p = fViewToPlaneNumber[size_t(view)];
255  if (p == geo::PlaneID::InvalidID) {
256  throw cet::exception("TPCGeo")
257  << "TPCGeo[" << ((void*)this) << "]::Plane(): no plane for view #" << (size_t)view << "\n";
258  }
259  return fPlanes[p];
260  } // TPCGeo::Plane(geo::View_t)
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:464
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
Definition: TPCGeo.h:625
static constexpr PlaneID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:479
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const PlaneGeo & geo::TPCGeo::Plane ( unsigned int  iplane) const

Return the iplane'th plane in the TPC.

Exceptions
cet::exception(category "PlaneOutOfRange") if no such plane

Definition at line 240 of file TPCGeo.cxx.

References PlanePtr().

241  {
242  geo::PlaneGeo const* pPlane = PlanePtr(iplane);
243  if (!pPlane) {
244  throw cet::exception("PlaneOutOfRange")
245  << "Request for non-existant plane " << iplane << "\n";
246  }
247 
248  return *pPlane;
249  }
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
Definition: TPCGeo.h:190
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const PlaneGeo& geo::TPCGeo::Plane ( PlaneID const &  planeid) const
inline

Returns the plane in planeid from this TPC.

Parameters
planeidfull plane ID
Returns
a constant reference to the plane in planeid
Exceptions
cet::exception(category "PlaneOutOfRange") if no such plane

The cryostat and TPC numbers in planeid are ignored, as it is ignored whether planeid is invalid.

Definition at line 181 of file TPCGeo.h.

References Plane(), and geo::PlaneID::Plane.

Referenced by Plane().

181 { return Plane(planeid.Plane); }
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:252
double geo::TPCGeo::Plane0Pitch ( unsigned int  p) const

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

Definition at line 314 of file TPCGeo.cxx.

References fPlane0Pitch.

Referenced by ActiveBoundingBox(), larg4::LArVoxelReadout::DriftIonizationElectrons(), and groupByDriftCoordinate().

315  {
316  return fPlane0Pitch[p];
317  }
std::vector< double > fPlane0Pitch
Pitch between planes.
Definition: TPCGeo.h:604
double geo::TPCGeo::PlanePitch ( unsigned int  p1 = 0,
unsigned int  p2 = 1 
) const

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

Definition at line 361 of file TPCGeo.cxx.

References util::abs(), and fPlane0Pitch.

Referenced by ActiveBoundingBox(), detinfo::DetectorPropertiesStandard::DataFor(), larg4::LArVoxelReadout::DriftIonizationElectrons(), geo::GeometryCore::PlanePitch(), detsim::DriftElectronstoPlane::produce(), and detsim::SimDriftElectrons::produce().

362  {
363  return std::abs(fPlane0Pitch[p2] - fPlane0Pitch[p1]);
364  }
std::vector< double > fPlane0Pitch
Pitch between planes.
Definition: TPCGeo.h:604
constexpr auto abs(T v)
Returns the absolute value of the argument.
PlaneGeo const* geo::TPCGeo::PlanePtr ( unsigned int  iplane) const
inline

Returns the plane number iplane from this TPC.

Parameters
iplanethe number of local plane
Returns
a constant pointer to the plane, or nullptr if it does not exist

Definition at line 190 of file TPCGeo.h.

References fPlanes, and HasPlane().

Referenced by GetElementPtr(), Plane(), and geo::GeometryCore::PlanePtr().

191  {
192  return HasPlane(iplane) ? &(fPlanes[iplane]) : nullptr;
193  }
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:147
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
PlaneGeo const* geo::TPCGeo::PlanePtr ( PlaneID const &  planeid) const
inline

Returns the plane in planeid from this TPC.

Parameters
planeidfull plane ID
Returns
a constant pointer to the plane, or nullptr if it does not exist

The cryostat and TPC numbers in planeid are ignored, as it is ignored whether planeid is invalid.

Definition at line 204 of file TPCGeo.h.

References geo::PlaneID::Plane, and PlanePtr().

Referenced by PlanePtr().

204 { return PlanePtr(planeid.Plane); }
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
Definition: TPCGeo.h:190
Projection_t geo::TPCGeo::PointProjection ( geo::Point_t const &  point) const
inline

Returns the projection of the specified point on the plane.

Parameters
pointthe 3D point to be projected, in world coordinates
Returns
a 2D vector representing the projection of point on the plane

The returned vector is a 2D vector expressing the projection of the point (from world coordinates) on the reference plane. The vector is expressed as $ ( w, d ) $, components following the width direction (RefWidthDir()) and the depth direction (RefDepthDir()) respectively. The origin point is returned by ProjectionReferencePoint(). All coordinates are in centimeters.

Definition at line 408 of file TPCGeo.h.

References Projection().

408 { return Projection(point); }
Projection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: TPCGeo.h:404
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 656 of file TPCGeo.h.

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

Referenced by geo::part::PartitionDataDescriber< geo::TPCGeo >::PartitionDataDescriber(), geo::GeometryCore::Print(), toLocalCoords(), and TPCInfo().

660 {
661 
662  //----------------------------------------------------------------------------
663  out << "TPC " << std::string(ID());
664 
665  if (verbosity-- <= 0) return; // 0
666 
667  //----------------------------------------------------------------------------
668  out << " (" << Width() << " x " << Height() << " x " << Length() << ") cm^3 at " << GetCenter();
669 
670  if (verbosity-- <= 0) return; // 1
671 
672  //----------------------------------------------------------------------------
673 
674  out << "\n"
675  << indent << "drift direction " << DriftDir() << " from cathode around " << GetCathodeCenter()
676  << " through " << DriftDistance() << " cm toward " << Nplanes() << " wire planes";
677 
678  if (verbosity-- <= 0) return; // 2
679 
680  //----------------------------------------------------------------------------
681  out << "\n" << indent << "maximum wires on any plane: " << MaxWires();
682 
683  if (verbosity-- <= 0) return; // 3
684 
685  //----------------------------------------------------------------------------
686  out << "\n"
687  << indent << "active volume (" << ActiveWidth() << " x " << ActiveHeight() << " x "
688  << ActiveLength() << ") cm^3, front face at " << GetFrontFaceCenter() << " cm;"
689  << "\n"
690  << indent << "main directions:"
691  << " width " << WidthDir() << " height " << HeightDir() << " length " << LengthDir();
692 
693  if (verbosity-- <= 0) return; // 4
694 
695  //----------------------------------------------------------------------------
696  // print also the containing box
697  geo::BoxBoundedGeo const& box = BoundingBox();
698  out << "\n" << indent << "bounding box: " << box.Min() << " -- " << box.Max();
699 
700  //----------------------------------------------------------------------------
701  // print also the active box
702  geo::BoxBoundedGeo const& activeBox = ActiveBoundingBox();
703  out << "\n" << indent << "active volume box: " << activeBox.Min() << " -- " << activeBox.Max();
704 
705  //----------------------------------------------------------------------------
706 } // geo::TPCGeo::PrintTPCInfo()
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:270
decltype(auto) LengthDir() const
Returns the direction Length() is measured on.
Definition: TPCGeo.h:118
decltype(auto) WidthDir() const
Returns the direction Width() is measured on.
Definition: TPCGeo.h:112
Point_t GetCathodeCenter() const
Definition: TPCGeo.h:254
decltype(auto) HeightDir() const
Returns the direction Height() is measured on.
Definition: TPCGeo.h:115
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:263
double Width() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:98
double Height() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:102
double Length() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:104
Point_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:247
std::string indent(std::size_t const i)
double ActiveHeight() const
Height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:90
geo::Point_t Min() const
Returns the corner point with the smallest coordinates.
unsigned int MaxWires() const
Returns the largest number of wires among the planes in this TPC.
Definition: TPCGeo.cxx:284
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:92
double DriftDistance() const
Definition: TPCGeo.h:128
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
double ActiveWidth() const
Width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:86
geo::BoxBoundedGeo const & BoundingBox() const
Returns the bounding box of this TPC.
Definition: TPCGeo.h:260
Vector_t DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
Definition: TPCGeo.h:124
geo::Point_t Max() const
Returns the corner point with the largest coordinates.
geo::Point_t GetFrontFaceCenter() const
Returns the center of the active TPC volume side facing negative z.
Definition: TPCGeo.h:257
Projection_t geo::TPCGeo::Projection ( geo::Point_t const &  point) const
inline

Returns the projection of the specified point on the plane.

Parameters
pointthe 3D point to be projected, in world coordinates
Returns
a 2D vector representing the projection of point on the plane

The returned vector is a 2D vector expressing the projection of the point (from world coordinates) on the reference plane. The vector is expressed as $ ( w, d ) $, components following the width direction (RefWidthDir()) and the depth direction (RefDepthDir()) respectively. The origin point is returned by ProjectionReferencePoint(). All coordinates are in centimeters.

Definition at line 404 of file TPCGeo.h.

References geo::PlaneGeo::PointWidthDepthProjection(), and ReferencePlane().

Referenced by PointProjection(), and VectorProjection().

405  {
407  }
WidthDepthProjection_t PointWidthDepthProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:1000
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
Projection_t geo::TPCGeo::Projection ( geo::Vector_t const &  v) const
inline

Returns the projection of the specified vector on the plane.

Parameters
vthe 3D vector to be projected, in world units [cm]
Returns
a 2D vector representing the projection of v on the plane

The returned vector is a 2D vector expressing the projection of the vector (from world units) on the reference plane. The vector is expressed as $ ( w, d ) $, components following the width direction (RefWidthDir()) and the depth direction (RefDepthDir()) respectively. All coordinates are in centimeters.

Definition at line 424 of file TPCGeo.h.

References ReferencePlane(), and geo::PlaneGeo::VectorWidthDepthProjection().

425  {
427  }
WidthDepthProjection_t VectorWidthDepthProjection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:1018
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
Point_t geo::TPCGeo::ProjectionReferencePoint ( ) const
inline

Returns the reference point used by PointProjection().

Template Parameters
Pointtype of point to be returned

The returned point is such that its decomposition results in a null projection and a 0 distance from the plane.

Definition at line 387 of file TPCGeo.h.

References geo::PlaneGeo::GetCenter(), and ReferencePlane().

387 { return ReferencePlane().GetCenter(); }
Point_t const & GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:435
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
Vector_t geo::TPCGeo::RefDepthDir ( ) const
inline

Return the direction of reference plane depth.

Template Parameters
Vectortype of vector to return (current default: TVector3)
See also
RefWidthDir(), DriftDir()

The precise definition of the vector is arbitrary, but it is defined to lie on the wire plane and so that RefWidthDir(), RefDepthDir() and a vector opposite to DriftDir() make a orthonormal base. That base (width, depth, normal) is guaranteed to be positive defined.

Definition at line 320 of file TPCGeo.h.

References geo::PlaneGeo::DepthDir(), and ReferencePlane().

Referenced by geo::buildDriftVolumes().

320 { return ReferencePlane().DepthDir(); }
Vector_t const & DepthDir() const
Return the direction of plane depth.
Definition: PlaneGeo.h:212
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
geo::PlaneGeo const& geo::TPCGeo::ReferencePlane ( ) const
inline

Returns the plane used for reference by projection methods.

Definition at line 290 of file TPCGeo.h.

References FirstPlane().

Referenced by ComposePoint(), DecomposePoint(), DistanceFromReferencePlane(), DriftPoint(), Projection(), ProjectionReferencePoint(), RefDepthDir(), ReferencePlaneID(), and RefWidthDir().

290 { return FirstPlane(); }
geo::PlaneGeo const & FirstPlane() const
Returns the first wire plane (the closest to TPC center).
Definition: TPCGeo.h:212
geo::PlaneID const& geo::TPCGeo::ReferencePlaneID ( ) const
inline

Returns the ID of the plane used for reference by projection methods.

Definition at line 293 of file TPCGeo.h.

References geo::PlaneGeo::ID(), and ReferencePlane().

293 { return ReferencePlane().ID(); }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:184
Vector_t geo::TPCGeo::RefWidthDir ( ) const
inline

Return the direction of reference plane width.

Template Parameters
Vectortype of vector to return (current default: TVector3)
See also
RefDepthDir(), DriftDir()

The precise definition of the vector is arbitrary, but it is defined to lie on the wire plane and so that RefWidthDir(), RefDepthDir() and a vector opposite to DriftDir() make a orthonormal base. That base (width, depth, normal) is guaranteed to be positive defined.

Definition at line 306 of file TPCGeo.h.

References ReferencePlane(), and geo::PlaneGeo::WidthDir().

Referenced by geo::buildDriftVolumes().

306 { return ReferencePlane().WidthDir(); }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:290
Vector_t const & WidthDir() const
Return the direction of plane width.
Definition: PlaneGeo.h:200
void geo::TPCGeo::ResetDriftDirection ( )
private

Recomputes the drift direction; needs planes to have been initialised.

Definition at line 374 of file TPCGeo.cxx.

References DetectDriftDirection(), e, fDriftDir, fDriftDirection, geo::PlaneGeo::GetBoxCenter(), GetCenter(), geo::kNeg, geo::kNegX, geo::kPos, geo::kPosX, geo::kUnknownDrift, Plane(), geo::vect::round01(), geo::Xaxis(), geo::Yaxis(), and geo::Zaxis().

Referenced by TPCGeo().

375  {
376 
377  auto const driftDirCode = DetectDriftDirection();
378  switch (driftDirCode) {
379  case +1:
380  fDriftDirection = geo::kPosX; // this is the same as kPos!
381  fDriftDir = geo::Xaxis();
382  break;
383  case -1:
384  fDriftDirection = geo::kNegX; // this is the same as kNeg!
385  fDriftDir = -geo::Xaxis();
386  break;
387  case +2:
388  fDriftDir = geo::Yaxis();
390  break;
391  case -2:
392  fDriftDir = -geo::Yaxis();
394  break;
395  case +3:
396  fDriftDir = geo::Zaxis();
398  break;
399  case -3:
400  fDriftDir = -geo::Zaxis();
402  break;
403  default:
404  // TPC ID is likely not yet set
406 
407  // we estimate the drift direction roughly from the geometry
409 
410  mf::LogError("TPCGeo") << "Unable to detect drift direction (result: " << driftDirCode
411  << ", drift: ( " << fDriftDir.X() << " ; " << fDriftDir.Y() << " ; "
412  << fDriftDir.Z() << " )";
413  break;
414  } // switch
415 
417 
418  } // TPCGeo::ResetDriftDirection()
void round01(Vector &v, Scalar tol)
Returns a vector with all components rounded if close to 0, -1 or +1.
Drift direction is unknown.
Definition: geo_types.h:163
Drift towards positive values.
Definition: geo_types.h:164
constexpr Vector Yaxis()
Returns a y axis vector of the specified type.
Definition: geo_vectors.h:215
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Drift towards negative X values.
Definition: geo_types.h:167
Point_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:247
Point_t GetBoxCenter() const
Returns the centre of the box representing the plane.
Definition: PlaneGeo.h:449
constexpr Vector Xaxis()
Returns a x axis vector of the specified type.
Definition: geo_vectors.h:208
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
Definition: TPCGeo.h:603
constexpr Vector Zaxis()
Returns a z axis vector of the specified type.
Definition: geo_vectors.h:222
Drift towards positive X values.
Definition: geo_types.h:166
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:149
Drift towards negative values.
Definition: geo_types.h:165
geo::Vector_t fDriftDir
Direction electrons drift along.
Definition: TPCGeo.h:618
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:252
Float_t e
Definition: plot.C:35
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 479 of file BoxBoundedGeo.h.

References value.

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

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

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

Definition at line 493 of file BoxBoundedGeo.h.

494  {
495  if (value.X() > var.X()) var.SetX(value.X());
496  if (value.Y() > var.Y()) var.SetY(value.Y());
497  if (value.Z() > var.Z()) var.SetZ(value.Z());
498  }
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 473 of file BoxBoundedGeo.h.

References value.

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

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

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

Definition at line 485 of file BoxBoundedGeo.h.

486  {
487  if (value.X() < var.X()) var.SetX(value.X());
488  if (value.Y() < var.Y()) var.SetY(value.Y());
489  if (value.Z() < var.Z()) var.SetZ(value.Z());
490  }
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 393 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().

399  {
400  c_min.SetXYZ(x_min, y_min, z_min);
401  c_max.SetXYZ(x_max, y_max, z_max);
402  SortCoordinates();
403  }
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 410 of file BoxBoundedGeo.h.

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

411  {
412  c_min = lower;
413  c_max = upper;
414  SortCoordinates();
415  }
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 99 of file BoxBoundedGeo.h.

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

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

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

Returns the full size in the Y dimension.

Definition at line 114 of file BoxBoundedGeo.h.

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

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

114 { 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 129 of file BoxBoundedGeo.h.

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

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

129 { 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.
geo::PlaneGeo const & geo::TPCGeo::SmallestPlane ( ) const

Returns the wire plane with the smallest surface.

Definition at line 263 of file TPCGeo.cxx.

References fPlanes.

Referenced by GetElementPtr().

264  {
265 
266  //
267  // Returns the plane with the smallest width x depth. No nonsense here.
268  //
269 
270  auto iPlane = fPlanes.begin(), pend = fPlanes.end();
271  auto smallestPlane = iPlane;
272  double smallestSurface = smallestPlane->Width() * smallestPlane->Depth();
273  while (++iPlane != pend) {
274  double const surface = iPlane->Width() * iPlane->Depth();
275  if (surface > smallestSurface) continue;
276  smallestSurface = surface;
277  smallestPlane = iPlane;
278  } // while
279  return *smallestPlane;
280 
281  } // TPCGeo::SmallestPlane()
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
void geo::TPCGeo::SortPlanes ( std::vector< geo::PlaneGeo > &  planes) const
private

Sorts (in place) the specified PlaneGeo objects by drift distance.

Definition at line 497 of file TPCGeo.cxx.

References geo::vect::dot(), GetCenter(), and geo::vect::normalize().

Referenced by SortSubVolumes().

498  {
499  //
500  // Sort planes by increasing drift distance.
501  //
502  // This function should work in bootstrap mode, relying on least things as
503  // possible. Therefore we compute here a proxy of the drift axis.
504  //
505 
506  //
507  // determine the drift axis (or close to): from TPC center to plane center
508  //
509 
510  // Instead of using the plane center, which might be not available yet,
511  // we use the plane box center, which only needs the geometry description
512  // to be available.
513  // We use the first plane -- it does not make any difference.
514  auto const TPCcenter = GetCenter();
515  auto const driftAxis = geo::vect::normalize(planes[0].GetBoxCenter() - TPCcenter);
516 
517  auto by_distance = [&TPCcenter, &driftAxis](auto const& a, auto const& b) {
518  return geo::vect::dot(a.GetBoxCenter() - TPCcenter, driftAxis) <
519  geo::vect::dot(b.GetBoxCenter() - TPCcenter, driftAxis);
520  };
521  cet::sort_all(planes, by_distance);
522 
523  } // TPCGeo::SortPlanes()
Point_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:247
constexpr auto dot(Vector const &a, OtherVector const &b)
Return cross product of two vectors.
Vector normalize(Vector const &v)
Returns a vector parallel to v and with norm 1.
void geo::TPCGeo::SortSubVolumes ( geo::GeoObjectSorter const &  sorter)

Apply sorting to the PlaneGeo objects.

Definition at line 191 of file TPCGeo.cxx.

References fPlanes, fViewToPlaneNumber, geo::PlaneID::InvalidID, geo::kUnknown, Nplanes(), and SortPlanes().

Referenced by geo::CryostatGeo::SortSubVolumes(), and toLocalCoords().

192  {
194 
195  // the PlaneID_t cast convert InvalidID into a rvalue (non-reference);
196  // leaving it a reference would cause C++ to treat it as such,
197  // that can't be because InvalidID is a static member constant without an address
198  // (it is not defined in any translation unit, just declared in header)
199  fViewToPlaneNumber.resize(1U + (size_t)geo::kUnknown,
201  for (size_t p = 0; p < this->Nplanes(); ++p)
202  fViewToPlaneNumber[(size_t)fPlanes[p].View()] = p;
203 
204  for (size_t p = 0; p < fPlanes.size(); ++p)
205  fPlanes[p].SortWires(sorter);
206  }
Unknown view.
Definition: geo_types.h:142
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:464
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
Definition: TPCGeo.h:625
void SortPlanes(std::vector< geo::PlaneGeo > &) const
Sorts (in place) the specified PlaneGeo objects by drift distance.
Definition: TPCGeo.cxx:497
static constexpr PlaneID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:479
LocalPoint_t geo::TPCGeo::toLocalCoords ( geo::Point_t const &  world) const
inline

Transform point from world frame to local TPC frame.

Definition at line 494 of file TPCGeo.h.

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

495  {
496  return fTrans.toLocalCoords(world);
497  }
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:598
LocalVector_t geo::TPCGeo::toLocalCoords ( geo::Vector_t const &  world) const
inline

Transform direction vector from world to local.

Definition at line 500 of file TPCGeo.h.

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

501  {
502  return fTrans.toLocalCoords(world);
503  }
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:598
const TGeoVolume* geo::TPCGeo::TotalVolume ( ) const
inline

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

Definition at line 109 of file TPCGeo.h.

References fTotalVolume.

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

Transform point from local TPC frame to world frame.

Definition at line 482 of file TPCGeo.h.

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

Referenced by GetCenter(), InitTPCBoundaries(), and geo::sortTPCStandard().

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

Transform direction vector from local to world.

Definition at line 488 of file TPCGeo.h.

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

489  {
490  return fTrans.toWorldCoords(local);
491  }
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:598
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 232 of file TPCGeo.cxx.

References PrintTPCInfo().

Referenced by toLocalCoords().

233  {
234  std::ostringstream sstr;
235  PrintTPCInfo(sstr, indent, verbosity);
236  return sstr.str();
237  } // TPCGeo::TPCInfo()
void PrintTPCInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this TPC.
Definition: TPCGeo.h:656
std::string indent(std::size_t const i)
void geo::TPCGeo::UpdateAfterSorting ( geo::TPCID  tpcid)

Performs all updates after cryostat has sorted TPCs.

Definition at line 209 of file TPCGeo.cxx.

References DriftDir(), e, fID, fPlanes, lar::util::makeVector3DComparison(), Nplanes(), UpdatePlaneCache(), and UpdatePlaneViewCache().

Referenced by toLocalCoords().

210  {
211 
212  // reset the ID
213  fID = tpcid;
214 
215  // ask the planes to update; also check
216 
217  for (unsigned int plane = 0; plane < Nplanes(); ++plane) {
218  fPlanes[plane].UpdateAfterSorting(geo::PlaneID(fID, plane), *this);
219 
220  // check that the plane normal is opposite to the TPC drift direction
221  assert(lar::util::makeVector3DComparison(1e-5).equal(-(fPlanes[plane].GetNormalDirection()),
222  DriftDir()));
223 
224  } // for
225 
228 
229  } // TPCGeo::UpdateAfterSorting()
void UpdatePlaneCache()
Updates plane cached information.
Definition: TPCGeo.cxx:476
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
The data type to uniquely identify a Plane.
Definition: geo_types.h:463
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
geo::TPCID fID
ID of this TPC.
Definition: TPCGeo.h:622
auto makeVector3DComparison(RealType threshold)
Creates a Vector3DComparison from a RealComparisons object.
void UpdatePlaneViewCache()
Refills the plane vs. view cache of the TPC.
Definition: TPCGeo.cxx:459
Float_t e
Definition: plot.C:35
Vector_t DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
Definition: TPCGeo.h:124
void geo::TPCGeo::UpdatePlaneCache ( )
private

Updates plane cached information.

Definition at line 476 of file TPCGeo.cxx.

References util::abs(), geo::vect::fillCoords(), fPlane0Pitch, fPlaneLocation, fPlanes, and Nplanes().

Referenced by UpdateAfterSorting().

477  {
478 
479  /*
480  * set the plane pitch for this TPC
481  */
482  fPlaneLocation.resize(fPlanes.size());
483  fPlane0Pitch.resize(Nplanes(), 0.);
484  geo::Point_t refPlaneCenter = fPlanes[0].GetCenter();
485  for (size_t p = 0; p < Nplanes(); ++p) {
486  geo::Point_t const& center = fPlanes[p].GetCenter();
487  fPlane0Pitch[p] =
488  (p == 0) ? 0.0 : fPlane0Pitch[p - 1] + std::abs(center.X() - refPlaneCenter.X());
489  fPlaneLocation[p].resize(3);
491  refPlaneCenter = center;
492  } // for planes
493 
494  } // TPCGeo::UpdatePlaneViewCache()
std::vector< double > fPlane0Pitch
Pitch between planes.
Definition: TPCGeo.h:604
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
constexpr auto abs(T v)
Returns the absolute value of the argument.
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
unsigned int fillCoords(Coords &dest, Vector const &src)
Fills a coordinate array with the coordinates of a vector.
std::vector< std::vector< double > > fPlaneLocation
xyz locations of planes in the TPC.
Definition: TPCGeo.h:605
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 geo::TPCGeo::UpdatePlaneViewCache ( )
private

Refills the plane vs. view cache of the TPC.

Definition at line 459 of file TPCGeo.cxx.

References fPlanes, fViewToPlaneNumber, geo::PlaneID::InvalidID, geo::kUnknown, and Nplanes().

Referenced by UpdateAfterSorting().

460  {
461 
462  // the PlaneID_t cast convert InvalidID into a rvalue (non-reference);
463  // leaving it a reference would cause C++ to treat it as such,
464  // that can't be because InvalidID is a static member constant without an address
465  // (it is not defined in any translation unit, just declared in header)
466  fViewToPlaneNumber.clear();
467  fViewToPlaneNumber.resize(1U + (size_t)geo::kUnknown,
469  for (size_t p = 0; p < Nplanes(); ++p)
470  fViewToPlaneNumber[(size_t)fPlanes[p].View()] = p;
471 
472  } // TPCGeo::UpdatePlaneViewCache()
Unknown view.
Definition: geo_types.h:142
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:464
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
Definition: TPCGeo.h:625
static constexpr PlaneID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:479
Projection_t geo::TPCGeo::VectorProjection ( geo::Vector_t const &  v) const
inline

Returns the projection of the specified vector on the plane.

Parameters
vthe 3D vector to be projected, in world units [cm]
Returns
a 2D vector representing the projection of v on the plane

The returned vector is a 2D vector expressing the projection of the vector (from world units) on the reference plane. The vector is expressed as $ ( w, d ) $, components following the width direction (RefWidthDir()) and the depth direction (RefDepthDir()) respectively. All coordinates are in centimeters.

Definition at line 428 of file TPCGeo.h.

References Projection().

428 { return Projection(v); }
Projection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: TPCGeo.h:404
std::set< geo::View_t > geo::TPCGeo::Views ( ) const

Returns a set of all views covered in this TPC.

Definition at line 301 of file TPCGeo.cxx.

References fPlanes, and geo::PlaneGeo::View().

Referenced by IteratePlanes().

302  {
303  std::set<geo::View_t> views;
304  std::transform(fPlanes.cbegin(),
305  fPlanes.cend(),
306  std::inserter(views, views.begin()),
307  std::mem_fn(&geo::PlaneGeo::View));
308  return views;
309  } // TPCGeo::Views()
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:600
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:166
double geo::TPCGeo::Width ( ) const
inline

Width is associated with x coordinate [cm].

Definition at line 98 of file TPCGeo.h.

References HalfWidth().

Referenced by PrintTPCInfo().

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

Returns the direction Width() is measured on.

Definition at line 112 of file TPCGeo.h.

References fWidthDir.

Referenced by PrintTPCInfo().

112 { return fWidthDir; }
geo::Vector_t fWidthDir
Direction width refers to.
Definition: TPCGeo.h:615
double geo::TPCGeo::WirePitch ( unsigned  plane = 0) const

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

Definition at line 368 of file TPCGeo.cxx.

References Plane(), and geo::PlaneGeo::WirePitch().

Referenced by ActiveBoundingBox(), hit::MagDriftAna::analyze(), and geo::ChannelMapStandardAlg::Initialize().

369  {
370  return this->Plane(plane).WirePitch();
371  }
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:252
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:378

Member Data Documentation

geo::BoxBoundedGeo geo::TPCGeo::fActiveBox
private

Box of the active volume.

Definition at line 620 of file TPCGeo.h.

Referenced by ActiveBoundingBox(), and InitTPCBoundaries().

geo::Point_t geo::TPCGeo::fActiveCenter
private

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

Definition at line 606 of file TPCGeo.h.

Referenced by GetActiveVolumeCenter(), and TPCGeo().

double geo::TPCGeo::fActiveHalfHeight
private

Half height of active volume.

Definition at line 609 of file TPCGeo.h.

Referenced by ActiveHalfHeight(), and TPCGeo().

double geo::TPCGeo::fActiveHalfWidth
private

Half width of active volume.

Definition at line 608 of file TPCGeo.h.

Referenced by ActiveHalfWidth(), and TPCGeo().

double geo::TPCGeo::fActiveLength
private

Length of active volume.

Definition at line 610 of file TPCGeo.h.

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

TGeoVolume* geo::TPCGeo::fActiveVolume
private

Active volume of LAr, called volTPCActive in GDML file.

Definition at line 601 of file TPCGeo.h.

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

geo::Vector_t geo::TPCGeo::fDriftDir
private

Direction electrons drift along.

Definition at line 618 of file TPCGeo.h.

Referenced by DriftDir(), and ResetDriftDirection().

DriftDirection_t geo::TPCGeo::fDriftDirection
private

Direction of the electron drift in the TPC.

Definition at line 603 of file TPCGeo.h.

Referenced by DriftDirection(), and ResetDriftDirection().

double geo::TPCGeo::fHalfHeight
private

Half height of total volume.

Definition at line 612 of file TPCGeo.h.

Referenced by HalfHeight(), and TPCGeo().

double geo::TPCGeo::fHalfWidth
private

Half width of total volume.

Definition at line 611 of file TPCGeo.h.

Referenced by HalfWidth(), and TPCGeo().

geo::Vector_t geo::TPCGeo::fHeightDir
private

Direction height refers to.

Definition at line 616 of file TPCGeo.h.

Referenced by HeightDir(), and TPCGeo().

geo::TPCID geo::TPCGeo::fID
private

ID of this TPC.

Definition at line 622 of file TPCGeo.h.

Referenced by ID(), and UpdateAfterSorting().

double geo::TPCGeo::fLength
private

Length of total volume.

Definition at line 613 of file TPCGeo.h.

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

geo::Vector_t geo::TPCGeo::fLengthDir
private

Direction length refers to.

Definition at line 617 of file TPCGeo.h.

Referenced by LengthDir(), and TPCGeo().

std::vector<double> geo::TPCGeo::fPlane0Pitch
private

Pitch between planes.

Definition at line 604 of file TPCGeo.h.

Referenced by Plane0Pitch(), PlanePitch(), and UpdatePlaneCache().

std::vector<std::vector<double> > geo::TPCGeo::fPlaneLocation
private

xyz locations of planes in the TPC.

Definition at line 605 of file TPCGeo.h.

Referenced by UpdatePlaneCache().

TGeoVolume* geo::TPCGeo::fTotalVolume
private

Total volume of TPC, called volTPC in GDML file.

Definition at line 602 of file TPCGeo.h.

Referenced by TotalVolume(), and TPCGeo().

LocalTransformation_t geo::TPCGeo::fTrans
private

TPC-to-world transformation.

Definition at line 598 of file TPCGeo.h.

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

std::vector<geo::PlaneID::PlaneID_t> geo::TPCGeo::fViewToPlaneNumber
private

Index of the plane for each view (InvalidID if none).

Definition at line 625 of file TPCGeo.h.

Referenced by Plane(), SortSubVolumes(), and UpdatePlaneViewCache().

geo::Vector_t geo::TPCGeo::fWidthDir
private

Direction width refers to.

Definition at line 615 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 566 of file TPCGeo.h.

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


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