LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 GeoNodePath_t = geo::WireGeo::GeoNodePath_t
 
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 (GeoNodePath_t &path, size_t depth)
 
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...
 
template<typename Point = DefaultPoint_t>
Point ProjectionReferencePoint () const
 Returns the reference point used by PointProjection(). More...
 
template<typename Point = DefaultPoint_t>
Point ComposePoint (DecomposedVector_t const &decomp) const
 Returns the 3D vector from composition of projection and distance. More...
 
template<typename Point = DefaultPoint_t>
Point ComposePoint (double distance, Projection_t const &proj) const
 Returns the 3D point from composition of projection and distance. 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...
 
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...
 
template<typename Vector = DefaultVector_t>
decltype(auto) WidthDir () const
 Returns the direction Width() is measured on. More...
 
template<typename Vector = DefaultVector_t>
decltype(auto) HeightDir () const
 Returns the direction Height() is measured on. More...
 
template<typename Vector = DefaultVector_t>
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...
 
template<typename Vector = DefaultVector_t>
Vector 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...
 
TPC geometry properties
template<typename Point = DefaultPoint_t>
Point GetCenter () const
 Returns the center of the TPC volume in world coordinates [cm]. More...
 
template<typename Point = DefaultPoint_t>
Point GetActiveVolumeCenter () const
 Returns the center of the TPC active volume in world coordinates [cm]. More...
 
template<typename Point = DefaultPoint_t>
Point GetCathodeCenter () const
 
template<typename Point = geo::Point_t>
Point 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...
 
const double * PlaneLocation (unsigned int p) const
 Returns the coordinates of the center of the specified plane [cm]. 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...
 
template<typename Vector = DefaultPoint_t>
Vector RefWidthDir () const
 Return the direction of reference plane width. More...
 
template<typename Vector = DefaultPoint_t>
Vector 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...
 
double DistanceFromReferencePlane (TVector3 const &point) const
 Returns the plane used for reference by projection methods. More...
 
void DriftPoint (geo::Point_t &position, double distance) const
 Shifts the position of an electron drifted by a distance. More...
 
void DriftPoint (TVector3 &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...
 
DecomposedVector_t DecomposePoint (TVector3 const &point) const
 Decomposes a 3D point in two components. 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 PointProjection (TVector3 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...
 
Projection_t VectorProjection (TVector3 const &v) const
 Returns the projection of the specified vector on the plane. More...
 
Coordinate transformation
void LocalToWorld (const double *tpc, double *world) const
 Transform point from local TPC frame to world frame. More...
 
TVector3 LocalToWorld (const TVector3 &local) const
 Transform point from local TPC frame to world frame. More...
 
geo::Point_t toWorldCoords (LocalPoint_t const &local) const
 Transform point from local TPC frame to world frame. More...
 
void LocalToWorldVect (const double *tpc, double *world) const
 Transform direction vector from local to world. More...
 
TVector3 LocalToWorldVect (const TVector3 &local) const
 Transform direction vector from local to world. More...
 
geo::Vector_t toWorldCoords (LocalVector_t const &local) const
 Transform direction vector from local to world. More...
 
void WorldToLocal (const double *world, double *tpc) const
 Transform point from world frame to local TPC frame. More...
 
TVector3 WorldToLocal (TVector3 const &world) const
 Transform point from world frame to local TPC frame. More...
 
LocalPoint_t toLocalCoords (geo::Point_t const &world) const
 Transform point from world frame to local TPC frame. More...
 
void WorldToLocalVect (const double *world, double *tpc) const
 Transform direction vector from world to local. More...
 
TVector3 WorldToLocalVect (TVector3 const &world) const
 Transform direction vector from world to local. 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...
 
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 DefaultVector_t = TVector3
 
using DefaultPoint_t = TVector3
 
using LocalTransformation_t = geo::LocalTransformationGeo< TGeoHMatrix, 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 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...
 
std::vector< PlaneGeofPlanes
 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 37 of file TPCGeo.h.

Member Typedef Documentation

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

Type of the coordinate.

Definition at line 38 of file BoxBoundedGeo.h.

Type of the coordinate triplet.

Definition at line 37 of file BoxBoundedGeo.h.

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

Definition at line 76 of file TPCGeo.h.

using geo::TPCGeo::DefaultPoint_t = TVector3
private

Definition at line 40 of file TPCGeo.h.

using geo::TPCGeo::DefaultVector_t = TVector3
private

Definition at line 39 of file TPCGeo.h.

Type of points in the local GDML TPC frame.

Definition at line 65 of file TPCGeo.h.

Definition at line 628 of file TPCGeo.h.

Type of displacement vectors in the local GDML TPC frame.

Definition at line 68 of file TPCGeo.h.

Type of 2D vector projection on a plane.

Definition at line 73 of file TPCGeo.h.

Constructor & Destructor Documentation

geo::TPCGeo::TPCGeo ( GeoNodePath_t path,
size_t  depth 
)

Definition at line 38 of file TPCGeo.cxx.

References fActiveCenter, fActiveHalfHeight, fActiveHalfWidth, fActiveLength, fActiveVolume, fHalfHeight, fHalfWidth, fHeightDir, FindPlane(), fLength, fLengthDir, fTotalVolume, fTrans, fWidthDir, InitTPCBoundaries(), LOG_DEBUG, geo::LocalTransformation< StoredMatrix >::Matrix(), ResetDriftDirection(), geo::Xaxis(), geo::Yaxis(), and geo::Zaxis().

39  : BoxBoundedGeo() // we initialize boundaries at the end of construction
40  , fTrans(path, depth)
41  , fActiveVolume(0)
42  , fTotalVolume(0)
44  , fWidthDir (geo::Xaxis())
47  , fDriftDir() // null until known
48  {
49 
50  // all planes are going to be contained in the volume named volTPC
51  // now get the total volume of the TPC
52  TGeoVolume *vc = path[depth]->GetVolume();
53  if(!vc){
54  throw cet::exception("Geometry") << "cannot find detector outline volume - bail ungracefully\n";
55  }
56 
57  fTotalVolume = vc;
58 
59  // loop over the daughters of this node and look for the active volume
60  int nd = vc->GetNdaughters();
61  TGeoNode const* pActiveVolNode = nullptr;
62  for(int i = 0; i < nd; ++i){
63  if(strncmp(vc->GetNode(i)->GetName(), "volTPCActive", 12) != 0) continue;
64 
65  pActiveVolNode = vc->GetNode(i);
66  TGeoVolume *vca = pActiveVolNode->GetVolume();
67  if(vca) fActiveVolume = vca;
68  break;
69 
70  }// end loop over daughters of the volume
71 
73 
74  LOG_DEBUG("Geometry") << "detector total volume is " << fTotalVolume->GetName()
75  << "\ndetector active volume is " << fActiveVolume->GetName();
76 
77  // compute the active volume transformation too
78  TGeoHMatrix ActiveHMatrix(fTrans.Matrix());
79  if (pActiveVolNode) ActiveHMatrix.Multiply(pActiveVolNode->GetMatrix());
80  // we don't keep the active volume information... just store its center:
81  std::array<double, 3> localActiveCenter, worldActiveCenter;
82  localActiveCenter.fill(0.0);
83  ActiveHMatrix.LocalToMaster
84  (localActiveCenter.data(), worldActiveCenter.data());
85  fActiveCenter = geo::vect::makeFromCoords<geo::Point_t>(worldActiveCenter);
86 
87 
88  // find the wires for the plane so that you can use them later
89  this->FindPlane(path, depth);
90 
91  // set the width, height, and lengths
92  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
93  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDY();
94  fActiveLength = 2.0*((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
95 
96  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
97  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
98  fLength = 2.0*((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
99 
100  // check that the rotation matrix to the world is the identity, if not
101  // we need to change the width, height and length values;
102  // the correspondence of these to x, y and z are not guaranteed to be
103  // trivial, so we store the two independently (cartesian dimensions in the
104  // bounding boxes, the sizes in data members directly)
105  double const* rotMatrix = fTrans.Matrix().GetRotationMatrix();
106  if(rotMatrix[0] != 1){
107  if(std::abs(rotMatrix[2]) == 1){
108  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
109  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
110  fWidthDir = Zaxis();
111  }
112  if(std::abs(rotMatrix[1]) == 1){
113  fActiveHalfWidth = ((TGeoBBox*)fActiveVolume->GetShape())->GetDY();
114  fHalfWidth = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
115  fWidthDir = Yaxis();
116  }
117  }
118  if(rotMatrix[4] != 1){
119  if(std::abs(rotMatrix[3]) == 1){
120  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
121  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
122  fHeightDir = Xaxis();
123  }
124  if(std::abs(rotMatrix[5]) == 1){
125  fActiveHalfHeight = ((TGeoBBox*)fActiveVolume->GetShape())->GetDZ();
126  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
127  fHeightDir = Zaxis();
128  }
129  }
130  if(rotMatrix[8] != 1){
131  if(std::abs(rotMatrix[6]) == 1){
132  fActiveLength = 2.*((TGeoBBox*)fActiveVolume->GetShape())->GetDX();
133  fLength = 2.*((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
134  fLengthDir = Xaxis();
135  }
136  if(std::abs(rotMatrix[7]) == 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:495
Drift direction is unknown.
Definition: geo_types.h:105
void FindPlane(GeoNodePath_t &path, size_t depth)
Definition: TPCGeo.cxx:149
double fLength
Length of total volume.
Definition: TPCGeo.h:645
double fActiveHalfWidth
Half width of active volume.
Definition: TPCGeo.h:640
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:222
BoxBoundedGeo()=default
Default constructor: sets an empty volume.
geo::Vector_t fHeightDir
Direction height refers to.
Definition: TPCGeo.h:648
geo::Vector_t fWidthDir
Direction width refers to.
Definition: TPCGeo.h:647
double fHalfWidth
Half width of total volume.
Definition: TPCGeo.h:643
double fActiveLength
Length of active volume.
Definition: TPCGeo.h:642
constexpr Vector Xaxis()
Returns a x axis vector of the specified type.
Definition: geo_vectors.h:218
TGeoVolume * fTotalVolume
Total volume of TPC, called volTPC in GDML file.
Definition: TPCGeo.h:634
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
Definition: TPCGeo.h:635
constexpr Vector Zaxis()
Returns a z axis vector of the specified type.
Definition: geo_vectors.h:226
TGeoVolume * fActiveVolume
Active volume of LAr, called volTPCActive in GDML file.
Definition: TPCGeo.h:633
geo::Vector_t fLengthDir
Direction length refers to.
Definition: TPCGeo.h:649
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
void ResetDriftDirection()
Recomputes the drift direction; needs planes to have been initialised.
Definition: TPCGeo.cxx:433
#define LOG_DEBUG(id)
geo::Vector_t fDriftDir
Direction electrons drift along.
Definition: TPCGeo.h:650
geo::Point_t fActiveCenter
Center of the active volume, in world coordinates [cm].
Definition: TPCGeo.h:638
double fHalfHeight
Half height of total volume.
Definition: TPCGeo.h:644
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
double fActiveHalfHeight
Half height of active volume.
Definition: TPCGeo.h:641

Member Function Documentation

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

Returns the box of the active volume of this TPC.

Definition at line 266 of file TPCGeo.h.

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

Referenced by GetFrontFaceCenterImpl(), and PrintTPCInfo().

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

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

Definition at line 91 of file TPCGeo.h.

References fActiveHalfHeight.

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

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

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

Definition at line 97 of file TPCGeo.h.

References fActiveLength.

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

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

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

Definition at line 87 of file TPCGeo.h.

References fActiveHalfWidth.

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

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

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

Definition at line 93 of file TPCGeo.h.

References ActiveHalfHeight().

Referenced by PrintTPCInfo().

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

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

Definition at line 95 of file TPCGeo.h.

References fActiveLength.

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

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

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

Definition at line 110 of file TPCGeo.h.

References fActiveVolume.

Referenced by evgen::ActiveVolumeVertexSampler::reconfigure().

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

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

Definition at line 111 of file TPCGeo.h.

References fActiveVolume.

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

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

Definition at line 89 of file TPCGeo.h.

References ActiveHalfWidth().

Referenced by PrintTPCInfo().

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

Returns the bounding box of this TPC.

Definition at line 262 of file TPCGeo.h.

Referenced by PrintTPCInfo().

263  { 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().

142  { 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.
template<typename Point = DefaultPoint_t>
Point 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 458 of file TPCGeo.h.

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

459  { return ReferencePlane().ComposePoint<Point>(decomp); }
Point ComposePoint(WireDecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: PlaneGeo.h:818
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
template<typename Point = DefaultPoint_t>
Point 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 480 of file TPCGeo.h.

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

481  { return ReferencePlane().ComposePoint<Point>(distance, proj); }
Point ComposePoint(WireDecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: PlaneGeo.h:818
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
Float_t proj
Definition: plot.C:34
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 481 of file TPCGeo.cxx.

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

Referenced by DriftDistance().

481  {
482 
483  //
484  // 1. find the center of the face of the TPC opposite to the anode
485  // 2. compute the distance of it from the last wire plane
486  //
487 
488  geo::PlaneGeo const& plane = fPlanes.back();
489  return std::abs(plane.DistanceFromPlane(GetCathodeCenter()));
490 
491  } // TPCGeo::ComputeDriftDistance()
Point GetCathodeCenter() const
Definition: TPCGeo.h:253
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
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:557
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 207 of file BoxBoundedGeo.h.

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

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

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

Definition at line 18 of file BoxBoundedGeo.cxx.

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

19  { return ContainsPosition(geo::vect::toPoint(point), wiggle); }
::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 23 of file BoxBoundedGeo.cxx.

References geo::vect::makePointFromCoords().

24  { return ContainsPosition(geo::vect::makePointFromCoords(point), wiggle); }
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 161 of file BoxBoundedGeo.h.

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

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

162  { return CoordinateContained(x, MinX(), MaxX(), wiggle); }
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 171 of file BoxBoundedGeo.h.

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

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

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

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

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

193  { return ContainsY(y, wiggle) && ContainsZ(z, wiggle); }
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
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 181 of file BoxBoundedGeo.h.

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

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

182  { return CoordinateContained(z, MinZ(), MaxZ(), wiggle); }
Double_t z
Definition: plot.C:279
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 610 of file TPCGeo.h.

Referenced by CoordinateContained().

611  {
612  return (c >= (min > 0? min / wiggle: min * wiggle))
613  && (c <= (max < 0? max / wiggle: max * wiggle));
614  } // CoordinateContained()
Int_t max
Definition: plot.C:27
Int_t min
Definition: plot.C:26
static bool geo::TPCGeo::CoordinateContained ( double  c,
double const *  range,
double  wiggle = 1. 
)
inlinestatic

Definition at line 617 of file TPCGeo.h.

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

618  { return CoordinateContained(c, range[0], range[1], wiggle); }
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
Definition: TPCGeo.h:610
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 384 of file TPCGeo.h.

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

Referenced by DecomposePoint().

385  { return ReferencePlane().DecomposePointWidthDepth(point); }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
WDDecomposedVector_t DecomposePointWidthDepth(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:878
DecomposedVector_t geo::TPCGeo::DecomposePoint ( TVector3 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 386 of file TPCGeo.h.

References DecomposePoint(), and geo::vect::toPoint().

387  { return DecomposePoint(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
DecomposedVector_t DecomposePoint(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: TPCGeo.h:384
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 182 of file TPCGeo.cxx.

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

Referenced by GetCathodeCenterImpl(), nnet::TrainingDataAlg::getProjection(), pma::PMAlgTracker::mergeCoLinear(), detsim::SimDriftElectrons::produce(), ResetDriftDirection(), and toLocalCoords().

182  {
183 
184  //
185  // 1. determine the drift axis
186  // 2. determine the drift direction on it
187  //
188  // We assume that all the planes cover most of the TPC face; therefore,
189  // the centre of the plane and the one of the TPC should be very close
190  // to each other, when projected on the same drift plane.
191  // Here we find which is the largest coordinate difference.
192 
193  if (Nplanes() == 0) {
194  // chances are that we get this because stuff is not initialised yet,
195  // and then even the ID might be wrong
196  throw cet::exception("TPCGeo")
197  << "DetectDriftDirection(): no planes in TPC " << std::string(ID())
198  << "\n";
199  }
200 
201  auto const TPCcenter = GetCenter();
202  auto const PlaneCenter = Plane(0).GetBoxCenter(); // any will do
203 
204  auto const driftVector = PlaneCenter - TPCcenter; // approximation!
205 
206  if ((std::abs(driftVector.X()) > std::abs(driftVector.Y()))
207  && (std::abs(driftVector.X()) > std::abs(driftVector.Z())))
208  {
209  // x is the solution
210  return (driftVector.X() > 0)? +1: -1;
211  }
212  else if (std::abs(driftVector.Y()) > std::abs(driftVector.Z()))
213  {
214  // y is the man
215  return (driftVector.Y() > 0)? +2: -2;
216  }
217  else {
218  // z is the winner
219  return (driftVector.Z() > 0)? +3: -3;
220  }
221 
222  } // TPCGeo::DetectDriftDirection()
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:278
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
Point GetBoxCenter() const
Returns the centre of the box representing the plane.
Definition: PlaneGeo.h:441
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:693
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 343 of file TPCGeo.h.

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

Referenced by DistanceFromReferencePlane().

344  { return ReferencePlane().DistanceFromPlane(point); }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:557
double geo::TPCGeo::DistanceFromReferencePlane ( TVector3 const &  point) const
inline

Returns the plane used for reference by projection methods.

Definition at line 345 of file TPCGeo.h.

References DistanceFromReferencePlane(), and geo::vect::toPoint().

double DistanceFromReferencePlane(geo::Point_t const &point) const
Returns the distance of the specified point from reference plane.
Definition: TPCGeo.h:343
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
template<typename Vector >
Vector geo::TPCGeo::DriftDir ( ) const

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

Definition at line 687 of file TPCGeo.h.

References fDriftDir.

Referenced by checkTPCcoords(), DriftDirection(), groupTPCsByDriftDir(), and UpdateAfterSorting().

688  { return geo::vect::convertTo<Vector>(fDriftDir); }
geo::Vector_t fDriftDir
Direction electrons drift along.
Definition: TPCGeo.h:650
DriftDirection_t geo::TPCGeo::DriftDirection ( ) const
inline

Returns an enumerator value describing the drift direction.

Definition at line 127 of file TPCGeo.h.

References DriftDir(), and fDriftDirection.

Referenced by util::DetectorPropertiesServiceArgoNeuT::CalculateXTicksParams(), detinfo::DetectorPropertiesStandard::CalculateXTicksParams(), and larg4::LArVoxelReadout::DriftIonizationElectrons().

127 { return fDriftDirection; }
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
Definition: TPCGeo.h:635
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 135 of file TPCGeo.h.

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

Referenced by pma::PMAlgCosmicTagger::GetDimensions(), and PrintTPCInfo().

135 { return ComputeDriftDistance(); }
double ComputeDriftDistance() const
Definition: TPCGeo.cxx:481
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 360 of file TPCGeo.h.

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

361  { ReferencePlane().DriftPoint(position, distance); }
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:299
void geo::TPCGeo::DriftPoint ( TVector3 &  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 362 of file TPCGeo.h.

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

363  { ReferencePlane().DriftPoint(position, distance); }
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:299
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 392 of file BoxBoundedGeo.h.

Referenced by geo::PlaneGeo::BoundingBox(), evd_tool::StandardDrawer::DetOutline3D(), and lar::example::SpacePointIsolationAlg::fillAlgConfigFromGeometry().

393  { ExtendToInclude(geo::Point_t(x, y, z)); }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:279
void ExtendToInclude(Coord_t x, Coord_t y, Coord_t z)
Extends the current box to also include the specified point.
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:187
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 399 of file BoxBoundedGeo.h.

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

400  {
401  set_min(c_min, point);
402  set_max(c_max, point);
403  }
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 411 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().

412  {
413  set_min(c_min, box.Min());
414  set_max(c_max, box.Max());
415  } // 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

Definition at line 149 of file TPCGeo.cxx.

References MakePlane().

Referenced by CoordinateContained(), and TPCGeo().

150  {
151 
152  const char* nm = path[depth]->GetName();
153  if( (strncmp(nm, "volTPCPlane", 11) == 0) ){
154  this->MakePlane(path,depth);
155  return;
156  }
157 
158  //explore the next layer down
159  unsigned int deeper = depth+1;
160  if(deeper >= path.size()){
161  throw cet::exception("BadTGeoNode") << "exceeded maximum TGeoNode depth\n";
162  }
163 
164  const TGeoVolume *v = path[depth]->GetVolume();
165  int nd = v->GetNdaughters();
166  for(int i = 0; i < nd; ++i){
167  path[deeper] = v->GetNode(i);
168  this->FindPlane(path, deeper);
169  }
170 
171  }
void MakePlane(GeoNodePath_t &path, size_t depth)
Definition: TPCGeo.cxx:175
void FindPlane(GeoNodePath_t &path, size_t depth)
Definition: TPCGeo.cxx:149
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::PlaneGeo const& geo::TPCGeo::FirstPlane ( ) const
inline

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

Definition at line 225 of file TPCGeo.h.

References fPlanes.

Referenced by ReferencePlane().

225 { return fPlanes[0]; }
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
template<typename Point = DefaultPoint_t>
Point geo::TPCGeo::GetActiveVolumeCenter ( ) const
inline

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

Definition at line 247 of file TPCGeo.h.

References fActiveCenter.

Referenced by evd_tool::StandardDrawer::DrawActiveTPCoutline(), and evd::SimulationDrawer::SimulationDrawer().

248  { return geo::vect::convertTo<Point>(fActiveCenter); }
geo::Point_t fActiveCenter
Center of the active volume, in world coordinates [cm].
Definition: TPCGeo.h:638
template<typename Point = DefaultPoint_t>
Point geo::TPCGeo::GetCathodeCenter ( ) const
inline

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

Definition at line 253 of file TPCGeo.h.

References GetCathodeCenterImpl().

Referenced by geo::DriftPartitions::computeCoverage(), and ComputeDriftDistance().

254  { return geo::vect::convertTo<Point>(GetCathodeCenterImpl()); }
geo::Point_t GetCathodeCenterImpl() const
Definition: TPCGeo.cxx:361
geo::Point_t geo::TPCGeo::GetCathodeCenterImpl ( ) const
private

Definition at line 361 of file TPCGeo.cxx.

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

Referenced by GetCathodeCenter().

361  {
362 
363  //
364  // 1. find the center of the face of the TPC opposite to the anode
365  // 2. compute the distance of it from the last wire plane
366  //
367 
368  //
369  // find the cathode center
370  //
371  geo::Point_t cathodeCenter = GetActiveVolumeCenter<geo::Point_t>();
372  switch (DetectDriftDirection()) {
373  case -1:
374  geo::vect::Xcoord(cathodeCenter) += ActiveHalfWidth();
375  // cathodeCenter.SetX(cathodeCenter.X() + ActiveHalfWidth());
376  break;
377  case +1:
378  cathodeCenter.SetX(cathodeCenter.X() - ActiveHalfWidth());
379  break;
380  case -2:
381  cathodeCenter.SetY(cathodeCenter.Y() + ActiveHalfHeight());
382  break;
383  case +2:
384  cathodeCenter.SetY(cathodeCenter.Y() - ActiveHalfHeight());
385  break;
386  case -3:
387  cathodeCenter.SetZ(cathodeCenter.Z() + ActiveLength() / 2.0);
388  break;
389  case +3:
390  cathodeCenter.SetZ(cathodeCenter.Z() - ActiveLength() / 2.0);
391  break;
392  case 0:
393  default:
394  // in this case, a better algorithm is probably needed
395  throw cet::exception("TPCGeo")
396  << "CathodeCenter(): Can't determine the cathode plane (code="
397  << DetectDriftDirection() << ")\n";
398  } // switch
399  return cathodeCenter;
400 
401  } // TPCGeo::GetCathodeCenterImpl()
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:91
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:87
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:95
auto Xcoord(Vector &v)
Returns an object to manage the coordinate X of the vector v.
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:182
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:187
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<typename Point >
Point geo::TPCGeo::GetCenter ( ) const

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

Definition at line 693 of file TPCGeo.h.

References toWorldCoords().

Referenced by DetectDriftDirection(), evd_tool::ICARUSDrawer::DetOutline3D(), LastPlane(), ResetDriftDirection(), evd::SimulationDrawer::SimulationDrawer(), and SortPlanes().

693  {
694 
695  // convert the origin (default constructed TVector)
696  return geo::vect::convertTo<Point>(toWorldCoords(LocalPoint_t{ 0.0, 0.0, 0.0 }));
697 
698 } // geo::TPCGeo::GetCenter()
geo::Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: TPCGeo.h:65
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:498
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 194 of file TPCGeo.h.

References Plane().

195  { return Plane(planeid); }
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
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 217 of file TPCGeo.h.

References PlanePtr(), and SmallestPlane().

218  { return PlanePtr(planeid); }
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
Definition: TPCGeo.h:203
template<typename Point = geo::Point_t>
Point geo::TPCGeo::GetFrontFaceCenter ( ) const
inline

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

Definition at line 258 of file TPCGeo.h.

References GetFrontFaceCenterImpl().

259  { return geo::vect::convertTo<Point>(GetFrontFaceCenterImpl()); }
geo::Point_t GetFrontFaceCenterImpl() const
Definition: TPCGeo.cxx:405
geo::Point_t geo::TPCGeo::GetFrontFaceCenterImpl ( ) const
private

Definition at line 405 of file TPCGeo.cxx.

References ActiveBoundingBox().

Referenced by GetFrontFaceCenter().

405  {
406  auto const& activeBox = ActiveBoundingBox();
407  return { activeBox.CenterX(), activeBox.CenterY(), activeBox.MinZ() };
408  } // TPCGeo::GetFrontFaceCenterImpl()
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:266
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 118 of file BoxBoundedGeo.cxx.

Referenced by geo::BoxBoundedGeo::ExtendToInclude(), and geo::BoxBoundedGeo::GetIntersections().

119  {
120  std::vector<TVector3> intersections;
121  for (auto const& point: GetIntersections(geo::Point_t(TrajectoryStart), geo::Vector_t(TrajectoryDirect)))
122  intersections.emplace_back(point.X(), point.Y(), point.Z());
123  return intersections;
124  } // 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:167
std::vector< TVector3 > GetIntersections(TVector3 const &TrajectoryStart, TVector3 const &TrajectoryDirect) const
Calculates the entry and exit points of a trajectory on the box surface.
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:187
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 27 of file BoxBoundedGeo.cxx.

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

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

Length is associated with z coordinate [cm].

Definition at line 109 of file TPCGeo.h.

References fLength.

Referenced by InitTPCBoundaries().

109 { return fLength / 2.0; }
double fLength
Length of total volume.
Definition: TPCGeo.h:645
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 156 of file TPCGeo.h.

References HasPlane().

156 { return HasPlane(iplane); }
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:155
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 170 of file TPCGeo.h.

References HasPlane(), and Plane().

171  { return HasPlane(planeid); }
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:155
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 155 of file TPCGeo.h.

References Nplanes().

Referenced by pma::ProjectionMatchingAlg::buildShowerSeg(), pma::VtxCandidate::ComputeMse2D(), pma::PMAlgStitching::GetTPCXOffsets(), pma::ProjectionMatchingAlg::guideEndpoints(), HasElement(), HasPlane(), geo::GeometryCore::HasPlane(), pma::PMAlgTracker::matchCluster(), pma::Node3D::Node3D(), PlanePtr(), trkf::PMAlgTrajFitter::produce(), trkf::PMAlgTrackMaker::produce(), and pma::ProjectionMatchingAlg::TestTrk().

155 { return iplane < Nplanes(); }
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
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 168 of file TPCGeo.h.

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

169  { 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:155
double geo::TPCGeo::Height ( ) const
inline

Height is associated with y coordinate [cm].

Definition at line 105 of file TPCGeo.h.

References HalfHeight().

Referenced by PrintTPCInfo().

105 { return 2.0 * HalfHeight(); }
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:103
template<typename Vector = DefaultVector_t>
decltype(auto) geo::TPCGeo::HeightDir ( ) const
inline

Returns the direction Height() is measured on.

Definition at line 120 of file TPCGeo.h.

References fHeightDir.

120 { return geo::vect::convertTo<Vector>(fHeightDir); }
geo::Vector_t fHeightDir
Direction height refers to.
Definition: TPCGeo.h:648
geo::TPCID const& geo::TPCGeo::ID ( ) const
inline

Returns the identifier of this TPC.

Definition at line 278 of file TPCGeo.h.

References fID.

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

278 { return fID; }
geo::TPCID fID
ID of this TPC.
Definition: TPCGeo.h:654
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().

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

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().

254  { 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 274 of file BoxBoundedGeo.h.

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

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

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

References geo::BoxBoundedGeo::InFiducialY().

285  { 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 305 of file BoxBoundedGeo.h.

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

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

306  {
307  return CoordinateContained(z, MinZ() + neg_margin, MaxZ() - pos_margin);
308  }
Double_t z
Definition: plot.C:279
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 315 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CoordinateContained(), and geo::BoxBoundedGeo::InFiducialZ().

316  { return InFiducialZ(z, margin, margin); }
Double_t z
Definition: plot.C:279
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 495 of file TPCGeo.cxx.

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

Referenced by TPCGeo().

495  {
496  // note that this assumes no rotations of the TPC
497  // (except for rotations of a flat angle around one of the three main axes);
498  // to avoid this, we should transform the six vertices
499  // rather than just the centre
500 
501  // we rely on the asumption that the center of TPC is at the local origin
505  );
506 
507  // the center of the active volume may be elsewhere than the local origin:
508  auto const& activeCenter = GetActiveVolumeCenter<geo::Point_t>();
510  activeCenter.X() - ActiveHalfWidth(), activeCenter.X() + ActiveHalfWidth(),
511  activeCenter.Y() - ActiveHalfHeight(), activeCenter.Y() + ActiveHalfHeight(),
512  activeCenter.Z() - ActiveHalfLength(), activeCenter.Z() + ActiveHalfLength()
513  );
514 
515 
516  } // CryostatGeo::InitTPCBoundaries()
geo::BoxBoundedGeo fActiveBox
Box of the active volume.
Definition: TPCGeo.h:652
geo::Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: TPCGeo.h:65
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:91
double HalfLength() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:109
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:498
double ActiveHalfLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:97
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:87
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:103
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:99
geo::PlaneGeo const& geo::TPCGeo::LastPlane ( ) const
inline

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

Definition at line 228 of file TPCGeo.h.

References fPlanes, GetCenter(), MaxWires(), Nplanes(), and Views().

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

228 { return fPlanes[Nplanes() - 1]; }
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
double geo::TPCGeo::Length ( ) const
inline
template<typename Vector = DefaultVector_t>
decltype(auto) geo::TPCGeo::LengthDir ( ) const
inline

Returns the direction Length() is measured on.

Definition at line 124 of file TPCGeo.h.

References fLengthDir.

124 { return geo::vect::convertTo<Vector>(fLengthDir); }
geo::Vector_t fLengthDir
Direction length refers to.
Definition: TPCGeo.h:649
TVector3 geo::TPCGeo::LocalToWorld ( const TVector3 &  local) const
inline

Transform point from local TPC frame to world frame.

Definition at line 494 of file TPCGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::LocalToWorld().

495  { return fTrans.LocalToWorld<TVector3>(local); }
void LocalToWorld(double const *local, double *world) const
Transforms a point from local frame to world frame.
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
void geo::TPCGeo::LocalToWorldVect ( const double *  tpc,
double *  world 
) const
inline

Transform direction vector from local to world.

Definition at line 502 of file TPCGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::LocalToWorldVect().

503  { fTrans.LocalToWorldVect(tpc, world); }
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
TVector3 geo::TPCGeo::LocalToWorldVect ( const TVector3 &  local) const
inline

Transform direction vector from local to world.

Definition at line 506 of file TPCGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::LocalToWorldVect().

507  { return fTrans.LocalToWorldVect<TVector3>(local); }
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
void geo::TPCGeo::MakePlane ( GeoNodePath_t path,
size_t  depth 
)
private

Definition at line 175 of file TPCGeo.cxx.

References fPlanes.

Referenced by CoordinateContained(), and FindPlane().

176  {
177  fPlanes.emplace_back(path, depth);
178  }
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
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 333 of file TPCGeo.cxx.

References fPlanes.

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

333  {
334  unsigned int maxWires = 0;
335  for (geo::PlaneGeo const& plane: fPlanes) {
336  unsigned int maxWiresInPlane = plane.Nwires();
337  if (maxWiresInPlane > maxWires) maxWires = maxWiresInPlane;
338  } // for
339  return maxWires;
340  } // TPCGeo::MaxWires()
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
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 146 of file TPCGeo.h.

References fPlanes.

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

146 { return fPlanes.size(); }
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
unsigned int geo::TPCGeo::Nplanes ( ) const
inline
const PlaneGeo & geo::TPCGeo::Plane ( geo::View_t  view) const

Return the plane in the tpc with View_t view.

Definition at line 299 of file TPCGeo.cxx.

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

Referenced by hit::MagDriftAna::analyze(), trkf::SpacePointAna::bookHistograms(), util::DetectorPropertiesServiceArgoNeuT::CalculateXTicksParams(), detinfo::DetectorPropertiesStandard::CalculateXTicksParams(), evd::RecoBaseDrawer::Cluster2D(), pma::CmToWireDrift(), lar_pandora::LArPandoraInput::CreatePandoraHits2D(), lar_pandora::LArPandoraInput::CreatePandoraReadoutGaps(), DetectDriftDirection(), hit::DisambigCheater::DisambigCheater(), evd::RecoBaseDrawer::DrawTrack2D(), evd::RecoBaseDrawer::DrawTrackVertexAssns2D(), larg4::LArVoxelReadout::DriftIonizationElectrons(), cluster::EndPointAlg::EndPoint(), evd::RecoBaseDrawer::EndPoint2D(), evd::RecoBaseDrawer::Event2D(), cluster::HoughBaseAlg::FastTransform(), corner::CornerFinderAlg::get_feature_points_fast(), pma::ProjectionMatchingAlg::GetCloseHits(), GetElement(), pma::GetProjectionToPlane(), trkf::BezierTrack::GetTrackPitch(), lar_pandora::PFParticleHitDumper::GetUVW(), HasElement(), geo::ChannelMapStandardAlg::Initialize(), lar_pandora::LArPandoraGeometry::LoadGeometry(), trkf::SpacePointAlg::makeSpacePoints(), Plane(), geo::GeometryCore::Print(), lar_pandora::LArPandoraTrackCreation::produce(), cluster::ClusterCheater::produce(), vertex::HarrisVertexFinder::produce(), evd::RecoBaseDrawer::Prong2D(), evd::RecoBaseDrawer::RecoBaseDrawer(), ResetDriftDirection(), geo::GeometryCore::ThirdPlane_dTdW(), geo::GeometryCore::ThirdPlaneSlope(), cluster::HoughBaseAlg::Transform(), trkf::SpacePointAlg::update(), pma::Node3D::UpdateProj2D(), pma::ProjectionMatchingAlg::validate(), pma::ProjectionMatchingAlg::validate_on_adc_test(), geo::GeometryCore::WireAngleToVertical(), pma::WireDriftToCm(), and WirePitch().

300  {
301  geo::PlaneID::PlaneID_t const p = fViewToPlaneNumber[size_t(view)];
302  if (p == geo::PlaneID::InvalidID) {
303  throw cet::exception("TPCGeo")
304  << "TPCGeo[" << ((void*) this) << "]::Plane(): no plane for view #"
305  << (size_t) view << "\n";
306  }
307  return fPlanes[p];
308  } // TPCGeo::Plane(geo::View_t)
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
Definition: TPCGeo.h:657
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:251
static const PlaneID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:255
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 288 of file TPCGeo.cxx.

References PlanePtr().

289  {
290  geo::PlaneGeo const* pPlane = PlanePtr(iplane);
291  if (!pPlane){
292  throw cet::exception("PlaneOutOfRange") << "Request for non-existant plane " << iplane << "\n";
293  }
294 
295  return *pPlane;
296  }
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:203
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 192 of file TPCGeo.h.

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

193  { 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:299
double geo::TPCGeo::Plane0Pitch ( unsigned int  p) const

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

Definition at line 355 of file TPCGeo.cxx.

References fPlane0Pitch.

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

356  {
357  return fPlane0Pitch[p];
358  }
std::vector< double > fPlane0Pitch
Pitch between planes.
Definition: TPCGeo.h:636
const double * geo::TPCGeo::PlaneLocation ( unsigned int  p) const

Returns the coordinates of the center of the specified plane [cm].

Definition at line 413 of file TPCGeo.cxx.

References fPlaneLocation.

Referenced by ActiveBoundingBox(), util::DetectorPropertiesServiceArgoNeuT::CalculateXTicksParams(), detinfo::DetectorPropertiesStandard::CalculateXTicksParams(), larg4::LArVoxelReadout::DriftIonizationElectrons(), pma::PMAlgStitching::GetTPCXOffsets(), detsim::SimDriftElectrons::produce(), DUNE::NeutrinoTrackingEff::truthLength(), and trkf::SpacePointAlg::update().

414  {
415  return &fPlaneLocation[p][0];
416  }
std::vector< std::vector< double > > fPlaneLocation
xyz locations of planes in the TPC.
Definition: TPCGeo.h:637
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 419 of file TPCGeo.cxx.

References fPlane0Pitch.

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

421  {
422  return std::abs(fPlane0Pitch[p2] - fPlane0Pitch[p1]);
423  }
std::vector< double > fPlane0Pitch
Pitch between planes.
Definition: TPCGeo.h:636
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 203 of file TPCGeo.h.

References fPlanes, and HasPlane().

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

204  { return HasPlane(iplane)? &(fPlanes[iplane]): nullptr; }
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:155
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
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 215 of file TPCGeo.h.

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

216  { return PlanePtr(planeid.Plane); }
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
Definition: TPCGeo.h:203
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 417 of file TPCGeo.h.

References Projection().

418  { 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:415
Projection_t geo::TPCGeo::PointProjection ( TVector3 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 419 of file TPCGeo.h.

References Projection(), and geo::vect::toPoint().

420  { return Projection(geo::vect::toPoint(point)); }
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
Projection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: TPCGeo.h:415
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 703 of file TPCGeo.h.

References ActiveBoundingBox(), ActiveHeight(), ActiveLength(), ActiveWidth(), BoundingBox(), DriftDistance(), Height(), ID(), Length(), geo::BoxBoundedGeo::Max(), MaxWires(), geo::BoxBoundedGeo::Min(), Nplanes(), and Width().

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

707  {
708 
709  //----------------------------------------------------------------------------
710  out << "TPC " << std::string(ID());
711 
712  if (verbosity-- <= 0) return; // 0
713 
714  //----------------------------------------------------------------------------
715  out
716  << " (" << Width() << " x " << Height() << " x " << Length() << ") cm^3 at "
717  << GetCenter<geo::Point_t>();
718 
719  if (verbosity-- <= 0) return; // 1
720 
721  //----------------------------------------------------------------------------
722 
723  out << "\n" << indent
724  << "drift direction " << DriftDir<geo::Vector_t>()
725  << " from cathode around " << GetCathodeCenter<geo::Point_t>()
726  << " through " << DriftDistance() << " cm toward "
727  << Nplanes() << " wire planes"
728  ;
729 
730  if (verbosity-- <= 0) return; // 2
731 
732  //----------------------------------------------------------------------------
733  out << "\n" << indent
734  << "maximum wires on any plane: " << MaxWires();
735 
736  if (verbosity-- <= 0) return; // 3
737 
738  //----------------------------------------------------------------------------
739  out << "\n" << indent
740  << "active volume ("
741  << ActiveWidth() << " x " << ActiveHeight() << " x " << ActiveLength()
742  << ") cm^3, front face at " << GetFrontFaceCenter<geo::Point_t>()
743  << " cm;"
744  << "\n" << indent << "main directions:"
745  << " width " << WidthDir<geo::Vector_t>()
746  << " height " << HeightDir<geo::Vector_t>()
747  << " length " << LengthDir<geo::Vector_t>()
748  ;
749 
750  if (verbosity-- <= 0) return; // 4
751 
752  //----------------------------------------------------------------------------
753  // print also the containing box
754  geo::BoxBoundedGeo const& box = BoundingBox();
755  out << "\n" << indent
756  << "bounding box: " << box.Min() << " -- " << box.Max();
757 
758 // if (verbosity-- <= 0) return; // 5
759 
760  //----------------------------------------------------------------------------
761  // print also the active box
762  geo::BoxBoundedGeo const& activeBox = ActiveBoundingBox();
763  out << "\n" << indent
764  << "active volume box: " << activeBox.Min() << " -- " << activeBox.Max();
765 
766 // if (verbosity-- <= 0) return; // 6
767 
768  //----------------------------------------------------------------------------
769 } // geo::TPCGeo::PrintTPCInfo()
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:278
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:266
double Width() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:101
double Height() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:105
double Length() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:107
std::string indent(std::size_t const i)
double ActiveHeight() const
Height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:93
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:333
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:95
double DriftDistance() const
Definition: TPCGeo.h:135
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:35
double ActiveWidth() const
Width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:89
geo::BoxBoundedGeo const & BoundingBox() const
Returns the bounding box of this TPC.
Definition: TPCGeo.h:262
geo::Point_t Max() const
Returns the corner point with the largest coordinates.
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 415 of file TPCGeo.h.

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

Referenced by PointProjection(), and VectorProjection().

416  { return ReferencePlane().PointWidthDepthProjection(point); }
WidthDepthProjection_t PointWidthDepthProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:897
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
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 436 of file TPCGeo.h.

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

WidthDepthProjection_t VectorWidthDepthProjection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:917
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
template<typename Point = DefaultPoint_t>
Point 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 398 of file TPCGeo.h.

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

399  { return ReferencePlane().GetCenter<Point>(); }
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
Point GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:426
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
template<typename Vector = DefaultPoint_t>
Vector 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 329 of file TPCGeo.h.

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

Referenced by geo::buildDriftVolumes().

329 { return ReferencePlane().DepthDir<Vector>(); }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
Vector DepthDir() const
Return the direction of plane depth.
Definition: PlaneGeo.h:219
geo::PlaneGeo const& geo::TPCGeo::ReferencePlane ( ) const
inline

Returns the plane used for reference by projection methods.

Definition at line 299 of file TPCGeo.h.

References FirstPlane().

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

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

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

Definition at line 302 of file TPCGeo.h.

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

303  { return ReferencePlane().ID(); }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:190
template<typename Vector = DefaultPoint_t>
Vector 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 316 of file TPCGeo.h.

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

Referenced by geo::buildDriftVolumes().

316 { return ReferencePlane().WidthDir<Vector>(); }
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:299
Vector WidthDir() const
Return the direction of plane width.
Definition: PlaneGeo.h:207
void geo::TPCGeo::ResetDriftDirection ( )
private

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

Definition at line 433 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().

433  {
434 
435  auto const driftDirCode = DetectDriftDirection();
436  switch (driftDirCode) {
437  case +1:
438  fDriftDirection = geo::kPosX; // this is the same as kPos!
439  fDriftDir = geo::Xaxis();
440  break;
441  case -1:
442  fDriftDirection = geo::kNegX; // this is the same as kNeg!
443  fDriftDir = -geo::Xaxis();
444  break;
445  case +2:
446  fDriftDir = geo::Yaxis();
448  break;
449  case -2:
450  fDriftDir = -geo::Yaxis();
452  break;
453  case +3:
454  fDriftDir = geo::Zaxis();
456  break;
457  case -3:
458  fDriftDir = -geo::Zaxis();
460  break;
461  default:
462  // TPC ID is likely not yet set
464 
465  // we estimate the drift direction roughly from the geometry
467 
468  mf::LogError("TPCGeo")
469  << "Unable to detect drift direction (result: " << driftDirCode
470  << ", drift: ( " << fDriftDir.X() << " ; " << fDriftDir.Y() << " ; "
471  << fDriftDir.Z() << " )";
472  break;
473  } // switch
474 
476 
477  } // 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:105
Drift towards positive values.
Definition: geo_types.h:106
constexpr Vector Yaxis()
Returns a y axis vector of the specified type.
Definition: geo_vectors.h:222
Point GetBoxCenter() const
Returns the centre of the box representing the plane.
Definition: PlaneGeo.h:441
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
Drift towards negative X values.
Definition: geo_types.h:109
constexpr Vector Xaxis()
Returns a x axis vector of the specified type.
Definition: geo_vectors.h:218
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
Definition: TPCGeo.h:635
constexpr Vector Zaxis()
Returns a z axis vector of the specified type.
Definition: geo_vectors.h:226
Drift towards positive X values.
Definition: geo_types.h:108
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:182
Drift towards negative values.
Definition: geo_types.h:107
geo::Vector_t fDriftDir
Direction electrons drift along.
Definition: TPCGeo.h:650
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
Float_t e
Definition: plot.C:34
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:693
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 446 of file BoxBoundedGeo.h.

References fhicl::detail::atom::value().

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

447  { if (value > var) var = value; }
std::string value(boost::any const &)
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 458 of file BoxBoundedGeo.h.

459  {
460  if (value.X() > var.X()) var.SetX(value.X());
461  if (value.Y() > var.Y()) var.SetY(value.Y());
462  if (value.Z() > var.Z()) var.SetZ(value.Z());
463  }
std::string value(boost::any const &)
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 442 of file BoxBoundedGeo.h.

References fhicl::detail::atom::value().

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

443  { if (value < var) var = value; }
std::string value(boost::any const &)
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 450 of file BoxBoundedGeo.h.

451  {
452  if (value.X() < var.X()) var.SetX(value.X());
453  if (value.Y() < var.Y()) var.SetY(value.Y());
454  if (value.Z() < var.Z()) var.SetZ(value.Z());
455  }
std::string value(boost::any const &)
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 367 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().

372  {
373  c_min.SetXYZ(x_min, y_min, z_min);
374  c_max.SetXYZ(x_max, y_max, z_max);
375  SortCoordinates();
376  }
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 383 of file BoxBoundedGeo.h.

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

384  { c_min = lower; c_max = upper; SortCoordinates(); }
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 312 of file TPCGeo.cxx.

References fPlanes.

Referenced by GetElementPtr().

312  {
313 
314  //
315  // Returns the plane with the smallest width x depth. No nonsense here.
316  //
317 
318  auto iPlane = fPlanes.begin(), pend = fPlanes.end();
319  auto smallestPlane = iPlane;
320  double smallestSurface = smallestPlane->Width() * smallestPlane->Depth();
321  while (++iPlane != pend) {
322  double const surface = iPlane->Width() * iPlane->Depth();
323  if (surface > smallestSurface) continue;
324  smallestSurface = surface;
325  smallestPlane = iPlane;
326  } // while
327  return *smallestPlane;
328 
329  } // TPCGeo::SmallestPlane()
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
void geo::TPCGeo::SortPlanes ( std::vector< geo::PlaneGeo > &  planes) const
private

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

Definition at line 536 of file TPCGeo.cxx.

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

Referenced by SortSubVolumes().

536  {
537  //
538  // Sort planes by increasing drift distance.
539  //
540  // This function should work in bootstrap mode, relying on least things as
541  // possible. Therefore we compute here a proxy of the drift axis.
542  //
543 
544  //
545  // determine the drift axis (or close to): from TPC center to plane center
546  //
547 
548  // Instead of using the plane center, which might be not available yet,
549  // we use the plane box center, which only needs the geometry description
550  // to be available.
551  // We use the first plane -- it does not make any difference.
552  auto const TPCcenter = GetCenter();
553  auto const driftAxis
554  = geo::vect::normalize(planes[0].GetBoxCenter() - TPCcenter);
555 
556  auto by_distance = [&TPCcenter, &driftAxis](auto const& a,
557  auto const& b) {
558  return geo::vect::dot(a.GetBoxCenter() - TPCcenter, driftAxis) <
559  geo::vect::dot(b.GetBoxCenter() - TPCcenter, driftAxis);
560  };
561  cet::sort_all(planes, by_distance);
562 
563  } // TPCGeo::SortPlanes()
constexpr auto dot(Vector const &a, Vector const &b)
Return cross product of two vectors.
Vector normalize(Vector const &v)
Returns a vector parallel to v and with norm 1.
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:693
void geo::TPCGeo::SortSubVolumes ( geo::GeoObjectSorter const &  sorter)

Apply sorting to the PlaneGeo objects.

Definition at line 226 of file TPCGeo.cxx.

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

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

227  {
229 
230  double origin[3] = {0.};
231 
232  // set the plane pitch for this TPC
233  double xyz[3] = {0.};
234  fPlanes[0].LocalToWorld(origin,xyz);
235  double xyz1[3] = {0.};
236  fPlaneLocation.clear();
237  fPlaneLocation.resize(fPlanes.size());
238  for(unsigned int i = 0; i < fPlaneLocation.size(); ++i) fPlaneLocation[i].resize(3);
239  fPlane0Pitch.clear();
240  fPlane0Pitch.resize(this->Nplanes(), 0.);
241  for(size_t p = 0; p < this->Nplanes(); ++p){
242  fPlanes[p].LocalToWorld(origin,xyz1);
243  if(p > 0) fPlane0Pitch[p] = fPlane0Pitch[p-1] + std::abs(xyz1[0]-xyz[0]);
244  else fPlane0Pitch[p] = 0.;
245  xyz[0] = xyz1[0];
246  fPlaneLocation[p][0] = xyz1[0];
247  fPlaneLocation[p][1] = xyz1[1];
248  fPlaneLocation[p][2] = xyz1[2];
249  }
250 
251  // the PlaneID_t cast convert InvalidID into a rvalue (non-reference);
252  // leaving it a reference would cause C++ to treat it as such,
253  // that can't be because InvalidID is a static member constant without an address
254  // (it is not defined in any translation unit, just declared in header)
255  fViewToPlaneNumber.resize
257  for(size_t p = 0; p < this->Nplanes(); ++p)
258  fViewToPlaneNumber[(size_t) fPlanes[p].View()] = p;
259 
260  for(size_t p = 0; p < fPlanes.size(); ++p) fPlanes[p].SortWires(sorter);
261 
262  }
std::vector< double > fPlane0Pitch
Pitch between planes.
Definition: TPCGeo.h:636
Unknown view.
Definition: geo_types.h:83
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
Definition: TPCGeo.h:657
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:251
void SortPlanes(std::vector< geo::PlaneGeo > &) const
Sorts (in place) the specified PlaneGeo objects by drift distance.
Definition: TPCGeo.cxx:536
std::vector< std::vector< double > > fPlaneLocation
xyz locations of planes in the TPC.
Definition: TPCGeo.h:637
static const PlaneID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:255
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:230
LocalPoint_t geo::TPCGeo::toLocalCoords ( geo::Point_t const &  world) const
inline

Transform point from world frame to local TPC frame.

Definition at line 522 of file TPCGeo.h.

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

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

Transform direction vector from world to local.

Definition at line 534 of file TPCGeo.h.

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

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

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

Definition at line 112 of file TPCGeo.h.

References fTotalVolume.

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

Transform point from local TPC frame to world frame.

Definition at line 498 of file TPCGeo.h.

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

Referenced by GetCenter(), and InitTPCBoundaries().

499  { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
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 510 of file TPCGeo.h.

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

511  { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
void geo::TPCGeo::UpdateAfterSorting ( geo::TPCID  tpcid)

Performs all updates after cryostat has sorted TPCs.

Definition at line 266 of file TPCGeo.cxx.

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

Referenced by toLocalCoords().

266  {
267 
268  // reset the ID
269  fID = tpcid;
270 
271  // ask the planes to update; also check
272 
273  for (unsigned int plane = 0; plane < Nplanes(); ++plane) {
274  fPlanes[plane].UpdateAfterSorting(geo::PlaneID(fID, plane), *this);
275 
276  // check that the plane normal is opposite to the TPC drift direction
278  .equal(-(fPlanes[plane].GetNormalDirection()), DriftDir()));
279 
280  } // for
281 
283 
284  } // TPCGeo::UpdateAfterSorting()
Vector DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
Definition: TPCGeo.h:687
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
geo::TPCID fID
ID of this TPC.
Definition: TPCGeo.h:654
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:520
Float_t e
Definition: plot.C:34
void geo::TPCGeo::UpdatePlaneViewCache ( )
private

Refills the plane vs. view cache of the TPC.

Definition at line 520 of file TPCGeo.cxx.

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

Referenced by UpdateAfterSorting().

520  {
521 
522  // the PlaneID_t cast convert InvalidID into a rvalue (non-reference);
523  // leaving it a reference would cause C++ to treat it as such,
524  // that can't be because InvalidID is a static member constant without an address
525  // (it is not defined in any translation unit, just declared in header)
526  fViewToPlaneNumber.clear();
527  fViewToPlaneNumber.resize
529  for(size_t p = 0; p < Nplanes(); ++p)
530  fViewToPlaneNumber[(size_t) fPlanes[p].View()] = p;
531 
532  } // TPCGeo::UpdatePlaneViewCache()
Unknown view.
Definition: geo_types.h:83
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
Definition: TPCGeo.h:657
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:251
static const PlaneID_t InvalidID
Special code for an invalid ID.
Definition: geo_types.h:255
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 438 of file TPCGeo.h.

References Projection().

439  { 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:415
Projection_t geo::TPCGeo::VectorProjection ( TVector3 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 440 of file TPCGeo.h.

References Projection(), and geo::vect::toVector().

441  { return Projection(geo::vect::toVector(v)); }
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
Projection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: TPCGeo.h:415
std::set< geo::View_t > geo::TPCGeo::Views ( ) const

Returns a set of all views covered in this TPC.

Definition at line 344 of file TPCGeo.cxx.

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

Referenced by LastPlane().

344  {
345  std::set<geo::View_t> views;
346  std::transform(fPlanes.cbegin(), fPlanes.cend(),
347  std::inserter(views, views.begin()), std::mem_fn(&geo::PlaneGeo::View));
348  return views;
349  } // TPCGeo::Views()
std::vector< PlaneGeo > fPlanes
List of planes in this plane.
Definition: TPCGeo.h:632
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:171
double geo::TPCGeo::Width ( ) const
inline

Width is associated with x coordinate [cm].

Definition at line 101 of file TPCGeo.h.

References HalfWidth().

Referenced by PrintTPCInfo().

101 { return 2.0 * HalfWidth(); }
double HalfWidth() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:99
template<typename Vector = DefaultVector_t>
decltype(auto) geo::TPCGeo::WidthDir ( ) const
inline

Returns the direction Width() is measured on.

Definition at line 116 of file TPCGeo.h.

References fWidthDir.

116 { return geo::vect::convertTo<Vector>(fWidthDir); }
geo::Vector_t fWidthDir
Direction width refers to.
Definition: TPCGeo.h:647
double geo::TPCGeo::WirePitch ( unsigned  plane = 0) const

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

Definition at line 427 of file TPCGeo.cxx.

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

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

428  {
429  return this->Plane(plane).WirePitch();
430  }
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
double WirePitch() const
Return the wire pitch (in centimeters). It is assumed constant.
Definition: PlaneGeo.h:367
void geo::TPCGeo::WorldToLocal ( const double *  world,
double *  tpc 
) const
inline

Transform point from world frame to local TPC frame.

Definition at line 514 of file TPCGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::WorldToLocal().

515  { fTrans.WorldToLocal(world, tpc); }
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
TVector3 geo::TPCGeo::WorldToLocal ( TVector3 const &  world) const
inline

Transform point from world frame to local TPC frame.

Definition at line 518 of file TPCGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::WorldToLocal().

519  { return fTrans.WorldToLocal<TVector3>(world); }
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
void geo::TPCGeo::WorldToLocalVect ( const double *  world,
double *  tpc 
) const
inline

Transform direction vector from world to local.

Definition at line 526 of file TPCGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::WorldToLocalVect().

527  { fTrans.WorldToLocalVect(world, tpc); }
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.
TVector3 geo::TPCGeo::WorldToLocalVect ( TVector3 const &  world) const
inline

Transform direction vector from world to local.

Definition at line 530 of file TPCGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::WorldToLocalVect().

531  { return fTrans.WorldToLocalVect<TVector3>(world); }
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:630
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.

Member Data Documentation

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

Box of the active volume.

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

Referenced by GetActiveVolumeCenter(), and TPCGeo().

double geo::TPCGeo::fActiveHalfHeight
private

Half height of active volume.

Definition at line 641 of file TPCGeo.h.

Referenced by ActiveHalfHeight(), and TPCGeo().

double geo::TPCGeo::fActiveHalfWidth
private

Half width of active volume.

Definition at line 640 of file TPCGeo.h.

Referenced by ActiveHalfWidth(), and TPCGeo().

double geo::TPCGeo::fActiveLength
private

Length of active volume.

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

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

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

Direction electrons drift along.

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

Referenced by DriftDirection(), and ResetDriftDirection().

double geo::TPCGeo::fHalfHeight
private

Half height of total volume.

Definition at line 644 of file TPCGeo.h.

Referenced by HalfHeight(), and TPCGeo().

double geo::TPCGeo::fHalfWidth
private

Half width of total volume.

Definition at line 643 of file TPCGeo.h.

Referenced by HalfWidth(), and TPCGeo().

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

Direction height refers to.

Definition at line 648 of file TPCGeo.h.

Referenced by HeightDir(), and TPCGeo().

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

ID of this TPC.

Definition at line 654 of file TPCGeo.h.

Referenced by ID(), and UpdateAfterSorting().

double geo::TPCGeo::fLength
private

Length of total volume.

Definition at line 645 of file TPCGeo.h.

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

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

Direction length refers to.

Definition at line 649 of file TPCGeo.h.

Referenced by LengthDir(), and TPCGeo().

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

Pitch between planes.

Definition at line 636 of file TPCGeo.h.

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

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

xyz locations of planes in the TPC.

Definition at line 637 of file TPCGeo.h.

Referenced by PlaneLocation(), and SortSubVolumes().

std::vector<PlaneGeo> geo::TPCGeo::fPlanes
private
TGeoVolume* geo::TPCGeo::fTotalVolume
private

Total volume of TPC, called volTPC in GDML file.

Definition at line 634 of file TPCGeo.h.

Referenced by TotalVolume(), and TPCGeo().

LocalTransformation_t geo::TPCGeo::fTrans
private

TPC-to-world transformation.

Definition at line 630 of file TPCGeo.h.

Referenced by LocalToWorld(), LocalToWorldVect(), toLocalCoords(), toWorldCoords(), TPCGeo(), WorldToLocal(), and WorldToLocalVect().

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

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

Definition at line 657 of file TPCGeo.h.

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

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

Direction width refers to.

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

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


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