14 #include "cetlib_except/exception.h" 20 #include "TGeoShape.h" 48 throw cet::exception(
"CryostatGeo") <<
"cannot find cryostat outline volume\n";
86 for (
unsigned int tpc = 0; tpc <
NTPC(); ++tpc)
97 throw cet::exception(
"TPCOutOfRange") <<
"Request for non-existant TPC " 110 throw cet::exception(
"OpDetOutOfRange") <<
"Request for non-existant OpDet " 127 (
double const worldLoc[3],
double wiggle)
const 153 <<
"Can't find any TPC for position " << point <<
" within " <<
ID()
164 if (tpc.ContainsPosition(point, wiggle))
return &tpc;
171 unsigned int maxPlanes = 0;
174 if (maxPlanesInTPC > maxPlanes) maxPlanes = maxPlanesInTPC;
181 unsigned int maxWires = 0;
184 if (maxWiresInTPC > maxWires) maxWires = maxWiresInTPC;
192 return static_cast<TGeoBBox
const*
>(
fVolume->GetShape())->GetDX();
198 return static_cast<TGeoBBox
const*
>(
fVolume->GetShape())->GetDY();
204 return static_cast<TGeoBBox
const*
>(
fVolume->GetShape())->GetDZ();
209 boundaries[0] =
MinX();
210 boundaries[1] =
MaxX();
211 boundaries[2] =
MinY();
212 boundaries[3] =
MaxY();
213 boundaries[4] =
MinZ();
214 boundaries[5] =
MaxZ();
222 std::ostringstream sstr;
243 for(
unsigned int o = 0U; o <
NOpDet(); ++o) {
245 if(ThisDist < ClosestDist) {
246 ClosestDist = ThisDist;
261 if (!dynamic_cast<TGeoBBox*>(
Volume()->GetShape())) {
263 throw cet::exception(
"CryostatGeo") <<
"Cryostat is not a box! (it is a " 264 <<
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.
static constexpr TPCID_t InvalidID
Special code for an invalid ID.
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.
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
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.
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.
static int max(int a, int b)
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].
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
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.
geo::TPCID::TPCID_t FindTPCAtPosition(double const worldLoc[3], double const wiggle) const
Returns the index of the TPC at specified location.
double DistanceToPoint(geo::Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
unsigned int TPCID_t
Type for the ID number.
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.
TPCID_t TPC
Index of the TPC within its cryostat.
The data type to uniquely identify a optical detector.
LArSoft geometry interface.
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.