LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
GeometryCore.h
Go to the documentation of this file.
1 
46 #ifndef LARCOREALG_GEOMETRY_GEOMETRYCORE_H
47 #define LARCOREALG_GEOMETRY_GEOMETRYCORE_H
48 
49 
50 // LArSoft libraries
61 #include "larcorealg/Geometry/GeometryDataContainers.h" // geo::TPCDataContainer
62 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect namespace
67 #include "larcoreobj/SimpleTypesAndConstants/RawTypes.h" // raw::ChannelID_t
68 
69 // Framework and infrastructure libraries
70 #include "fhiclcpp/ParameterSet.h"
71 
72 // ROOT libraries
73 #include "TVector3.h"
74 
75 // C/C++ standard libraries
76 #include <cstddef> // size_t
77 #include <string>
78 #include <vector>
79 #include <set>
80 #include <memory> // std::shared_ptr<>
81 #include <iterator> // std::forward_iterator_tag
82 #include <type_traits> // std::is_base_of<>
83 
84 
85 // ROOT class prototypes
86 class TGeoManager;
87 class TGeoNode;
88 class TGeoVolume;
89 class TGeoMaterial;
90 
91 
93 namespace geo {
94 
95 
96  // Forward declarations within namespace.
97  class AuxDetGeo;
98  class AuxDetSensitiveGeo;
99  class OpDetGeo;
100  class GeometryCore;
101 
102 
103  //
104  // iterators
105  //
106 
107  namespace details {
108 
111  public:
112 
114  struct BeginPos_t {};
116  struct EndPos_t {};
117  struct UndefinedPos_t {};
118 
119  static constexpr BeginPos_t begin_pos = {};
120  static constexpr EndPos_t end_pos = {};
121  static constexpr UndefinedPos_t undefined_pos = {};
123 
124  }; // class geometry_iterator_types
125 
128  public:
129 
131  geometry_iterator_base(geo::GeometryCore const* geom): pGeo(geom) {}
132 
133  protected:
135  geo::GeometryCore const* geometry() const { return pGeo; }
136 
139 
140  private:
141  GeometryCore const* pGeo = nullptr;
142 
143  }; // class geometry_iterator_base
144 
145 
146 
159  template <typename GEOID>
161  virtual public std::forward_iterator_tag, public geometry_iterator_base
162  {
163  public:
165  using GeoID_t = GEOID;
166 
168 
171  "template type GEOID is not a LocalID_t");
172 
173 
176 
180 
183  (geo::GeometryCore const* geom, GeoID_t const& start_from):
185  { id = start_from; }
186 
189  (geo::GeometryCore const* geom, BeginPos_t const):
191  { set_begin(); }
192 
196  { set_end(); }
197 
198  // TODO reconsider if the additional template is indeed needed
200  template <typename OTHERID>
202  { return localID() == as.localID(); }
203 
205  template <typename OTHERID>
207  { return localID() != as.localID(); }
208 
210  LocalID_t const& operator* () const { return localID(); }
211 
213  LocalID_t const* operator-> () const { return &(localID()); }
214 
216  iterator& operator++ () { next(); return *this; }
217 
219  iterator operator++ (int) { iterator old(*this); next(); return old; }
220 
222  operator bool() const;
223 
225  ElementPtr_t get() const;
226 
227  protected:
228  using ID_t = typename LocalID_t::CryostatID_t;
229 
232  geometry_iterator_base(geom), id()
233  { set_local_limits(); }
234 
236  GeoID_t const& ID() const { return id; }
238  GeoID_t& ID() { return id; }
240 
242  void next();
243 
245  bool at_end() const { return local_index() == limit; }
246 
247  private:
249  ID_t limit = LocalID_t::InvalidID;
250 
252  void set_local_limits();
253 
255  void set_begin();
256 
258  void set_end();
259 
261  LocalID_t const& localID() const
263  { return static_cast<LocalID_t const&>(ID()); }
264  LocalID_t& localID() { return static_cast<LocalID_t&>(ID()); }
266 
268  ID_t const& local_index() const { return localID().Cryostat; }
270  ID_t& local_index() { return localID().Cryostat; }
272 
273  }; // class cryostat_id_iterator_base<>
274 
275 
293  template <typename GEOID>
295  virtual public std::forward_iterator_tag,
296  protected cryostat_id_iterator_base<GEOID>
297  {
299 
300  public:
301  using ElementPtr_t = geo::TPCGeo const*;
303 
306  "template type GEOID is not a LocalID_t");
307 
309 
310  // import all the useful types from the base templated class
311  using typename upper_iterator::UndefinedPos_t;
312  using typename upper_iterator::BeginPos_t;
313  using typename upper_iterator::EndPos_t;
314 
315  // import all the useful members from the base templated class
319 
322 
326 
329  (geo::GeometryCore const* geom, GeoID_t const& start_from):
330  upper_iterator(geom, start_from)
331  { set_local_limits(); }
332 
336  { set_local_limits(); }
337 
340  upper_iterator(geom, end_pos)
341  {} // the local limit is ill-defined and left invalid
342 
343  // TODO reconsider if the additional template is indeed needed
345  template <typename OTHERID>
347  { return localID() == as.localID(); }
348 
350  template <typename OTHERID>
352  { return localID() != as.localID(); }
353 
355  LocalID_t const& operator* () const { return localID(); }
356 
358  LocalID_t const* operator-> () const { return &(localID()); }
359 
361  iterator& operator++ () { next(); return *this; }
362 
364  iterator operator++ (int) { iterator old(*this); next(); return old; }
365 
367  operator bool() const;
368 
370  ElementPtr_t get() const;
371 
372  protected:
373 
374  using ID_t = typename LocalID_t::TPCID_t;
375 
379  {}
380 
381  using upper_iterator::ID; // to be explicit; this is NOT overloaded
382 
384  LocalID_t const& localID() const
385  { return static_cast<LocalID_t const&>(upper_iterator::ID()); }
386 
387  using upper_iterator::at_end; // to be explicit; this is NOT overloaded
388 
390  void next();
391 
393  ID_t const& local_index() const { return localID().TPC; }
394 
395  private:
396 
398  ID_t limit = LocalID_t::InvalidID;
399 
401  void set_local_limits();
402 
404  LocalID_t& localID() { return static_cast<LocalID_t&>(ID()); }
405 
407  ID_t& local_index() { return localID().TPC; }
408 
409  }; // class TPC_id_iterator_base
410 
411 
429  template <typename GEOID>
431  virtual public std::forward_iterator_tag,
432  protected TPC_id_iterator_base<GEOID>
433  {
435 
436  public:
437  using ElementPtr_t = geo::PlaneGeo const*;
439 
442  "template type GEOID is not a LocalID_t");
443 
446 
447  // import all the useful types from the base templated class
448  using typename upper_iterator::UndefinedPos_t;
449  using typename upper_iterator::BeginPos_t;
450  using typename upper_iterator::EndPos_t;
451 
452  // import all the useful members from the base templated class
456 
459 
463 
466  (geo::GeometryCore const* geom, GeoID_t const& start_from):
467  upper_iterator(geom, start_from)
468  { set_local_limits(); }
469 
473  { set_local_limits(); }
474 
477  upper_iterator(geom, end_pos)
478  {} // the local limit is ill-defined and left invalid
479 
480  // TODO reconsider if the additional template is indeed needed
482  template <typename OTHERID>
484  { return localID() == as.localID(); }
485 
487  template <typename OTHERID>
489  { return localID() != as.localID(); }
490 
492  LocalID_t const& operator* () const { return localID(); }
493 
495  LocalID_t const* operator-> () const { return &(localID()); }
496 
498  iterator& operator++ () { next(); return *this; }
499 
501  iterator operator++ (int) { iterator old(*this); next(); return old; }
502 
504  operator bool() const;
505 
507  ElementPtr_t get() const;
508 
509  protected:
510 
511  using ID_t = typename LocalID_t::PlaneID_t;
512 
516  {}
517 
518  using upper_iterator::ID; // to be explicit; this is NOT overloaded
519 
521  LocalID_t const& localID() const
522  { return static_cast<LocalID_t const&>(upper_iterator::ID()); }
523 
524  using upper_iterator::at_end; // to be explicit; this is NOT overloaded
525 
527  void next();
528 
530  ID_t const& local_index() const { return localID().Plane; }
531 
532  private:
533 
535  ID_t limit = LocalID_t::InvalidID;
536 
538  void set_local_limits();
539 
541  LocalID_t& localID() { return static_cast<LocalID_t&>(ID()); }
542 
544  ID_t& local_index() { return localID().Plane; }
545 
546  }; // class plane_id_iterator_base
547 
548 
566  template <typename GEOID>
568  virtual public std::forward_iterator_tag,
569  protected plane_id_iterator_base<GEOID>
570  {
572 
573  public:
574  using ElementPtr_t = geo::WireGeo const*;
576 
579  "template type GEOID is not a LocalID_t");
580 
583 
584  // import all the useful types from the base templated class
585  using typename upper_iterator::UndefinedPos_t;
586  using typename upper_iterator::BeginPos_t;
587  using typename upper_iterator::EndPos_t;
588 
589  // import all the useful members from the base templated class
593 
596 
600 
603  (geo::GeometryCore const* geom, GeoID_t const& start_from):
604  upper_iterator(geom, start_from)
605  { set_local_limits(); }
606 
610  { set_local_limits(); }
611 
614  upper_iterator(geom, end_pos)
615  {} // the local limit is ill-defined and left invalid
616 
617  // TODO reconsider if the additional template is indeed needed
619  template <typename OTHERID>
621  { return localID() == as.localID(); }
622 
624  template <typename OTHERID>
626  { return localID() != as.localID(); }
627 
629  LocalID_t const& operator* () const { return localID(); }
630 
632  LocalID_t const* operator-> () const { return &(localID()); }
633 
635  iterator& operator++ () { next(); return *this; }
636 
638  iterator operator++ (int) { iterator old(*this); next(); return old; }
639 
641  operator bool() const;
642 
644  ElementPtr_t get() const;
645 
646  protected:
647 
648  using ID_t = typename LocalID_t::WireID_t;
649 
653  {}
654 
655  using upper_iterator::ID; // to be explicit; this is NOT overloaded
656 
658  LocalID_t const& localID() const
659  { return static_cast<LocalID_t const&>(upper_iterator::ID()); }
660 
661  using upper_iterator::at_end; // to be explicit; this is NOT overloaded
662 
664  void next();
665 
667  ID_t const& local_index() const { return localID().Wire; }
668 
669  private:
670 
672  ID_t limit = LocalID_t::InvalidID;
673 
675  void set_local_limits();
676 
678  LocalID_t& localID() { return static_cast<LocalID_t&>(ID()); }
679 
681  ID_t& local_index() { return localID().Wire; }
682 
683  }; // class wire_id_iterator_base
684 
685 
686  // forward declarations:
687  template <typename GEOIDITER>
689 
691  template <typename GEOIDITER>
692  bool operator== (
694  GEOIDITER const& id_iter
695  );
697  template <typename GEOIDITER>
698  inline bool operator== (
699  GEOIDITER const& id_iter,
701  )
702  { return iter == id_iter; }
703 
705  template <typename GEOIDITER>
706  bool operator!= (
708  GEOIDITER const& id_iter
709  );
711  template <typename GEOIDITER>
712  inline bool operator!= (
713  GEOIDITER const& id_iter,
715  )
716  { return iter != id_iter; }
717 
734  template <typename GEOIDITER>
736  public std::forward_iterator_tag, public geometry_iterator_types
737  {
738  public:
739  using id_iterator_t = GEOIDITER;
740 
741  static_assert(
743  "template class for geometry_element_iterator"
744  " must be a geometry iterator"
745  );
746 
748 
751  using LocalID_t = typename id_iterator_t::LocalID_t;
752  using GeoID_t = typename id_iterator_t::GeoID_t;
756  using ElementPtr_t = typename id_iterator_t::ElementPtr_t;
758 
765 
767  using Element_t = typename std::remove_pointer<ElementPtr_t>::type;
768 
770  geometry_element_iterator() = default;
771 
774  id_iter(geom) {}
775 
777  geometry_element_iterator(id_iterator_t const& iter): id_iter(iter) {}
778 
780  geometry_element_iterator(id_iterator_t&& iter): id_iter(iter) {}
781 
784  (geo::GeometryCore const* geom, GeoID_t const& start_from):
785  id_iter(geom, start_from)
786  {}
787 
790  (geo::GeometryCore const* geom, BeginPos_t const pos):
791  id_iter(geom, pos)
792  {}
793 
796  (geo::GeometryCore const* geom, EndPos_t const pos):
797  id_iter(geom, pos)
798  {}
799 
801  bool operator== (iterator const& as) const
802  { return id_iterator() == as.id_iterator(); }
803 
805  bool operator!= (iterator const& as) const
806  { return id_iterator() != as.id_iterator(); }
807 
814  Element_t const& operator* () const
815  {
816  ElementPtr_t ptr = get();
817  if (ptr) return *ptr;
818  throw cet::exception("geometry_iterator")
819  << "iterator attempted to obtain geometry element "
820  << std::string(ID());
821  } // operator*()
822 
824  Element_t const* operator-> () const { return get(); }
825 
827  iterator& operator++ () { ++id_iterator(); return *this; }
828 
830  iterator operator++ (int)
831  { iterator old(*this); ++id_iterator(); return old; }
832 
834  operator bool() const
835  { return bool(id_iterator()) && (id_iterator().get() != nullptr); }
836 
838  ElementPtr_t get() const { return id_iterator().get(); }
839 
841  LocalID_t const& ID() const { return *(id_iterator()); }
842 
843  protected:
844  friend bool geo::details::operator== <id_iterator_t>
845  (iterator const& iter, id_iterator_t const& id_iter);
846  friend bool geo::details::operator== <id_iterator_t>
847  (id_iterator_t const& id_iter, iterator const& iter);
848  friend bool geo::details::operator!= <id_iterator_t>
849  (iterator const& iter, id_iterator_t const& id_iter);
850  friend bool geo::details::operator!= <id_iterator_t>
851  (id_iterator_t const& id_iter, iterator const& iter);
852 
854  id_iterator_t const& id_iterator() const { return id_iter; }
856  id_iterator_t& id_iterator() { return id_iter; }
858 
859  private:
861 
862  }; // class geometry_element_iterator<>
863 
864 
882  template <typename GEOID>
884  virtual public std::forward_iterator_tag,
885  protected cryostat_id_iterator_base<GEOID>
886  {
888 
889  public:
891 
894  "template type GEOID is not a LocalID_t");
895 
898 
899  // import all the useful types from the base templated class
900  using typename upper_iterator::UndefinedPos_t;
901  using typename upper_iterator::BeginPos_t;
902  using typename upper_iterator::EndPos_t;
903 
904  // import all the useful members from the base templated class
908 
911 
915  {}
916 
919  (geo::GeometryCore const* geom, GeoID_t const& start_from)
920  : upper_iterator(geom, start_from)
921  { set_local_limits(); }
922 
925  : upper_iterator(geom, begin_pos)
926  { set_local_limits(); }
927 
930  : upper_iterator(geom, end_pos)
931  {} // the local limit is ill-defined and left invalid
932 
933  // TODO reconsider if the additional template is indeed needed
935  template <typename OTHERID>
937  { return localID() == as.localID(); }
938 
940  template <typename OTHERID>
942  { return localID() != as.localID(); }
943 
945  LocalID_t const& operator* () const { return localID(); }
946 
948  LocalID_t const* operator-> () const { return &(localID()); }
949 
951  iterator& operator++ () { next(); return *this; }
952 
954  iterator operator++ (int) { iterator old(*this); next(); return old; }
955 
957  operator bool() const;
958 
959  protected:
960 
962  using ID_t = typename LocalID_t::TPCsetID_t;
963 
967  {}
968 
969  using upper_iterator::ID; // to be explicit; this is NOT overloaded
970 
972  LocalID_t const& localID() const
973  { return static_cast<LocalID_t const&>(upper_iterator::ID()); }
974 
975  using upper_iterator::at_end; // to be explicit; this is NOT overloaded
976 
978  void next();
979 
981  ID_t const& local_index() const { return localID().TPCset; }
982 
983  private:
984 
986  ID_t limit = LocalID_t::InvalidID;
987 
989  void set_local_limits();
990 
992  LocalID_t& localID() { return static_cast<LocalID_t&>(ID()); }
993 
995  ID_t& local_index() { return localID().TPCset; }
996 
997  // no object is currently implemented for TPC sets
998  typename upper_iterator::ElementPtr_t get() const = delete;
999 
1000 
1001  }; // class TPCset_id_iterator_base
1002 
1003 
1022  template <typename GEOID>
1024  virtual public std::forward_iterator_tag,
1025  protected TPCset_id_iterator_base<GEOID>
1026  {
1028 
1029  public:
1031 
1034  "template type GEOID is not a LocalID_t");
1035 
1038 
1039  // import all the useful types from the base templated class
1040  using typename upper_iterator::UndefinedPos_t;
1041  using typename upper_iterator::BeginPos_t;
1042  using typename upper_iterator::EndPos_t;
1043 
1044  // import all the useful members from the base templated class
1048 
1050  ROP_id_iterator_base() = default;
1051 
1054  : ROP_id_iterator_base(geom, begin_pos) {}
1055 
1058  (geo::GeometryCore const* geom, GeoID_t const& start_from)
1059  : upper_iterator(geom, start_from)
1060  { set_local_limits(); }
1061 
1064  : upper_iterator(geom, begin_pos)
1065  { set_local_limits(); }
1066 
1069  : upper_iterator(geom, end_pos)
1070  {} // the local limit is ill-defined and left invalid
1071 
1072  // TODO reconsider if the additional template is indeed needed
1074  template <typename OTHERID>
1076  { return localID() == as.localID(); }
1077 
1079  template <typename OTHERID>
1081  { return localID() != as.localID(); }
1082 
1084  LocalID_t const& operator* () const { return localID(); }
1085 
1087  LocalID_t const* operator-> () const { return &(localID()); }
1088 
1090  iterator& operator++ () { next(); return *this; }
1091 
1093  iterator operator++ (int) { iterator old(*this); next(); return old; }
1094 
1096  operator bool() const;
1097 
1098  protected:
1099 
1100  using ID_t = typename LocalID_t::ROPID_t;
1101 
1104  : upper_iterator(geom, undefined_pos)
1105  {}
1106 
1107  using upper_iterator::ID; // to be explicit; this is NOT overloaded
1108 
1110  LocalID_t const& localID() const
1111  { return static_cast<LocalID_t const&>(upper_iterator::ID()); }
1112 
1113  using upper_iterator::at_end; // to be explicit; this is NOT overloaded
1114 
1116  void next();
1117 
1119  ID_t const& local_index() const { return localID().ROP; }
1120 
1121  private:
1122 
1124  ID_t limit = LocalID_t::InvalidID;
1125 
1128  void set_local_limits();
1129 
1131  LocalID_t& localID() { return static_cast<LocalID_t&>(ID()); }
1132 
1134  ID_t& local_index() { return localID().ROP; }
1135 
1136  }; // class ROP_id_iterator_base
1137 
1138 
1139  } // namespace details
1140 
1141  // BEGIN Geometry group ------------------------------------------------------
1144 
1163  using cryostat_id_iterator
1165 
1173  using cryostat_iterator
1175 
1176 
1197 
1206 
1207 
1228 
1237 
1238 
1258 
1267 
1268 
1287  using TPCset_id_iterator
1289 
1290 
1310 
1311 
1312  template <typename Iter>
1314  public:
1315  using iterator = Iter;
1316 
1318  IteratorBoxBase(iterator const& b, iterator const& e): b(b), e(e) {}
1319 
1320  iterator begin() const { return b; }
1321  iterator end() const { return e; }
1322 
1323  iterator cbegin() const { return b; }
1324  iterator cend() const { return e; }
1325 
1326  protected:
1328 
1329  }; // IteratorBoxBase<>
1330 
1331 
1332  template <
1333  typename Iter,
1334  Iter (GeometryCore::*BeginFunc)() const,
1335  Iter (GeometryCore::*EndFunc)() const
1336  >
1338  public:
1339 
1341  : IteratorBoxBase<Iter>((geom->*BeginFunc)(), (geom->*EndFunc)())
1342  {}
1343 
1344  }; // IteratorBox<>
1345 
1346 
1347  template <
1348  typename Iter,
1349  typename GeoID,
1350  Iter (GeometryCore::*BeginFunc)(GeoID const&) const,
1351  Iter (GeometryCore::*EndFunc)(GeoID const&) const
1352  >
1354  public:
1355 
1356  LocalIteratorBox(GeometryCore const* geom, GeoID const& ID)
1357  : IteratorBoxBase<Iter>((geom->*BeginFunc)(ID), (geom->*EndFunc)(ID))
1358  {}
1359 
1360  }; // LocalIteratorBox<>
1361 
1362 
1365  namespace iterators {
1366 
1370 
1374 
1375  } // namespace iterators
1376 
1377 
1378  //
1379  // GeometryCore
1380  //
1381 
1382 
1385 
1387  using CryostatList_t = std::vector<geo::CryostatGeo>;
1389  using AuxDetList_t = std::vector<AuxDetGeo*>;
1390 
1393 
1394  }; // GeometryData_t
1395 
1396 
1397 
1443 
1444  using DefaultVector_t = TVector3;
1445  using DefaultPoint_t = TVector3;
1446 
1447  public:
1448 
1451  using Coord_t [[deprecated("Use geo::Point_t instead")]] = geo::Length_t;
1452 
1455  using Point3D_t [[deprecated("Convert the code to use geo::Point_t")]]
1456  = DefaultPoint_t;
1457 
1458 
1460  template <typename Point>
1461  struct Segment: public std::pair<Point, Point> {
1462 
1463  // use the base class constructors
1464  using std::pair<Point, Point>::pair;
1465 
1466  Point const& start() const { return this->first; }
1467  Point& start() { return this->first; }
1468 
1469  Point const& end() const { return this->second; }
1470  Point& end() { return this->second; }
1471 
1472  }; // struct Segment_t
1473 
1475 
1480 
1481 
1484  static constexpr std::size_t MaxWireDepthInGDML = 20U;
1485 
1488 
1489 
1490  // import iterators
1511 
1532 
1556 
1578 
1602 
1624 
1648 
1670 
1671 
1672 
1680  GeometryCore(fhicl::ParameterSet const& pset);
1681 
1683  ~GeometryCore();
1684 
1685  // this object is not copiable nor moveable (see also issue #14384);
1686  // currently, auxiliary detectors are stored as bare pointers,
1687  // which prevents trivial copy or move.
1688  GeometryCore(GeometryCore const&) = delete;
1689  GeometryCore(GeometryCore&&) = delete;
1690  GeometryCore& operator= (GeometryCore const&) = delete;
1691  GeometryCore& operator= (GeometryCore&&) = delete;
1692 
1693 
1705  double DefaultWiggle() const { return fPositionWiggle; }
1706 
1714  std::string ROOTFile() const { return fROOTfile; }
1715 
1723  std::string GDMLFile() const { return fGDMLfile; }
1724 
1725 
1726 
1727  // BEGIN Detector information
1730 
1731  //
1732  // global features
1733  //
1735  std::string DetectorName() const { return fDetectorName; }
1736 
1737 
1738  //
1739  // position
1740  //
1741 
1743  TGeoVolume const* WorldVolume() const;
1744 
1745 
1764  void WorldBox(double* xlo, double* xhi,
1765  double* ylo, double* yhi,
1766  double* zlo, double* zhi) const;
1767 
1770  geo::BoxBoundedGeo WorldBox() const;
1771 
1785  //
1786  geo::Length_t SurfaceY() const { return fSurfaceY; }
1787 
1788 
1789  //
1790  // object description and information
1791  //
1792 
1794  TGeoManager* ROOTGeoManager() const;
1795 
1797  const std::string GetWorldVolumeName() const;
1798 
1802  geo::BoxBoundedGeo DetectorEnclosureBox
1803  (std::string const& name = "volDetEnclosure") const;
1804 
1805 
1807 
1815  std::string VolumeName(geo::Point_t const& point) const;
1816  std::string VolumeName(TVector3 const& point) const
1817  { return VolumeName(geo::vect::toPoint(point)); }
1819 
1820 
1830  std::vector<TGeoNode const*> FindAllVolumes
1831  (std::set<std::string> const& vol_names) const;
1832 
1846  std::vector<std::vector<TGeoNode const*>> FindAllVolumePaths
1847  (std::set<std::string> const& vol_names) const;
1848 
1849 
1851  TGeoMaterial const* Material(geo::Point_t const& point) const;
1853 
1857  std::string MaterialName(TVector3 const& point) const
1858  { return MaterialName(geo::vect::toPoint(point)); }
1859  std::string MaterialName(geo::Point_t const& point) const;
1861 
1862 
1864  double TotalMass() const { return TotalMass(GetWorldVolumeName()); }
1866  double TotalMass(std::string vol) const;
1868 
1870 
1883  double MassBetweenPoints
1884  (geo::Point_t const& p1, geo::Point_t const& p2) const;
1885  double MassBetweenPoints(double *p1, double *p2) const;
1887 
1888 
1890  template <typename Stream>
1891  void Print(Stream&& out, std::string indent = " ") const;
1892 
1894  // END Detector information
1895 
1896 
1902  template <typename GeoID>
1903  GeoID GetBeginID() const { GeoID id; GetBeginID(id); return id; }
1904 
1911  template <typename GeoID>
1912  GeoID GetNextID(GeoID const& id) const
1913  { auto nextID(id); IncrementID(nextID); return nextID; }
1914 
1921  template <typename GeoID>
1922  GeoID GetEndID() const { GeoID id; GetEndID(id); return id; }
1923 
1924 
1932  template <typename GeoID, typename ContextID>
1933  GeoID GetBeginID(ContextID const& id) const;
1934 
1944  template <typename GeoID, typename ContextID>
1945  GeoID GetEndID(ContextID const& id) const;
1946 
1947 
1950 
1951  //
1952  // group features
1953  //
1954 
1956 
1964  unsigned int Ncryostats() const { return Cryostats().size(); }
1965  unsigned int NElements() const { return Ncryostats(); }
1966  unsigned int NSiblingElements(geo::CryostatID const&) const
1967  { return Ncryostats(); }
1969 
1970  //
1971  // access
1972  //
1973 
1975 
1981  bool HasCryostat(geo::CryostatID const& cryoid) const
1982  { return cryoid.Cryostat < Ncryostats(); }
1983  bool HasElement(geo::CryostatID const& cryoid) const
1984  { return HasCryostat(cryoid); }
1986 
1988 
2000  CryostatGeo const& Cryostat(geo::CryostatID const& cryoid) const;
2001  CryostatGeo const& Cryostat(unsigned int const cstat = 0) const
2002  { return Cryostat(geo::CryostatID(cstat)); }
2003  CryostatGeo const& GetElement(geo::CryostatID const& cryoid) const
2004  { return Cryostat(cryoid); }
2006 
2008 
2016  CryostatGeo const* CryostatPtr(geo::CryostatID const& cryoid) const
2017  { return HasCryostat(cryoid)? &(Cryostats()[cryoid.Cryostat]): nullptr; }
2018  CryostatGeo const* GetElementPtr(geo::CryostatID const& cryoid) const
2019  { return CryostatPtr(cryoid); }
2021 
2023 
2030  geo::CryostatID::CryostatID_t FindCryostatAtPosition
2031  (geo::Point_t const& worldLoc) const;
2032  geo::CryostatID::CryostatID_t FindCryostatAtPosition
2033  (double const worldLoc[3]) const;
2035 
2036 
2044  geo::CryostatGeo const* PositionToCryostatPtr
2045  (geo::Point_t const& point) const;
2046 
2054  geo::CryostatID PositionToCryostatID(geo::Point_t const& point) const;
2055 
2056 
2058 
2066  CryostatGeo const& PositionToCryostat(geo::Point_t const& point) const;
2067  CryostatGeo const& PositionToCryostat(double const point[3]) const
2068  { return PositionToCryostat(geo::vect::makePointFromCoords(point)); }
2070 
2082  CryostatGeo const& PositionToCryostat
2083  (double const worldLoc[3], geo::CryostatID& cid) const;
2084 
2096  CryostatGeo const& PositionToCryostat
2097  (double const worldLoc[3], unsigned int &cstat) const;
2098 
2099  //
2100  // iterators
2101  //
2102 
2104  void GetBeginID(geo::CryostatID& id) const
2105  { id = geo::CryostatID(0, HasCryostat(geo::CryostatID(0))); }
2106 
2108  void GetEndID(geo::CryostatID& id) const
2109  { id = geo::CryostatID(Ncryostats(), false); }
2110 
2113  bool IncrementID(geo::CryostatID& id) const; // inline implementation
2114 
2118 
2122 
2126 
2130 
2145  IteratorBox<
2148  >
2149  IterateCryostatIDs() const { return { this }; }
2150 
2164  IteratorBox<
2167  >
2168  IterateCryostats() const { return { this }; }
2169 
2170  //
2171  // single object features
2172  //
2173 
2175  geo::Length_t CryostatHalfWidth(geo::CryostatID const& cid) const;
2177  geo::Length_t CryostatHalfWidth(unsigned int cstat = 0) const
2178  { return CryostatHalfWidth(geo::CryostatID(cstat)); }
2180 
2182  geo::Length_t CryostatHalfHeight(geo::CryostatID const& cid) const;
2184  geo::Length_t CryostatHalfHeight(unsigned int cstat = 0) const
2185  { return CryostatHalfHeight(geo::CryostatID(cstat)); }
2187 
2189  geo::Length_t CryostatLength(geo::CryostatID const& cid) const;
2191  geo::Length_t CryostatLength(unsigned int cstat = 0) const
2192  { return CryostatLength(geo::CryostatID(cstat)); }
2194 
2195 
2211  void CryostatBoundaries
2212  (double* boundaries, geo::CryostatID const& cid) const;
2213 
2229  void CryostatBoundaries
2230  (double* boundaries, unsigned int cstat = 0) const
2231  { CryostatBoundaries(boundaries, geo::CryostatID(cstat)); }
2232 
2233 
2234  //
2235  // object description
2236  //
2237 
2239 
2249  std::string GetCryostatVolumeName(geo::CryostatID const& cid) const;
2250  std::string GetCryostatVolumeName(unsigned int const cstat = 0) const
2251  { return GetCryostatVolumeName(geo::CryostatID(cstat)); }
2253 
2255 
2256 
2257 
2260 
2261  //
2262  // group features
2263  //
2264 
2273  unsigned int NTPC(unsigned int cstat = 0) const
2274  { return NTPC(geo::CryostatID(cstat)); }
2275 
2277  unsigned int MaxTPCs() const;
2278 
2280  unsigned int TotalNTPC() const;
2281 
2282 
2311  template <typename T>
2313  { return { Ncryostats(), MaxTPCs() }; }
2314 
2334  template <typename T>
2335  geo::TPCDataContainer<T> makeTPCData(T const& defValue) const
2336  { return { Ncryostats(), MaxTPCs(), defValue }; }
2337 
2338 
2339 
2341 
2351  unsigned int NTPC(geo::CryostatID const& cryoid) const
2352  {
2353  CryostatGeo const* pCryo = GetElementPtr(cryoid);
2354  return pCryo? pCryo->NElements(): 0;
2355  }
2356  unsigned int NElements(geo::CryostatID const& cryoid) const
2357  { return NTPC(cryoid); }
2358  unsigned int NSiblingElements(geo::TPCID const& tpcid) const
2359  { return NTPC(tpcid); }
2361 
2362 
2363  //
2364  // access
2365  //
2367  bool HasTPC(geo::TPCID const& tpcid) const
2368  {
2369  CryostatGeo const* pCryo = CryostatPtr(tpcid);
2370  return pCryo? pCryo->HasTPC(tpcid): false;
2371  }
2372 
2374  bool HasElement(geo::TPCID const& tpcid) const { return HasTPC(tpcid); }
2375 
2376 
2378 
2392  TPCGeo const& TPC
2393  (unsigned int const tpc = 0, unsigned int const cstat = 0) const
2394  { return TPC(geo::TPCID(cstat, tpc)); }
2395  TPCGeo const& TPC(geo::TPCID const& tpcid) const
2396  { return Cryostat(tpcid).TPC(tpcid); }
2397  TPCGeo const& GetElement(geo::TPCID const& tpcid) const
2398  { return TPC(tpcid); }
2400 
2402 
2410  TPCGeo const* TPCPtr(geo::TPCID const& tpcid) const
2411  {
2412  CryostatGeo const* pCryo = CryostatPtr(tpcid);
2413  return pCryo? pCryo->TPCPtr(tpcid): nullptr;
2414  } // TPCPtr()
2415  TPCGeo const* GetElementPtr(geo::TPCID const& tpcid) const
2416  { return TPCPtr(tpcid); }
2418 
2424  geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
2425  { return FindTPCAtPosition(geo::vect::makePointFromCoords(worldLoc)); }
2426 
2428 
2433  geo::TPCID FindTPCAtPosition(geo::Point_t const& point) const;
2434  geo::TPCID FindTPCAtPosition(TVector3 const& point) const
2435  { return FindTPCAtPosition(geo::vect::toPoint(point)); }
2437 
2443  geo::TPCGeo const* PositionToTPCptr(geo::Point_t const& point) const;
2444 
2445 
2447 
2453  geo::TPCGeo const& PositionToTPC(geo::Point_t const& point) const;
2454  TPCGeo const& PositionToTPC(double const point[3]) const
2455  { return PositionToTPC(geo::vect::makePointFromCoords(point)); }
2457 
2467  TPCGeo const& PositionToTPC
2468  (double const worldLoc[3], unsigned int &tpc, unsigned int &cstat) const;
2469 
2478  TPCGeo const& PositionToTPC
2479  (double const worldLoc[3], TPCID& tpcid) const;
2480 
2487  geo::TPCID PositionToTPCID(geo::Point_t const& point) const;
2488 
2492 
2494  void GetBeginID(geo::TPCID& id) const
2495  { GetBeginID(id.asCryostatID()); id.TPC = 0; }
2496 
2498  void GetEndID(geo::TPCID& id) const
2499  { GetEndID(id.asCryostatID()); id.TPC = 0; }
2500 
2503  bool IncrementID(geo::TPCID& id) const; // inline implementation
2504 
2507  { return { id, 0 }; }
2508 
2512  { return { id.Cryostat + 1, 0 }; }
2513 
2514 
2517  { return TPC_id_iterator(this, TPC_id_iterator::begin_pos); }
2518 
2521  { return TPC_id_iterator(this, TPC_id_iterator::end_pos); }
2522 
2526  { return TPC_id_iterator(this, GetBeginTPCID(cid)); }
2527 
2531  { return TPC_id_iterator(this, GetEndTPCID(cid)); }
2532 
2535  { return TPC_iterator(this, TPC_iterator::begin_pos); }
2536 
2539  { return TPC_iterator(this, TPC_iterator::end_pos); }
2540 
2543  { return TPC_iterator(this, GetBeginTPCID(cid)); }
2544 
2547  { return TPC_iterator(this, GetEndTPCID(cid)); }
2548 
2563  IteratorBox<
2566  >
2567  IterateTPCIDs() const { return { this }; }
2568 
2590  >
2591  IterateTPCIDs(geo::CryostatID const& cid) const { return { this, cid }; }
2592 
2594  void IterateTPCIDs(geo::TPCID const& pid) const = delete;
2595 
2597  void IterateTPCIDs(geo::PlaneID const& pid) const = delete;
2598 
2600  void IterateTPCIDs(geo::WireID const& pid) const = delete;
2601 
2603  void IterateTPCIDs(readout::TPCsetID const&) const = delete;
2604 
2606  void IterateTPCIDs(readout::ROPID const&) const = delete;
2607 
2623  IteratorBox
2625  IterateTPCs() const { return { this }; }
2626 
2647  >
2648  IterateTPCs(geo::CryostatID const& cid) const { return { this, cid }; }
2649 
2651  void IterateTPCs(geo::TPCID const& pid) const = delete;
2652 
2654  void IterateTPCs(geo::PlaneID const& pid) const = delete;
2655 
2657  void IterateTPCs(geo::WireID const& pid) const = delete;
2658 
2660  void IterateTPCs(readout::TPCsetID const&) const = delete;
2661 
2663  void IterateTPCs(readout::ROPID const&) const = delete;
2664 
2665 
2666  //
2667  // single object features
2668  //
2669 
2671 
2684  geo::Length_t DetHalfWidth(geo::TPCID const& tpcid) const;
2685  geo::Length_t DetHalfWidth
2686  (unsigned int tpc = 0, unsigned int cstat = 0) const
2687  { return DetHalfWidth(geo::TPCID(cstat, tpc)); }
2689 
2691 
2706  geo::Length_t DetHalfHeight(geo::TPCID const& tpcid) const;
2707  geo::Length_t DetHalfHeight
2708  (unsigned int tpc = 0, unsigned int cstat = 0) const
2709  { return DetHalfHeight(geo::TPCID(cstat, tpc)); }
2711 
2713 
2728  geo::Length_t DetLength(geo::TPCID const& tpcid) const;
2729  geo::Length_t DetLength(unsigned int tpc = 0, unsigned int cstat = 0) const
2730  { return DetLength(geo::TPCID(cstat, tpc)); }
2732 
2733 
2735 
2746  template <typename Point = DefaultPoint_t>
2748  { return TPC(tpcid).GetFrontFaceCenter<Point>(); }
2749  template <typename Point = DefaultPoint_t>
2750  Point GetTPCFrontFaceCenter
2751  (unsigned int tpc = 0, unsigned int cstat = 0) const
2752  { return GetTPCFrontFaceCenter<Point>(geo::TPCID(cstat, tpc)); }
2754 
2755 
2756  //
2757  // object description
2758  //
2759 
2761 
2773  std::string GetLArTPCVolumeName(geo::TPCID const& tpcid) const;
2774  std::string GetLArTPCVolumeName
2775  (unsigned int const tpc = 0, unsigned int const cstat = 0) const
2776  { return GetLArTPCVolumeName(geo::TPCID(cstat, tpc)); }
2778 
2780 
2781 
2782 
2785 
2786  //
2787  // group features
2788  //
2789 
2799  unsigned int Nplanes(unsigned int tpc = 0, unsigned int cstat = 0) const
2800  { return Nplanes(geo::TPCID(cstat, tpc)); }
2801 
2803  unsigned int MaxPlanes() const;
2804 
2832  template <typename T>
2834  { return { Ncryostats(), MaxTPCs(), MaxPlanes() }; }
2835 
2854  template <typename T>
2856  { return { Ncryostats(), MaxTPCs(), MaxPlanes(), defValue }; }
2857 
2858 
2860 
2870  unsigned int Nplanes(geo::TPCID const& tpcid) const
2871  {
2872  TPCGeo const* pTPC = GetElementPtr(tpcid);
2873  return pTPC? pTPC->NElements(): 0;
2874  }
2875  unsigned int NElements(geo::TPCID const& tpcid) const
2876  { return Nplanes(tpcid); }
2877  unsigned int NSiblingElements(geo::PlaneID const& planeid) const
2878  { return Nplanes(planeid); }
2880 
2881 
2893  unsigned int Nviews() const;
2894 
2902  [[deprecated("Iterate through geo::GeometryCore::IteratePlaneIDs() instead")]]
2903  std::set<PlaneID> const& PlaneIDs() const;
2904 
2905 
2906  //
2907  // access
2908  //
2909 
2911 
2918  bool HasPlane(geo::PlaneID const& planeid) const
2919  {
2920  geo::TPCGeo const* pTPC = TPCPtr(planeid);
2921  return pTPC? pTPC->HasPlane(planeid): false;
2922  }
2923  bool HasElement(geo::PlaneID const& planeid) const
2924  { return HasPlane(planeid); }
2926 
2928 
2944  PlaneGeo const& Plane
2945  (unsigned int const p, unsigned int const tpc = 0, unsigned int const cstat = 0)
2946  const
2947  { return Plane(geo::PlaneID(cstat, tpc, p)); }
2948  PlaneGeo const& Plane(geo::PlaneID const& planeid) const
2949  { return TPC(planeid).Plane(planeid); }
2950  PlaneGeo const& GetElement(geo::PlaneID const& planeid) const
2951  { return Plane(planeid); }
2953 
2955 
2963  PlaneGeo const* PlanePtr(geo::PlaneID const& planeid) const
2964  {
2965  geo::TPCGeo const* pTPC = TPCPtr(planeid);
2966  return pTPC? pTPC->PlanePtr(planeid): nullptr;
2967  } // PlanePtr()
2968  PlaneGeo const* GetElementPtr(geo::PlaneID const& planeid) const
2969  { return PlanePtr(planeid); }
2971 
2972  //
2973  // iterators
2974  //
2975 
2977  void GetBeginID(geo::PlaneID& id) const
2978  { GetBeginID(id.asTPCID()); id.Plane = 0; }
2979 
2981  void GetEndID(geo::PlaneID& id) const
2982  { GetEndID(id.asTPCID()); id.Plane = 0; }
2983 
2986  bool IncrementID(geo::PlaneID& id) const; // inline implementation
2987 
2989  geo::PlaneID GetBeginPlaneID(geo::CryostatID const& id) const
2990  { return { GetBeginTPCID(id), 0 }; }
2991 
2994  geo::PlaneID GetEndPlaneID(geo::CryostatID const& id) const
2995  { return { GetEndTPCID(id), 0 }; }
2996 
2999  { return { id, 0 }; }
3000 
3004  { return { GetNextID(id), 0 }; }
3005 
3009 
3013 
3016  plane_id_iterator begin_plane_id(geo::CryostatID const& ID) const
3017  { return plane_id_iterator(this, GetBeginPlaneID(ID)); }
3018 
3021  plane_id_iterator end_plane_id(geo::CryostatID const& ID) const
3022  { return plane_id_iterator(this, GetEndPlaneID(ID)); }
3023 
3027  { return plane_id_iterator(this, GetBeginPlaneID(ID)); }
3028 
3032  { return plane_id_iterator(this, GetEndPlaneID(ID)); }
3033 
3036  { return plane_iterator(this, plane_iterator::begin_pos); }
3037 
3040  { return plane_iterator(this, plane_iterator::end_pos); }
3041 
3044  plane_iterator begin_plane(geo::CryostatID const& ID) const
3045  { return plane_iterator(this, GetBeginPlaneID(ID)); }
3046 
3049  plane_iterator end_plane(geo::CryostatID const& ID) const
3050  { return plane_iterator(this, GetEndPlaneID(ID)); }
3051 
3054  { return plane_iterator(this, GetBeginPlaneID(ID)); }
3055 
3058  { return plane_iterator(this, GetEndPlaneID(ID)); }
3059 
3074  IteratorBox<
3077  >
3078  IteratePlaneIDs() const { return { this }; }
3079 
3102  >
3103  IteratePlaneIDs(geo::CryostatID const& cid) const { return { this, cid }; }
3104 
3126  >
3127  IteratePlaneIDs(geo::TPCID const& tid) const { return { this, tid }; }
3128 
3129 
3131  void IteratePlaneIDs(geo::PlaneID const& pid) const = delete;
3132 
3134  void IteratePlaneIDs(geo::WireID const& pid) const = delete;
3135 
3137  void IteratePlaneIDs(readout::TPCsetID const&) const = delete;
3138 
3140  void IteratePlaneIDs(readout::ROPID const&) const = delete;
3141 
3142 
3156  IteratorBox<
3159  >
3160  IteratePlanes() const { return { this }; }
3161 
3182  >
3183  IteratePlanes(geo::CryostatID const& cid) const { return { this, cid }; }
3184 
3203  plane_iterator, geo::TPCID,
3205  >
3206  IteratePlanes(geo::TPCID const& tid) const { return { this, tid }; }
3207 
3209  void IteratePlanes(geo::PlaneID const& pid) const = delete;
3210 
3212  void IteratePlanes(geo::WireID const& pid) const = delete;
3213 
3215  void IteratePlanes(readout::TPCsetID const&) const = delete;
3216 
3218  void IteratePlanes(readout::ROPID const&) const = delete;
3219 
3220 
3221  //
3222  // single object features
3223  //
3224 
3226 
3241  geo::Length_t PlanePitch(
3242  geo::TPCID const& tpcid,
3244  )
3245  const;
3246  geo::Length_t PlanePitch(geo::PlaneID const& pid1, geo::PlaneID const& pid2) const;
3247  geo::Length_t PlanePitch(unsigned int p1 = 0,
3248  unsigned int p2 = 1,
3249  unsigned int tpc = 0,
3250  unsigned int cstat = 0) const;
3252 
3258  View_t View(geo::PlaneID const& pid) const;
3259 
3269  SigType_t SignalType(geo::PlaneID const& pid) const;
3270 
3271 
3273 
3274 
3277 
3278  //
3279  // group features
3280  //
3281 
3292  unsigned int Nwires
3293  (unsigned int p, unsigned int tpc = 0, unsigned int cstat = 0) const
3294  { return Nwires(geo::PlaneID(cstat, tpc, p)); }
3295 
3297 
3307  unsigned int Nwires(geo::PlaneID const& planeid) const
3308  {
3309  PlaneGeo const* pPlane = GetElementPtr(planeid);
3310  return pPlane? pPlane->NElements(): 0;
3311  }
3312  unsigned int NElements(geo::PlaneID const& planeid) const
3313  { return Nwires(planeid); }
3314  unsigned int NSiblingElements(geo::WireID const& wireid) const
3315  { return Nwires(wireid); }
3316 
3318  unsigned int MaxWires() const;
3319 
3321 
3322 
3323  //
3324  // access
3325  //
3326 
3328 
3334  bool HasWire(geo::WireID const& wireid) const
3335  {
3336  geo::PlaneGeo const* pPlane = PlanePtr(wireid);
3337  return pPlane? pPlane->HasWire(wireid): false;
3338  }
3339  bool HasElement(geo::WireID const& wireid) const { return HasWire(wireid); }
3341 
3343 
3351  WireGeo const* WirePtr(geo::WireID const& wireid) const
3352  {
3353  geo::PlaneGeo const* pPlane = PlanePtr(wireid);
3354  return pPlane? pPlane->WirePtr(wireid): nullptr;
3355  } // WirePtr()
3356  WireGeo const* GetElementPtr(geo::WireID const& wireid) const
3357  { return WirePtr(wireid); }
3359 
3361 
3370  WireGeo const& Wire(geo::WireID const& wireid) const
3371  { return Plane(wireid).Wire(wireid); }
3372  WireGeo const& WireIDToWireGeo(geo::WireID const& wireid) const
3373  { return Wire(wireid); }
3374  WireGeo const& GetElement(geo::WireID const& wireid) const
3375  { return Wire(wireid); }
3377 
3378  //
3379  // iterators
3380  //
3381 
3383  void GetBeginID(geo::WireID& id) const
3384  { GetBeginID(id.asPlaneID()); id.Wire = 0; }
3385 
3387  void GetEndID(geo::WireID& id) const
3388  { GetEndID(id.asPlaneID()); id.Wire = 0; }
3389 
3392  bool IncrementID(geo::WireID& id) const; // inline implementation
3393 
3395  geo::WireID GetBeginWireID(geo::CryostatID const& id) const
3396  { return { GetBeginPlaneID(id), 0 }; }
3397 
3400  geo::WireID GetEndWireID(geo::CryostatID const& id) const
3401  { return { GetEndPlaneID(id), 0 }; }
3402 
3404  geo::WireID GetBeginWireID(geo::TPCID const& id) const
3405  { return { geo::PlaneID(id, 0), 0 }; }
3406 
3409  geo::WireID GetEndWireID(geo::TPCID const& id) const
3410  { return { geo::PlaneID(GetNextID(id), 0), 0 }; }
3411 
3414  { return { id, 0 }; }
3415 
3419  { return { GetNextID(id), 0 }; }
3420 
3424 
3427  { return wire_id_iterator(this, wire_id_iterator::end_pos); }
3428 
3430  wire_id_iterator begin_wire_id(geo::CryostatID const& id) const
3431  { return wire_id_iterator(this, GetBeginWireID(id)); }
3432 
3435  wire_id_iterator end_wire_id(geo::CryostatID const& id) const
3436  { return wire_id_iterator(this, GetEndWireID(id)); }
3437 
3439  wire_id_iterator begin_wire_id(geo::TPCID const& id) const
3440  { return wire_id_iterator(this, GetBeginWireID(id)); }
3441 
3443  wire_id_iterator end_wire_id(geo::TPCID const& id) const
3444  { return wire_id_iterator(this, GetEndWireID(id)); }
3445 
3448  { return wire_id_iterator(this, GetBeginWireID(id)); }
3449 
3452  { return wire_id_iterator(this, GetEndWireID(id)); }
3453 
3456  { return wire_iterator(this, wire_iterator::begin_pos); }
3457 
3460  { return wire_iterator(this, wire_iterator::end_pos); }
3461 
3463  wire_iterator begin_wire(geo::CryostatID const& id) const
3464  { return wire_iterator(begin_wire_id(id)); }
3465 
3467  wire_iterator end_wire(geo::CryostatID const& id) const
3468  { return wire_iterator(end_wire_id(id)); }
3469 
3471  wire_iterator begin_wire(geo::TPCID const& id) const
3472  { return wire_iterator(begin_wire_id(id)); }
3473 
3475  wire_iterator end_wire(geo::TPCID const& id) const
3476  { return wire_iterator(end_wire_id(id)); }
3477 
3480  { return wire_iterator(begin_wire_id(id)); }
3481 
3484  { return wire_iterator(end_wire_id(id)); }
3485 
3501  IteratorBox<
3504  >
3505  IterateWireIDs() const { return { this }; }
3506 
3529  >
3530  IterateWireIDs(geo::CryostatID const& cid) const { return { this, cid }; }
3531 
3552  geo::TPCID,
3554  >
3555  IterateWireIDs(geo::TPCID const& tid) const { return { this, tid }; }
3556 
3577  geo::PlaneID,
3579  >
3580  IterateWireIDs(geo::PlaneID const& pid) const { return { this, pid }; }
3581 
3583  void IterateWireIDs(geo::WireID const& pid) const = delete;
3584 
3586  void IterateWireIDs(readout::TPCsetID const&) const = delete;
3587 
3589  void IterateWireIDs(readout::ROPID const&) const = delete;
3590 
3591 
3605  IteratorBox<
3606  wire_iterator,
3608  >
3609  IterateWires() const { return { this }; }
3610 
3629  wire_iterator,
3632  >
3633  IterateWires(geo::CryostatID const& cid) const { return { this, cid }; }
3634 
3653  wire_iterator,
3654  geo::TPCID,
3656  >
3657  IterateWires(geo::TPCID const& tid) const { return { this, tid }; }
3658 
3677  wire_iterator,
3678  geo::PlaneID,
3680  >
3681  IterateWires(geo::PlaneID const& tid) const { return { this, tid }; }
3682 
3684  void IterateWires(geo::WireID const& pid) const = delete;
3685 
3687  void IterateWires(readout::TPCsetID const&) const = delete;
3688 
3690  void IterateWires(readout::ROPID const&) const = delete;
3691 
3692  //
3693  // single object features
3694  //
3695 
3697 
3713  geo::Length_t WirePitch(geo::PlaneID const& planeid) const;
3714  geo::Length_t WirePitch(unsigned int plane = 0,
3715  unsigned int tpc = 0,
3716  unsigned int cstat = 0) const
3717  { return WirePitch(geo::PlaneID(cstat, tpc, plane)); }
3719 
3732  geo::Length_t WirePitch(geo::View_t view) const;
3733 
3734 
3736 
3752  double WireAngleToVertical(geo::View_t view, geo::TPCID const& tpcid) const;
3753  double WireAngleToVertical(geo::View_t view, int TPC=0, int Cryo=0) const
3754  { return WireAngleToVertical(view, geo::TPCID(Cryo, TPC)); }
3756 
3758 
3759 
3760 
3771 
3773  //
3774  // simple geometry queries
3775  //
3776 
3789  void WireEndPoints
3790  (geo::WireID const& wireid, double *xyzStart, double *xyzEnd) const;
3791 
3808  unsigned int cstat, unsigned int tpc, unsigned int plane, unsigned int wire,
3809  double *xyzStart, double *xyzEnd
3810  ) const
3811  { WireEndPoints(geo::WireID(cstat, tpc, plane, wire), xyzStart, xyzEnd); }
3812 
3825  template <typename Point = DefaultPoint_t>
3826  Segment<Point> WireEndPoints(geo::WireID const& wireID) const;
3827 
3828  //
3829  // closest wire
3830  //
3831 
3870  geo::WireID NearestWireID
3871  (geo::Point_t const& point, geo::PlaneID const& planeid) const;
3872 
3874 
3889  geo::WireID NearestWireID
3890  (const double point[3], geo::PlaneID const& planeid) const;
3891  geo::WireID NearestWireID
3892  (std::vector<double> const& point, geo::PlaneID const& planeid) const;
3893  geo::WireID NearestWireID
3894  (const TVector3& point, geo::PlaneID const& planeid) const
3895  { return NearestWireID(geo::vect::toPoint(point), planeid); }
3896  geo::WireID NearestWireID(const double point[3],
3897  unsigned int const PlaneNo,
3898  unsigned int const TPCNo = 0,
3899  unsigned int const cstat = 0) const
3900  { return NearestWireID(point, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3901  geo::WireID NearestWireID(std::vector<double> const& point,
3902  unsigned int const PlaneNo,
3903  unsigned int const TPCNo = 0,
3904  unsigned int const cstat = 0) const
3905  { return NearestWireID(point, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3906  geo::WireID NearestWireID(const TVector3& point,
3907  unsigned int const PlaneNo,
3908  unsigned int const TPCNo = 0,
3909  unsigned int const cstat = 0) const
3910  { return NearestWireID(point, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3912  unsigned int const PlaneNo,
3913  unsigned int const TPCNo = 0,
3914  unsigned int const cstat = 0) const
3915  { return NearestWireID(point, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3917 
3927  geo::WireID::WireID_t NearestWire
3928  (geo::Point_t const& point, geo::PlaneID const& planeid) const;
3929 
3931 
3946  unsigned int NearestWire
3947  (const double worldLoc[3], geo::PlaneID const& planeid) const;
3948  unsigned int NearestWire
3949  (std::vector<double> const& worldLoc, geo::PlaneID const& planeid) const;
3950  unsigned int NearestWire
3951  (const TVector3& worldLoc, geo::PlaneID const& planeid) const
3952  { return NearestWire(geo::vect::toPoint(worldLoc), planeid); }
3953  unsigned int NearestWire(const double worldLoc[3],
3954  unsigned int const PlaneNo,
3955  unsigned int const TPCNo = 0,
3956  unsigned int const cstat = 0) const
3957  { return NearestWire(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3958  unsigned int NearestWire(std::vector<double> const& worldLoc,
3959  unsigned int const PlaneNo,
3960  unsigned int const TPCNo = 0,
3961  unsigned int const cstat = 0) const
3962  { return NearestWire(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3963  unsigned int NearestWire(const TVector3& worldLoc,
3964  unsigned int const PlaneNo,
3965  unsigned int const TPCNo = 0,
3966  unsigned int const cstat = 0) const
3967  { return NearestWire(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3968  unsigned int NearestWire(geo::Point_t const& worldLoc,
3969  unsigned int const PlaneNo,
3970  unsigned int const TPCNo = 0,
3971  unsigned int const cstat = 0) const
3972  { return NearestWire(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3974 
3975 
3992  geo::Length_t WireCoordinate
3993  (double YPos, double ZPos, geo::PlaneID const& planeid) const;
3994 
4007  geo::Length_t WireCoordinate(double YPos, double ZPos,
4008  unsigned int PlaneNo,
4009  unsigned int TPCNo,
4010  unsigned int cstat) const
4011  { return WireCoordinate(YPos, ZPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4012 
4014 
4025  geo::Length_t WireCoordinate
4026  (geo::Point_t const& pos, geo::PlaneID const& planeid) const;
4027  geo::Length_t WireCoordinate
4028  (TVector3 const& pos, geo::PlaneID const& planeid) const
4029  { return WireCoordinate(geo::vect::toPoint(pos), planeid); }
4031 
4032  //
4033  // wire intersections
4034  //
4035 
4036  // The following functions are utilized to determine if two wires
4037  // in the TPC intersect or not, and if they do then
4038  // determine the coordinates of the intersection.
4039 
4060  bool IntersectLines(
4061  double A_start_x, double A_start_y, double A_end_x, double A_end_y,
4062  double B_start_x, double B_start_y, double B_end_x, double B_end_y,
4063  double& x, double& y
4064  ) const;
4065 
4087  bool IntersectSegments(
4088  double A_start_x, double A_start_y, double A_end_x, double A_end_y,
4089  double B_start_x, double B_start_y, double B_end_x, double B_end_y,
4090  double& x, double& y
4091  ) const;
4092 
4094 
4114  bool WireIDsIntersect(
4115  WireID const& wid1, WireID const& wid2,
4116  geo::Point_t& intersection
4117  ) const;
4118  bool WireIDsIntersect
4119  (WireID const& wid1, WireID const& wid2, TVector3& intersection) const;
4121 
4144  bool WireIDsIntersect
4145  (WireID const& wid1, WireID const& wid2, WireIDIntersection& widIntersect)
4146  const;
4147 
4165  bool IntersectionPoint(geo::WireID const& wid1,
4166  geo::WireID const& wid2,
4167  double &y,
4168  double &z) const;
4169 
4188  bool IntersectionPoint(unsigned int wire1,
4189  unsigned int wire2,
4190  unsigned int plane1,
4191  unsigned int plane2,
4192  unsigned int cstat,
4193  unsigned int tpc,
4194  double &y,
4195  double &z) const
4196  {
4197  return IntersectionPoint(
4198  geo::WireID(cstat, tpc, plane1, wire1),
4199  geo::WireID(cstat, tpc, plane2, wire2),
4200  y, z
4201  );
4202  }
4203 
4204 
4216  geo::PlaneID ThirdPlane
4217  (geo::PlaneID const& pid1, geo::PlaneID const& pid2) const;
4218 
4219 
4238  double ThirdPlaneSlope(geo::PlaneID const& pid1, double slope1,
4239  geo::PlaneID const& pid2, double slope2,
4240  geo::PlaneID const& output_plane) const;
4241 
4259  double ThirdPlaneSlope(geo::PlaneID const& pid1, double slope1,
4260  geo::PlaneID const& pid2, double slope2) const;
4261 
4263 
4278  double ThirdPlaneSlope(geo::PlaneID::PlaneID_t plane1, double slope1,
4279  geo::PlaneID::PlaneID_t plane2, double slope2,
4280  geo::TPCID const& tpcid) const
4281  {
4282  return ThirdPlaneSlope(
4283  geo::PlaneID(tpcid, plane1), slope1,
4284  geo::PlaneID(tpcid, plane2), slope2
4285  );
4286  }
4287  double ThirdPlaneSlope(unsigned int plane1, double slope1,
4288  unsigned int plane2, double slope2,
4289  unsigned int tpc, unsigned int cstat) const
4290  {
4291  return ThirdPlaneSlope
4292  (plane1, slope1, plane2, slope2, geo::TPCID(cstat, tpc));
4293  }
4295 
4296 
4313  double ThirdPlane_dTdW(geo::PlaneID const& pid1, double slope1,
4314  geo::PlaneID const& pid2, double slope2,
4315  geo::PlaneID const& output_plane) const;
4316 
4334  double ThirdPlane_dTdW(geo::PlaneID const& pid1, double slope1,
4335  geo::PlaneID const& pid2, double slope2) const;
4336 
4337 
4349  static double ComputeThirdPlaneSlope(
4350  double angle1, double slope1,
4351  double angle2, double slope2,
4352  double angle_target
4353  );
4354 
4371  static double ComputeThirdPlane_dTdW(
4372  double angle1, double pitch1, double dTdW1,
4373  double angle2, double pitch2, double dTdW2,
4374  double angle_target, double pitch_target
4375  );
4376 
4378 
4379 
4380 
4386 
4388  //
4389  // group features
4390  //
4391 
4393  unsigned int NOpDets() const;
4394 
4395 
4396  //
4397  // access
4398  //
4400  OpDetGeo const& OpDetGeoFromOpChannel(unsigned int OpChannel) const;
4402  OpDetGeo const& OpDetGeoFromOpDet(unsigned int OpDet) const;
4404 
4405 
4407 
4418  unsigned int GetClosestOpDet(geo::Point_t const& point) const;
4419  unsigned int GetClosestOpDet(double const* point) const;
4421 
4422 
4423  //
4424  // object description
4425  //
4426 
4435  std::string OpDetGeoName(unsigned int c = 0) const;
4436 
4438 
4439 
4440 
4443 
4445 
4446  //
4447  // group features
4448  //
4449 
4458  unsigned int NAuxDets() const { return AuxDets().size(); }
4459 
4466  unsigned int NAuxDetSensitive(size_t const& aid) const;
4467 
4468  //
4469  // access
4470  //
4471 
4480  AuxDetGeo const& AuxDet(unsigned int const ad = 0) const;
4481 
4491  unsigned int FindAuxDetAtPosition(double const worldLoc[3]) const;
4492 
4501  unsigned int FindAuxDetAtPosition(geo::Point_t const& point) const;
4502 
4509  void FindAuxDetSensitiveAtPosition(geo::Point_t const& point,
4510  std::size_t & adg,
4511  std::size_t & sv) const;
4512 
4520  void FindAuxDetSensitiveAtPosition(double const worldLoc[3],
4521  size_t & adg,
4522  size_t & sv) const;
4523 
4532  AuxDetGeo const& PositionToAuxDet
4533  (geo::Point_t const& point, unsigned int& ad) const;
4534 
4544  AuxDetGeo const& PositionToAuxDet
4545  (double const worldLoc[3], unsigned int& ad) const;
4546 
4556  const AuxDetSensitiveGeo& PositionToAuxDetSensitive
4557  (geo::Point_t const& point, size_t& ad, size_t& sv) const;
4558 
4569  const AuxDetSensitiveGeo& PositionToAuxDetSensitive(double const worldLoc[3],
4570  size_t & ad,
4571  size_t & sv) const;
4572 
4573  const AuxDetGeo& ChannelToAuxDet(std::string const& auxDetName,
4574  uint32_t const& channel) const; // return the AuxDetGeo for the given detector
4575  // name and channel
4576 
4577  const AuxDetSensitiveGeo& ChannelToAuxDetSensitive(std::string const& auxDetName,
4578  uint32_t const& channel) const; // return the AuxDetSensitiveGeo for the given
4579 
4581 
4582 
4583 
4586 
4587  //
4588  // group features
4589  //
4590 
4592  unsigned int Nchannels() const;
4593 
4596  unsigned int Nchannels(readout::ROPID const& ropid) const;
4597 
4602  std::set<geo::View_t> const& Views() const { return allViews; }
4603 
4604 
4605  //
4606  // access
4607  //
4608 
4617  bool HasChannel(raw::ChannelID_t channel) const;
4618 
4620 
4632  raw::ChannelID_t PlaneWireToChannel(WireID const& wireid) const;
4633  raw::ChannelID_t PlaneWireToChannel(unsigned int const plane,
4634  unsigned int const wire,
4635  unsigned int const tpc = 0,
4636  unsigned int const cstat = 0) const
4637  { return PlaneWireToChannel(geo::WireID(cstat, tpc, plane, wire)); }
4639 
4640  //
4641  // single object features
4642  //
4643 
4651  SigType_t SignalType(raw::ChannelID_t const channel) const;
4652 
4653 
4662  View_t View(raw::ChannelID_t const channel) const;
4663 
4664 
4671  std::vector<geo::WireID> ChannelToWire
4672  (raw::ChannelID_t const channel) const;
4673 
4674 
4677  readout::ROPID ChannelToROP(raw::ChannelID_t channel) const;
4678 
4679 
4680  //
4681  // geometry queries
4682  //
4683 
4692  raw::ChannelID_t NearestChannel
4693  (geo::Point_t const& worldLoc, geo::PlaneID const& planeid) const;
4694 
4696 
4709  raw::ChannelID_t NearestChannel
4710  (const double worldLoc[3], geo::PlaneID const& planeid) const;
4711  raw::ChannelID_t NearestChannel
4712  (std::vector<double> const& worldLoc, geo::PlaneID const& planeid) const;
4713  raw::ChannelID_t NearestChannel
4714  (const TVector3& worldLoc, geo::PlaneID const& planeid) const
4715  { return NearestChannel(geo::vect::toPoint(worldLoc), planeid); }
4716  raw::ChannelID_t NearestChannel(const double worldLoc[3],
4717  unsigned int const PlaneNo,
4718  unsigned int const TPCNo = 0,
4719  unsigned int const cstat = 0) const
4720  { return NearestChannel(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4721  raw::ChannelID_t NearestChannel(std::vector<double> const& worldLoc,
4722  unsigned int const PlaneNo,
4723  unsigned int const TPCNo = 0,
4724  unsigned int const cstat = 0) const
4725  { return NearestChannel(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4726  raw::ChannelID_t NearestChannel(const TVector3& worldLoc,
4727  unsigned int const PlaneNo,
4728  unsigned int const TPCNo = 0,
4729  unsigned int const cstat = 0) const
4730  { return NearestChannel(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4732  unsigned int const PlaneNo,
4733  unsigned int const TPCNo = 0,
4734  unsigned int const cstat = 0) const
4735  { return NearestChannel(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4737 
4751  bool ChannelsIntersect
4752  (raw::ChannelID_t c1, raw::ChannelID_t c2, double &y, double &z) const;
4753 
4755 
4756 
4757 
4760 
4761  //
4762  // group features
4763  //
4764 
4766 
4774  unsigned int NTPCsets(readout::CryostatID const& cryoid) const;
4775  unsigned int NSiblingElements(readout::TPCsetID const& tpcsetid) const
4776  { return NTPCsets(tpcsetid); }
4778 
4780  unsigned int MaxTPCsets() const;
4781 
4782 
4783  //
4784  // access
4785  //
4788  bool HasTPCset(readout::TPCsetID const& tpcsetid) const;
4789 
4791  bool HasElement(readout::TPCsetID const& tpcsetid) const
4792  { return HasTPCset(tpcsetid); }
4793 
4794 
4800  readout::TPCsetID FindTPCsetAtPosition(double const worldLoc[3]) const;
4801 
4802  //
4803  // mapping
4804  //
4806  readout::TPCsetID TPCtoTPCset(geo::TPCID const& tpcid) const;
4807 
4818  std::vector<geo::TPCID> TPCsetToTPCs
4819  (readout::TPCsetID const& tpcsetid) const;
4820 
4821 
4825 
4828  { GetBeginID(id.asCryostatID()); id.TPCset = 0; }
4829 
4831  void GetEndID(readout::TPCsetID& id) const
4832  { GetEndID(id.asCryostatID()); id.TPCset = 0; }
4833 
4836  bool IncrementID(readout::TPCsetID& id) const; // inline implementation
4837 
4839  readout::TPCsetID GetBeginTPCsetID(geo::CryostatID const& id) const
4840  { return { id, 0 }; }
4841 
4844  readout::TPCsetID GetEndTPCsetID(geo::CryostatID const& id) const
4845  { return { id.Cryostat + 1, 0 }; }
4846 
4847 
4851 
4855 
4858  TPCset_id_iterator begin_TPCset_id(geo::CryostatID const& cid) const
4859  { return TPCset_id_iterator(this, GetBeginTPCsetID(cid)); }
4860 
4863  TPCset_id_iterator end_TPCset_id(geo::CryostatID const& cid) const
4864  { return TPCset_id_iterator(this, GetEndTPCsetID(cid)); }
4865 
4880  IteratorBox<
4883  >
4884  IterateTPCsetIDs() const { return { this }; }
4885 
4907  >
4908  IterateTPCsetIDs(geo::CryostatID const& cid) const { return { this, cid }; }
4909 
4910 
4911 #if 0
4912  //
4913  // single object features
4914  //
4915 
4923  double TPCsetHalfWidth(readout::TPCsetID const& tpcsetid) const;
4924 
4932  double TPCsetHalfHeight(readout::TPCsetID const& tpcsetid) const;
4933 
4941  double TPCsetLength(readout::TPCsetID const& tpcsetid) const;
4942 
4943 
4949  geo::Point_t GetTPCsetFrontFaceCenter
4950  (readout::TPCsetID const& tpcsetid) const;
4951 
4952 
4953 #endif // 0
4954 
4956 
4957 
4958 
4961 
4962  //
4963  // group features
4964  //
4965 
4967 
4977  unsigned int NROPs(readout::TPCsetID const& tpcsetid) const;
4978  unsigned int NSiblingElements(readout::ROPID const& ropid) const
4979  { return NROPs(ropid); }
4981 
4983  unsigned int MaxROPs() const;
4984 
4985 
4986  //
4987  // access
4988  //
4991  bool HasROP(readout::ROPID const& ropid) const;
4992 
4995  bool HasElement(readout::ROPID const& ropid) const { return HasROP(ropid); }
4996 
4997 
4998  //
4999  // mapping
5000  //
5011  readout::ROPID WirePlaneToROP(geo::PlaneID const& planeid) const;
5012 
5023  std::vector<geo::PlaneID> ROPtoWirePlanes
5024  (readout::ROPID const& ropid) const;
5025 
5036  std::vector<geo::TPCID> ROPtoTPCs(readout::ROPID const& ropid) const;
5037 
5038 
5049  raw::ChannelID_t FirstChannelInROP(readout::ROPID const& ropid) const;
5050 
5054 
5056  void GetBeginID(readout::ROPID& id) const
5057  { GetBeginID(id.asTPCsetID()); id.ROP = 0; }
5058 
5060  void GetEndID(readout::ROPID& id) const
5061  { GetEndID(id.asTPCsetID()); id.ROP = 0; }
5062 
5065  bool IncrementID(readout::ROPID& id) const; // inline implementation
5066 
5068  readout::ROPID GetBeginROPID(geo::CryostatID const& id) const
5069  { return { GetBeginTPCsetID(id), 0 }; }
5070 
5073  readout::ROPID GetEndROPID(geo::CryostatID const& id) const
5074  { return { GetEndTPCsetID(id), 0 }; }
5075 
5078  { return { id, 0 }; }
5079 
5083  { return { GetNextID(id), 0 }; }
5084 
5087  { return ROP_id_iterator(this, ROP_id_iterator::begin_pos); }
5088 
5091  { return ROP_id_iterator(this, ROP_id_iterator::end_pos); }
5092 
5095  ROP_id_iterator begin_ROP_id(geo::CryostatID const& ID) const
5096  { return ROP_id_iterator(this, GetBeginROPID(ID)); }
5097 
5100  ROP_id_iterator end_ROP_id(geo::CryostatID const& ID) const
5101  { return ROP_id_iterator(this, GetEndROPID(ID)); }
5102 
5106  { return ROP_id_iterator(this, GetBeginROPID(ID)); }
5107 
5111  { return ROP_id_iterator(this, GetEndROPID(ID)); }
5112 
5127  IteratorBox<
5130  >
5131  IterateROPIDs() const { return { this }; }
5132 
5154  >
5155  IterateROPIDs(geo::CryostatID const& cid) const { return { this, cid }; }
5156 
5178  >
5179  IterateROPIDs(readout::TPCsetID const& sid) const { return { this, sid }; }
5180 
5181 
5194  geo::View_t View(readout::ROPID const& ropid) const;
5195 
5208  geo::SigType_t SignalType(readout::ROPID const& ropid) const;
5209 
5210 
5212 
5213 
5214 
5220 
5223  //
5224  // group features
5225  //
5226 
5228  unsigned int NOpChannels() const;
5229 
5231  unsigned int MaxOpChannel() const;
5232 
5233  // Number of hardware channels for a given optical detector
5234  unsigned int NOpHardwareChannels(int opDet) const;
5235 
5236 
5237  //
5238  // access
5239  //
5240 
5242  bool IsValidOpChannel(int opChannel) const;
5243 
5245  unsigned int OpChannel(int detNum, int hardwareChannel) const;
5246 
5248  unsigned int OpDetFromOpChannel(int opChannel) const;
5249 
5251  unsigned int HardwareChannelFromOpChannel(int opChannel) const;
5252 
5254  unsigned int OpDetFromCryo(unsigned int o, unsigned int c) const;
5255 
5257 
5258 
5259  //
5260  // unsorted methods
5261  //
5262 
5276  bool ValueInRange(double value, double min, double max) const;
5277 
5278 
5281 
5305  void LoadGeometryFile
5306  (std::string gdmlfile, std::string rootfile, bool bForceReload = false);
5307 
5326  void ApplyChannelMap(std::shared_ptr<geo::ChannelMapAlg> pChannelMap);
5328 
5329 
5330  protected:
5332  void SetDetectorName(std::string new_name) { fDetectorName = new_name; }
5333 
5336  { return fChannelMapAlg.get(); }
5337 
5339  CryostatList_t& Cryostats() { return fGeoData.cryostats; }
5341  CryostatList_t const& Cryostats() const { return fGeoData.cryostats; }
5343 
5345  AuxDetList_t& AuxDets() { return fGeoData.auxDets; }
5347  AuxDetList_t const& AuxDets() const { return fGeoData.auxDets; }
5349 
5350  private:
5351 
5352  std::vector<TGeoNode const*> FindDetectorEnclosure
5353  (std::string const& name = "volDetEnclosure") const;
5354 
5355  bool FindFirstVolume
5356  (std::string const& name, std::vector<const TGeoNode*>& path) const;
5357 
5358  void FindCryostat(std::vector<const TGeoNode*>& path, unsigned int depth);
5359 
5360  void MakeCryostat(std::vector<const TGeoNode*>& path, int depth);
5361 
5362  void FindAuxDet(std::vector<const TGeoNode*>& path, unsigned int depth);
5363 
5364  void MakeAuxDet(std::vector<const TGeoNode*>& path, int depth);
5365 
5367  bool WireIDIntersectionCheck
5368  (const geo::WireID& wid1, const geo::WireID& wid2) const;
5369 
5371  static bool PointWithinSegments(
5372  double A_start_x, double A_start_y, double A_end_x, double A_end_y,
5373  double B_start_x, double B_start_y, double B_end_x, double B_end_y,
5374  double x, double y
5375  );
5376 
5378  void SortGeometry(geo::GeoObjectSorter const& sorter);
5379 
5381  void UpdateAfterSorting();
5382 
5384  void ClearGeometry();
5385 
5388  static void CheckIndependentPlanesOnSameTPC
5389  (geo::PlaneID const& pid1, geo::PlaneID const& pid2, const char* caller);
5390 
5392 
5393  double fSurfaceY;
5394  std::string fDetectorName;
5395  std::string fGDMLfile;
5396  std::string fROOTfile;
5397  double fMinWireZDist;
5398  double fPositionWiggle;
5400  std::shared_ptr<const geo::ChannelMapAlg> fChannelMapAlg;
5402 
5403  // cached values
5404  std::set<geo::View_t> allViews;
5405 
5406  }; // class GeometryCore
5407 
5408 
5409 
5433  public:
5435  ROOTGeoNodeForwardIterator(TGeoNode const* start_node)
5436  { init(start_node); }
5437 
5439  TGeoNode const* operator* () const
5440  { return current_path.empty()? nullptr: current_path.back().self; }
5441 
5443  ROOTGeoNodeForwardIterator& operator++ ();
5444 
5446  std::vector<TGeoNode const*> get_path() const;
5447 
5448  protected:
5449  using Node_t = TGeoNode const*;
5450  struct NodeInfo_t {
5451  Node_t self; int sibling;
5452  NodeInfo_t(Node_t new_self, int new_sibling)
5453  : self(new_self), sibling(new_sibling) {}
5454  }; // NodeInfo_t
5455 
5457  std::vector<NodeInfo_t> current_path;
5458 
5459  void reach_deepest_descendant();
5460 
5461  void init(TGeoNode const* start_node);
5462 
5463  }; // class ROOTGeoNodeForwardIterator
5464 
5466  // END Geometry group --------------------------------------------------------
5467 
5468 } // namespace geo
5469 
5470 
5471 
5472 //******************************************************************************
5473 //*** inline implementation
5474 //***
5475 inline bool geo::GeometryCore::IncrementID(geo::CryostatID& id) const {
5476  ++id.Cryostat;
5477  if (id) id.isValid = HasCryostat(id); // if invalid already, it stays so
5478  return bool(id);
5479 } // geo::GeometryCore::IncrementID(geo::CryostatID)
5480 
5481 inline bool geo::GeometryCore::IncrementID(geo::TPCID& id) const {
5482  unsigned int const nTPCsInCryo = NTPC(id);
5483  if (++id.TPC < nTPCsInCryo) return bool(id); // if was invalid, it stays so
5484  // no more TPCs in this cryostat
5485  id.TPC = 0;
5486  return IncrementID(id.asCryostatID()); // also sets validity
5487 } // geo::GeometryCore::IncrementID(geo::TPCID)
5488 
5489 inline bool geo::GeometryCore::IncrementID(geo::PlaneID& id) const {
5490  // this implementation is non-optimal, in that the cryostat lookup is
5491  // performed both here and, potentially, in IncrementID(TPCID)
5492  unsigned int const nPlanesInTPC = Nplanes(id);
5493  if (++id.Plane < nPlanesInTPC) return bool(id); // if was invalid, stays so
5494  // no more planes in this TPCs
5495  id.Plane = 0;
5496  return IncrementID(id.asTPCID()); // also sets validity
5497 } // geo::GeometryCore::IncrementID(geo::PlaneID)
5498 
5500  // this implementation is non-optimal, in that the TPC lookup is
5501  // performed both here and, potentially, in IncrementID(PlaneID)
5502  unsigned int const nWiresInPlane = Nwires(id);
5503  if (++id.Wire < nWiresInPlane) return bool(id); // if was invalid, stays so
5504  // no more wires in this plane
5505  id.Wire = 0;
5506  return IncrementID(id.asPlaneID()); // also sets validity
5507 } // geo::GeometryCore::IncrementID(geo::WireID)
5508 
5510  unsigned int const nTPCsetsInCryo = NTPCsets(id);
5511  if (++id.TPCset < nTPCsetsInCryo)
5512  return bool(id); // if was invalid, it stays so
5513  // no more TPC sets in this cryostat
5514  id.TPCset = 0;
5515  return IncrementID(id.asCryostatID()); // also sets validity
5516 } // geo::GeometryCore::IncrementID(readout::TPCsetID)
5517 
5519  // this implementation is non-optimal, in that the cryostat lookup is
5520  // performed both here and, potentially, in IncrementID(TPCsetID)
5521  unsigned int const nROPinTPC = NROPs(id);
5522  if (++id.ROP < nROPinTPC) return bool(id); // if was invalid, stays so
5523  // no more readout planes in this TPC set
5524  id.ROP = 0;
5525  return IncrementID(id.asTPCsetID()); // also sets validity
5526 } // geo::GeometryCore::IncrementID(readout::ROPID)
5527 
5528 
5529 
5530 //******************************************************************************
5531 //*** template implementation
5532 //***
5533 //------------------------------------------------------------------------------
5534 template <typename Point>
5536  (geo::WireID const& wireid) const
5537 {
5538  geo::WireGeo const& wire = Wire(wireid);
5539  return { wire.GetStart<Point>(), wire.GetEnd<Point>() };
5540 } // geo::GeometryCore::WireEndPoints(WireID)
5541 
5542 
5543 //------------------------------------------------------------------------------
5544 template <typename Stream>
5546  (Stream&& out, std::string indent /* = " " */) const
5547 {
5548 
5549  out << "Detector " << DetectorName() << " has "
5550  << Ncryostats() << " cryostats and "
5551  << NAuxDets() << " auxiliary detectors:";
5552 
5553  auto const& detEnclosureBox = DetectorEnclosureBox();
5554  out << "\n" << indent << "Detector enclosure: "
5555  << detEnclosureBox.Min() << " -- " << detEnclosureBox.Max()
5556  << " cm => ( " << detEnclosureBox.SizeX() << " x "
5557  << detEnclosureBox.SizeY() << " x "
5558  << detEnclosureBox.SizeZ() << " ) cm^3"
5559  ;
5560 
5561  for (geo::CryostatGeo const& cryostat: IterateCryostats()) {
5562  out << "\n" << indent;
5563  cryostat.PrintCryostatInfo
5564  (std::forward<Stream>(out), indent + " ", cryostat.MaxVerbosity);
5565 
5566  const unsigned int nTPCs = cryostat.NTPC();
5567  for(unsigned int t = 0; t < nTPCs; ++t) {
5568  const geo::TPCGeo& tpc = cryostat.TPC(t);
5569 
5570  out << "\n" << indent << " ";
5571  tpc.PrintTPCInfo
5572  (std::forward<Stream>(out), indent + " ", tpc.MaxVerbosity);
5573 
5574  const unsigned int nPlanes = tpc.Nplanes();
5575  for(unsigned int p = 0; p < nPlanes; ++p) {
5576  const geo::PlaneGeo& plane = tpc.Plane(p);
5577  const unsigned int nWires = plane.Nwires();
5578 
5579  out << "\n" << indent << " ";
5580  plane.PrintPlaneInfo
5581  (std::forward<Stream>(out), indent + " ", plane.MaxVerbosity);
5582 
5583  for(unsigned int w = 0; w < nWires; ++w) {
5584  const geo::WireGeo& wire = plane.Wire(w);
5585  geo::WireID wireID(plane.ID(), w);
5586 
5587  // the wire should be aligned on z axis, half on each side of 0,
5588  // in its local frame
5589  out << "\n" << indent << " " << wireID << " ";
5590  wire.PrintWireInfo
5591  (std::forward<Stream>(out), indent + " ", wire.MaxVerbosity);
5592  } // for wire
5593  } // for plane
5594  } // for TPC
5595 
5596  unsigned int nOpDets = cryostat.NOpDet();
5597  for (unsigned int iOpDet = 0; iOpDet < nOpDets; ++iOpDet) {
5598  geo::OpDetGeo const& opDet = cryostat.OpDet(iOpDet);
5599  out << "\n" << indent << " [OpDet #" << iOpDet << "] ";
5600  opDet.PrintOpDetInfo
5601  (std::forward<Stream>(out), indent + " ", opDet.MaxVerbosity);
5602  } // for
5603  } // for cryostat
5604 
5605  unsigned int const nAuxDets = NAuxDets();
5606  for (unsigned int iDet = 0; iDet < nAuxDets; ++iDet) {
5607  geo::AuxDetGeo const& auxDet = AuxDet(iDet);
5608 
5609  out << "\n" << indent << "[#" << iDet << "] ";
5610  auxDet.PrintAuxDetInfo
5611  (std::forward<Stream>(out), indent + " ", auxDet.MaxVerbosity);
5612 
5613  unsigned int const nSensitive = auxDet.NSensitiveVolume();
5614  switch (nSensitive) {
5615  case 0: break;
5616  case 1: {
5617  geo::AuxDetSensitiveGeo const& auxDetS = auxDet.SensitiveVolume(0U);
5618  out << "\n" << indent << " ";
5619  auxDetS.PrintAuxDetInfo
5620  (std::forward<Stream>(out), indent + " ", auxDetS.MaxVerbosity);
5621  break;
5622  }
5623  default:
5624  for (unsigned int iSens = 0; iSens < nSensitive; ++iSens) {
5625  out << "\n" << indent << "[#" << iSens << "] ";
5626  geo::AuxDetSensitiveGeo const& auxDetS
5627  = auxDet.SensitiveVolume(iSens);
5628  auxDetS.PrintAuxDetInfo
5629  (std::forward<Stream>(out), indent + " ", auxDetS.MaxVerbosity);
5630  } // for
5631  break;
5632  } // if sensitive detectors
5633 
5634  } // for auxiliary detector
5635 
5636  out << '\n';
5637 
5638 } // geo::GeometryCore::Print()
5639 
5640 
5641 //------------------------------------------------------------------------------
5642 // template member function specializations
5643 namespace geo {
5644 
5645  template <>
5646  inline geo::TPCID GeometryCore::GetBeginID<geo::TPCID, geo::CryostatID>
5647  (geo::CryostatID const& id) const
5648  { return GetBeginTPCID(id); }
5649 
5650  template <>
5651  inline geo::TPCID GeometryCore::GetEndID<geo::TPCID, geo::CryostatID>
5652  (geo::CryostatID const& id) const
5653  { return GetEndTPCID(id); }
5654 
5655  template <>
5656  inline geo::PlaneID GeometryCore::GetBeginID<geo::PlaneID, geo::CryostatID>
5657  (geo::CryostatID const& id) const
5658  { return GetBeginPlaneID(id); }
5659 
5660  template <>
5661  inline geo::PlaneID GeometryCore::GetEndID<geo::PlaneID, geo::CryostatID>
5662  (geo::CryostatID const& id) const
5663  { return GetEndPlaneID(id); }
5664 
5665 } // namespace geo
5666 
5667 //******************************************************************************
5668 //
5669 // geo::details::cryostat_id_iterator_base<>
5670 //
5671 template <typename GEOID>
5673  { return geometry() && geometry()->HasElement(localID()); }
5674 
5675 template <typename GEOID>
5677  -> ElementPtr_t
5678  { return geometry()->GetElementPtr(localID()); }
5679 
5680 template <typename GEOID>
5682  { limit = geometry()->NSiblingElements(localID()); }
5683 
5684 template <typename GEOID>
5686  { geometry()->GetBeginID(ID()); }
5687 
5688 template <typename GEOID>
5690  { geometry()->GetEndID(ID()); }
5691 
5692 template <typename GEOID>
5694  if (at_end()) return;
5695  if (++local_index() < limit) return;
5696  localID().isValid = false;
5697 } // geo::cryostat_id_iterator_base<GEOID>::next()
5698 
5699 
5700 //
5701 // geo::details::TPC_id_iterator_base<>
5702 //
5703 template <typename GEOID>
5705  return upper_iterator::geometry()
5706  && upper_iterator::geometry()->HasElement(localID());
5707 } // geo::details::TPC_id_iterator_base<>::operator bool()
5708 
5709 
5710 template <typename GEOID>
5711 inline
5713  { return upper_iterator::geometry()->GetElementPtr(localID()); }
5714 
5715 template <typename GEOID>
5717  // limit is how many sibling TPCs there are
5718  limit = upper_iterator::geometry()->NSiblingElements(localID());
5719 } // geo::details::TPC_id_iterator_base<GEOID>::set_local_limits()
5720 
5721 template <typename GEOID>
5723  // if at end (checked in the inherited context), do nothing
5724  if (upper_iterator::at_end()) return;
5725 
5726  // if after incrementing we haven't reached the limit, we are done
5727  if (++local_index() < limit) return;
5728 
5729  // we reached the end of the current elements list, we need to escalate:
5730  // - go to the next parent; if that becomes invalid, too bad, but we go on
5731  upper_iterator::next();
5732  // - set the index to the first element of the new parent
5733  local_index() = 0;
5734  // - update how many elements there are
5735  // (expect 0 if it is now at_end() -- and it does not even matter)
5736  set_local_limits();
5737 } // geo::details::TPC_id_iterator_base<GEOID>::next()
5738 
5739 
5740 //
5741 // geo::details::plane_id_iterator_base<>
5742 //
5743 template <typename GEOID>
5745  return upper_iterator::geometry()
5746  && upper_iterator::geometry()->HasElement(localID());
5747 } // geo::details::plane_id_iterator_base<>::operator bool()
5748 
5749 
5750 template <typename GEOID>
5752  -> ElementPtr_t
5753  { return upper_iterator::geometry()->GetElementPtr(localID()); }
5754 
5755 template <typename GEOID>
5757  // limit is how many sibling planes there are
5758  limit = upper_iterator::geometry()->NSiblingElements(localID());
5759 } // geo::details::plane_id_iterator_base<GEOID>::set_local_limits()
5760 
5761 template <typename GEOID>
5763  // if at end (checked in the inherited context), do nothing
5764  if (upper_iterator::at_end()) return;
5765 
5766  // if after incrementing we haven't reached the limit, we are done
5767  if (++local_index() < limit) return;
5768 
5769  // we reached the end of the current elements list, we need to escalate:
5770  // - go to the next parent; if that becomes invalid, too bad, but we go on
5771  upper_iterator::next();
5772  // - set the index to the first element of the new parent
5773  local_index() = 0;
5774  // - update how many elements there are
5775  // (expect 0 if it is now at_end() -- and it does not even matter)
5776  set_local_limits();
5777 } // geo::details::plane_id_iterator_base<GEOID>::next()
5778 
5779 
5780 //
5781 // geo::details::wire_id_iterator_base<>
5782 //
5783 template <typename GEOID>
5785  return upper_iterator::geometry()
5786  && upper_iterator::geometry()->HasElement(localID());
5787 } // geo::details::wire_id_iterator_base<>::operator bool()
5788 
5789 template <typename GEOID>
5791  -> ElementPtr_t
5792  { return upper_iterator::geometry()->GetElementPtr(localID()); }
5793 
5794 template <typename GEOID>
5796  // limit is how many sibling wires there are
5797  limit = upper_iterator::geometry()->NSiblingElements(localID());
5798 } // geo::details::wire_id_iterator_base<>::set_local_limits()
5799 
5800 template <typename GEOID>
5802  // if at end (checked in the inherited context), do nothing
5803  if (upper_iterator::at_end()) return;
5804 
5805  // if after incrementing we haven't reached the limit, we are done
5806  if (++local_index() < limit) return;
5807 
5808  // we reached the end of the current elements list, we need to escalate:
5809  // - go to the next parent; if that becomes invalid, too bad, but we go on
5810  upper_iterator::next();
5811  // - set the index to the first element of the new parent
5812  local_index() = 0;
5813  // - update how many elements there are
5814  // (expect 0 if it is now at_end() -- and it does not even matter)
5815  set_local_limits();
5816 } // geo::details::wire_id_iterator_base<>::next()
5817 
5818 
5819 //
5820 // comparison operators between ID iterators and element iterators
5821 //
5822 template <typename GEOIDITER>
5823 bool geo::details::operator==
5824  (geometry_element_iterator<GEOIDITER> const& iter, GEOIDITER const& id_iter)
5825 {
5826  return iter.id_iterator() == id_iter;
5827 } // operator==(iterator_t, id_iterator_t)
5828 
5829 template <typename GEOIDITER>
5830 bool geo::details::operator!=
5831  (geometry_element_iterator<GEOIDITER> const& iter, GEOIDITER const& id_iter)
5832 {
5833  return iter.id_iterator() != id_iter;
5834 } // operator!=(iterator_t, id_iterator_t)
5835 
5836 
5837 //
5838 // geo::details::TPCset_id_iterator_base<>
5839 //
5840 template <typename GEOID>
5842  return upper_iterator::geometry()
5843  && upper_iterator::geometry()->HasElement(localID());
5844 } // geo::details::TPCset_id_iterator_base<>::operator bool()
5845 
5846 
5847 template <typename GEOID>
5849  // limit is how many sibling TPCs there are
5850  limit = upper_iterator::geometry()->NSiblingElements(localID());
5851 } // geo::details::TPCset_id_iterator_base<GEOID>::set_local_limits()
5852 
5853 template <typename GEOID>
5855  // if at end (checked in the inherited context), do nothing
5856  if (upper_iterator::at_end()) return;
5857 
5858  // if after incrementing we haven't reached the limit, we are done
5859  if (++local_index() < limit) return;
5860 
5861  // we reached the end of the current elements list, we need to escalate:
5862  // - go to the next parent; if that becomes invalid, too bad, but we go on
5863  upper_iterator::next();
5864  // - set the index to the first element of the new parent
5865  local_index() = 0;
5866  // - update how many elements there are
5867  // (expect 0 if it is now at_end() -- and it does not even matter)
5868  set_local_limits();
5869 } // geo::details::TPCset_id_iterator_base<GEOID>::next()
5870 
5871 
5872 //
5873 // geo::details::ROP_id_iterator_base<>
5874 //
5875 template <typename GEOID>
5877  return upper_iterator::geometry()
5878  && upper_iterator::geometry()->HasElement(localID());
5879 } // geo::details::ROP_id_iterator_base<>::operator bool()
5880 
5881 
5882 template <typename GEOID>
5884  // limit is how many sibling planes there are
5885  limit = upper_iterator::geometry()->NSiblingElements(localID());
5886 } // geo::details::ROP_id_iterator_base<GEOID>::set_local_limits()
5887 
5888 template <typename GEOID>
5890  // if at end (checked in the inherited context), do nothing
5891  if (upper_iterator::at_end()) return;
5892 
5893  // if after incrementing we haven't reached the limit, we are done
5894  if (++local_index() < limit) return;
5895 
5896  // we reached the end of the current elements list, we need to escalate:
5897  // - go to the next parent; if that becomes invalid, too bad, but we go on
5898  upper_iterator::next();
5899  // - set the index to the first element of the new parent
5900  local_index() = 0;
5901  // - update how many elements there are
5902  // (expect 0 if it is now at_end() -- and it does not even matter)
5903  set_local_limits();
5904 } // geo::details::ROP_id_iterator_base<GEOID>::next()
5905 
5906 
5907 
5908 //******************************************************************************
5909 
5910 #endif // LARCOREALG_GEOMETRY_GEOMETRYCORE_H
Float_t x
Definition: compare.C:6
unsigned int NearestWire(geo::Point_t const &worldLoc, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Returns the index of wire closest to position in the specified TPC.
wire_iterator end_wire(geo::PlaneID const &id) const
Returns an iterator pointing after the last wire in specified plane.
wire_iterator begin_wire() const
Returns an iterator pointing to the first wire in the detector.
unsigned int NElements() const
Number of wires in this plane.
Definition: PlaneGeo.h:251
void GetStart(double *xyz) const
Definition: WireGeo.h:129
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Definition: WireGeo.h:61
bool HasElement(readout::TPCsetID const &tpcsetid) const
Returns whether we have the specified TPC set.
geo::TPCID GetEndTPCID(geo::CryostatID const &id) const
GeoID GetEndID() const
Returns the (possibly invalid) ID after the last subelement of the detector.
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:155
geo::PlaneDataContainer< T > makePlaneData() const
Returns a container with one entry per wire plane.
ROP_id_iterator begin_ROP_id() const
Returns an iterator pointing to the first ROP ID in the detector.
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:855
typename id_iterator_t::LocalID_t LocalID_t
Definition: GeometryCore.h:751
LocalIteratorBox< wire_iterator, geo::CryostatID,&GeometryCore::begin_wire,&GeometryCore::end_wire > IterateWires(geo::CryostatID const &cid) const
Enables ranged-for loops on all wires of specified cryostat.
Interface for a class providing readout channel mapping to geometry.
Definition: ChannelMapAlg.h:55
ID_t & local_index()
Returns the index (part if the ID) this iterator runs on (non-const)
Definition: GeometryCore.h:407
void PrintWireInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this wire.
Definition: WireGeo.h:386
cryostat_id_iterator_base(geo::GeometryCore const *geom, UndefinedPos_t)
Constructor: does not set the current ID.
Definition: GeometryCore.h:231
raw::ChannelID_t NearestChannel(geo::Point_t const &worldLoc, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Returns the ID of the channel nearest to the specified position.
std::string GetCryostatVolumeName(unsigned int const cstat=0) const
Return the name of LAr TPC volume.
cryostat_id_iterator_base(geo::GeometryCore const *geom)
Constructor: points to begin.
Definition: GeometryCore.h:178
readout::ROPID GetEndROPID(geo::CryostatID const &id) const
constexpr auto undefined_pos
wire_iterator end_wire() const
Returns an iterator pointing after the last wire in the detector.
void PrintTPCInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this TPC.
Definition: TPCGeo.h:703
CryostatGeo const * GetElementPtr(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:135
IteratorBoxBase(iterator const &b, iterator const &e)
Constructor: initializes the begin and end iterators.
void set_begin()
Sets the iterator to the begin position.
CryostatGeo const & GetElement(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:121
raw::ChannelID_t NearestChannel(const double worldLoc[3], unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Returns the ID of the channel nearest to the specified position.
void GetBeginID(geo::WireID &id) const
Initializes the specified ID with the ID of the first wire.
TPC_id_iterator begin_TPC_id() const
Returns an iterator pointing to the first TPC ID in the detector.
GeometryData_t fGeoData
The detector description data.
unsigned int NSiblingElements(geo::CryostatID const &) const
Returns the number of cryostats in the detector.
wire_iterator begin_wire(geo::CryostatID const &id) const
Returns an iterator pointing to the first wire in specified cryostat.
std::vector< NodeInfo_t > current_path
which node, which sibling?
IteratorBox< wire_iterator,&GeometryCore::begin_wire,&GeometryCore::end_wire > IterateWires() const
Enables ranged-for loops on all wires of the detector.
Encapsulate the construction of a single cyostat.
bool HasElement(geo::PlaneID const &planeid) const
Returns whether we have the specified plane.
geo::WireID GetEndWireID(geo::TPCID const &id) const
double Length_t
Type used for coordinates and distances. They are measured in centimeters.
Definition: geo_vectors.h:140
geo::Length_t WirePitch(unsigned int plane=0, unsigned int tpc=0, unsigned int cstat=0) const
Returns the distance between two consecutive wires.
IteratorBox< plane_iterator,&GeometryCore::begin_plane,&GeometryCore::end_plane > IteratePlanes() const
Enables ranged-for loops on all planes of the detector.
Encapsulate the geometry of the sensitive portion of an auxiliary detector.
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
constexpr auto end_pos
cryostat_id_iterator_base(geo::GeometryCore const *geom, EndPos_t)
Constructor: points to end.
Definition: GeometryCore.h:194
Classes identifying readout-related concepts.
geo::WireID NearestWireID(const TVector3 &point, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Fills two arrays with the coordinates of the wire end points.
LocalIteratorBox< wire_iterator, geo::PlaneID,&GeometryCore::begin_wire,&GeometryCore::end_wire > IterateWires(geo::PlaneID const &tid) const
Enables ranged-for loops on all wires of specified wire plane.
LocalID_t & localID()
Returns the type of ID we act on (non-const version)
Definition: GeometryCore.h:678
TPCset_id_iterator_base(geo::GeometryCore const *geom, EndPos_t)
Constructor: points to end.
Definition: GeometryCore.h:929
void Print(Stream &&out, std::string indent=" ") const
Prints geometry information with maximum verbosity.
unsigned int ROPID_t
type for the ID number
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:119
WireGeo const & Wire(unsigned int iwire) const
Definition: PlaneGeo.cxx:506
wire_iterator end_wire(geo::CryostatID const &id) const
Returns an iterator pointing after the last wire in specified cryostat.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
Base forward iterator browsing all wire IDs in the detector.
Definition: GeometryCore.h:567
Base forward iterator browsing all TPC IDs in the detector.
Definition: GeometryCore.h:294
Base forward iterator browsing all readout plane IDs in the detector.
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
Definition: AuxDetGeo.h:159
void WireEndPoints(unsigned int cstat, unsigned int tpc, unsigned int plane, unsigned int wire, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:145
LocalID_t & localID()
Returns the type of ID we act on (non-const version).
LocalIteratorBox< wire_id_iterator, geo::CryostatID,&GeometryCore::begin_wire_id,&GeometryCore::end_wire_id > IterateWireIDs(geo::CryostatID const &cid) const
Enables ranged-for loops on all wire IDs of specified cryostat.
Float_t y
Definition: compare.C:6
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:521
unsigned int CryostatID_t
Type for the ID number.
Definition: geo_types.h:121
raw::ChannelID_t NearestChannel(const TVector3 &worldLoc, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Returns the ID of the channel nearest to the specified position.
unsigned int NSiblingElements(geo::PlaneID const &planeid) const
Returns the total number of wire planes in the specified TPC.
std::set< geo::View_t > const & Views() const
Returns a list of possible views in the detector.
details::cryostat_id_iterator_base< geo::CryostatID > cryostat_id_iterator
Forward iterator browsing all cryostats in the detector.
LocalIteratorBox(GeometryCore const *geom, GeoID const &ID)
wire_id_iterator begin_wire_id(geo::TPCID const &id) const
Returns an iterator pointing to the first wire ID in specified TPC.
Double_t z
Definition: plot.C:279
AuxDetList_t auxDets
The auxiliary detectors.
cryostat_iterator end_cryostat() const
Returns an iterator pointing after the last cryostat.
wire_id_iterator begin_wire_id(geo::PlaneID const &id) const
Returns an iterator pointing to the first wire ID in specified plane.
plane_iterator end_plane() const
Returns an iterator pointing after the last plane in the detector.
The data type to uniquely identify a Plane.
Definition: geo_types.h:250
Geometry information for a single TPC.
Definition: TPCGeo.h:37
wire_id_iterator begin_wire_id(geo::CryostatID const &id) const
Returns an iterator pointing to the first wire ID in specified cryostat.
details::ROP_id_iterator_base< readout::ROPID > ROP_id_iterator
Forward iterator browsing all readout planes in the detector.
TPC_iterator end_TPC(geo::CryostatID const &cid) const
Returns an iterator pointing after the last TPC in the detector.
TPCGeo const & GetElement(geo::TPCID const &tpcid) const
Returns the specified TPC.
void next()
Skips to the next wire.
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
Class identifying a set of TPC sharing readout channels.
Definition: readout_types.h:41
geo::PlaneID GetBeginPlaneID(geo::CryostatID const &id) const
Returns the ID of the first plane of the specified cryostat.
Point const & start() const
NodeInfo_t(Node_t new_self, int new_sibling)
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:120
LocalID_t & localID()
Returns the type of ID we act on (non-const version).
Definition: GeometryCore.h:992
TPCset_id_iterator_base(geo::GeometryCore const *geom)
Constructor: points to begin.
Definition: GeometryCore.h:913
std::vector< geo::CryostatGeo > CryostatList_t
Type of list of cryostats.
geo::WireID GetBeginWireID(geo::TPCID const &id) const
Returns the ID of the first wire of the specified TPC.
double fSurfaceY
The point where air meets earth for this detector.
GeoID_t & ID()
Returns the actual type of ID we store.
Definition: GeometryCore.h:238
plane_iterator end_plane(geo::TPCID const &ID) const
Returns an iterator pointing after the last plane in the specified TPC.
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
wire_iterator end_wire(geo::TPCID const &id) const
Returns an iterator pointing after the last wire in specified TPC.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:130
TPC_iterator begin_TPC(geo::CryostatID const &cid) const
Returns an iterator pointing to the first TPC in the detector.
ROP_id_iterator end_ROP_id() const
Returns an iterator pointing after the last ROP ID in the detector.
geo::WireID NearestWireID(std::vector< double > const &point, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Fills two arrays with the coordinates of the wire end points.
void next()
Skips to the next TPC.
enum geo::coordinates Coord_t
Enumerate the possible plane projections.
TPCset_id_iterator end_TPCset_id() const
Returns an iterator pointing after the last TPC set ID in the detector.
geo::TPCDataContainer< T > makeTPCData(T const &defValue) const
Returns a container with one entry per TPC.
geo::TPCDataContainer< T > makeTPCData() const
Returns a container with one entry per TPC.
Point const & end() const
geo::WireID GetEndWireID(geo::CryostatID const &id) const
CryostatList_t cryostats
The detector cryostats.
geo::WireID GetEndWireID(geo::PlaneID const &id) const
geo::Length_t CryostatLength(unsigned int cstat=0) const
Returns the length of the cryostat (z direction)
LocalID_t & localID()
Returns the type of ID we act on (non-const version)
Definition: GeometryCore.h:541
iterator cbegin() const
TPCset_id_iterator begin_TPCset_id(geo::CryostatID const &cid) const
Container with one element per geometry wire plane.
void GetEndID(geo::WireID &id) const
Initializes the specified ID with the invalid ID after the last wire.
Geometry information for a single cryostat.
Definition: CryostatGeo.h:36
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
TPCGeo const & TPC(geo::TPCID const &tpcid) const
Returns the specified TPC.
void set_local_limits()
Sets limit to the past-the-end TPC set number of current croystat.
typename id_iterator_t::EndPos_t EndPos_t
Definition: GeometryCore.h:755
double WireAngleToVertical(geo::View_t view, int TPC=0, int Cryo=0) const
Returns the angle of the wires in the specified view from vertical.
ElementPtr_t get() const
Returns a pointer to the geometry element, or nullptr if invalid.
Definition: GeometryCore.h:838
TPC_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:321
typename LocalID_t::CryostatID_t ID_t
Definition: GeometryCore.h:228
void GetBeginID(geo::TPCID &id) const
Initializes the specified ID with the ID of the first TPC.
TPC_id_iterator begin_TPC_id(geo::CryostatID const &cid) const
geometry_iterator_base(geo::GeometryCore const *geom)
Constructor: associates with the specified geometry.
Definition: GeometryCore.h:131
wire_id_iterator_base(geo::GeometryCore const *geom, EndPos_t)
Constructor: points to end.
Definition: GeometryCore.h:613
std::vector< AuxDetGeo * > AuxDetList_t
Type of list of auxiliary detectors.
unsigned int NearestWire(const TVector3 &worldLoc, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Returns the index of wire closest to position in the specified TPC.
wire_id_iterator end_wire_id(geo::TPCID const &id) const
Returns an iterator pointing after the last wire ID in specified TPC.
void GetBeginID(readout::TPCsetID &id) const
Initializes the specified ID with the ID of the first TPC set.
PlaneGeo const * GetElementPtr(geo::PlaneID const &planeid) const
Returns the specified plane.
ID_t & local_index()
Returns the index (part if the ID) this iterator runs on (non-const).
Definition: GeometryCore.h:995
TVector3 DefaultVector_t
Default template argument.
Class for approximate comparisons.
IteratorBox< TPC_id_iterator,&GeometryCore::begin_TPC_id,&GeometryCore::end_TPC_id > IterateTPCIDs() const
Enables ranged-for loops on all TPC IDs of the detector.
details::geometry_iterator_types::EndPos_t EndPos_t
void next()
Skips to the next TPC set.
unsigned int NSiblingElements(readout::TPCsetID const &tpcsetid) const
Returns the total number of TPC sets in the specified cryostat.
bool IntersectionPoint(unsigned int wire1, unsigned int wire2, unsigned int plane1, unsigned int plane2, unsigned int cstat, unsigned int tpc, double &y, double &z) const
Returns the intersection point of two wires.
WireGeo const * GetElementPtr(geo::WireID const &wireid) const
Returns the specified wire.
unsigned int NElements() const
Returns the number of cryostats in the detector.
void GetEndID(geo::TPCID &id) const
Initializes the specified ID with the invalid ID after the last TPC.
wire_id_iterator_base(geo::GeometryCore const *geom, BeginPos_t const)
Constructor: points to begin.
Definition: GeometryCore.h:608
std::string ROOTFile() const
Returns the full directory path to the geometry file source.
wire_id_iterator_base(geo::GeometryCore const *geom, UndefinedPos_t)
Constructor: position undefined (meaning undefined local limits too)
Definition: GeometryCore.h:651
bool IncrementID(geo::CryostatID &id) const
details::plane_id_iterator_base< geo::PlaneID > plane_id_iterator
Forward iterator browsing all planes in the detector.
PlaneGeo const & Plane(geo::PlaneID const &planeid) const
Returns the specified wire.
TPCGeo const & PositionToTPC(double const point[3]) const
Returns the TPC at specified location.
LocalIteratorBox< wire_id_iterator, geo::TPCID,&GeometryCore::begin_wire_id,&GeometryCore::end_wire_id > IterateWireIDs(geo::TPCID const &tid) const
Enables ranged-for loops on all wire IDs of specified TPC.
readout::TPCsetID GetEndTPCsetID(geo::CryostatID const &id) const
details::geometry_iterator_types::BeginPos_t BeginPos_t
unsigned int NSiblingElements(geo::TPCID const &tpcid) const
Returns the total number of TPCs in the specified cryostat.
raw::ChannelID_t NearestChannel(std::vector< double > const &worldLoc, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Returns the ID of the channel nearest to the specified position.
TPC_iterator begin_TPC() const
Returns an iterator pointing to the first TPC in the detector.
LocalIteratorBox< ROP_id_iterator, readout::TPCsetID,&GeometryCore::begin_ROP_id,&GeometryCore::end_ROP_id > IterateROPIDs(readout::TPCsetID const &sid) const
Enables ranged-for loops on all readout plane IDs of the specified TPC set.
void GetBeginID(readout::ROPID &id) const
Initializes the specified ID with the ID of the first readout plane.
static lar::util::RealComparisons< geo::Length_t > coordIs
Value of tolerance for equality comparisons.
geo::CryostatID CryostatID
Definition: readout_types.h:30
IteratorBox< plane_id_iterator,&GeometryCore::begin_plane_id,&GeometryCore::end_plane_id > IteratePlaneIDs() const
Enables ranged-for loops on all plane IDs of the detector.
geo::PlaneID GetBeginPlaneID(geo::TPCID const &id) const
Returns the ID of the first plane of the specified TPC.
TPC_id_iterator end_TPC_id(geo::CryostatID const &cid) const
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
CryostatList_t const & Cryostats() const
Return the internal cryostat list.
geo::CryostatGeo const * ElementPtr_t
Definition: GeometryCore.h:164
Interface to algorithm class for sorting geo::XXXGeo objects.
details::geometry_element_iterator< wire_id_iterator > wire_iterator
Forward iterator browsing all wires in the detector.
ROP_id_iterator begin_ROP_id(readout::TPCsetID const &ID) const
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
details::geometry_element_iterator< plane_id_iterator > plane_iterator
Forward iterator browsing all planes in the detector.
plane_id_iterator_base(geo::GeometryCore const *geom, UndefinedPos_t)
Constructor: position undefined (meaning undefined local limits too)
Definition: GeometryCore.h:514
bool HasElement(readout::ROPID const &ropid) const
cryostat_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:175
TVector3 DefaultPoint_t
Default template argument.
AuxDetList_t const & AuxDets() const
Return the interfal auxiliary detectors list.
Containers to hold one datum per TPC or plane.
unsigned int PlaneID_t
Type for the ID number.
Definition: geo_types.h:251
TPC_id_iterator_base(geo::GeometryCore const *geom, UndefinedPos_t)
Constructor: position undefined (meaning undefined local limits too)
Definition: GeometryCore.h:377
geo::WireID GetBeginWireID(geo::PlaneID const &id) const
Returns the ID of the first wire of the specified wire plane.
IteratorBox< wire_id_iterator,&GeometryCore::begin_wire_id,&GeometryCore::end_wire_id > IterateWireIDs() const
Enables ranged-for loops on all wire IDs of the detector.
LocalIteratorBox< plane_id_iterator, geo::CryostatID,&GeometryCore::begin_plane_id,&GeometryCore::end_plane_id > IteratePlaneIDs(geo::CryostatID const &cid) const
Enables ranged-for loops on all plane IDs of the specified cryostat.
void set_end()
Sets the iterator to the end position.
Container with one element per geometry TPC.
Base class for geometry iterators, containing some type definitions.
Definition: GeometryCore.h:110
PlaneGeo const * PlanePtr(geo::PlaneID const &planeid) const
Returns the specified plane.
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
Int_t max
Definition: plot.C:27
LocalIteratorBox< TPCset_id_iterator, geo::CryostatID,&GeometryCore::begin_TPCset_id,&GeometryCore::end_TPCset_id > IterateTPCsetIDs(geo::CryostatID const &cid) const
Enables ranged-for loops on all TPC set IDs of the specified cryostat.
plane_id_iterator end_plane_id(geo::TPCID const &ID) const
Iterator to navigate through all the nodes.
bool HasElement(geo::CryostatID const &cryoid) const
Returns whether we have the specified cryostat.
void GetEndID(readout::TPCsetID &id) const
Initializes the specified ID with the invalid ID after the last TPC set.
std::set< geo::View_t > allViews
All views in the detector.
readout::ROPID GetBeginROPID(readout::TPCsetID const &id) const
Returns the ID of the first readout plane of the specified TPC set.
TCanvas * c1
Definition: plotHisto.C:7
readout::TPCsetID GetBeginTPCsetID(geo::CryostatID const &id) const
Returns the ID of the first TPC set in the specified cryostat.
TCanvas * c2
Definition: plot_hist.C:75
GeometryData_t::CryostatList_t CryostatList_t
Type of list of cryostats.
LocalID_t & localID()
Returns the type of ID we act on.
Definition: GeometryCore.h:264
geometry_iterator_base()
Default constructor; do not use a default-constructed iterator as-is!
Definition: GeometryCore.h:138
details::TPCset_id_iterator_base< readout::TPCsetID > TPCset_id_iterator
Forward iterator browsing all TPC sets in the detector.
void GetBeginID(geo::CryostatID &id) const
Initializes the specified ID with the ID of the first cryostat.
void GetBeginID(geo::PlaneID &id) const
Initializes the specified ID with the ID of the first plane.
constexpr auto begin_pos
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:262
LocalIteratorBox< wire_id_iterator, geo::PlaneID,&GeometryCore::begin_wire_id,&GeometryCore::end_wire_id > IterateWireIDs(geo::PlaneID const &pid) const
Enables ranged-for loops on all wire IDs of specified wire plane.
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
ROOTGeoNodeForwardIterator(TGeoNode const *start_node)
Constructor: start from this node.
Definitions of geometry vector data types.
ElementPtr_t get() const
Returns a pointer to plane, or nullptr if invalid.
plane_iterator begin_plane(geo::CryostatID const &ID) const
geo::Length_t DetLength(unsigned int tpc=0, unsigned int cstat=0) const
Returns the length of the active volume of the specified TPC.
typename std::remove_pointer< ElementPtr_t >::type Element_t
Geometry class pointed by the iterator.
Definition: GeometryCore.h:767
unsigned int TPCID_t
Type for the ID number.
Definition: geo_types.h:196
typename id_iterator_t::GeoID_t GeoID_t
Definition: GeometryCore.h:752
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
IteratorBox< TPC_iterator,&GeometryCore::begin_TPC,&GeometryCore::end_TPC > IterateTPCs() const
Enables ranged-for loops on all TPCs of the detector.
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:658
Base forward iterator browsing all cryostat IDs in the detector.
Definition: GeometryCore.h:160
ROP_id_iterator_base(geo::GeometryCore const *geom, BeginPos_t const)
Constructor: points to begin.
plane_id_iterator_base(geo::GeometryCore const *geom, BeginPos_t const)
Constructor: points to begin.
Definition: GeometryCore.h:471
wire_iterator begin_wire(geo::PlaneID const &id) const
Returns an iterator pointing to the first wire in specified plane.
details::geometry_element_iterator< TPC_id_iterator > TPC_iterator
Forward iterator browsing all TPCs in the detector.
void set_local_limits()
Sets the limit member to the past-the-end cryostat number.
std::string indent(std::size_t const i)
geo::PlaneID GetEndPlaneID(geo::TPCID const &id) const
std::shared_ptr< const geo::ChannelMapAlg > fChannelMapAlg
Object containing the channel to wire mapping.
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:78
unsigned int NElements() const
Alias for NTPC().
Definition: CryostatGeo.h:157
void PrintOpDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this optical detector.
Definition: OpDetGeo.h:199
TPCset_id_iterator begin_TPCset_id() const
Returns an iterator pointing to the first TPC set ID in the detector.
Utilities to extend the interface of geometry vectors.
wire_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:595
geometry_element_iterator(id_iterator_t &&iter)
Constructor: points to the same element as the specified ID iterator.
Definition: GeometryCore.h:780
TPCGeo const * TPCPtr(unsigned int itpc) const
Returns the TPC number itpc from this cryostat.
Definition: CryostatGeo.h:217
iterator end() const
TPC_id_iterator_base(geo::GeometryCore const *geom, EndPos_t)
Constructor: points to end.
Definition: GeometryCore.h:339
iterator e
Begin and end iterators.
Point GetTPCFrontFaceCenter(geo::TPCID const &tpcid) const
Returns the center of side of the detector facing the beam.
details::wire_id_iterator_base< geo::WireID > wire_id_iterator
Forward iterator browsing all wires in the detector.
bool HasElement(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:981
TPCGeo const * TPCPtr(geo::TPCID const &tpcid) const
Returns the specified TPC.
LocalIteratorBox< plane_id_iterator, geo::TPCID,&GeometryCore::begin_plane_id,&GeometryCore::end_plane_id > IteratePlaneIDs(geo::TPCID const &tid) const
Enables ranged-for loops on all plane IDs of the specified TPC.
size_t NSensitiveVolume() const
Definition: AuxDetGeo.h:160
geo::Length_t SurfaceY() const
The position of the detector respect to earth surface.
TPC_id_iterator_base(geo::GeometryCore const *geom)
Constructor: points to begin.
Definition: GeometryCore.h:324
ROP_id_iterator_base(geo::GeometryCore const *geom, EndPos_t)
Constructor: points to end.
wire_id_iterator end_wire_id() const
Returns an iterator pointing after the last wire ID in the detector.
geo::WireID NearestWireID(geo::Point_t const &point, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Fills two arrays with the coordinates of the wire end points.
The data type to uniquely identify a TPC.
Definition: geo_types.h:195
Description of geometry of one entire detector.
void Print(G4Element &ele)
Definition: pyG4Element.cc:56
plane_iterator end_plane(geo::CryostatID const &ID) const
void next()
Skips to the next cryostat.
Definition of data types for geometry description.
LocalIteratorBox< plane_iterator, geo::CryostatID,&GeometryCore::begin_plane,&GeometryCore::end_plane > IteratePlanes(geo::CryostatID const &cid) const
Enables ranged-for loops on all planes of the specified cryostat.
ROP_id_iterator_base(geo::GeometryCore const *geom)
Constructor: points to begin.
TPC_id_iterator_base(geo::GeometryCore const *geom, BeginPos_t const)
Constructor: points to begin.
Definition: GeometryCore.h:334
LocalIteratorBox< TPC_id_iterator, geo::CryostatID,&GeometryCore::begin_TPC_id,&GeometryCore::end_TPC_id > IterateTPCIDs(geo::CryostatID const &cid) const
Enables ranged-for loops on all TPC IDs of the specified cryostat.
double DefaultWiggle() const
Returns the tolerance used in looking for positions.
wire_iterator begin_wire(geo::TPCID const &id) const
Returns an iterator pointing to the first wire in specified TPC.
TPC_id_iterator end_TPC_id() const
Returns an iterator pointing after the last TPC ID in the detector.
IteratorBox(GeometryCore const *geom)
Class identifying a set of planes sharing readout channels.
LocalIteratorBox< wire_iterator, geo::TPCID,&GeometryCore::begin_wire,&GeometryCore::end_wire > IterateWires(geo::TPCID const &tid) const
Enables ranged-for loops on all wires of specified TPC.
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this auxiliary sensitive detector.
Provides a base class aware of world box coordinates.
typename id_iterator_t::BeginPos_t BeginPos_t
Definition: GeometryCore.h:754
ElementPtr_t get() const
Returns a pointer to TPC, or nullptr if invalid.
wire_id_iterator end_wire_id(geo::CryostatID const &id) const
plane_id_iterator_base(geo::GeometryCore const *geom, EndPos_t)
Constructor: points to end.
Definition: GeometryCore.h:476
unsigned int NElements(geo::CryostatID const &cryoid) const
Returns the total number of TPCs in the specified cryostat.
double ThirdPlaneSlope(geo::PlaneID::PlaneID_t plane1, double slope1, geo::PlaneID::PlaneID_t plane2, double slope2, geo::TPCID const &tpcid) const
Returns the slope on the third plane, given it in the other two.
Encapsulate the geometry of an auxiliary detector.
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:972
Encapsulate the geometry of a wire.
GeometryData_t::AuxDetList_t AuxDetList_t
Type of list of auxiliary detectors.
plane_iterator begin_plane(geo::TPCID const &ID) const
Returns an iterator pointing to the first plane in the specified TPC.
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:393
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
CryostatGeo const & PositionToCryostat(double const point[3]) const
Returns the cryostat at specified location.
void GetEndID(geo::PlaneID &id) const
Initializes the specified ID with the invalid ID after the last plane.
LocalID_t const & localID() const
Returns the type of ID we act on.
LocalIteratorBox< plane_iterator, geo::TPCID,&GeometryCore::begin_plane,&GeometryCore::end_plane > IteratePlanes(geo::TPCID const &tid) const
Enables ranged-for loops on all planes of the specified TPC.
Encapsulate the geometry of an optical detector.
IteratorBox< cryostat_iterator,&GeometryCore::begin_cryostat,&GeometryCore::end_cryostat > IterateCryostats() const
Enables ranged-for loops on all cryostats of the detector.
std::string fGDMLfile
path to geometry file used for Geant4 simulation
void next()
Skips to the next plane.
bool HasTPC(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
cryostat_iterator begin_cryostat() const
Returns an iterator pointing to the first cryostat.
unsigned int WireID_t
Type for the ID number.
Definition: geo_types.h:306
ROP_id_iterator begin_ROP_id(geo::CryostatID const &ID) const
unsigned int Nwires(geo::PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
details::geometry_iterator_types::UndefinedPos_t UndefinedPos_t
WireGeo const & Wire(geo::WireID const &wireid) const
Returns the specified wire.
WireGeo const & GetElement(geo::WireID const &wireid) const
Returns the specified wire.
unsigned int NSiblingElements(geo::WireID const &wireid) const
Returns the total number of wires in the specified plane.
void set_local_limits()
Sets limit to the past-the-end TPC number of current croystat.
plane_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:458
LocalIteratorBox< ROP_id_iterator, geo::CryostatID,&GeometryCore::begin_ROP_id,&GeometryCore::end_ROP_id > IterateROPIDs(geo::CryostatID const &cid) const
Enables ranged-for loops on all readout plane IDs of the specified cryostat.
bool operator!=(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to different IDs.
plane_id_iterator begin_plane_id(geo::TPCID const &ID) const
geo::WireID GetBeginWireID(geo::CryostatID const &id) const
Returns the ID of the first wire in the specified cryostat.
std::string VolumeName(TVector3 const &point) const
Returns a string with the name of the detector, as configured.
std::string value(boost::any const &)
Base forward iterator browsing all plane IDs in the detector.
Definition: GeometryCore.h:430
double ThirdPlaneSlope(unsigned int plane1, double slope1, unsigned int plane2, double slope2, unsigned int tpc, unsigned int cstat) const
Returns the slope on the third plane, given it in the other two.
ID_t & local_index()
Returns the index (part if the ID) this iterator runs on (non-const).
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintAuxDetInfo().
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:35
unsigned int NearestWire(std::vector< double > const &worldLoc, unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Returns the index of wire closest to position in the specified TPC.
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:530
Encapsulate the construction of a single detector plane.
IteratorBox< ROP_id_iterator,&GeometryCore::begin_ROP_id,&GeometryCore::end_ROP_id > IterateROPIDs() const
Enables ranged-for loops on all readout plane IDs of the detector.
readout::ROPID GetEndROPID(readout::TPCsetID const &id) const
ROP_id_iterator end_ROP_id(readout::TPCsetID const &ID) const
bool HasWire(unsigned int iwire) const
Returns whether a wire with index iwire is present in this plane.
Definition: PlaneGeo.h:260
void PrintPlaneInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this plane.
Definition: PlaneGeo.h:1324
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
Definition: TPCGeo.h:203
geometry_element_iterator(id_iterator_t const &iter)
Constructor: points to the same element as the specified ID iterator.
Definition: GeometryCore.h:777
ElementPtr_t get() const
Returns a pointer to cryostat, or nullptr if invalid.
LocalID_t const & ID() const
Returns the ID of the pointed geometry element.
Definition: GeometryCore.h:841
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
void GetEnd(double *xyz) const
Definition: WireGeo.h:133
Int_t min
Definition: plot.C:26
plane_id_iterator end_plane_id() const
Returns an iterator pointing after the last plane ID in the detector.
geo::TPCID FindTPCAtPosition(TVector3 const &point) const
Returns the ID of the TPC at specified location.
ElementPtr_t get() const
Returns a pointer to wire, or nullptr if invalid.
void GetEndID(readout::ROPID &id) const
Initializes the specified ID with the invalid ID after the last ROP.
iterator cend() const
IteratorBox< TPCset_id_iterator,&GeometryCore::begin_TPCset_id,&GeometryCore::end_TPCset_id > IterateTPCsetIDs() const
Enables ranged-for loops on all TPC set IDs of the detector.
geo::ChannelMapAlg const * ChannelMap() const
Returns the object handling the channel map.
void next()
Skips to the next readout plane.
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintOpDetInfo().
Definition: OpDetGeo.h:172
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:190
unsigned int NElements(geo::TPCID const &tpcid) const
Returns the total number of wire planes in the specified TPC.
cryostat_id_iterator begin_cryostat_id() const
Returns an iterator pointing to the first cryostat ID.
IteratorBox< cryostat_id_iterator,&GeometryCore::begin_cryostat_id,&GeometryCore::end_cryostat_id > IterateCryostatIDs() const
Enables ranged-for loops on all cryostat IDs of the detector.
WireGeo const * WirePtr(unsigned int iwire) const
Returns the wire number iwire from this plane.
Definition: PlaneGeo.h:305
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintAuxDetInfo().
Definition: AuxDetGeo.h:193
geo::TPCID GetBeginTPCID(geo::CryostatID const &id) const
Returns the ID of the first TPC in the specified cryostat.
unsigned int Nwires() const
Number of wires in this plane.
Definition: PlaneGeo.h:250
unsigned int NElements(geo::PlaneID const &planeid) const
Returns the total number of wires in the specified plane.
ID_t & local_index()
Returns the index (part if the ID) this iterator runs on (non-const)
Definition: GeometryCore.h:544
unsigned int NElements() const
Number of planes in this tpc.
Definition: TPCGeo.h:146
ID_t & local_index()
Returns the index (part if the ID) this iterator runs on (non-const)
Definition: GeometryCore.h:681
Base class for geometry iterators (note: this is not an iterator)
Definition: GeometryCore.h:127
Simple class with two points (a pair with aliases).
iterator begin() const
void set_local_limits()
Sets limit to the past-the-end wire number of current plane.
ID_t & local_index()
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:270
void WireEndPoints(geo::WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
std::string fDetectorName
Name of the detector.
details::TPC_id_iterator_base< geo::TPCID > TPC_id_iterator
Forward iterator browsing all TPCs in the detector.
TPCset_id_iterator_base(geo::GeometryCore const *geom, UndefinedPos_t)
Constructor: position undefined (meaning undefined local limits too).
Definition: GeometryCore.h:965
CryostatGeo const & Cryostat(unsigned int const cstat=0) const
Returns the specified cryostat.
typename id_iterator_t::UndefinedPos_t UndefinedPos_t
Definition: GeometryCore.h:753
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:860
TPCset_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:910
raw::ChannelID_t PlaneWireToChannel(unsigned int const plane, unsigned int const wire, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the number of TPC readout channels in the detector.
bool HasPlane(geo::PlaneID const &planeid) const
Returns whether we have the specified plane.
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintWireInfo().
Definition: WireGeo.h:251
TPCGeo const * GetElementPtr(geo::TPCID const &tpcid) const
Returns the specified TPC.
plane_id_iterator begin_plane_id() const
Returns an iterator pointing to the first plane ID in the detector.
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:384
Structures to distinguish the constructors.
Definition: GeometryCore.h:115
bool HasElement(geo::WireID const &wireid) const
Returns whether we have the specified wire.
LocalIteratorBox< TPC_iterator, geo::CryostatID,&GeometryCore::begin_TPC,&GeometryCore::end_TPC > IterateTPCs(geo::CryostatID const &cid) const
Enables ranged-for loops on all TPCs of the specified cryostat.
wire_id_iterator begin_wire_id() const
Returns an iterator pointing to the first wire ID in the detector.
unsigned int Nplanes(geo::TPCID const &tpcid) const
Returns the total number of planes in the specified TPC.
void set_local_limits()
Sets limit to the past-the-end plane number of current TPC.
id_iterator_t & id_iterator()
Access to the base ID iterator.
Definition: GeometryCore.h:856
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:299
TPCset_id_iterator_base(geo::GeometryCore const *geom, BeginPos_t const)
Constructor: points to begin.
Definition: GeometryCore.h:924
bool HasTPC(unsigned int itpc) const
Returns whether a TPC with index itpc is present in this cryostat.
Definition: CryostatGeo.h:164
std::string MaterialName(TVector3 const &point) const
Name of the deepest material containing the point xyz.
Interface to algorithm class for a specific detector channel mapping.
Data in the geometry description.
wire_id_iterator_base(geo::GeometryCore const *geom)
Constructor: points to begin.
Definition: GeometryCore.h:598
details::geometry_element_iterator< cryostat_id_iterator > cryostat_iterator
Forward iterator browsing all cryostats in the detector.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
Definition: RawTypes.h:27
TPCset_id_iterator end_TPCset_id(geo::CryostatID const &cid) const
GeoID GetNextID(GeoID const &id) const
Returns the ID next to the specified one.
Float_t e
Definition: plot.C:34
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:688
recob::tracking::Plane Plane
Definition: TrackState.h:17
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:187
static constexpr unsigned int MaxVerbosity
Maximum value for print verbosity.
Definition: PlaneGeo.h:645
QuadExpr operator*(double v, const QuadExpr &e)
Definition: QuadExpr.h:39
unsigned int NSiblingElements(readout::ROPID const &ropid) const
Returns the total number of ROP in the specified TPC set.
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
plane_id_iterator end_plane_id(geo::CryostatID const &ID) const
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintTPCInfo().
Definition: TPCGeo.h:595
wire_id_iterator end_wire_id(geo::PlaneID const &id) const
Returns an iterator pointing after the last wire ID in specified plane.
Namespace collecting geometry-related classes utilities.
geometry_element_iterator(geo::GeometryCore const *geom)
Constructor: points to begin.
Definition: GeometryCore.h:773
Float_t w
Definition: plot.C:23
Base forward iterator browsing all TPC set IDs in the detector.
Definition: GeometryCore.h:883
geo::Length_t CryostatHalfWidth(unsigned int cstat=0) const
Returns the half width of the cryostat (x direction)
plane_iterator begin_plane() const
Returns an iterator pointing to the first plane in the detector.
ROP_id_iterator end_ROP_id(geo::CryostatID const &ID) const
std::string fROOTfile
path to geometry file for geometry in GeometryCore
unsigned int NearestWire(const double worldLoc[3], unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Returns the index of wire closest to position in the specified TPC.
geo::WireID NearestWireID(const double point[3], unsigned int const PlaneNo, unsigned int const TPCNo=0, unsigned int const cstat=0) const
Fills two arrays with the coordinates of the wire end points.
unsigned int NTPC(geo::CryostatID const &cryoid) const
Returns the total number of TPCs in the specified cryostat.
plane_id_iterator begin_plane_id(geo::CryostatID const &ID) const
readout::ROPID GetBeginROPID(geo::CryostatID const &id) const
Returns the ID of the first readout plane of the specified cryostat.
bool operator==(geometry_element_iterator< GEOIDITER > const &iter, GEOIDITER const &id_iter)
Comparison operator: geometry ID and element point to the same ID.
void SetDetectorName(std::string new_name)
Sets the detector name.
typename id_iterator_t::ElementPtr_t ElementPtr_t
Definition: GeometryCore.h:756
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this auxiliary detector.
Definition: AuxDetGeo.h:225
CryostatGeo const * CryostatPtr(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
bool HasCryostat(geo::CryostatID const &cryoid) const
Returns whether we have the specified cryostat.
geo::Length_t WireCoordinate(double YPos, double ZPos, unsigned int PlaneNo, unsigned int TPCNo, unsigned int cstat) const
Returns the index of the nearest wire to the specified position.
plane_id_iterator_base(geo::GeometryCore const *geom)
Constructor: points to begin.
Definition: GeometryCore.h:461
LocalID_t & localID()
Returns the type of ID we act on (non-const version)
Definition: GeometryCore.h:404
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
GeoID_t id
ID of the current cryostat.
Definition: GeometryCore.h:248
GEOID GeoID_t
type of the actual ID stored in the iterator
Definition: GeometryCore.h:165
unsigned int NAuxDets() const
Returns the number of auxiliary detectors.
geo::Length_t CryostatHalfHeight(unsigned int cstat=0) const
Returns the height of the cryostat (y direction)
TPC_iterator end_TPC() const
Returns an iterator pointing after the last TPC in the detector.
ROP_id_iterator_base(geo::GeometryCore const *geom, UndefinedPos_t)
Constructor: position undefined (meaning undefined local limits too).
Encapsulate the construction of a single detector plane.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:120
geo::PlaneID GetEndPlaneID(geo::CryostatID const &id) const
unsigned short TPCsetID_t
type for the ID number
Definition: readout_types.h:42
bool HasWire(geo::WireID const &wireid) const
Returns whether we have the specified wire.
void GetEndID(geo::CryostatID &id) const
Initializes the specified ID with the invalid ID after the last cryostat.
geo::PlaneDataContainer< T > makePlaneData(T const &defValue) const
Returns a container with one entry per wire plane.
bool at_end() const
Returns whether this iterator has reached the end.
Definition: GeometryCore.h:245
WireGeo const & WireIDToWireGeo(geo::WireID const &wireid) const
Returns the specified wire.
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:667
WireGeo const * WirePtr(geo::WireID const &wireid) const
Returns the specified wire.
PlaneGeo const & GetElement(geo::PlaneID const &planeid) const
Returns the specified wire.
cryostat_id_iterator end_cryostat_id() const
Returns an iterator pointing after the last cryostat ID.