14 #include "cetlib_except/exception.h" 21 #include "TGeoShape.h" 36 : fTrans(
std::move(trans)), fTPCs(
std::move(TPCs)), fOpDets(
std::move(OpDets)), fVolume(nullptr)
78 for (
unsigned int tpc = 0; tpc <
NTPC(); ++tpc)
88 throw cet::exception(
"TPCOutOfRange") <<
"Request for non-existant TPC " << itpc <<
"\n";
98 throw cet::exception(
"OpDetOutOfRange") <<
"Request for non-existant OpDet " << iopdet;
127 <<
"Can't find any TPC for position " << point <<
" within " <<
ID() <<
"\n";
136 if (tpc.ContainsPosition(point, wiggle))
return &tpc;
143 unsigned int maxPlanes = 0;
146 if (maxPlanesInTPC > maxPlanes) maxPlanes = maxPlanesInTPC;
154 unsigned int maxWires = 0;
157 if (maxWiresInTPC > maxWires) maxWires = maxWiresInTPC;
165 return static_cast<TGeoBBox const*
>(
fVolume->GetShape())->GetDX();
171 return static_cast<TGeoBBox const*
>(
fVolume->GetShape())->GetDY();
177 return static_cast<TGeoBBox const*
>(
fVolume->GetShape())->GetDZ();
183 boundaries[0] =
MinX();
184 boundaries[1] =
MaxX();
185 boundaries[2] =
MinY();
186 boundaries[3] =
MaxY();
187 boundaries[4] =
MinZ();
188 boundaries[5] =
MaxZ();
193 unsigned int verbosity )
const 195 std::ostringstream sstr;
206 return (iOpDet == std::numeric_limits<double>::max()) ?
nullptr : &
OpDet(iOpDet);
212 unsigned int ClosestDet = std::numeric_limits<unsigned int>::max();
213 double ClosestDist = std::numeric_limits<double>::max();
215 for (
unsigned int o = 0U; o <
NOpDet(); ++o) {
217 if (ThisDist < ClosestDist) {
218 ClosestDist = ThisDist;
236 if (!dynamic_cast<TGeoBBox*>(
Volume()->GetShape())) {
239 <<
"Cryostat is not a box! (it is a " <<
Volume()->GetShape()->IsA()->GetName() <<
")\n";
geo::TPCID const & ID() const
Returns the identifier of this TPC.
void InitCryoBoundaries()
Fill the boundary information of the cryostat.
unsigned int GetClosestOpDet(geo::Point_t const &point) const
virtual void SortTPCs(std::vector< geo::TPCGeo > &tgeo) const =0
double HalfLength() const
Half height of the cryostat [cm].
std::vector< geo::OpDetGeo > OpDetList_t
Type used internally to store the optical detectors.
Encapsulate the construction of a single cyostat.
unsigned int MaxPlanes() const
Returns the largest number of planes among the TPCs in this cryostat.
TGeoVolume * fVolume
Total volume of cryostat, called volCryostat in GDML file.
unsigned int Nplanes() const
Number of planes in this tpc.
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.
std::vector< geo::TPCGeo > TPCList_t
Type used internally to store the 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, geo::TransformationMatrix &&trans, TPCList_t &&TPCs, OpDetList_t &&OpDets)
Construct a representation of a single cryostat of the detector.
void SortSubVolumes(geo::GeoObjectSorter const &sorter)
Apply sorting to the PlaneGeo objects.
virtual void SortOpDets(std::vector< geo::OpDetGeo > &opdet) const
geo::TPCGeo const * PositionToTPCptr(geo::Point_t const &point, double wiggle) const
Returns a pointer to the TPC at specified location.
std::string fOpDetGeoName
Name of opdet geometry elements in gdml.
Interface to algorithm class for sorting geo::XXXGeo objects.
void SortSubVolumes(geo::GeoObjectSorter const &sorter)
Method to sort TPCGeo objects.
void PrintCryostatInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this cryostat.
geo::OpDetGeo const * GetClosestOpDetPtr(geo::Point_t const &point) const
const TGeoVolume * Volume() const
Pointer to ROOT's volume descriptor.
const OpDetGeo & OpDet(unsigned int iopdet) const
Return the iopdet'th optical detector in the cryostat.
geo::Point3DBase_t< CryostatGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML cryostat frame.
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.
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.
geo::CryostatID fID
ID of this cryostat.
The data type to uniquely identify a TPC.
unsigned int MaxWires() const
Returns the largest number of wires among the planes in this TPC.
unsigned int MaxWires() const
Returns the largest number of wires among the TPCs in this cryostat.
void UpdateAfterSorting(geo::CryostatID cryoid)
Performs all needed updates after geometry has sorted the cryostats.
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.
double DistanceToPoint(geo::Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
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.
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
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.
geo::BoxBoundedGeo const & Boundaries() const
Returns boundaries of the cryostat (in centimetres).
TPCGeo const & PositionToTPC(geo::Point_t const &point, double wiggle) const
Returns the ID of the TPC at specified location.
The data type to uniquely identify a optical detector.
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
Namespace collecting geometry-related classes utilities.
double MinY() const
Returns the world y coordinate of the start of the box.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local cryostat frame to world frame.
geo::TPCID PositionToTPCID(geo::Point_t const &point, double wiggle) const
Returns the ID of the TPC at specified location.
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.
geo::CryostatID const & ID() const
Returns the identifier of this cryostat.
ElementIteratorBox IterateElements() const
Returns an object suitable for iterating through all TPCs.