LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geo::CryostatGeo Class Reference

Geometry information for a single cryostat. More...

#include "CryostatGeo.h"

Inheritance diagram for geo::CryostatGeo:
geo::BoxBoundedGeo

Classes

struct  CryostatGeoCoordinatesTag
 Tag for vectors in the "local" GDML coordinate frame of the cryostat. More...
 

Public Types

using ID_t = CryostatID
 
using TPCList_t = std::vector< geo::TPCGeo >
 Type used internally to store the TPCs. More...
 
using OpDetList_t = std::vector< geo::OpDetGeo >
 Type used internally to store the optical detectors. More...
 
using GeoNodePath_t = geo::WireGeo::GeoNodePath_t
 
using ElementIteratorBox = TPCList_t const &
 Type returned by IterateElements(). 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 cryostat 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::CryostatGeo have the same type but are not compatible.

using LocalPoint_t = geo::Point3DBase_t< CryostatGeoCoordinatesTag >
 Type of points in the local GDML cryostat frame. More...
 
using LocalVector_t = geo::Vector3DBase_t< CryostatGeoCoordinatesTag >
 Type of displacement vectors in the local GDML cryostat frame. More...
 

Public Member Functions

 CryostatGeo (TGeoNode const &node, geo::TransformationMatrix &&trans, TPCList_t &&TPCs, OpDetList_t &&OpDets)
 Construct a representation of a single cryostat of the detector. More...
 
void SortSubVolumes (geo::GeoObjectSorter const &sorter)
 Method to sort TPCGeo objects. More...
 
void UpdateAfterSorting (geo::CryostatID cryoid)
 Performs all needed updates after geometry has sorted the cryostats. More...
 
TPC access
unsigned int NTPC () const
 Number of TPCs in this cryostat. More...
 
unsigned int NElements () const
 Alias for NTPC(). More...
 
bool HasTPC (unsigned int itpc) const
 Returns whether a TPC with index itpc is present in this cryostat. More...
 
bool HasElement (unsigned int itpc) const
 Alias for HasTPC(). More...
 
bool HasTPC (geo::TPCID const &tpcid) const
 Returns whether the TPC in tpcid is present in this cryostat. More...
 
bool HasElement (geo::TPCID const &tpcid) const
 Alias for HasTPC(geo::TPCID const&) More...
 
const TPCGeoTPC (unsigned int itpc) const
 Return the itpc'th TPC in the cryostat. More...
 
const TPCGeoTPC (TPCID const &tpcid) const
 Returns the TPC in tpcid from this cryostat. More...
 
const TPCGeoGetElement (TPCID const &tpcid) const
 Alias for TPC(). More...
 
ElementIteratorBox IterateElements () const
 Returns an object suitable for iterating through all TPCs. More...
 
ElementIteratorBox IterateTPCs () const
 Returns an object suitable for iterating through all TPCs. More...
 
TPCGeo const * TPCPtr (unsigned int itpc) const
 Returns the TPC number itpc from this cryostat. More...
 
TPCGeo const * TPCPtr (TPCID const &tpcid) const
 Returns the TPC in tpcid from this cryostat. More...
 
TPCGeo const * GetElementPtr (TPCID const &tpcid) const
 Alias for TPCPtr(). More...
 
geo::TPCID PositionToTPCID (geo::Point_t const &point, double wiggle) const
 Returns the ID of the TPC at specified location. More...
 
TPCGeo const & PositionToTPC (geo::Point_t const &point, double wiggle) const
 Returns the ID of the TPC at specified location. More...
 
TPCGeo const & PositionToTPC (double const worldLoc[3], double wiggle) const
 Returns the ID of the TPC at specified location. More...
 
geo::TPCGeo const * PositionToTPCptr (geo::Point_t const &point, double wiggle) const
 Returns a pointer to the TPC at specified location. More...
 
unsigned int MaxPlanes () const
 Returns the largest number of planes among the TPCs in this cryostat. More...
 
unsigned int MaxWires () const
 Returns the largest number of wires among the TPCs in this cryostat. More...
 
Optical detector access
unsigned int NOpDet () const
 Number of optical detectors in this TPC. More...
 
const OpDetGeoOpDet (unsigned int iopdet) const
 Return the iopdet'th optical detector in the cryostat. More...
 
unsigned int GetClosestOpDet (geo::Point_t const &point) const
 
unsigned int GetClosestOpDet (double const *point) const
 
geo::OpDetGeo const * GetClosestOpDetPtr (geo::Point_t const &point) const
 
std::string OpDetGeoName () const
 Get name of opdet geometry element. More...
 
Coordinate transformation
geo::Point_t toWorldCoords (LocalPoint_t const &local) const
 Transform point from local cryostat frame to world frame. More...
 
geo::Vector_t toWorldCoords (LocalVector_t const &local) const
 Transform direction vector from local to world. More...
 
LocalPoint_t toLocalCoords (geo::Point_t const &world) const
 Transform point from world frame to local cryostat frame. More...
 
LocalVector_t toLocalCoords (geo::Vector_t const &world) const
 Transform direction vector from world to local. More...
 
Dimension queries
double MinX () const
 Returns the world x coordinate of the start of the box. More...
 
double MaxX () const
 Returns the world x coordinate of the end of the box. More...
 
double CenterX () const
 Returns the world x coordinate of the center of the box. More...
 
double SizeX () const
 Returns the full size in the X dimension. More...
 
double HalfSizeX () const
 Returns the size from the center to the border on X dimension. More...
 
double MinY () const
 Returns the world y coordinate of the start of the box. More...
 
double MaxY () const
 Returns the world y coordinate of the end of the box. More...
 
double CenterY () const
 Returns the world y coordinate of the center of the box. More...
 
double SizeY () const
 Returns the full size in the Y dimension. More...
 
double HalfSizeY () const
 Returns the size from the center to the border on Y dimension. More...
 
double MinZ () const
 Returns the world z coordinate of the start of the box. More...
 
double MaxZ () const
 Returns the world z coordinate of the end of the box. More...
 
double CenterZ () const
 Returns the world z coordinate of the center of the box. More...
 
double SizeZ () const
 Returns the full size in the Z dimension. More...
 
double HalfSizeZ () const
 Returns the size from the center to the border on Z dimension. More...
 
geo::Point_t Min () const
 Returns the corner point with the smallest coordinates. More...
 
geo::Point_t Max () const
 Returns the corner point with the largest coordinates. More...
 
geo::Point_t Center () const
 Returns the center point of the box. More...
 
Containment in the full volume
bool ContainsX (double x, double const wiggle=1) const
 Returns whether this TPC contains the specified world x coordinate. More...
 
bool ContainsY (double y, double const wiggle=1) const
 Returns whether this TPC contains the specified world y coordinate. More...
 
bool ContainsZ (double z, double const wiggle=1) const
 Returns whether this TPC contains the specified world z coordinate. More...
 
bool ContainsYZ (double y, double z, double const wiggle=1) const
 Returns if TPC contains the specified world y and z coordinates. More...
 
bool ContainsPosition (geo::Point_t const &point, double wiggle=1.0) const
 Returns whether this volume contains the specified point. More...
 
bool ContainsPosition (TVector3 const &point, double wiggle=1.0) const
 
bool ContainsPosition (double const *point, double wiggle=1.0) const
 
Containment in a fiducial volume
bool InFiducialX (double x, double neg_margin, double pos_margin) const
 Returns whether TPC fiducial volume contains world x coordinate. More...
 
bool InFiducialX (double x, double margin) const
 Returns whether TPC fiducial volume contains world x coordinate. More...
 
bool InFiducialY (double y, double neg_margin, double pos_margin) const
 Returns whether TPC fiducial volume contains world y coordinate. More...
 
bool InFiducialY (double y, double margin) const
 Returns whether TPC fiducial volume contains world y coordinate. More...
 
bool InFiducialZ (double z, double neg_margin, double pos_margin) const
 Returns whether TPC fiducial volume contains world z coordinate. More...
 
bool InFiducialZ (double z, double margin) const
 Returns whether TPC fiducial volume contains world z coordinate. More...
 
Overlaps
bool OverlapsX (geo::BoxBoundedGeo const &other) const
 Returns if the x coordinates covered by this and other box overlap. More...
 
bool OverlapsY (geo::BoxBoundedGeo const &other) const
 Returns if the y coordinates covered by this and other box overlap. More...
 
bool OverlapsZ (geo::BoxBoundedGeo const &other) const
 Returns if the z coordinates covered by this and other box overlap. More...
 
bool Overlaps (geo::BoxBoundedGeo const &other) const
 Returns if this and other box overlap. More...
 
Setting dimensions
void SetBoundaries (Coord_t x_min, Coord_t x_max, Coord_t y_min, Coord_t y_max, Coord_t z_min, Coord_t z_max)
 Sets the boundaries in world coordinates as specified. More...
 
void SetBoundaries (Coords_t lower, Coords_t upper)
 Sets the boundaries in world coordinates as specified. More...
 
void ExtendToInclude (Coord_t x, Coord_t y, Coord_t z)
 Extends the current box to also include the specified point. More...
 
void ExtendToInclude (geo::Point_t const &point)
 Extends the current box to also include the specified point. More...
 
void ExtendToInclude (BoxBoundedGeo const &box)
 Extends the current box to also include the specified one. More...
 
std::vector< TVector3 > GetIntersections (TVector3 const &TrajectoryStart, TVector3 const &TrajectoryDirect) const
 Calculates the entry and exit points of a trajectory on the box surface. More...
 
std::vector< geo::Point_tGetIntersections (geo::Point_t const &TrajectoryStart, geo::Vector_t const &TrajectoryDirect) const
 Calculates the entry and exit points of a trajectory on the box surface. More...
 

Static Public Member Functions

static bool CoordinateContained (double c, double min, double max, double wiggle=1.)
 Returns whether the specified coordinate is in a range. More...
 
static bool CoordinateContained (double c, double const *range, double wiggle=1.)
 Returns whether the specified coordinate is in a range. More...
 
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...
 

Private Types

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

Private Member Functions

void FindTPC (std::vector< const TGeoNode * > &path, unsigned int depth)
 
void MakeTPC (std::vector< const TGeoNode * > &path, int depth)
 
void FindOpDet (std::vector< const TGeoNode * > &path, unsigned int depth)
 
void MakeOpDet (std::vector< const TGeoNode * > &path, int depth)
 
void InitCryoBoundaries ()
 Fill the boundary information of the cryostat. More...
 

Private Attributes

LocalTransformation_t fTrans
 Cryostat-to-world transformation. More...
 
TPCList_t fTPCs
 List of tpcs in this cryostat. More...
 
OpDetList_t fOpDets
 List of opdets in this cryostat. More...
 
TGeoVolume * fVolume
 Total volume of cryostat, called volCryostat in GDML file. More...
 
std::string fOpDetGeoName
 Name of opdet geometry elements in gdml. More...
 
geo::CryostatID fID
 ID of this cryostat. More...
 

Cryostat geometry information

static constexpr unsigned int MaxVerbosity = 3
 Maximum verbosity supported by PrintCryostatInfo(). More...
 
double HalfWidth () const
 Half width of the cryostat [cm]. More...
 
double HalfHeight () const
 Half height of the cryostat [cm]. More...
 
double HalfLength () const
 Half height of the cryostat [cm]. More...
 
double Width () const
 Full width of the cryostat [cm]. More...
 
double Height () const
 Full height of the cryostat [cm]. More...
 
double Length () const
 Length of the cryostat [cm]. More...
 
double Mass () const
 Mass of the cryostat. More...
 
const TGeoVolume * Volume () const
 Pointer to ROOT's volume descriptor. More...
 
geo::BoxBoundedGeo const & Boundaries () const
 Returns boundaries of the cryostat (in centimetres). More...
 
void Boundaries (double *boundaries) const
 Fills boundaries of the cryostat (in centimetres). More...
 
geo::Point_t GetCenter () const
 Returns the geometrical center of the cryostat. More...
 
geo::BoxBoundedGeo const & BoundingBox () const
 Returns the bounding box of this cryostat. More...
 
geo::CryostatID const & ID () const
 Returns the identifier of this cryostat. More...
 
template<typename Stream >
void PrintCryostatInfo (Stream &&out, std::string indent="", unsigned int verbosity=1) const
 Prints information about this cryostat. More...
 
std::string CryostatInfo (std::string indent="", unsigned int verbosity=1) const
 Returns a string with cryostat information. More...
 

Detailed Description

Geometry information for a single cryostat.

Definition at line 43 of file CryostatGeo.h.

Member Typedef Documentation

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

Type of the coordinate.

Definition at line 36 of file BoxBoundedGeo.h.

Type of the coordinate triplet.

Definition at line 35 of file BoxBoundedGeo.h.

Type returned by IterateElements().

Definition at line 57 of file CryostatGeo.h.

Definition at line 46 of file CryostatGeo.h.

Type of points in the local GDML cryostat frame.

Definition at line 79 of file CryostatGeo.h.

Definition at line 391 of file CryostatGeo.h.

Type of displacement vectors in the local GDML cryostat frame.

Definition at line 82 of file CryostatGeo.h.

Type used internally to store the optical detectors.

Definition at line 52 of file CryostatGeo.h.

Type used internally to store the TPCs.

Definition at line 49 of file CryostatGeo.h.

Constructor & Destructor Documentation

geo::CryostatGeo::CryostatGeo ( TGeoNode const &  node,
geo::TransformationMatrix &&  trans,
TPCList_t &&  TPCs,
OpDetList_t &&  OpDets 
)

Construct a representation of a single cryostat of the detector.

Definition at line 32 of file CryostatGeo.cxx.

References fOpDetGeoName, fVolume, InitCryoBoundaries(), and MF_LOG_DEBUG.

36  : fTrans(std::move(trans)), fTPCs(std::move(TPCs)), fOpDets(std::move(OpDets)), fVolume(nullptr)
37  {
38 
39  // all planes are going to be contained in the volume named volCryostat
40  // now get the total volume of the Cryostat
41  fVolume = node.GetVolume();
42  if (!fVolume) throw cet::exception("CryostatGeo") << "cannot find cryostat outline volume\n";
43 
44  MF_LOG_DEBUG("Geometry") << "cryostat volume is " << fVolume->GetName();
45 
46  // set the bounding box
48 
49  // Set OpDetName;
50  fOpDetGeoName = "volOpDetSensitive";
51  }
void InitCryoBoundaries()
Fill the boundary information of the cryostat.
TGeoVolume * fVolume
Total volume of cryostat, called volCryostat in GDML file.
Definition: CryostatGeo.h:396
OpDetList_t fOpDets
List of opdets in this cryostat.
Definition: CryostatGeo.h:395
std::string fOpDetGeoName
Name of opdet geometry elements in gdml.
Definition: CryostatGeo.h:397
TPCList_t fTPCs
List of tpcs in this cryostat.
Definition: CryostatGeo.h:394
#define MF_LOG_DEBUG(id)
LocalTransformation_t fTrans
Cryostat-to-world transformation.
Definition: CryostatGeo.h:393
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Function Documentation

geo::BoxBoundedGeo const& geo::CryostatGeo::Boundaries ( ) const
inline

Returns boundaries of the cryostat (in centimetres).

Returns
boundaries in a geo::BoxBoundedGeo

Definition at line 114 of file CryostatGeo.h.

References BoundingBox().

Referenced by opdet::SimPhotonCounter::beginJob(), evgen::PhotonGen::beginRun(), GetCenter(), and phot::PhotonVisibilityService::reconfigure().

114 { return BoundingBox(); }
geo::BoxBoundedGeo const & BoundingBox() const
Returns the bounding box of this cryostat.
Definition: CryostatGeo.h:124
void geo::CryostatGeo::Boundaries ( double *  boundaries) const

Fills boundaries of the cryostat (in centimetres).

Parameters
boundariesfilled as: [0] -x [1] +x [2] -y [3] +y [4] -z [5] +z

Definition at line 181 of file CryostatGeo.cxx.

References geo::BoxBoundedGeo::MaxX(), geo::BoxBoundedGeo::MaxY(), geo::BoxBoundedGeo::MaxZ(), geo::BoxBoundedGeo::MinX(), geo::BoxBoundedGeo::MinY(), and geo::BoxBoundedGeo::MinZ().

182  {
183  boundaries[0] = MinX();
184  boundaries[1] = MaxX();
185  boundaries[2] = MinY();
186  boundaries[3] = MaxY();
187  boundaries[4] = MinZ();
188  boundaries[5] = MaxZ();
189  } // CryostatGeo::CryostatBoundaries(double*)
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 MinZ() const
Returns the world z coordinate of the start of the box.
double MaxY() const
Returns the world y coordinate of the end of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
double MinY() const
Returns the world y coordinate of the start of the box.
geo::BoxBoundedGeo const& geo::CryostatGeo::BoundingBox ( ) const
inline

Returns the bounding box of this cryostat.

Definition at line 124 of file CryostatGeo.h.

Referenced by Boundaries(), PrintCryostatInfo(), and phot::PhotonVisibilityService::reconfigure().

125  {
126  return static_cast<geo::BoxBoundedGeo const&>(*this);
127  }
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
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(), GetCenter(), and geo::PlaneGeo::UpdatePlaneNormal().

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

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

Definition at line 96 of file BoxBoundedGeo.h.

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

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

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

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

Definition at line 111 of file BoxBoundedGeo.h.

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

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

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

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

Definition at line 126 of file BoxBoundedGeo.h.

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

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

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

Returns whether this volume contains the specified point.

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

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

Definition at line 210 of file BoxBoundedGeo.h.

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

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

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

Definition at line 24 of file BoxBoundedGeo.cxx.

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

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

Definition at line 30 of file BoxBoundedGeo.cxx.

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

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

Returns whether this TPC contains the specified world x coordinate.

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

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

Definition at line 158 of file BoxBoundedGeo.h.

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

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

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

Returns whether this TPC contains the specified world y coordinate.

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

Definition at line 170 of file BoxBoundedGeo.h.

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

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

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

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

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

Definition at line 195 of file BoxBoundedGeo.h.

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

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

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

Returns whether this TPC contains the specified world z coordinate.

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

Definition at line 182 of file BoxBoundedGeo.h.

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

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

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

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 359 of file BoxBoundedGeo.h.

Referenced by geo::BoxBoundedGeo::ContainsX(), geo::BoxBoundedGeo::ContainsY(), geo::BoxBoundedGeo::ContainsZ(), geo::BoxBoundedGeo::CoordinateContained(), geo::BoxBoundedGeo::InFiducialX(), geo::BoxBoundedGeo::InFiducialY(), and geo::BoxBoundedGeo::InFiducialZ().

360  {
361  return (c >= (min > 0 ? min / wiggle : min * wiggle)) &&
362  (c <= (max < 0 ? max / wiggle : max * wiggle));
363  } // CoordinateContained()
static bool geo::BoxBoundedGeo::CoordinateContained ( double  c,
double const *  range,
double  wiggle = 1. 
)
inlinestaticinherited

Returns whether the specified coordinate is in a range.

Parameters
cthe coordinate
rangepointer to [ lower boundary, upper boundary ] of the range
wiggleexpansion factor for the range
Returns
whether the specified coordinate is in a range
See also
CoordinateContained(double, double, double, double)

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 376 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::CoordinateContained().

377  {
378  return CoordinateContained(c, range[0], range[1], wiggle);
379  }
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
std::string geo::CryostatGeo::CryostatInfo ( std::string  indent = "",
unsigned int  verbosity = 1 
) const

Returns a string with cryostat information.

See also
PrintCryostatInfo()

The arguments and provided information are the same as in PrintCryostatInfo().

Definition at line 192 of file CryostatGeo.cxx.

References PrintCryostatInfo().

Referenced by ID().

194  {
195  std::ostringstream sstr;
196  PrintCryostatInfo(sstr, indent, verbosity);
197  return sstr.str();
198  } // CryostatGeo::CryostatInfo()
void PrintCryostatInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this cryostat.
Definition: CryostatGeo.h:406
std::string indent(std::size_t const i)
void geo::BoxBoundedGeo::ExtendToInclude ( Coord_t  x,
Coord_t  y,
Coord_t  z 
)
inlineinherited

Extends the current box to also include the specified point.

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

Definition at line 423 of file BoxBoundedGeo.h.

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

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

Extends the current box to also include the specified point.

Parameters
pointcoordinates of the point to include

Definition at line 432 of file BoxBoundedGeo.h.

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

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

Extends the current box to also include the specified one.

Parameters
boxthe box to include

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

Definition at line 444 of file BoxBoundedGeo.h.

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

445  {
446  set_min(c_min, box.Min());
447  set_max(c_max, box.Max());
448  } // ExtendToInclude()
static void set_min(Coord_t &var, Coord_t value)
Sets var to value if value is smaller than the current var value.
static void set_max(Coord_t &var, Coord_t value)
Sets var to value if value is larger than the current var value.
Coords_t c_max
maximum coordinates (x, y, z)
Coords_t c_min
minimum coordinates (x, y, z)
void geo::CryostatGeo::FindOpDet ( std::vector< const TGeoNode * > &  path,
unsigned int  depth 
)
private

Referenced by toLocalCoords().

void geo::CryostatGeo::FindTPC ( std::vector< const TGeoNode * > &  path,
unsigned int  depth 
)
private

Referenced by toLocalCoords().

geo::Point_t geo::CryostatGeo::GetCenter ( ) const
inline

Returns the geometrical center of the cryostat.

Definition at line 121 of file CryostatGeo.h.

References Boundaries(), and geo::BoxBoundedGeo::Center().

Referenced by PrintCryostatInfo().

121 { return Boundaries().Center(); }
geo::BoxBoundedGeo const & Boundaries() const
Returns boundaries of the cryostat (in centimetres).
Definition: CryostatGeo.h:114
geo::Point_t Center() const
Returns the center point of the box.
unsigned int geo::CryostatGeo::GetClosestOpDet ( geo::Point_t const &  point) const

Returns the index of the optical detector in this cryostat closest to point.

Definition at line 210 of file CryostatGeo.cxx.

References geo::OpDetGeo::DistanceToPoint(), NOpDet(), and OpDet().

Referenced by GetClosestOpDet(), geo::GeometryCore::GetClosestOpDet(), GetClosestOpDetPtr(), and NOpDet().

211  {
212  unsigned int ClosestDet = std::numeric_limits<unsigned int>::max();
213  double ClosestDist = std::numeric_limits<double>::max();
214 
215  for (unsigned int o = 0U; o < NOpDet(); ++o) {
216  double const ThisDist = OpDet(o).DistanceToPoint(point);
217  if (ThisDist < ClosestDist) {
218  ClosestDist = ThisDist;
219  ClosestDet = o;
220  }
221  } // for
222  return ClosestDet;
223  } // CryostatGeo::GetClosestOpDet(geo::Point_t)
const OpDetGeo & OpDet(unsigned int iopdet) const
Return the iopdet&#39;th optical detector in the cryostat.
Definition: CryostatGeo.cxx:95
double DistanceToPoint(geo::Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
Definition: OpDetGeo.cxx:98
unsigned int NOpDet() const
Number of optical detectors in this TPC.
Definition: CryostatGeo.h:321
unsigned int geo::CryostatGeo::GetClosestOpDet ( double const *  point) const
See also
GetClosestOpDet(geo::Point_t const&) const

Definition at line 226 of file CryostatGeo.cxx.

References GetClosestOpDet(), and geo::vect::makePointFromCoords().

227  {
229  }
unsigned int GetClosestOpDet(geo::Point_t const &point) const
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
geo::OpDetGeo const * geo::CryostatGeo::GetClosestOpDetPtr ( geo::Point_t const &  point) const

Returns the optical detector det in this cryostat nearest to point. If there are no optical detectors, nullptr is returned.

Definition at line 203 of file CryostatGeo.cxx.

References GetClosestOpDet(), and OpDet().

Referenced by NOpDet().

204  {
205  unsigned int iOpDet = GetClosestOpDet(point);
206  return (iOpDet == std::numeric_limits<double>::max()) ? nullptr : &OpDet(iOpDet);
207  }
unsigned int GetClosestOpDet(geo::Point_t const &point) const
const OpDetGeo & OpDet(unsigned int iopdet) const
Return the iopdet&#39;th optical detector in the cryostat.
Definition: CryostatGeo.cxx:95
const TPCGeo& geo::CryostatGeo::GetElement ( TPCID const &  tpcid) const
inline

Alias for TPC().

Definition at line 216 of file CryostatGeo.h.

References IterateElements(), and TPC().

216 { return TPC(tpcid); }
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:84
TPCGeo const* geo::CryostatGeo::GetElementPtr ( TPCID const &  tpcid) const
inline

Alias for TPCPtr().

Definition at line 271 of file CryostatGeo.h.

References PositionToTPC(), PositionToTPCID(), and TPCPtr().

271 { return TPCPtr(tpcid); }
TPCGeo const * TPCPtr(unsigned int itpc) const
Returns the TPC number itpc from this cryostat.
Definition: CryostatGeo.h:256
std::vector< TVector3 > geo::BoxBoundedGeo::GetIntersections ( TVector3 const &  TrajectoryStart,
TVector3 const &  TrajectoryDirect 
) const
inherited

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

Author
Christoph Rudolf von Rohr (crohr.nosp@m.@fna.nosp@m.l.gov)
Date
July 27th, 2015
Parameters
TrajectoryStartposition of the trajectory source
TrajectoryDirectdirection vector of the trajectory

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

Definition at line 125 of file BoxBoundedGeo.cxx.

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

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

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

Author
Christoph Rudolf von Rohr (crohr.nosp@m.@fna.nosp@m.l.gov)
Date
July 27th, 2015
Parameters
TrajectoryStartposition of the trajectory source
TrajectoryDirectdirection vector of the trajectory

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

Definition at line 36 of file BoxBoundedGeo.cxx.

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

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

Half height of the cryostat [cm].

Definition at line 169 of file CryostatGeo.cxx.

References fVolume.

Referenced by geo::GeometryCore::CryostatHalfHeight(), Height(), and InitCryoBoundaries().

170  {
171  return static_cast<TGeoBBox const*>(fVolume->GetShape())->GetDY();
172  }
TGeoVolume * fVolume
Total volume of cryostat, called volCryostat in GDML file.
Definition: CryostatGeo.h:396
double geo::CryostatGeo::HalfLength ( ) const

Half height of the cryostat [cm].

Definition at line 175 of file CryostatGeo.cxx.

References fVolume.

Referenced by InitCryoBoundaries(), and Length().

176  {
177  return static_cast<TGeoBBox const*>(fVolume->GetShape())->GetDZ();
178  }
TGeoVolume * fVolume
Total volume of cryostat, called volCryostat in GDML file.
Definition: CryostatGeo.h:396
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::CryostatGeo::HalfWidth ( ) const

Half width of the cryostat [cm].

Definition at line 163 of file CryostatGeo.cxx.

References fVolume.

Referenced by geo::GeometryCore::CryostatHalfWidth(), InitCryoBoundaries(), and Width().

164  {
165  return static_cast<TGeoBBox const*>(fVolume->GetShape())->GetDX();
166  }
TGeoVolume * fVolume
Total volume of cryostat, called volCryostat in GDML file.
Definition: CryostatGeo.h:396
bool geo::CryostatGeo::HasElement ( unsigned int  itpc) const
inline

Alias for HasTPC().

Definition at line 187 of file CryostatGeo.h.

References HasTPC().

187 { return HasTPC(itpc); }
bool HasTPC(unsigned int itpc) const
Returns whether a TPC with index itpc is present in this cryostat.
Definition: CryostatGeo.h:184
bool geo::CryostatGeo::HasElement ( geo::TPCID const &  tpcid) const
inline

Alias for HasTPC(geo::TPCID const&)

Definition at line 199 of file CryostatGeo.h.

References HasTPC(), and TPC().

199 { return HasTPC(tpcid); }
bool HasTPC(unsigned int itpc) const
Returns whether a TPC with index itpc is present in this cryostat.
Definition: CryostatGeo.h:184
bool geo::CryostatGeo::HasTPC ( unsigned int  itpc) const
inline

Returns whether a TPC with index itpc is present in this cryostat.

Parameters
itpcindex of TPC in this cryostat
Returns
whether the TPC with index itpc is present in this cryostat

Definition at line 184 of file CryostatGeo.h.

References NTPC().

Referenced by HasElement(), geo::GeometryCore::HasTPC(), and TPCPtr().

184 { return itpc < NTPC(); }
unsigned int NTPC() const
Number of TPCs in this cryostat.
Definition: CryostatGeo.h:175
bool geo::CryostatGeo::HasTPC ( geo::TPCID const &  tpcid) const
inline

Returns whether the TPC in tpcid is present in this cryostat.

Parameters
tpcidfull TPC ID
Returns
whether the TPC in tpcid is present in this cryostat

The cryostat number in tpcid is ignored, as it is ignored whether tpcid is invalid.

Definition at line 197 of file CryostatGeo.h.

References HasTPC(), and geo::TPCID::TPC.

Referenced by HasTPC().

197 { return HasTPC(tpcid.TPC); }
bool HasTPC(unsigned int itpc) const
Returns whether a TPC with index itpc is present in this cryostat.
Definition: CryostatGeo.h:184
double geo::CryostatGeo::Height ( ) const
inline

Full height of the cryostat [cm].

Definition at line 104 of file CryostatGeo.h.

References HalfHeight().

Referenced by PrintCryostatInfo().

104 { return 2. * HalfHeight(); }
double HalfHeight() const
Half height of the cryostat [cm].
geo::CryostatID const& geo::CryostatGeo::ID ( ) const
inline

Returns the identifier of this cryostat.

Definition at line 130 of file CryostatGeo.h.

References CryostatInfo(), fID, art::detail::indent(), and PrintCryostatInfo().

Referenced by geo::GeometryCore::FindTPCAtPosition(), geo::GeometryCore::GetClosestOpDet(), geo::GeometryCore::PositionToCryostatID(), PositionToTPC(), and PrintCryostatInfo().

130 { return fID; }
geo::CryostatID fID
ID of this cryostat.
Definition: CryostatGeo.h:398
bool geo::BoxBoundedGeo::InFiducialX ( double  x,
double  neg_margin,
double  pos_margin 
) const
inlineinherited

Returns whether TPC fiducial volume contains world x coordinate.

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

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

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

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

Definition at line 243 of file BoxBoundedGeo.h.

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

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

Returns whether TPC fiducial volume contains world x coordinate.

See also
InFiducialX(double, double, double) const

Margins are symmetric.

Definition at line 253 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialX().

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

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

Returns whether TPC fiducial volume contains world y coordinate.

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

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

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

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

Definition at line 273 of file BoxBoundedGeo.h.

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

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

Returns whether TPC fiducial volume contains world y coordinate.

See also
InFiducialY(double, double, double) const

Margins are symmetric.

Definition at line 283 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialY().

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

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

Returns whether TPC fiducial volume contains world z coordinate.

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

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

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

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

Definition at line 303 of file BoxBoundedGeo.h.

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

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

Returns whether TPC fiducial volume contains world z coordinate.

See also
InFiducialZ(double, double, double) const

Margins are symmetric.

Definition at line 313 of file BoxBoundedGeo.h.

References geo::BoxBoundedGeo::InFiducialZ().

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

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

Fill the boundary information of the cryostat.

Definition at line 232 of file CryostatGeo.cxx.

References HalfHeight(), HalfLength(), HalfWidth(), geo::BoxBoundedGeo::SetBoundaries(), toWorldCoords(), and Volume().

Referenced by CryostatGeo(), and toLocalCoords().

233  {
234 
235  // check that this is indeed a box
236  if (!dynamic_cast<TGeoBBox*>(Volume()->GetShape())) {
237  // at initialisation time we don't know yet our real ID
238  throw cet::exception("CryostatGeo")
239  << "Cryostat is not a box! (it is a " << Volume()->GetShape()->IsA()->GetName() << ")\n";
240  }
241 
242  // get the half width, height, etc of the cryostat
243  const double halflength = HalfLength();
244  const double halfwidth = HalfWidth();
245  const double halfheight = HalfHeight();
246 
247  SetBoundaries(toWorldCoords(LocalPoint_t{-halfwidth, -halfheight, -halflength}),
248  toWorldCoords(LocalPoint_t{+halfwidth, +halfheight, +halflength}));
249 
250  } // CryostatGeo::InitCryoBoundaries()
double HalfLength() const
Half height of the cryostat [cm].
const TGeoVolume * Volume() const
Pointer to ROOT&#39;s volume descriptor.
Definition: CryostatGeo.h:110
geo::Point3DBase_t< CryostatGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML cryostat frame.
Definition: CryostatGeo.h:79
double HalfWidth() const
Half width of the cryostat [cm].
double HalfHeight() const
Half height of the cryostat [cm].
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.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local cryostat frame to world frame.
Definition: CryostatGeo.h:347
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
auto geo::CryostatGeo::IterateElements ( ) const

Returns an object suitable for iterating through all TPCs.

See also
IterateTPCs()

The returned value can be used in a range-for loop like:

for (geo::TPCGeo const& tpc: cryo.IterateElements()) { ... }

The resulting sequence exposes the TPCs within the cryostat in their ID order, from TPC 0 to NTPC() - 1.

This method is designed for templated code, where the object obj.IterateElements() may be a geo::CryostatGeo or some other one. For non-template code, prefer IterateTPCs() for clarity.

Definition at line 105 of file CryostatGeo.cxx.

References fTPCs.

Referenced by GetElement(), and IterateTPCs().

106  {
107  return fTPCs;
108  }
TPCList_t fTPCs
List of tpcs in this cryostat.
Definition: CryostatGeo.h:394
ElementIteratorBox geo::CryostatGeo::IterateTPCs ( ) const
inline

Returns an object suitable for iterating through all TPCs.

See also
IterateElements()

The returned value can be used in a range-for loop like:

for (geo::TPCGeo const& tpc: cryo.IterateTPCs()) { ... }

The resulting sequence exposes the TPCs within the cryostat in their ID order, from TPC 0 to NTPC() - 1.

A version of this functionality designed for template code is provided under the generic name IterateElements().

Definition at line 249 of file CryostatGeo.h.

References IterateElements().

Referenced by PositionToTPCptr().

249 { return IterateElements(); }
ElementIteratorBox IterateElements() const
Returns an object suitable for iterating through all TPCs.
double geo::CryostatGeo::Length ( ) const
inline

Length of the cryostat [cm].

Definition at line 106 of file CryostatGeo.h.

References HalfLength().

Referenced by geo::GeometryCore::CryostatLength(), and PrintCryostatInfo().

106 { return 2. * HalfLength(); }
double HalfLength() const
Half height of the cryostat [cm].
void geo::CryostatGeo::MakeOpDet ( std::vector< const TGeoNode * > &  path,
int  depth 
)
private

Referenced by toLocalCoords().

void geo::CryostatGeo::MakeTPC ( std::vector< const TGeoNode * > &  path,
int  depth 
)
private

Referenced by toLocalCoords().

double geo::CryostatGeo::Mass ( ) const
inline

Mass of the cryostat.

Definition at line 108 of file CryostatGeo.h.

References fVolume.

108 { return fVolume->Weight(); }
TGeoVolume * fVolume
Total volume of cryostat, called volCryostat in GDML file.
Definition: CryostatGeo.h:396
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(), PrintCryostatInfo(), and geo::TPCGeo::PrintTPCInfo().

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

Returns the largest number of planes among the TPCs in this cryostat.

Definition at line 141 of file CryostatGeo.cxx.

References fTPCs, geo::TPCGeo::Nplanes(), and TPC().

Referenced by ems::MultiEMShowers::convCluster(), geo::GeometryCore::GetEndPlaneID(), ems::EMShower3D::LinkCandidates(), PositionToTPC(), and PrintCryostatInfo().

142  {
143  unsigned int maxPlanes = 0;
144  for (geo::TPCGeo const& TPC : fTPCs) {
145  unsigned int maxPlanesInTPC = TPC.Nplanes();
146  if (maxPlanesInTPC > maxPlanes) maxPlanes = maxPlanesInTPC;
147  } // for
148  return maxPlanes;
149  } // CryostatGeo::MaxPlanes()
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:137
Geometry information for a single TPC.
Definition: TPCGeo.h:36
TPCList_t fTPCs
List of tpcs in this cryostat.
Definition: CryostatGeo.h:394
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:84
unsigned int geo::CryostatGeo::MaxWires ( ) const

Returns the largest number of wires among the TPCs in this cryostat.

Definition at line 152 of file CryostatGeo.cxx.

References fTPCs, geo::TPCGeo::MaxWires(), and TPC().

Referenced by geo::GeometryCore::GetEndWireID(), PositionToTPC(), and PrintCryostatInfo().

153  {
154  unsigned int maxWires = 0;
155  for (geo::TPCGeo const& TPC : fTPCs) {
156  unsigned int maxWiresInTPC = TPC.MaxWires();
157  if (maxWiresInTPC > maxWires) maxWires = maxWiresInTPC;
158  } // for
159  return maxWires;
160  } // CryostatGeo::MaxWires()
Geometry information for a single TPC.
Definition: TPCGeo.h:36
unsigned int MaxWires() const
Returns the largest number of wires among the planes in this TPC.
Definition: TPCGeo.cxx:284
TPCList_t fTPCs
List of tpcs in this cryostat.
Definition: CryostatGeo.h:394
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:84
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(), PrintCryostatInfo(), and geo::TPCGeo::PrintTPCInfo().

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

Alias for NTPC().

Definition at line 177 of file CryostatGeo.h.

References fTPCs.

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

177 { return fTPCs.size(); }
TPCList_t fTPCs
List of tpcs in this cryostat.
Definition: CryostatGeo.h:394
unsigned int geo::CryostatGeo::NOpDet ( ) const
inline
unsigned int geo::CryostatGeo::NTPC ( ) const
inline
const OpDetGeo & geo::CryostatGeo::OpDet ( unsigned int  iopdet) const

Return the iopdet'th optical detector in the cryostat.

Definition at line 95 of file CryostatGeo.cxx.

References fOpDets.

Referenced by cosmic::BeamFlashTrackMatchTaggerAlg::FillFlashProperties(), opdet::FlashHypothesisAnaAlg::FillOpDetPositions(), GetClosestOpDet(), GetClosestOpDetPtr(), NOpDet(), and geo::GeometryCore::OpDetGeoFromOpDet().

96  {
97  if (iopdet >= fOpDets.size()) {
98  throw cet::exception("OpDetOutOfRange") << "Request for non-existant OpDet " << iopdet;
99  }
100 
101  return fOpDets[iopdet];
102  }
OpDetList_t fOpDets
List of opdets in this cryostat.
Definition: CryostatGeo.h:395
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::string geo::CryostatGeo::OpDetGeoName ( ) const
inline

Get name of opdet geometry element.

Definition at line 337 of file CryostatGeo.h.

References fOpDetGeoName.

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

337 { return fOpDetGeoName; }
std::string fOpDetGeoName
Name of opdet geometry elements in gdml.
Definition: CryostatGeo.h:397
bool geo::BoxBoundedGeo::Overlaps ( geo::BoxBoundedGeo const &  other) const
inlineinherited

Returns if this and other box overlap.

Definition at line 340 of file BoxBoundedGeo.h.

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

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

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

Definition at line 322 of file BoxBoundedGeo.h.

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

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

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

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

Definition at line 328 of file BoxBoundedGeo.h.

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

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

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

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

Definition at line 334 of file BoxBoundedGeo.h.

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

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

335  {
336  return std::min(MaxZ(), other.MaxZ()) > std::max(MinZ(), other.MinZ());
337  }
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
TPCGeo const & geo::CryostatGeo::PositionToTPC ( geo::Point_t const &  point,
double  wiggle 
) const

Returns the ID of the TPC at specified location.

Parameters
pointthe location (world reference frame)
wigglea small factor (like 1+epsilon) to avoid rounding errors
Returns
the ID of the TPC at the specified point (invalid ID if none)

Definition at line 122 of file CryostatGeo.cxx.

References ID(), and PositionToTPCptr().

Referenced by GetElementPtr(), and PositionToTPC().

123  {
124  geo::TPCGeo const* tpc = PositionToTPCptr(point, wiggle);
125  if (!tpc) {
126  throw cet::exception("CryostatGeo")
127  << "Can't find any TPC for position " << point << " within " << ID() << "\n";
128  }
129  return *tpc;
130  }
Geometry information for a single TPC.
Definition: TPCGeo.h:36
geo::TPCGeo const * PositionToTPCptr(geo::Point_t const &point, double wiggle) const
Returns a pointer to the TPC at specified location.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::CryostatID const & ID() const
Returns the identifier of this cryostat.
Definition: CryostatGeo.h:130
TPCGeo const& geo::CryostatGeo::PositionToTPC ( double const  worldLoc[3],
double  wiggle 
) const
inline

Returns the ID of the TPC at specified location.

Parameters
worldLoc3D coordinates of the point (world reference frame)
wigglea small factor (like 1+epsilon) to avoid rounding errors
Returns
the ID of the TPC at the specified point (invalid ID if none)

Definition at line 294 of file CryostatGeo.h.

References geo::vect::makePointFromCoords(), MaxPlanes(), MaxWires(), PositionToTPC(), and PositionToTPCptr().

295  {
296  return PositionToTPC(geo::vect::makePointFromCoords(worldLoc), wiggle);
297  }
TPCGeo const & PositionToTPC(geo::Point_t const &point, double wiggle) const
Returns the ID of the TPC at specified location.
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
geo::TPCID geo::CryostatGeo::PositionToTPCID ( geo::Point_t const &  point,
double  wiggle 
) const

Returns the ID of the TPC at specified location.

Parameters
point3D coordinates of the point (world reference frame)
wigglea small factor (like 1+epsilon) to avoid rounding errors
Returns
the ID of the TPC at the specified point (invalid ID if none)

Definition at line 113 of file CryostatGeo.cxx.

References geo::TPCGeo::ID(), and PositionToTPCptr().

Referenced by geo::GeometryCore::FindTPCAtPosition(), and GetElementPtr().

114  {
115  geo::TPCGeo const* tpc = PositionToTPCptr(point, wiggle);
116  return tpc ? tpc->ID() : geo::TPCID{};
117  }
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:270
Geometry information for a single TPC.
Definition: TPCGeo.h:36
geo::TPCGeo const * PositionToTPCptr(geo::Point_t const &point, double wiggle) const
Returns a pointer to the TPC at specified location.
The data type to uniquely identify a TPC.
Definition: geo_types.h:381
geo::TPCGeo const * geo::CryostatGeo::PositionToTPCptr ( geo::Point_t const &  point,
double  wiggle 
) const

Returns a pointer to the TPC at specified location.

Parameters
pointposition in space [cm]
wigglea small factor (like 1+ε) to avoid rounding errors
Returns
a pointer to the geo::TPCGeo at point (nullptr if none)

Definition at line 133 of file CryostatGeo.cxx.

References IterateTPCs().

Referenced by PositionToTPC(), PositionToTPCID(), and geo::GeometryCore::PositionToTPCptr().

134  {
135  for (auto const& tpc : IterateTPCs())
136  if (tpc.ContainsPosition(point, wiggle)) return &tpc;
137  return nullptr;
138  } // CryostatGeo::PositionToTPCptr()
ElementIteratorBox IterateTPCs() const
Returns an object suitable for iterating through all TPCs.
Definition: CryostatGeo.h:249
template<typename Stream >
void geo::CryostatGeo::PrintCryostatInfo ( Stream &&  out,
std::string  indent = "",
unsigned int  verbosity = 1 
) const

Prints information about this cryostat.

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 cryostat ID
  • 1 _(default)_: also center and size
  • 2: also number of TPCs, optical detectors, and maximum wires per plane
  • and of planes for TPC
  • 3: also information on bounding box

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

Definition at line 406 of file CryostatGeo.h.

References BoundingBox(), GetCenter(), Height(), ID(), Length(), geo::BoxBoundedGeo::Max(), MaxPlanes(), MaxWires(), geo::BoxBoundedGeo::Min(), NOpDet(), NTPC(), and Width().

Referenced by CryostatInfo(), and ID().

410 {
411 
412  //----------------------------------------------------------------------------
413  out << "Cryostat " << std::string(ID());
414 
415  if (verbosity-- <= 0) return; // 0
416 
417  //----------------------------------------------------------------------------
418  out << " (" << Width() << " x " << Height() << " x " << Length() << ") cm^3 at " << GetCenter();
419 
420  if (verbosity-- <= 0) return; // 1
421 
422  //----------------------------------------------------------------------------
423 
424  out << "\n"
425  << indent << "hosts " << NTPC() << " TPCs (largest number of planes: " << MaxPlanes()
426  << ", of wires: " << MaxWires() << ") and " << NOpDet() << " optical detectors";
427 
428  if (verbosity-- <= 0) return; // 2
429 
430  //----------------------------------------------------------------------------
431  // print also the containing box
432  geo::BoxBoundedGeo const& box = BoundingBox();
433  out << "\n" << indent << "bounding box: " << box.Min() << " -- " << box.Max();
434 
435  // if (verbosity-- <= 0) return; // 3
436 
437  //----------------------------------------------------------------------------
438 } // geo::CryostatGeo::PrintCryostatInfo()
geo::Point_t GetCenter() const
Returns the geometrical center of the cryostat.
Definition: CryostatGeo.h:121
unsigned int MaxPlanes() const
Returns the largest number of planes among the TPCs in this cryostat.
geo::BoxBoundedGeo const & BoundingBox() const
Returns the bounding box of this cryostat.
Definition: CryostatGeo.h:124
double Height() const
Full height of the cryostat [cm].
Definition: CryostatGeo.h:104
std::string indent(std::size_t const i)
double Width() const
Full width of the cryostat [cm].
Definition: CryostatGeo.h:102
unsigned int NTPC() const
Number of TPCs in this cryostat.
Definition: CryostatGeo.h:175
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 TPCs in this cryostat.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
unsigned int NOpDet() const
Number of optical detectors in this TPC.
Definition: CryostatGeo.h:321
geo::Point_t Max() const
Returns the corner point with the largest coordinates.
double Length() const
Length of the cryostat [cm].
Definition: CryostatGeo.h:106
geo::CryostatID const & ID() const
Returns the identifier of this cryostat.
Definition: CryostatGeo.h:130
static void geo::BoxBoundedGeo::set_max ( Coord_t var,
Coord_t  value 
)
inlinestaticinherited

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

Definition at line 479 of file BoxBoundedGeo.h.

References value.

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

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

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

Definition at line 493 of file BoxBoundedGeo.h.

494  {
495  if (value.X() > var.X()) var.SetX(value.X());
496  if (value.Y() > var.Y()) var.SetY(value.Y());
497  if (value.Z() > var.Z()) var.SetZ(value.Z());
498  }
double value
Definition: spectrum.C:18
static void geo::BoxBoundedGeo::set_min ( Coord_t var,
Coord_t  value 
)
inlinestaticinherited

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

Definition at line 473 of file BoxBoundedGeo.h.

References value.

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

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

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

Definition at line 485 of file BoxBoundedGeo.h.

486  {
487  if (value.X() < var.X()) var.SetX(value.X());
488  if (value.Y() < var.Y()) var.SetY(value.Y());
489  if (value.Z() < var.Z()) var.SetZ(value.Z());
490  }
double value
Definition: spectrum.C:18
void geo::BoxBoundedGeo::SetBoundaries ( Coord_t  x_min,
Coord_t  x_max,
Coord_t  y_min,
Coord_t  y_max,
Coord_t  z_min,
Coord_t  z_max 
)
inlineinherited

Sets the boundaries in world coordinates as specified.

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

Definition at line 393 of file BoxBoundedGeo.h.

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

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

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

Sets the boundaries in world coordinates as specified.

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

Definition at line 410 of file BoxBoundedGeo.h.

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

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

Returns the full size in the X dimension.

Definition at line 99 of file BoxBoundedGeo.h.

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

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

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

Returns the full size in the Y dimension.

Definition at line 114 of file BoxBoundedGeo.h.

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

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

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

Returns the full size in the Z dimension.

Definition at line 129 of file BoxBoundedGeo.h.

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

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

129 { return MaxZ() - MinZ(); }
double MinZ() const
Returns the world z coordinate of the start of the box.
double MaxZ() const
Returns the world z coordinate of the end of the box.
void geo::CryostatGeo::SortSubVolumes ( geo::GeoObjectSorter const &  sorter)

Method to sort TPCGeo objects.

Definition at line 55 of file CryostatGeo.cxx.

References fOpDets, fTPCs, geo::GeoObjectSorter::SortOpDets(), geo::TPCGeo::SortSubVolumes(), geo::GeoObjectSorter::SortTPCs(), and TPC().

Referenced by toLocalCoords().

56  {
57  sorter.SortTPCs(fTPCs);
58 
59  for (geo::TPCGeo& TPC : fTPCs) {
60  TPC.SortSubVolumes(sorter);
61  }
62 
63  sorter.SortOpDets(fOpDets);
64  } // CryostatGeo::SortSubVolumes()
Geometry information for a single TPC.
Definition: TPCGeo.h:36
OpDetList_t fOpDets
List of opdets in this cryostat.
Definition: CryostatGeo.h:395
void SortSubVolumes(geo::GeoObjectSorter const &sorter)
Apply sorting to the PlaneGeo objects.
Definition: TPCGeo.cxx:191
TPCList_t fTPCs
List of tpcs in this cryostat.
Definition: CryostatGeo.h:394
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:84
LocalPoint_t geo::CryostatGeo::toLocalCoords ( geo::Point_t const &  world) const
inline

Transform point from world frame to local cryostat frame.

Definition at line 359 of file CryostatGeo.h.

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

360  {
361  return fTrans.toLocalCoords(world);
362  }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Cryostat-to-world transformation.
Definition: CryostatGeo.h:393
LocalVector_t geo::CryostatGeo::toLocalCoords ( geo::Vector_t const &  world) const
inline

Transform direction vector from world to local.

Definition at line 365 of file CryostatGeo.h.

References FindOpDet(), FindTPC(), fTrans, InitCryoBoundaries(), MakeOpDet(), MakeTPC(), SortSubVolumes(), geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toLocalCoords(), and UpdateAfterSorting().

366  {
367  return fTrans.toLocalCoords(world);
368  }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Cryostat-to-world transformation.
Definition: CryostatGeo.h:393
geo::Point_t geo::CryostatGeo::toWorldCoords ( LocalPoint_t const &  local) const
inline

Transform point from local cryostat frame to world frame.

Definition at line 347 of file CryostatGeo.h.

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

Referenced by InitCryoBoundaries(), and geo::sortCryoStandard().

348  {
349  return fTrans.toWorldCoords(local);
350  }
LocalTransformation_t fTrans
Cryostat-to-world transformation.
Definition: CryostatGeo.h:393
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
geo::Vector_t geo::CryostatGeo::toWorldCoords ( LocalVector_t const &  local) const
inline

Transform direction vector from local to world.

Definition at line 353 of file CryostatGeo.h.

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

354  {
355  return fTrans.toWorldCoords(local);
356  }
LocalTransformation_t fTrans
Cryostat-to-world transformation.
Definition: CryostatGeo.h:393
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
const TPCGeo & geo::CryostatGeo::TPC ( unsigned int  itpc) const

Return the itpc'th TPC in the cryostat.

Exceptions
cet::exception(category "TPCOutOfRange") if no such TPC

Definition at line 84 of file CryostatGeo.cxx.

References TPCPtr().

Referenced by geo::buildDriftVolumes(), GetElement(), groupTPCsByDriftDir(), HasElement(), geo::ChannelMapStandardAlg::Initialize(), trkf::SpacePointAlg::makeSpacePoints(), MaxPlanes(), MaxWires(), phot::PhotonVisibilityService::reconfigure(), SortSubVolumes(), and geo::GeometryCore::TPC().

85  {
86  TPCGeo const* pTPC = TPCPtr(itpc);
87  if (!pTPC) {
88  throw cet::exception("TPCOutOfRange") << "Request for non-existant TPC " << itpc << "\n";
89  }
90 
91  return *pTPC;
92  }
TPCGeo const * TPCPtr(unsigned int itpc) const
Returns the TPC number itpc from this cryostat.
Definition: CryostatGeo.h:256
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
const TPCGeo& geo::CryostatGeo::TPC ( TPCID const &  tpcid) const
inline

Returns the TPC in tpcid from this cryostat.

Parameters
tpcidfull TPC ID
Returns
a constant reference to the TPC in tpcid
Exceptions
cet::exception(category "TPCOutOfRange") if no such TPC

The cryostat number in tpcid is ignored, as it is ignored whether tpcid is invalid.

Definition at line 214 of file CryostatGeo.h.

References TPC(), and geo::TPCID::TPC.

Referenced by TPC().

214 { return TPC(tpcid.TPC); }
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:84
TPCGeo const* geo::CryostatGeo::TPCPtr ( unsigned int  itpc) const
inline

Returns the TPC number itpc from this cryostat.

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

Definition at line 256 of file CryostatGeo.h.

References fTPCs, and HasTPC().

Referenced by GetElementPtr(), TPC(), and geo::GeometryCore::TPCPtr().

257  {
258  return HasTPC(itpc) ? &(fTPCs[itpc]) : nullptr;
259  }
TPCList_t fTPCs
List of tpcs in this cryostat.
Definition: CryostatGeo.h:394
bool HasTPC(unsigned int itpc) const
Returns whether a TPC with index itpc is present in this cryostat.
Definition: CryostatGeo.h:184
TPCGeo const* geo::CryostatGeo::TPCPtr ( TPCID const &  tpcid) const
inline

Returns the TPC in tpcid from this cryostat.

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

The cryostat number in tpcid is ignored, as it is ignored whether tpcid is invalid.

Definition at line 269 of file CryostatGeo.h.

References geo::TPCID::TPC, and TPCPtr().

Referenced by TPCPtr().

269 { return TPCPtr(tpcid.TPC); }
TPCGeo const * TPCPtr(unsigned int itpc) const
Returns the TPC number itpc from this cryostat.
Definition: CryostatGeo.h:256
void geo::CryostatGeo::UpdateAfterSorting ( geo::CryostatID  cryoid)

Performs all needed updates after geometry has sorted the cryostats.

Definition at line 67 of file CryostatGeo.cxx.

References fID, fOpDets, fTPCs, NOpDet(), and NTPC().

Referenced by toLocalCoords().

68  {
69 
70  // update the cryostat ID
71  fID = cryoid;
72 
73  // trigger all the optical detectors to update
74  for (unsigned int opdet = 0; opdet < NOpDet(); ++opdet)
76 
77  // trigger all the TPCs to update as well
78  for (unsigned int tpc = 0; tpc < NTPC(); ++tpc)
80 
81  } // CryostatGeo::UpdateAfterSorting()
OpDetList_t fOpDets
List of opdets in this cryostat.
Definition: CryostatGeo.h:395
unsigned int NTPC() const
Number of TPCs in this cryostat.
Definition: CryostatGeo.h:175
geo::CryostatID fID
ID of this cryostat.
Definition: CryostatGeo.h:398
The data type to uniquely identify a TPC.
Definition: geo_types.h:381
void UpdateAfterSorting(geo::CryostatID cryoid)
Performs all needed updates after geometry has sorted the cryostats.
Definition: CryostatGeo.cxx:67
TPCList_t fTPCs
List of tpcs in this cryostat.
Definition: CryostatGeo.h:394
unsigned int NOpDet() const
Number of optical detectors in this TPC.
Definition: CryostatGeo.h:321
The data type to uniquely identify a optical detector.
Definition: geo_types.h:297
const TGeoVolume* geo::CryostatGeo::Volume ( ) const
inline

Pointer to ROOT's volume descriptor.

Definition at line 110 of file CryostatGeo.h.

References fVolume.

Referenced by geo::GeometryCore::GetCryostatVolumeName(), and InitCryoBoundaries().

110 { return fVolume; }
TGeoVolume * fVolume
Total volume of cryostat, called volCryostat in GDML file.
Definition: CryostatGeo.h:396
double geo::CryostatGeo::Width ( ) const
inline

Full width of the cryostat [cm].

Definition at line 102 of file CryostatGeo.h.

References HalfWidth().

Referenced by PrintCryostatInfo().

102 { return 2. * HalfWidth(); }
double HalfWidth() const
Half width of the cryostat [cm].

Member Data Documentation

geo::CryostatID geo::CryostatGeo::fID
private

ID of this cryostat.

Definition at line 398 of file CryostatGeo.h.

Referenced by ID(), and UpdateAfterSorting().

std::string geo::CryostatGeo::fOpDetGeoName
private

Name of opdet geometry elements in gdml.

Definition at line 397 of file CryostatGeo.h.

Referenced by CryostatGeo(), and OpDetGeoName().

OpDetList_t geo::CryostatGeo::fOpDets
private

List of opdets in this cryostat.

Definition at line 395 of file CryostatGeo.h.

Referenced by NOpDet(), OpDet(), SortSubVolumes(), and UpdateAfterSorting().

TPCList_t geo::CryostatGeo::fTPCs
private

List of tpcs in this cryostat.

Definition at line 394 of file CryostatGeo.h.

Referenced by IterateElements(), MaxPlanes(), MaxWires(), NElements(), NTPC(), SortSubVolumes(), TPCPtr(), and UpdateAfterSorting().

LocalTransformation_t geo::CryostatGeo::fTrans
private

Cryostat-to-world transformation.

Definition at line 393 of file CryostatGeo.h.

Referenced by toLocalCoords(), and toWorldCoords().

TGeoVolume* geo::CryostatGeo::fVolume
private

Total volume of cryostat, called volCryostat in GDML file.

Definition at line 396 of file CryostatGeo.h.

Referenced by CryostatGeo(), HalfHeight(), HalfLength(), HalfWidth(), Mass(), and Volume().

constexpr unsigned int geo::CryostatGeo::MaxVerbosity = 3
static

Maximum verbosity supported by PrintCryostatInfo().

Definition at line 166 of file CryostatGeo.h.


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