LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
geo::Geometry Class Reference

The geometry of one entire detector, as served by art. More...

#include "Geometry.h"

Inheritance diagram for geo::Geometry:
geo::GeometryCore geo::Iterable< details::GeometryIterationPolicy, details::ToGeometryElement >

Public Types

using provider_type = GeometryCore
 type of service provider More...
 
using CryostatList_t = std::vector< CryostatGeo >
 

Public Member Functions

 Geometry (fhicl::ParameterSet const &pset)
 
provider_type const * provider () const
 Returns a pointer to the geometry service provider. More...
 
sumdata::GeometryConfigurationInfo const & configurationInfo () const
 Returns the current geometry configuration information. More...
 
double DefaultWiggle () const
 Returns the tolerance used in looking for positions. More...
 
std::string const & GDMLFile () const
 Returns the full directory path to the GDML file source. More...
 
std::vector< TGeoNode const * > FindAllVolumes (std::set< std::string > const &vol_names) const
 Returns all the nodes with volumes with any of the specified names. More...
 
std::vector< std::vector< TGeoNode const * > > FindAllVolumePaths (std::set< std::string > const &vol_names) const
 Returns paths of all nodes with volumes with the specified names. More...
 
TGeoMaterial const * Material (Point_t const &point) const
 Returns the material at the specified position. More...
 
template<typename Stream >
void Print (Stream &&out, std::string indent=" ") const
 Prints geometry information with maximum verbosity. More...
 
std::string Info (std::string indent=" ") const
 Returns a string with complete geometry information. More...
 
bool HasElement (TPCID const &tpcid) const
 Returns whether we have the specified TPC. More...
 
CryostatGeo const * PositionToCryostatPtr (Point_t const &point) const
 Returns the cryostat at specified location. More...
 
CryostatID PositionToCryostatID (Point_t const &point) const
 Returns the ID of the cryostat at specified location. More...
 
bool HasTPC (TPCID const &tpcid) const
 Returns whether we have the specified TPC. More...
 
TPCGeo const * PositionToTPCptr (Point_t const &point) const
 Returns the TPC at specified location. More...
 
TPCID PositionToTPCID (Point_t const &point) const
 Returns the ID of the TPC at specified location. More...
 
std::string OpDetGeoName (CryostatID const &cid=details::cryostat_zero) const
 Returns gdml string which gives sensitive opdet name. More...
 
CryostatList_t const & Cryostats () const noexcept
 
Detector information
std::string const & DetectorName () const
 Returns a string with the name of the detector, as configured. More...
 
TGeoVolume const * WorldVolume () const
 Returns a pointer to the world volume. More...
 
void WorldBox (double *xlo, double *xhi, double *ylo, double *yhi, double *zlo, double *zhi) const
 Fills the arguments with the boundaries of the world. More...
 
BoxBoundedGeo WorldBox () const
 
Length_t SurfaceY () const
 The position of the detector respect to earth surface. More...
 
TGeoManager * ROOTGeoManager () const
 Access to the ROOT geometry description manager. More...
 
std::string const & GetWorldVolumeName () const
 Return the name of the world volume (needed by Geant4 simulation) More...
 
BoxBoundedGeo DetectorEnclosureBox (std::string const &name="volDetEnclosure") const
 
std::string VolumeName (Point_t const &point) const
 Returns the name of the deepest volume containing specified point. More...
 
std::string MaterialName (Point_t const &point) const
 Name of the deepest material containing the point xyz. More...
 
double TotalMass () const
 Returns the total mass [kg] of the specified volume (default: world). More...
 
double TotalMass (std::string vol) const
 Returns the total mass [kg] of the specified volume (default: world). More...
 
double MassBetweenPoints (Point_t const &p1, Point_t const &p2) const
 Returns the column density between two points. More...
 
Cryostat access and information
unsigned int Ncryostats () const
 Returns the number of cryostats in the detector. More...
 
unsigned int NElements () const
 Returns the number of cryostats in the detector. More...
 
unsigned int NSiblingElements (CryostatID const &) const
 Returns the number of cryostats in the detector. More...
 
TPC access and information
unsigned int NElements (CryostatID const &cryoid) const
 Returns the largest number of TPCs a cryostat in the detector has. More...
 
unsigned int NSiblingElements (TPCID const &tpcid) const
 Returns the largest number of TPCs a cryostat in the detector has. More...
 
unsigned int MaxTPCs () const
 Returns the largest number of TPCs a cryostat in the detector has. More...
 
unsigned int TotalNTPC () const
 Returns the total number of TPCs in the detector. More...
 
unsigned int NTPC (CryostatID const &cryoid=details::cryostat_zero) const
 Returns the total number of TPCs in the specified cryostat. More...
 
bool HasCryostat (CryostatID const &cryoid) const
 Returns whether we have the specified cryostat. More...
 
bool HasElement (CryostatID const &cryoid) const
 Returns whether we have the specified cryostat. More...
 
CryostatGeo const & Cryostat (CryostatID const &cryoid=details::cryostat_zero) const
 Returns the specified cryostat. More...
 
CryostatGeo const & GetElement (CryostatID const &cryoid) const
 Returns the specified cryostat. More...
 
TPCGeo const & GetElement (TPCID const &tpcid) const
 Returns the specified TPC. More...
 
TPCGeo const & TPC (TPCID const &tpcid=details::tpc_zero) const
 Returns the specified TPC. More...
 
CryostatGeo const * CryostatPtr (CryostatID const &cryoid) const
 Returns the specified cryostat. More...
 
CryostatGeo const * GetElementPtr (CryostatID const &cryoid) const
 Returns the specified cryostat. More...
 
TPCGeo const * GetElementPtr (TPCID const &tpcid) const
 Returns the specified TPC. More...
 
TPCGeo const * TPCPtr (TPCID const &tpcid) const
 Returns the specified TPC. More...
 
CryostatGeo const & PositionToCryostat (Point_t const &point) const
 Returns the cryostat at specified location. More...
 
TPCID FindTPCAtPosition (Point_t const &point) const
 Returns the ID of the TPC at specified location. More...
 
TPCGeo const & PositionToTPC (Point_t const &point) const
 Returns the TPC at specified location. More...
 
Optical detector geometry access and information

See also
optical detector channel information

There are a number of ways to identify an optical detector or channel:

  • geometric:
    • cryostat (e.g. geo::CryostatID) and relative optical detector number within it
    • unique optical detector number
  • readout:
    • optical detector channel
    • "hardware" channel

And they all should be better documented!

unsigned int NOpDets () const
 Number of OpDets in the whole detector. More...
 
OpDetGeo const & OpDetGeoFromOpDet (unsigned int OpDet) const
 Returns the geo::OpDetGeo object for the given detector number. More...
 
unsigned int GetClosestOpDet (Point_t const &point) const
 Find the nearest OpChannel to some point. More...
 
Optical readout channels
unsigned int OpDetFromCryo (unsigned int o, unsigned int c) const
 Get unique opdet number from cryo and internal count. More...
 

Private Member Functions

Configuration information checks
void FillGeometryConfigurationInfo (fhicl::ParameterSet const &config)
 Fills the service configuration information into fConfInfo. More...
 

Private Attributes

sumdata::GeometryConfigurationInfo fConfInfo
 Summary of service configuration. More...
 

Detailed Description

The geometry of one entire detector, as served by art.

This class extends the interface of the geometry service provider, geo::GeometryCore, to the one of an art service.

Configuration

In addition to the parameters documented in geo::GeometryCore, the following parameters are supported:

  • Builder (a parameter set: default: empty): configuration for the geometry builder; if omitted, the standard builder (geo::GeometryBuilderStandard) with standard configuration will be used; if specified, currently the standard builder is nevertheless used; this interface can be "toolized", in which case this parameter set will select and configure the chosen tool.
  • SortingParameters (a parameter set; default: empty): this configuration is used to create a GeoObjectSorter tool, which sorts the LArSoft geometry objects.

Definition at line 42 of file Geometry.h.

Member Typedef Documentation

using geo::GeometryCore::CryostatList_t = std::vector<CryostatGeo>
inherited

Definition at line 95 of file GeometryCore.h.

type of service provider

Definition at line 44 of file Geometry.h.

Constructor & Destructor Documentation

geo::Geometry::Geometry ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 31 of file Geometry.cc.

References FillGeometryConfigurationInfo(), and fhicl::ParameterSet::get().

32  : GeometryCore{
33  pset,
34  std::make_unique<GeometryBuilderStandard>(pset.get<fhicl::ParameterSet>("Builder", {})),
35  art::make_tool<GeoObjectSorter>(pset.get<fhicl::ParameterSet>("SortingParameters", {}))}
36 {
38 }
void FillGeometryConfigurationInfo(fhicl::ParameterSet const &config)
Fills the service configuration information into fConfInfo.
Definition: Geometry.cc:41
GeometryCore(fhicl::ParameterSet const &pset, std::unique_ptr< GeometryBuilder > builder, std::unique_ptr< GeoObjectSorter > sorter)
Initialize geometry from a given configuration.

Member Function Documentation

sumdata::GeometryConfigurationInfo const& geo::Geometry::configurationInfo ( ) const
inline

Returns the current geometry configuration information.

Definition at line 52 of file Geometry.h.

References fConfInfo, and FillGeometryConfigurationInfo().

52 { return fConfInfo; }
sumdata::GeometryConfigurationInfo fConfInfo
Summary of service configuration.
Definition: Geometry.h:65
CryostatGeo const & geo::GeometryCore::Cryostat ( CryostatID const &  cryoid = details::cryostat_zero) const
inherited

Returns the specified cryostat.

Parameters
cryoidcryostat ID
Returns
a constant reference to the specified cryostat
Exceptions
cet::exception(GeometryCore category) if cryostat not present

The GetElement() method is overloaded and its return depends on the type of ID.

Todo:
Make the cryostat number mandatory (as CryostatID)

Definition at line 150 of file GeometryCore.cxx.

References geo::CryostatID::Cryostat, and geo::GeometryCore::CryostatPtr().

Referenced by phot::PDFastSimANN::beginJob(), opdet::SimPhotonCounter::beginJob(), larg4::LArG4::beginJob(), evgen::PhotonGen::beginRun(), larg4::LArVoxelReadoutGeometry::Construct(), detinfo::DetectorPropertiesStandard::DataFor(), cosmic::BeamFlashTrackMatchTaggerAlg::FillFlashProperties(), opdet::FlashHypothesisAnaAlg::FillOpDetPositions(), simfilter::FilterNoDirtNeutrinos::filter(), geo::GeometryCore::GetElement(), geo::GeometryCore::HasElement(), trkf::SpacePointAlg::makeSpacePoints(), geo::GeometryCore::OpDetFromCryo(), geo::GeometryCore::OpDetGeoFromOpDet(), evgen::PhotonGen::PhotonGen(), larg4::LArG4::produce(), phot::PhotonVisibilityService::reconfigure(), and geo::GeometryCore::TPC().

151  {
152  if (auto pCryo = CryostatPtr(cryoid)) { return *pCryo; }
153  throw cet::exception("GeometryCore") << "Cryostat #" << cryoid.Cryostat << " does not exist\n";
154  }
CryostatGeo const * CryostatPtr(CryostatID const &cryoid) const
Returns the specified cryostat.
Definition: GeometryCore.h:345
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
CryostatGeo const* geo::GeometryCore::CryostatPtr ( CryostatID const &  cryoid) const
inlineinherited

Returns the specified cryostat.

Parameters
cryoidcryostat ID
Returns
a constant pointer to the specified cryostat, or nullptr if none

The GetElementPtr() method is overloaded and its return depends on the type of ID.

Definition at line 345 of file GeometryCore.h.

References geo::CryostatID::Cryostat, geo::GeometryCore::fCryostats, and geo::GeometryCore::HasCryostat().

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

346  {
347  return HasCryostat(cryoid) ? &fCryostats[cryoid.Cryostat] : nullptr;
348  }
CryostatList_t fCryostats
Definition: GeometryCore.h:605
bool HasCryostat(CryostatID const &cryoid) const
Returns whether we have the specified cryostat.
Definition: GeometryCore.h:318
CryostatList_t const& geo::GeometryCore::Cryostats ( ) const
inlinenoexceptinherited
double geo::GeometryCore::DefaultWiggle ( ) const
inlineinherited

Returns the tolerance used in looking for positions.

Returns
the tolerance value

This parameter is used as tolerance ("wiggle") for methods that require it (e.g. geo::CryostatGeo::FindTPCAtPosition()). Typically, it's a additional fraction of tolerance: 0 means no tolerance, 0.1 means 10% tolerance.

Todo:
Confirm the definition of wiggle: this one is taken from other doc

Definition at line 121 of file GeometryCore.h.

References geo::GeometryCore::fPositionWiggle.

121 { return fPositionWiggle; }
double fPositionWiggle
accounting for rounding errors when testing positions
Definition: GeometryCore.h:614
BoxBoundedGeo geo::GeometryCore::DetectorEnclosureBox ( std::string const &  name = "volDetEnclosure") const
inherited

Returns the absolute coordinates of the detector enclosure volume [cm].

Parameters
namename of the volume to be sought (default: volDetEnclosure)
Exceptions
cet::exceptionif the specified volume is not found

Definition at line 221 of file GeometryCore.cxx.

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

Referenced by geo::WireReadoutDumper::dumpDetectorInfo(), geo::GeometryCore::Print(), and geo::GeometryCore::SurfaceY().

223  {
224  auto const& path = FindDetectorEnclosure(name);
225  if (path.empty()) {
226  throw cet::exception("GeometryCore")
227  << "DetectorEnclosureBox(): can't find enclosure volume '" << name << "'\n";
228  }
229 
230  TGeoVolume const* pEncl = path.back().node->GetVolume();
231  auto const* pBox = dynamic_cast<TGeoBBox const*>(pEncl->GetShape());
232 
233  // check that this is indeed a box
234  if (!pBox) {
235  // at initialisation time we don't know yet our real ID
236  throw cet::exception("GeometryCore")
237  << "Detector enclosure '" << name << "' is not a box! (it is a "
238  << pEncl->GetShape()->IsA()->GetName() << ")\n";
239  }
240 
241  LocalTransformation<TGeoHMatrix> trans(path, path.size() - 1);
242  // get the half width, height, etc of the cryostat
243  double const halfwidth = pBox->GetDX();
244  double const halfheight = pBox->GetDY();
245  double const halflength = pBox->GetDZ();
246 
247  return {trans.LocalToWorld(Point_t{-halfwidth, -halfheight, -halflength}),
248  trans.LocalToWorld(Point_t{+halfwidth, +halfheight, +halflength})};
249  }
std::vector< GeoNodePathEntry > FindDetectorEnclosure(std::string const &name="volDetEnclosure") const
recob::tracking::Point_t Point_t
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void geo::Geometry::FillGeometryConfigurationInfo ( fhicl::ParameterSet const &  config)
private

Fills the service configuration information into fConfInfo.

Definition at line 41 of file Geometry.cc.

References sumdata::GeometryConfigurationInfo::dataVersion, sumdata::GeometryConfigurationInfo::detectorName, geo::GeometryCore::DetectorName(), fConfInfo, sumdata::GeometryConfigurationInfo::geometryServiceConfiguration, MF_LOG_TRACE, and fhicl::ParameterSet::to_indented_string().

Referenced by configurationInfo(), and Geometry().

42 {
45 
46  // version 1+:
47  confInfo.detectorName = DetectorName();
48 
49  // version 2+:
50  confInfo.geometryServiceConfiguration = config.to_indented_string();
51  fConfInfo = std::move(confInfo);
52 
53  MF_LOG_TRACE("Geometry") << "Geometry configuration information:\n" << fConfInfo;
54 }
DataVersion_t dataVersion
Version of the data in this object (0 is invalid version).
std::string geometryServiceConfiguration
geo::Geometry service configuration, as FHiCL table.
#define MF_LOG_TRACE(id)
sumdata::GeometryConfigurationInfo fConfInfo
Summary of service configuration.
Definition: Geometry.h:65
unsigned int DataVersion_t
Type used for the version of data.
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Definition: GeometryCore.h:140
Description of the current configuration of detector geometry.
std::vector< std::vector< TGeoNode const * > > geo::GeometryCore::FindAllVolumePaths ( std::set< std::string > const &  vol_names) const
inherited

Returns paths of all nodes with volumes with the specified names.

Parameters
vol_nameslist of names of volumes
Returns
list paths of the found nodes

All the nodes in the geometry are checked, and the path of all the ones that contain a volume with a name among the ones specified in vol_names is saved in the collection and returned.

A node path is a ordered list of all nodes leading to the final one, starting from thetop level (root) down. The node at the back() of the path is the one with name in vol_names. No empty paths are returned.

Definition at line 363 of file GeometryCore.cxx.

References geo::CollectPathsByName::paths, and geo::GeometryCore::ROOTGeoManager().

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

365  {
366  CollectPathsByName path_collector(vol_names);
367 
368  ROOTGeoNodeForwardIterator iNode(ROOTGeoManager()->GetTopNode());
369 
370  while (*iNode) {
371  path_collector(iNode);
372  ++iNode;
373  }
374 
375  return path_collector.paths;
376  }
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
std::vector< TGeoNode const * > geo::GeometryCore::FindAllVolumes ( std::set< std::string > const &  vol_names) const
inherited

Returns all the nodes with volumes with any of the specified names.

Parameters
vol_nameslist of names of volumes
Returns
list of nodes found

All the nodes in the geometry are checked, and all the ones that contain a volume with a name among the ones specified in vol_names are saved in the collection and returned.

Definition at line 346 of file GeometryCore.cxx.

References geo::CollectNodesByName::nodes, and geo::GeometryCore::ROOTGeoManager().

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

348  {
349  CollectNodesByName node_collector(vol_names);
350 
351  ROOTGeoNodeForwardIterator iNode{ROOTGeoManager()->GetTopNode()};
352  TGeoNode const* pCurrentNode;
353 
354  while ((pCurrentNode = *iNode)) {
355  node_collector(*pCurrentNode);
356  ++iNode;
357  }
358 
359  return node_collector.nodes;
360  }
TGeoManager * ROOTGeoManager() const
Access to the ROOT geometry description manager.
TPCID geo::GeometryCore::FindTPCAtPosition ( Point_t const &  point) const
inherited

Returns the ID of the TPC at specified location.

Parameters
point3D point (world reference frame, centimeters)
Returns
the TPC ID, or an invalid one if no TPC is there

Definition at line 157 of file GeometryCore.cxx.

References geo::GeometryCore::fPositionWiggle, geo::GeometryCore::PositionToCryostatPtr(), and geo::CryostatGeo::PositionToTPCID().

Referenced by trkf::TrajectoryMCSFitter::breakTrajInSegments(), pma::ProjectionMatchingAlg::buildShowerSeg(), ShowerRecoTools::ShowerUnidirectiondEdx::CalculateElement(), ShowerRecoTools::ShowerTrajPointdEdx::CalculateElement(), ems::MultiEMShowers::convCluster(), evd::RecoBaseDrawer::DrawTrack2D(), hit::HitCheater::FindHitsOnChannel(), shower::EMShowerAlg::FindInitialTrackHits(), geo::WireReadoutGeom::FindTPCsetAtPosition(), geo::GeometryCore::GetElementPtr(), opdet::GetHitGeometryInfo(), nnet::TrainingDataAlg::getProjection(), lar_pandora::LArPandoraInput::GetTrueStartAndEndPoints(), hit::DisambigCheater::InitHitToWids(), trkf::TrajectoryMCSFitter::linearRegression(), evd::SimulationDrawer::MCTruthOrtho(), shower::EMShowerAlg::OrderShowerHits_(), calo::Calorimetry::produce(), shower::EMShowerAlg::Project3DPointOntoPlane_(), filt::LArG4ParticleFilter::StartInTPCCheck(), filt::LArG4ParticleFilter::StopInTPCCheck(), filt::LArG4ParticleFilter::TPCTrajLengthCheck(), DUNE::NeutrinoTrackingEff::truthLength(), and DUNE::MuonTrackingEff::truthLength().

158  {
159  // first find the cryostat
160  CryostatGeo const* cryo = PositionToCryostatPtr(point);
161  if (!cryo) return {};
162 
163  // then ask it about the TPC
164  return cryo->PositionToTPCID(point, 1. + fPositionWiggle);
165  }
CryostatGeo const * PositionToCryostatPtr(Point_t const &point) const
Returns the cryostat at specified location.
double fPositionWiggle
accounting for rounding errors when testing positions
Definition: GeometryCore.h:614
std::string const& geo::GeometryCore::GDMLFile ( ) const
inlineinherited

Returns the full directory path to the GDML file source.

Returns
the full directory path to the GDML file source

This is the full path of the source of the detector geometry handed to the detector simulation (GEANT).

Definition at line 130 of file GeometryCore.h.

References geo::GeometryCore::fGDMLfile.

Referenced by larg4::LArG4::beginJob(), geo::DumpGeometry::dumpGeometry(), and evgen::GENIEGen::GENIEGen().

130 { return fGDMLfile; }
std::string fGDMLfile
path to geometry file used for Geant4 simulation
Definition: GeometryCore.h:611
unsigned int geo::GeometryCore::GetClosestOpDet ( Point_t const &  point) const
inherited

Find the nearest OpChannel to some point.

Parameters
pointpoint to be queried, in world coordinates
Returns
the index of the nearest OpChannel to the point, or std::numeric_limits<unsigned int>::max() if invalid point
Deprecated:
This method does not tell in which cryostat the detector is; use geo::CryostatGeo::GetClosestOpDet() instead (find the cryostat with PositionToCryostatPtr()).

Definition at line 658 of file GeometryCore.cxx.

References geo::CryostatID::Cryostat, geo::CryostatGeo::GetClosestOpDet(), geo::CryostatGeo::ID(), geo::GeometryCore::OpDetFromCryo(), and geo::GeometryCore::PositionToCryostatPtr().

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

659  {
660  CryostatGeo const* cryo = PositionToCryostatPtr(point);
661  if (!cryo) return std::numeric_limits<unsigned int>::max();
662  int o = cryo->GetClosestOpDet(point);
663  return OpDetFromCryo(o, cryo->ID().Cryostat);
664  }
CryostatGeo const * PositionToCryostatPtr(Point_t const &point) const
Returns the cryostat at specified location.
unsigned int OpDetFromCryo(unsigned int o, unsigned int c) const
Get unique opdet number from cryo and internal count.
CryostatGeo const& geo::GeometryCore::GetElement ( CryostatID const &  cryoid) const
inlineinherited

Returns the specified cryostat.

Parameters
cryoidcryostat ID
Returns
a constant reference to the specified cryostat
Exceptions
cet::exception(GeometryCore category) if cryostat not present

The GetElement() method is overloaded and its return depends on the type of ID.

Todo:
Make the cryostat number mandatory (as CryostatID)

Definition at line 334 of file GeometryCore.h.

References geo::GeometryCore::Cryostat().

Referenced by evd::SimulationDrawer::MCTruthOrtho().

334 { return Cryostat(cryoid); }
CryostatGeo const & Cryostat(CryostatID const &cryoid=details::cryostat_zero) const
Returns the specified cryostat.
TPCGeo const& geo::GeometryCore::GetElement ( TPCID const &  tpcid) const
inlineinherited

Returns the specified TPC.

Parameters
tpcidID of the tpc
Returns
a constant reference to the specified TPC
Exceptions
cet::exception(GeometryCore category) if cryostat not present
cet::exception(TPCOutOfRange category) if no such TPC

The GetElement() method is overloaded and its return depends on the type of ID.

Definition at line 452 of file GeometryCore.h.

References geo::GeometryCore::TPC().

452 { return TPC(tpcid); }
TPCGeo const & TPC(TPCID const &tpcid=details::tpc_zero) const
Returns the specified TPC.
Definition: GeometryCore.h:448
CryostatGeo const* geo::GeometryCore::GetElementPtr ( CryostatID const &  cryoid) const
inlineinherited

Returns the specified cryostat.

Parameters
cryoidcryostat ID
Returns
a constant pointer to the specified cryostat, or nullptr if none

The GetElementPtr() method is overloaded and its return depends on the type of ID.

Definition at line 349 of file GeometryCore.h.

References geo::Iterable< details::GeometryIterationPolicy, details::ToGeometryElement >::begin(), geo::GeometryCore::CryostatPtr(), geo::Iterable< details::GeometryIterationPolicy, details::ToGeometryElement >::end(), geo::Iterable< details::GeometryIterationPolicy, details::ToGeometryElement >::Iterate(), geo::GeometryCore::MaxTPCs(), geo::GeometryCore::PositionToCryostat(), geo::GeometryCore::PositionToCryostatID(), geo::GeometryCore::PositionToCryostatPtr(), and geo::GeometryCore::TotalNTPC().

Referenced by geo::details::getElementPtr(), and geo::GeometryCore::NTPC().

349 { return CryostatPtr(cryoid); }
CryostatGeo const * CryostatPtr(CryostatID const &cryoid) const
Returns the specified cryostat.
Definition: GeometryCore.h:345
TPCGeo const* geo::GeometryCore::GetElementPtr ( TPCID const &  tpcid) const
inlineinherited

Returns the specified TPC.

Parameters
tpcidTPC ID
Returns
a constant pointer to the specified TPC, or nullptr if none

The GetElementPtr() method is overloaded and its return depends on the type of ID.

Definition at line 468 of file GeometryCore.h.

References geo::details::cryostat_zero, geo::GeometryCore::FindTPCAtPosition(), geo::GeometryCore::GetClosestOpDet(), geo::GeometryCore::NOpDets(), geo::GeometryCore::OpDetFromCryo(), geo::GeometryCore::OpDetGeoFromOpDet(), geo::GeometryCore::OpDetGeoName(), geo::GeometryCore::PositionToTPC(), geo::GeometryCore::PositionToTPCID(), geo::GeometryCore::PositionToTPCptr(), and geo::GeometryCore::TPCPtr().

468 { return TPCPtr(tpcid); }
TPCGeo const * TPCPtr(TPCID const &tpcid) const
Returns the specified TPC.
Definition: GeometryCore.h:463
std::string const & geo::GeometryCore::GetWorldVolumeName ( ) const
inherited

Return the name of the world volume (needed by Geant4 simulation)

Definition at line 212 of file GeometryCore.cxx.

Referenced by geo::GeometryCore::SurfaceY(), geo::GeometryCore::WorldBox(), and geo::GeometryCore::WorldVolume().

213  {
214  // For now, and possibly forever, this is a constant (given the definition of
215  // "nodeNames" above).
216  static std::string const worldVolumeName{"volWorld"};
217  return worldVolumeName;
218  }
bool geo::GeometryCore::HasCryostat ( CryostatID const &  cryoid) const
inlineinherited

Returns whether we have the specified cryostat.

The HasElement() method is overloaded and its meaning depends on the type of ID.

Definition at line 318 of file GeometryCore.h.

References geo::CryostatID::Cryostat, and geo::GeometryCore::Ncryostats().

Referenced by geo::GeometryCore::CryostatPtr(), and geo::GeometryCore::HasElement().

318 { return cryoid.Cryostat < Ncryostats(); }
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
bool geo::GeometryCore::HasElement ( CryostatID const &  cryoid) const
inlineinherited

Returns whether we have the specified cryostat.

The HasElement() method is overloaded and its meaning depends on the type of ID.

Definition at line 319 of file GeometryCore.h.

References geo::GeometryCore::Cryostat(), geo::details::cryostat_zero, and geo::GeometryCore::HasCryostat().

319 { return HasCryostat(cryoid); }
bool HasCryostat(CryostatID const &cryoid) const
Returns whether we have the specified cryostat.
Definition: GeometryCore.h:318
bool geo::GeometryCore::HasElement ( TPCID const &  tpcid) const
inlineinherited

Returns whether we have the specified TPC.

Definition at line 436 of file GeometryCore.h.

References geo::GeometryCore::HasTPC().

436 { return HasTPC(tpcid); }
bool HasTPC(TPCID const &tpcid) const
Returns whether we have the specified TPC.
Definition: GeometryCore.h:429
bool geo::GeometryCore::HasTPC ( TPCID const &  tpcid) const
inlineinherited

Returns whether we have the specified TPC.

Definition at line 429 of file GeometryCore.h.

References geo::GeometryCore::CryostatPtr(), and geo::CryostatGeo::HasTPC().

Referenced by pma::ProjectionMatchingAlg::buildShowerSeg(), ems::MultiEMShowers::convCluster(), geo::GeometryCore::HasElement(), and evd::TWQProjectionView::SelectTPC().

430  {
431  CryostatGeo const* pCryo = CryostatPtr(tpcid);
432  return pCryo ? pCryo->HasTPC(tpcid) : false;
433  }
CryostatGeo const * CryostatPtr(CryostatID const &cryoid) const
Returns the specified cryostat.
Definition: GeometryCore.h:345
std::string geo::GeometryCore::Info ( std::string  indent = "  ") const
inherited

Returns a string with complete geometry information.

See also
Print()

Definition at line 588 of file GeometryCore.cxx.

References geo::GeometryCore::Print().

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

589  {
590  std::ostringstream sstr;
591  Print(sstr, indent);
592  return sstr.str();
593  }
void Print(Stream &&out, std::string indent=" ") const
Prints geometry information with maximum verbosity.
Definition: GeometryCore.h:633
std::string indent(std::size_t const i)
double geo::GeometryCore::MassBetweenPoints ( Point_t const &  p1,
Point_t const &  p2 
) const
inherited

Returns the column density between two points.

Parameters
p1the first point
p2the second point
Returns
the column density [kg / cm²]

The column density is defined as $ \int_{\vec{p}_{1}}^{\vec{p}_{2}} \rho(\vec{p}) d\vec{p} $ where $ \rho(\vec{p}) $ is the density at point $ \vec{p} $, which the integral leads from p1 to p2 in a straight line.

Both points are specified in world coordinates.

Definition at line 550 of file GeometryCore.cxx.

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

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

551  {
552  //The purpose of this method is to determine the column density between the two points
553  //given. Do that by starting at p1 and stepping until you get to the node of p2.
554  //calculate the distance between the point just inside that node and p2 to get the
555  //last bit of column density
556  double columnD = 0.;
557 
558  //first initialize a track - get the direction cosines
559  Vector_t const dir = (p2 - p1).Unit();
560 
561  double const dxyz[3] = {dir.X(), dir.Y(), dir.Z()};
562  double const cp1[3] = {p1.X(), p1.Y(), p1.Z()};
563  gGeoManager->InitTrack(cp1, dxyz);
564 
565  //might be helpful to have a point to a TGeoNode
566  TGeoNode* node = gGeoManager->GetCurrentNode();
567 
568  //check that the points are not in the same volume already. if they are in different
569  //volumes, keep stepping until you are in the same volume as the second point
570  while (!gGeoManager->IsSameLocation(p2.X(), p2.Y(), p2.Z())) {
571  gGeoManager->FindNextBoundary();
572  columnD += gGeoManager->GetStep() * node->GetMedium()->GetMaterial()->GetDensity();
573 
574  //the act of stepping puts you in the next node and returns that node
575  node = gGeoManager->Step();
576  } //end loop to get to volume of second point
577 
578  //now you are in the same volume as the last point, but not at that point. get the
579  //distance between the current point and the last one
580  Point_t const last = vect::makePointFromCoords(gGeoManager->GetCurrentPoint());
581  double const lastStep = (p2 - last).R();
582  columnD += lastStep * node->GetMedium()->GetMaterial()->GetDensity();
583 
584  return columnD;
585  }
GENVECTOR_CONSTEXPR Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
recob::tracking::Point_t Point_t
TDirectory * dir
Definition: macro.C:5
recob::tracking::Vector_t Vector_t
TGeoMaterial const * geo::GeometryCore::Material ( Point_t const &  point) const
inherited

Returns the material at the specified position.

Definition at line 467 of file GeometryCore.cxx.

Referenced by geo::GeometryCore::MaterialName(), and geo::GeometryCore::SurfaceY().

468  {
469  auto const pNode = gGeoManager->FindNode(point.X(), point.Y(), point.Z());
470  if (!pNode) return nullptr;
471  auto const pMedium = pNode->GetMedium();
472  return pMedium ? pMedium->GetMaterial() : nullptr;
473  }
std::string geo::GeometryCore::MaterialName ( Point_t const &  point) const
inherited

Name of the deepest material containing the point xyz.

Parameters
pointthe location to query, in world coordinates
Returns
material name at the specified position

Definition at line 476 of file GeometryCore.cxx.

References geo::BoxBoundedGeo::ContainsPosition(), geo::GeometryCore::Material(), geo::BoxBoundedGeo::Max(), geo::BoxBoundedGeo::Min(), and geo::GeometryCore::WorldBox().

Referenced by larg4::LArG4Ana::analyze(), and geo::GeometryCore::SurfaceY().

477  {
478  // check that the given point is in the World volume at least
479  BoxBoundedGeo worldBox = WorldBox();
480  if (!worldBox.ContainsPosition(point)) {
481  mf::LogWarning("GeometryCoreBadInputPoint")
482  << "point " << point << " is not inside the world volume " << worldBox.Min() << " -- "
483  << worldBox.Max() << "; returning unknown material name";
484  return {"unknownMaterial"};
485  }
486  auto const pMaterial = Material(point);
487  if (!pMaterial) {
488  mf::LogWarning("GeometryCoreBadInputPoint")
489  << "material for point " << point << " not found! returning unknown material name";
490  return {"unknownMaterial"};
491  }
492  return pMaterial->GetName();
493  }
TGeoMaterial const * Material(Point_t const &point) const
Returns the material at the specified position.
BoxBoundedGeo WorldBox() const
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
unsigned int geo::GeometryCore::MaxTPCs ( ) const
inherited

Returns the largest number of TPCs a cryostat in the detector has.

Definition at line 379 of file GeometryCore.cxx.

References geo::GeometryCore::fCryostats.

Referenced by geo::details::GeometryIterationPolicy::EndTPCID(), geo::GeometryCore::GetElementPtr(), and evd::TWQProjectionView::SetUpTPCselection().

380  {
381  unsigned int maxTPCs = 0;
382  for (CryostatGeo const& cryo : fCryostats) {
383  unsigned int maxTPCsInCryo = cryo.NTPC();
384  if (maxTPCsInCryo > maxTPCs) maxTPCs = maxTPCsInCryo;
385  }
386  return maxTPCs;
387  }
CryostatList_t fCryostats
Definition: GeometryCore.h:605
unsigned int geo::GeometryCore::Ncryostats ( ) const
inlineinherited

Returns the number of cryostats in the detector.

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 303 of file GeometryCore.h.

References geo::GeometryCore::fCryostats.

Referenced by detsim::WienerFilterAna::beginJob(), detsim::SimDriftElectrons::beginJob(), detsim::DriftElectronstoPlane::beginJob(), lar_cluster3d::StandardHit3DBuilder::BuildHitPairMap(), lar_cluster3d::SnippetHit3DBuilder::BuildHitPairMap(), larg4::LArVoxelReadout::ClearSimChannels(), lar_cluster3d::StandardHit3DBuilder::CollectArtHits(), lar_cluster3d::SnippetHit3DBuilder::CollectArtHits(), larg4::LArVoxelReadoutGeometry::Construct(), detinfo::DetectorPropertiesStandard::DataFor(), hit::DisambigCheater::DisambigCheater(), geo::WireReadoutDumper::dumpDetectorInfo(), geo::details::GeometryIterationPolicy::EndCryostatID(), detsim::WienerFilterAna::endJob(), geo::details::ReadoutIterationPolicy::EndPlaneID(), geo::details::GeometryIterationPolicy::EndTPCID(), geo::details::ReadoutIterationPolicy::EndWireID(), larg4::ISTPC::extractActiveLArVolume(), larg4::OpFastScintillation::extractActiveVolumes(), geo::GeometryCore::HasCryostat(), lar_cluster3d::SpacePointHit3DBuilder::Hit3DBuilder(), trkf::SpacePointAlg::makeSpacePoints(), geo::GeometryCore::NElements(), geo::GeometryCore::NSiblingElements(), geo::GeometryCore::OpDetFromCryo(), geo::GeometryCore::OpDetGeoFromOpDet(), larg4::OpFastScintillation::OpFastScintillation(), phot::PDFastSimPAR::PDFastSimPAR(), geo::GeometryCore::Print(), larg4::LArG4::produce(), evd::TWQProjectionView::SelectTPC(), evd::TWQProjectionView::SetUpTPCselection(), and cheat::BackTracker::SpacePointHitsToWeightedXYZ().

303 { return fCryostats.size(); }
CryostatList_t fCryostats
Definition: GeometryCore.h:605
unsigned int geo::GeometryCore::NElements ( ) const
inlineinherited

Returns the number of cryostats in the detector.

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 304 of file GeometryCore.h.

References geo::GeometryCore::Ncryostats().

304 { return Ncryostats(); }
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
unsigned int geo::GeometryCore::NElements ( CryostatID const &  cryoid) const
inlineinherited

Returns the largest number of TPCs a cryostat in the detector has.

Definition at line 421 of file GeometryCore.h.

References geo::GeometryCore::NTPC().

421 { return NTPC(cryoid); }
unsigned int NTPC(CryostatID const &cryoid=details::cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
Definition: GeometryCore.h:416
unsigned int geo::GeometryCore::NSiblingElements ( CryostatID const &  ) const
inlineinherited

Returns the number of cryostats in the detector.

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 305 of file GeometryCore.h.

References geo::GeometryCore::Ncryostats().

Referenced by geo::details::GeometryIterationPolicy::NSiblings().

305 { return Ncryostats(); }
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
unsigned int geo::GeometryCore::NSiblingElements ( TPCID const &  tpcid) const
inlineinherited

Returns the largest number of TPCs a cryostat in the detector has.

Definition at line 422 of file GeometryCore.h.

References geo::GeometryCore::NTPC().

422 { return NTPC(tpcid); }
unsigned int NTPC(CryostatID const &cryoid=details::cryostat_zero) const
Returns the total number of TPCs in the specified cryostat.
Definition: GeometryCore.h:416
unsigned int geo::GeometryCore::NTPC ( CryostatID const &  cryoid = details::cryostat_zero) const
inlineinherited

Returns the total number of TPCs in the specified cryostat.

Parameters
cryoidcryostat number
Returns
number of TPCs in specified cryostat, or 0 if no cryostat found

The NElements() and NSiblingElements() methods are overloaded and their return depends on the type of ID.

Todo:
Change return type to size_t

Definition at line 416 of file GeometryCore.h.

References geo::GeometryCore::GetElementPtr(), and geo::CryostatGeo::NElements().

Referenced by apa::APAGeometryAlg::APAGeometryAlg(), detsim::WienerFilterAna::beginJob(), detsim::SimDriftElectrons::beginJob(), detsim::DriftElectronstoPlane::beginJob(), lar_cluster3d::StandardHit3DBuilder::BuildHitPairMap(), lar_cluster3d::SnippetHit3DBuilder::BuildHitPairMap(), mvapid::MVAAlg::CalcSegmentdEdxDist(), larg4::LArVoxelReadout::ClearSimChannels(), lar_cluster3d::StandardHit3DBuilder::CollectArtHits(), lar_cluster3d::SnippetHit3DBuilder::CollectArtHits(), hit::DisambigCheater::DisambigCheater(), detsim::WienerFilterAna::endJob(), mvapid::MVAAlg::GetWireNormals(), lar_cluster3d::SpacePointHit3DBuilder::Hit3DBuilder(), geo::GeometryCore::NElements(), geo::GeometryCore::NSiblingElements(), phot::PDFastSimPAR::PDFastSimPAR(), nnet::PointIdTrainingData::PointIdTrainingData(), evgen::ActiveVolumeVertexSampler::reconfigure(), evgen::ActiveVolumeVertexSampler::sample_vertex_pos(), evd::TWQProjectionView::SelectTPC(), phot::SemiAnalyticalModel::SemiAnalyticalModel(), tca::TrajClusterAlg::SetSourceHits(), evd::TWQProjectionView::SetUpTPCselection(), cheat::BackTracker::SpacePointHitsToWeightedXYZ(), tca::StitchPFPs(), apa::DisambigAlg::TrivialDisambig(), and evd::TWQMultiTPCProjectionView::TWQMultiTPCProjectionView().

417  {
418  CryostatGeo const* pCryo = GetElementPtr(cryoid);
419  return pCryo ? pCryo->NElements() : 0;
420  }
CryostatGeo const * GetElementPtr(CryostatID const &cryoid) const
Returns the specified cryostat.
Definition: GeometryCore.h:349
unsigned int geo::GeometryCore::OpDetFromCryo ( unsigned int  o,
unsigned int  c 
) const
inherited

Get unique opdet number from cryo and internal count.

Todo:
add explanation of the different IDs

Definition at line 598 of file GeometryCore.cxx.

References geo::GeometryCore::Cryostat(), geo::GeometryCore::Ncryostats(), and geo::CryostatGeo::NOpDet().

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

599  {
600  static bool Loaded = false;
601  static std::vector<unsigned int> LowestID;
602  static unsigned int NCryo;
603 
604  CryostatID const cid{c};
605  // If not yet loaded static parameters, do it
606  if (Loaded == false) {
607 
608  Loaded = true;
609 
610  // Store the lowest ID for each cryostat
611  NCryo = Ncryostats();
612  LowestID.resize(NCryo + 1);
613  LowestID.at(0) = 0;
614  for (size_t cryo = 0; cryo != NCryo; ++cryo) {
615  LowestID.at(cryo + 1) = LowestID.at(cryo) + Cryostat(cid).NOpDet();
616  }
617  }
618 
619  if ((c < NCryo) && (o < Cryostat(cid).NOpDet())) { return LowestID.at(c) + o; }
620 
621  throw cet::exception("OpDetCryoToOpID Error")
622  << "Coordinates c=" << c << ", o=" << o << " out of range. Abort\n";
623  }
IDparameter< geo::CryostatID > CryostatID
Member type of validated geo::CryostatID parameter.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
CryostatGeo const & Cryostat(CryostatID const &cryoid=details::cryostat_zero) const
Returns the specified cryostat.
unsigned int NOpDet() const
Number of optical detectors in this TPC.
Definition: CryostatGeo.h:317
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
OpDetGeo const & geo::GeometryCore::OpDetGeoFromOpDet ( unsigned int  OpDet) const
inherited

Returns the geo::OpDetGeo object for the given detector number.

Parameters
OpDetoptical detector unique number
See also
GeometryCoreOpDetGeometry "optical detector identification"

Definition at line 626 of file GeometryCore.cxx.

References geo::GeometryCore::Cryostat(), geo::GeometryCore::Ncryostats(), geo::CryostatGeo::NOpDet(), and geo::CryostatGeo::OpDet().

Referenced by opdet::SimPhotonCounter::beginJob(), phot::CreateHybridLibrary::CreateHybridLibrary(), phot::PhotonVisibilityService::DistanceToOpDetImpl(), larg4::OpDetLookup::FindClosestOpDet(), phot::PhotonLibraryHybrid::GetCount(), geo::GeometryCore::GetElementPtr(), phot::PropagationTimeModel::opDetCenters(), phot::PDFastSimPAR::opDetCenters(), geo::WireReadoutGeom::OpDetGeoFromOpChannel(), phot::PropagationTimeModel::opDetOrientations(), larg4::OpFastScintillation::OpFastScintillation(), phot::SemiAnalyticalModel::opticalDetectors(), and phot::PhotonVisibilityService::SolidAngleFactorImpl().

627  {
628  static bool Loaded = false;
629  static std::vector<unsigned int> LowestID;
630  static size_t NCryo;
631  // If not yet loaded static parameters, do it
632  if (Loaded == false) {
633 
634  Loaded = true;
635 
636  // Store the lowest ID for each cryostat
637  NCryo = Ncryostats();
638  LowestID.resize(NCryo + 1);
639  LowestID[0] = 0;
640  for (size_t cryo = 0; cryo != NCryo; ++cryo) {
641  LowestID[cryo + 1] = LowestID[cryo] + Cryostat(CryostatID(cryo)).NOpDet();
642  }
643  }
644 
645  for (size_t i = 0; i != NCryo; ++i) {
646  if ((OpDet >= LowestID[i]) && (OpDet < LowestID[i + 1])) {
647  int c = i;
648  int o = OpDet - LowestID[i];
649  return Cryostat(CryostatID(c)).OpDet(o);
650  }
651  }
652  // If we made it here, we didn't find the right combination. abort
653  throw cet::exception("OpID To OpDetCryo error") << "OpID out of range, " << OpDet << "\n";
654  }
IDparameter< geo::CryostatID > CryostatID
Member type of validated geo::CryostatID parameter.
OpDetGeo const & OpDet(unsigned int iopdet) const
Return the iopdet&#39;th optical detector in the cryostat.
Definition: CryostatGeo.cxx:83
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
CryostatGeo const & Cryostat(CryostatID const &cryoid=details::cryostat_zero) const
Returns the specified cryostat.
unsigned int NOpDet() const
Number of optical detectors in this TPC.
Definition: CryostatGeo.h:317
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::string geo::GeometryCore::OpDetGeoName ( CryostatID const &  cid = details::cryostat_zero) const
inherited

Returns gdml string which gives sensitive opdet name.

Parameters
cidID of the cryostat the detector is in

This name is defined in the geometry (GDML) description.

Todo:
Change to use CryostatID

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

CryostatGeo const & geo::GeometryCore::PositionToCryostat ( Point_t const &  point) const
inherited

Returns the cryostat at specified location.

Parameters
pointthe location [cm]
Returns
a constant reference to the geo::CryostatGeo containing point
Exceptions
cet::exception("Geometry" category) if no cryostat matches

The tolerance used here is the one returned by DefaultWiggle().

Definition at line 205 of file GeometryCore.cxx.

References geo::GeometryCore::PositionToCryostatPtr().

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

206  {
207  if (auto cstat = PositionToCryostatPtr(point)) { return *cstat; }
208  throw cet::exception("GeometryCore") << "Can't find any cryostat at position " << point << "\n";
209  }
CryostatGeo const * PositionToCryostatPtr(Point_t const &point) const
Returns the cryostat at specified location.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
CryostatID geo::GeometryCore::PositionToCryostatID ( Point_t const &  point) const
inherited

Returns the ID of the cryostat at specified location.

Parameters
pointthe location [cm]
Returns
ID of the cryostat including point (invalid if none)

The tolerance used here is the one returned by DefaultWiggle().

Definition at line 177 of file GeometryCore.cxx.

References geo::CryostatGeo::ID(), and geo::GeometryCore::PositionToCryostatPtr().

Referenced by pma::ProjectionMatchingAlg::buildShowerSeg(), ems::MultiEMShowers::convCluster(), larg4::LArVoxelReadoutGeometry::FindNestedVolume(), geo::GeometryCore::GetElementPtr(), sim::MCRecoEdep::MakeMCEdep(), evd::SimulationDrawer::MCTruthOrtho(), and detsim::SimDriftElectrons::produce().

178  {
179  CryostatGeo const* cryo = PositionToCryostatPtr(point);
180  return cryo ? cryo->ID() : CryostatID{};
181  }
CryostatGeo const * PositionToCryostatPtr(Point_t const &point) const
Returns the cryostat at specified location.
IDparameter< geo::CryostatID > CryostatID
Member type of validated geo::CryostatID parameter.
CryostatGeo const * geo::GeometryCore::PositionToCryostatPtr ( Point_t const &  point) const
inherited

Returns the cryostat at specified location.

Parameters
pointthe location [cm]
Returns
pointer to the geo::CryostatGeo including point, or nullptr

The tolerance used here is the one returned by DefaultWiggle().

Definition at line 168 of file GeometryCore.cxx.

References geo::GeometryCore::fPositionWiggle.

Referenced by geo::GeometryCore::FindTPCAtPosition(), geo::GeometryCore::GetClosestOpDet(), geo::GeometryCore::GetElementPtr(), geo::GeometryCore::PositionToCryostat(), geo::GeometryCore::PositionToCryostatID(), and geo::GeometryCore::PositionToTPCptr().

169  {
170  for (auto const& cryostat : Iterate<CryostatGeo>()) {
171  if (cryostat.ContainsPosition(point, 1.0 + fPositionWiggle)) return &cryostat;
172  }
173  return nullptr;
174  }
double fPositionWiggle
accounting for rounding errors when testing positions
Definition: GeometryCore.h:614
TPCGeo const & geo::GeometryCore::PositionToTPC ( Point_t const &  point) const
inherited

Returns the TPC at specified location.

Parameters
pointthe location [cm]
Returns
a constant reference to the geo::TPCGeo including point
Exceptions
cet::exception("Geometry" category) if no TPC matches

Definition at line 191 of file GeometryCore.cxx.

References geo::GeometryCore::PositionToTPCptr().

Referenced by geo::GeometryCore::GetElementPtr(), and opreco::OpticalRecoAna::update_MC_particle_time().

192  {
193  if (auto tpc = PositionToTPCptr(point)) { return *tpc; }
194  throw cet::exception("GeometryCore") << "Can't find any TPC at position " << point << "\n";
195  }
TPCGeo const * PositionToTPCptr(Point_t const &point) const
Returns the TPC at specified location.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
TPCID geo::GeometryCore::PositionToTPCID ( Point_t const &  point) const
inherited

Returns the ID of the TPC at specified location.

Parameters
pointthe location [cm]
Returns
ID of the TPC at specified location, invalid if none
See also
PositionToTPC()

Definition at line 198 of file GeometryCore.cxx.

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

Referenced by larg4::ISCalcCorrelated::AngleToEFieldAtStep(), evdb_tool::DrawLArVoxel3D::Draw(), evdb_tool::DrawSimEnergyDeposit3D::drawAll(), evdb_tool::DrawSimEnergyDeposit3D::drawMCPartAssociated(), larg4::ISCalcCorrelated::EFieldAtStep(), larg4::LArVoxelReadoutGeometry::FindNestedVolume(), geo::GeometryCore::GetElementPtr(), lar_pandora::LArPandoraInput::GetTrueX0(), apa::APAGeometryAlg::LineSegChanIntersect(), sim::MCRecoEdep::MakeMCEdep(), evd::SimulationDrawer::MCTruth3D(), detsim::SimDriftElectrons::produce(), and cheat::BackTracker::SpacePointHitsToWeightedXYZ().

199  {
200  TPCGeo const* tpc = PositionToTPCptr(point);
201  return tpc ? tpc->ID() : TPCID{};
202  }
IDparameter< geo::TPCID > TPCID
Member type of validated geo::TPCID parameter.
TPCGeo const * PositionToTPCptr(Point_t const &point) const
Returns the TPC at specified location.
TPCGeo const * geo::GeometryCore::PositionToTPCptr ( Point_t const &  point) const
inherited

Returns the TPC at specified location.

Parameters
pointthe location [cm]
Returns
the geo::TPCGeo including point, or nullptr if none

Definition at line 184 of file GeometryCore.cxx.

References geo::GeometryCore::fPositionWiggle, geo::GeometryCore::PositionToCryostatPtr(), and geo::CryostatGeo::PositionToTPCptr().

Referenced by geo::GeometryCore::GetElementPtr(), lar_pandora::PFParticleMonitoring::GetStartAndEndPoints(), geo::GeometryCore::PositionToTPC(), and geo::GeometryCore::PositionToTPCID().

185  {
186  CryostatGeo const* cryo = PositionToCryostatPtr(point);
187  return cryo ? cryo->PositionToTPCptr(point, 1. + fPositionWiggle) : nullptr;
188  }
CryostatGeo const * PositionToCryostatPtr(Point_t const &point) const
Returns the cryostat at specified location.
double fPositionWiggle
accounting for rounding errors when testing positions
Definition: GeometryCore.h:614
template<typename Stream >
void geo::GeometryCore::Print ( Stream &&  out,
std::string  indent = "  " 
) const
inherited

Prints geometry information with maximum verbosity.

Definition at line 633 of file GeometryCore.h.

References geo::GeometryCore::DetectorEnclosureBox(), geo::GeometryCore::DetectorName(), art::detail::indent(), geo::TPCGeo::MaxVerbosity, geo::OpDetGeo::MaxVerbosity, geo::GeometryCore::Ncryostats(), geo::OpDetGeo::PrintOpDetInfo(), and geo::TPCGeo::PrintTPCInfo().

Referenced by geo::GeometryCore::Info(), and geo::GeometryCore::SurfaceY().

634 {
635 
636  out << "Detector " << DetectorName() << " has " << Ncryostats() << " cryostats:";
637 
638  auto const& detEnclosureBox = DetectorEnclosureBox();
639  out << "\n"
640  << indent << "Detector enclosure: " << detEnclosureBox.Min() << " -- "
641  << detEnclosureBox.Max() << " cm => ( " << detEnclosureBox.SizeX() << " x "
642  << detEnclosureBox.SizeY() << " x " << detEnclosureBox.SizeZ() << " ) cm^3";
643 
644  for (auto const& cryostat : Iterate<CryostatGeo>()) {
645  out << "\n" << indent;
646  cryostat.PrintCryostatInfo(std::forward<Stream>(out), indent + " ", cryostat.MaxVerbosity);
647 
648  unsigned const int nTPCs = cryostat.NTPC();
649  for (unsigned int t = 0; t < nTPCs; ++t) {
650  TPCGeo const& tpc = cryostat.TPC(t);
651 
652  out << "\n" << indent << " ";
653  tpc.PrintTPCInfo(std::forward<Stream>(out), indent + " ", tpc.MaxVerbosity);
654  } // for TPC
655 
656  unsigned int nOpDets = cryostat.NOpDet();
657  for (unsigned int iOpDet = 0; iOpDet < nOpDets; ++iOpDet) {
658  OpDetGeo const& opDet = cryostat.OpDet(iOpDet);
659  out << "\n" << indent << " [OpDet #" << iOpDet << "] ";
660  opDet.PrintOpDetInfo(std::forward<Stream>(out), indent + " ", opDet.MaxVerbosity);
661  } // for
662  } // for cryostat
663 
664  out << '\n';
665 
666 } // geo::GeometryCore::Print()
BoxBoundedGeo DetectorEnclosureBox(std::string const &name="volDetEnclosure") const
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
Definition: GeometryCore.h:303
std::string indent(std::size_t const i)
std::string const & DetectorName() const
Returns a string with the name of the detector, as configured.
Definition: GeometryCore.h:140
provider_type const* geo::Geometry::provider ( ) const
inline

Returns a pointer to the geometry service provider.

Definition at line 49 of file Geometry.h.

49 { return static_cast<provider_type const*>(this); }
GeometryCore provider_type
type of service provider
Definition: Geometry.h:44
TGeoManager * geo::GeometryCore::ROOTGeoManager ( ) const
inherited
Length_t geo::GeometryCore::SurfaceY ( ) const
inlineinherited

The position of the detector respect to earth surface.

Returns
typical y position at surface in units of cm

This is the depth (y) of the surface (where earth meets air) for this detector site. The number is expressed in world coordinates and in centimeters, and it represents the y coordinate of earth surface. A negative value means that the origin of coordinates, typically matching the detector centre, is above surface.

Todo:
check that this is actually how it is used

Definition at line 186 of file GeometryCore.h.

References geo::GeometryCore::DetectorEnclosureBox(), geo::GeometryCore::FindAllVolumePaths(), geo::GeometryCore::FindAllVolumes(), geo::GeometryCore::fSurfaceY, geo::GeometryCore::GetWorldVolumeName(), art::detail::indent(), geo::GeometryCore::Info(), geo::GeometryCore::MassBetweenPoints(), geo::GeometryCore::Material(), geo::GeometryCore::MaterialName(), geo::GeometryCore::Print(), geo::GeometryCore::ROOTGeoManager(), geo::GeometryCore::TotalMass(), and geo::GeometryCore::VolumeName().

Referenced by evgen::CosmicsGen::produce().

186 { return fSurfaceY; }
double fSurfaceY
The point where air meets earth for this detector.
Definition: GeometryCore.h:613
double geo::GeometryCore::TotalMass ( ) const
inlineinherited

Returns the total mass [kg] of the specified volume (default: world).

Definition at line 255 of file GeometryCore.h.

Referenced by evgen::GENIEGen::GENIEGen(), and geo::GeometryCore::SurfaceY().

255 { return TotalMass(GetWorldVolumeName()); }
std::string const & GetWorldVolumeName() const
Return the name of the world volume (needed by Geant4 simulation)
double TotalMass() const
Returns the total mass [kg] of the specified volume (default: world).
Definition: GeometryCore.h:255
double geo::GeometryCore::TotalMass ( std::string  vol) const
inherited

Returns the total mass [kg] of the specified volume (default: world).

Definition at line 538 of file GeometryCore.cxx.

539  {
540  //the TGeoNode::GetVolume() returns the TGeoVolume of the detector outline and ROOT
541  //calculates the mass in kg for you
542  TGeoVolume* gvol = gGeoManager->FindVolumeFast(vol.c_str());
543  if (gvol) return gvol->Weight();
544 
545  throw cet::exception("GeometryCore")
546  << "could not find specified volume '" << vol << " 'to determine total mass\n";
547  }
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
unsigned int geo::GeometryCore::TotalNTPC ( ) const
inherited

Returns the total number of TPCs in the detector.

Definition at line 390 of file GeometryCore.cxx.

References geo::GeometryCore::fCryostats, and sum.

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

391  {
392  // it looks like C++11 lambdas have made STL algorithms easier to use, but only so
393  // much:
394  return std::accumulate(
395  fCryostats.begin(), fCryostats.end(), 0U, [](unsigned int sum, CryostatGeo const& cryo) {
396  return sum + cryo.NTPC();
397  });
398  }
CryostatList_t fCryostats
Definition: GeometryCore.h:605
Double_t sum
Definition: plot.C:31
TPCGeo const& geo::GeometryCore::TPC ( TPCID const &  tpcid = details::tpc_zero) const
inlineinherited

Returns the specified TPC.

Parameters
tpcidID of the tpc
Returns
a constant reference to the specified TPC
Exceptions
cet::exception(GeometryCore category) if cryostat not present
cet::exception(TPCOutOfRange category) if no such TPC

The GetElement() method is overloaded and its return depends on the type of ID.

Definition at line 448 of file GeometryCore.h.

References geo::GeometryCore::Cryostat(), and geo::CryostatGeo::TPC().

Referenced by lar::example::AnalysisExample::analyze(), larg4::ISCalcCorrelated::AngleToEFieldAtStep(), sce::SCECorrection::applyT0Shift(), trkf::SpacePointAna::bookHistograms(), pma::ProjectionMatchingAlg::buildShowerSeg(), phot::PropagationTimeModel::cathodeCentre(), LArStackingAction::ClassifyNewTrack(), evd::Display3DPad::Draw(), larg4::LArVoxelReadout::DriftIonizationElectrons(), larg4::ISCalcCorrelated::EFieldAtStep(), larg::LArSimChannelAna::ensureHists(), hit::MagDriftAna::ensureHists(), tca::FillWireHitRange(), simfilter::FilterNoDirtNeutrinos::filter(), util::GeometryUtilities::Get2DangleFrom3D(), trk::TrackContainmentAlg::GetCosmicTagID(), geo::GeometryCore::GetElement(), nnet::TrainingDataAlg::getProjection(), lar_pandora::LArPandoraInput::GetTrueX0(), cosmic::BeamFlashTrackMatchTaggerAlg::InDetector(), cosmic::BeamFlashTrackMatchTaggerAlg::InDriftWindow(), pma::Track3D::InitFromMiddle(), trk::TrackContainmentAlg::IsContained(), pma::PMAlgTracker::mergeCoLinear(), lar_cluster3d::StandardHit3DBuilder::NearestWireID(), lar_cluster3d::SnippetHit3DBuilder::NearestWireID(), larg4::OpFastScintillation::OpFastScintillation(), phot::PDFastSimPAR::PDFastSimPAR(), trkf::CCTrackMaker::PlnMatch(), trk::TrackContainmentAlg::ProcessTracks(), evgen::CosmicsGen::produce(), trkf::SpacePts::produce(), trkf::Track3Dreco::produce(), trkf::Track3DKalman::produce(), vertex::VertexFinder2D::produce(), detsim::SimDriftElectrons::produce(), detsim::DriftElectronstoPlane::produce(), trkf::Track3DKalmanSPS::produce(), trkf::PMAlgTrackMaker::produce(), evgen::ActiveVolumeVertexSampler::sample_vertex_pos(), tca::SaveCRInfo(), phot::SemiAnalyticalModel::SemiAnalyticalModel(), pma::Track3D::SetT0FromDx(), lar_pandora::LArPandoraGeometry::ShouldSwitchUV(), geo::WireReadoutGeom::SortPlanes(), trkf::CCTrackMaker::TagCosmics(), lar_pandora::ICARUS::TargetViewU(), lar_pandora::VintageLArTPCThreeView::TargetViewU(), lar_pandora::ICARUS::TargetViewV(), lar_pandora::VintageLArTPCThreeView::TargetViewV(), apa::APAGeometryAlg::ThreeChanPos(), calo::GnocchiCalorimetry::TrajectoryToWirePosition(), apa::DisambigAlg::TrivialDisambig(), apa::DisambigAlg::UseEndPts(), and evd::RecoBaseDrawer::Vertex2D().

449  {
450  return Cryostat(tpcid).TPC(tpcid);
451  }
CryostatGeo const & Cryostat(CryostatID const &cryoid=details::cryostat_zero) const
Returns the specified cryostat.
TPCGeo const & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:73
TPCGeo const* geo::GeometryCore::TPCPtr ( TPCID const &  tpcid) const
inlineinherited

Returns the specified TPC.

Parameters
tpcidTPC ID
Returns
a constant pointer to the specified TPC, or nullptr if none

The GetElementPtr() method is overloaded and its return depends on the type of ID.

Definition at line 463 of file GeometryCore.h.

References geo::GeometryCore::CryostatPtr(), and geo::CryostatGeo::TPCPtr().

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

464  {
465  CryostatGeo const* pCryo = CryostatPtr(tpcid);
466  return pCryo ? pCryo->TPCPtr(tpcid) : nullptr;
467  }
CryostatGeo const * CryostatPtr(CryostatID const &cryoid) const
Returns the specified cryostat.
Definition: GeometryCore.h:345
std::string geo::GeometryCore::VolumeName ( Point_t const &  point) const
inherited

Returns the name of the deepest volume containing specified point.

Parameters
pointthe location to query, in world coordinates
Returns
name of the volume containing the point
Todo:

what happens if none?

Unify the coordinates type

Definition at line 446 of file GeometryCore.cxx.

References util::abs(), and geo::GeometryCore::WorldVolume().

Referenced by larg4::LArG4Ana::analyze(), LArStackingAction::InsideTPC(), and geo::GeometryCore::SurfaceY().

447  {
448  // check that the given point is in the World volume at least
449  TGeoVolume const* volWorld = WorldVolume();
450  double halflength = ((TGeoBBox*)volWorld->GetShape())->GetDZ();
451  double halfheight = ((TGeoBBox*)volWorld->GetShape())->GetDY();
452  double halfwidth = ((TGeoBBox*)volWorld->GetShape())->GetDX();
453  if (std::abs(point.x()) > halfwidth || std::abs(point.y()) > halfheight ||
454  std::abs(point.z()) > halflength) {
455  mf::LogWarning("GeometryCoreBadInputPoint")
456  << "point (" << point.x() << "," << point.y() << "," << point.z() << ") "
457  << "is not inside the world volume "
458  << " half width = " << halfwidth << " half height = " << halfheight
459  << " half length = " << halflength << " returning unknown volume name";
460  return "unknownVolume";
461  }
462 
463  return gGeoManager->FindNode(point.X(), point.Y(), point.Z())->GetName();
464  }
constexpr auto abs(T v)
Returns the absolute value of the argument.
TGeoVolume const * WorldVolume() const
Returns a pointer to the world volume.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void geo::GeometryCore::WorldBox ( double *  xlo,
double *  xhi,
double *  ylo,
double *  yhi,
double *  zlo,
double *  zhi 
) const
inherited

Fills the arguments with the boundaries of the world.

Parameters
xlo(output) pointer to the lower x coordinate
xlo(output) pointer to the upper x coordinate
ylo(output) pointer to the lower y coordinate
ylo(output) pointer to the upper y coordinate
zlo(output) pointer to the lower z coordinate
zlo(output) pointer to the upper z coordinate
Exceptions
cet::exception("GeometryCore" category) if no world found
See also
GetWorldVolumeName()

This method fills the boundaries of the world volume (GetWorldVolumeName()).

If a pointer is null, its coordinate is skipped.

Deprecated:
Use the version without arguments instead.

Definition at line 429 of file GeometryCore.cxx.

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

Referenced by evd_tool::ICARUSDrawer::DetOutline3D(), and evgen::CORSIKAGen::GetSample().

435  {
436  BoxBoundedGeo const box = WorldBox();
437  if (xlo) *xlo = box.MinX();
438  if (ylo) *ylo = box.MinY();
439  if (zlo) *zlo = box.MinZ();
440  if (xhi) *xhi = box.MaxX();
441  if (yhi) *yhi = box.MaxY();
442  if (zhi) *zhi = box.MaxZ();
443  }
BoxBoundedGeo WorldBox() const
BoxBoundedGeo geo::GeometryCore::WorldBox ( ) const
inherited

Returns a box with the extremes of the world volume (from shape axes).

See also
GetWorldVolumeName()

Definition at line 407 of file GeometryCore.cxx.

References geo::GeometryCore::GetWorldVolumeName(), geo::GeometryCore::WorldVolume(), x1, x2, y1, and y2.

Referenced by geo::GeometryCore::DetectorName(), geo::GeometryCore::MaterialName(), and geo::GeometryCore::WorldBox().

408  {
409  TGeoVolume const* world = WorldVolume();
410  if (!world) {
411  throw cet::exception("GeometryCore") << "no world volume '" << GetWorldVolumeName() << "'\n";
412  }
413  TGeoShape const* s = world->GetShape();
414  if (!s) {
415  throw cet::exception("GeometryCore")
416  << "world volume '" << GetWorldVolumeName() << "' is shapeless!!!\n";
417  }
418 
419  double x1, x2, y1, y2, z1, z2;
420  s->GetAxisRange(1, x1, x2);
421  s->GetAxisRange(2, y1, y2);
422  s->GetAxisRange(3, z1, z2);
423 
424  // BoxBoundedGeo constructor will sort the coordinates as needed
425  return BoxBoundedGeo{x1, x2, y1, y2, z1, z2};
426  }
std::string const & GetWorldVolumeName() const
Return the name of the world volume (needed by Geant4 simulation)
Float_t y1[n_points_granero]
Definition: compare.C:5
Float_t x1[n_points_granero]
Definition: compare.C:5
TGeoVolume const * WorldVolume() const
Returns a pointer to the world volume.
Float_t y2[n_points_geant4]
Definition: compare.C:26
Float_t x2[n_points_geant4]
Definition: compare.C:26
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
TGeoVolume const * geo::GeometryCore::WorldVolume ( ) const
inherited

Returns a pointer to the world volume.

Definition at line 401 of file GeometryCore.cxx.

References geo::GeometryCore::GetWorldVolumeName().

Referenced by geo::GeometryCore::DetectorName(), geo::GeometryCore::VolumeName(), and geo::GeometryCore::WorldBox().

402  {
403  return gGeoManager->FindVolumeFast(GetWorldVolumeName().c_str());
404  }
std::string const & GetWorldVolumeName() const
Return the name of the world volume (needed by Geant4 simulation)

Member Data Documentation

sumdata::GeometryConfigurationInfo geo::Geometry::fConfInfo
private

Summary of service configuration.

Definition at line 65 of file Geometry.h.

Referenced by configurationInfo(), and FillGeometryConfigurationInfo().


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