12 #include "cetlib_except/exception.h" 19 #include "TGeoShape.h" 35 : fTrans(
std::move(trans))
36 , fTPCs(
std::move(TPCs))
37 , fOpDets(
std::move(OpDets))
38 , fVolume(node->GetVolume())
68 for (
unsigned int tpc = 0; tpc <
NTPC(); ++tpc)
77 throw cet::exception(
"TPCOutOfRange") <<
"Request for non-existant TPC " << itpc <<
"\n";
86 throw cet::exception(
"OpDetOutOfRange") <<
"Request for non-existant OpDet " << iopdet;
103 return tpc ? tpc->
ID() :
TPCID{};
114 <<
"Can't find any TPC for position " << point <<
" within " <<
ID() <<
"\n";
123 if (tpc.ContainsPosition(point, wiggle))
return &tpc;
130 return static_cast<TGeoBBox const*
>(
fVolume->GetShape())->GetDX();
136 return static_cast<TGeoBBox const*
>(
fVolume->GetShape())->GetDY();
142 return static_cast<TGeoBBox const*
>(
fVolume->GetShape())->GetDZ();
148 boundaries[0] =
MinX();
149 boundaries[1] =
MaxX();
150 boundaries[2] =
MinY();
151 boundaries[3] =
MaxY();
152 boundaries[4] =
MinZ();
153 boundaries[5] =
MaxZ();
158 unsigned int verbosity )
const 160 std::ostringstream sstr;
171 return (iOpDet == std::numeric_limits<double>::max()) ?
nullptr : &
OpDet(iOpDet);
177 unsigned int ClosestDet = std::numeric_limits<unsigned int>::max();
178 double ClosestDist = std::numeric_limits<double>::max();
180 for (
unsigned int o = 0U; o <
NOpDet(); ++o) {
182 if (ThisDist < ClosestDist) {
183 ClosestDist = ThisDist;
200 if (!dynamic_cast<TGeoBBox*>(
Volume()->GetShape())) {
203 <<
"Cryostat is not a box! (it is a " <<
Volume()->GetShape()->IsA()->GetName() <<
")\n";
IDparameter< geo::OpDetID > OpDetID
Member type of validated geo::OpDetID parameter.
void InitCryoBoundaries()
Fill the boundary information of the cryostat.
double HalfLength() const
Half height of the cryostat [cm].
Encapsulate the construction of a single cyostat .
OpDetGeo const & OpDet(unsigned int iopdet) const
Return the iopdet'th optical detector in the cryostat.
unsigned int GetClosestOpDet(Point_t const &point) const
TGeoVolume * fVolume
Total volume of cryostat, called volCryostat in GDML file.
GENVECTOR_CONSTEXPR Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
double MinX() const
Returns the world x coordinate of the start of the box.
Geometry information for a single TPC.
ElementIteratorBox IterateTPCs() const
Returns an object suitable for iterating through all TPCs.
double MaxX() const
Returns the world x coordinate of the end of the box.
OpDetList_t fOpDets
List of opdets in this cryostat.
CryostatGeo(TGeoNode const *node, TransformationMatrix &&trans, TPCList_t &&TPCs, OpDetList_t &&OpDets)
Construct a representation of a single cryostat of the detector.
std::vector< OpDetGeo > OpDetList_t
Type used internally to store the optical detectors.
OpDetGeo const * GetClosestOpDetPtr(Point_t const &point) const
Interface to algorithm class for sorting geo::AuxDet objects .
double DistanceToPoint(Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local cryostat frame to world frame.
void PrintCryostatInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this cryostat.
const TGeoVolume * Volume() const
Pointer to ROOT's volume descriptor.
TPCGeo const & PositionToTPC(Point_t const &point, double wiggle) const
Returns the ID of the TPC at specified location.
std::string indent(std::size_t const i)
double HalfWidth() const
Half width of the cryostat [cm].
double MinZ() const
Returns the world z coordinate of the start of the box.
void UpdateAfterSorting(CryostatID cryoid)
Performs all needed updates after geometry has sorted the cryostats.
TPCGeo const * TPCPtr(unsigned int itpc) const
Returns the TPC number itpc from this cryostat.
unsigned int NTPC() const
Number of TPCs in this cryostat.
CryostatID const & ID() const
Returns the identifier of this cryostat.
The data type to uniquely identify a TPC.
void sort(std::vector< CryostatGeo > &cryostats) const
double MaxY() const
Returns the world y coordinate of the end of the box.
double HalfHeight() const
Half height of the cryostat [cm].
TPCList_t const & ElementIteratorBox
Type returned by IterateElements().
std::string CryostatInfo(std::string indent="", unsigned int verbosity=1) const
Returns a string with cryostat information.
TPCID PositionToTPCID(Point_t const &point, double wiggle) const
Returns the ID of the TPC at specified location.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
TPCGeo const & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
TPCList_t fTPCs
List of tpcs in this cryostat.
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.
unsigned int NOpDet() const
Number of optical detectors in this TPC.
double MaxZ() const
Returns the world z coordinate of the end of the box.
Point3DBase_t< CryostatGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML cryostat frame.
std::vector< TPCGeo > TPCList_t
Type used internally to store the TPCs.
BoxBoundedGeo const & Boundaries() const
Returns boundaries of the cryostat (in centimetres).
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
void SortSubVolumes(GeoObjectSorter const &sorter)
Method to sort TPCGeo objects.
CryostatID fID
ID of this cryostat.
TPCGeo const * PositionToTPCptr(Point_t const &point, double wiggle) const
Returns a pointer to the TPC at specified location.
double MinY() const
Returns the world y coordinate of the start of the box.
TPCID const & ID() const
Returns the identifier of this TPC.
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.
cet::coded_exception< error, detail::translate > exception
The data type to uniquely identify a cryostat.
ElementIteratorBox IterateElements() const
Returns an object suitable for iterating through all TPCs.