LArSoft  v06_85_00
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 
1800 
1808  std::string VolumeName(geo::Point_t const& point) const;
1809  std::string VolumeName(TVector3 const& point) const
1810  { return VolumeName(geo::vect::toPoint(point)); }
1812 
1813 
1823  std::vector<TGeoNode const*> FindAllVolumes
1824  (std::set<std::string> const& vol_names) const;
1825 
1839  std::vector<std::vector<TGeoNode const*>> FindAllVolumePaths
1840  (std::set<std::string> const& vol_names) const;
1841 
1842 
1844  TGeoMaterial const* Material(geo::Point_t const& point) const;
1846 
1850  std::string MaterialName(TVector3 const& point) const
1851  { return MaterialName(geo::vect::toPoint(point)); }
1852  std::string MaterialName(geo::Point_t const& point) const;
1854 
1855 
1857  double TotalMass() const { return TotalMass(GetWorldVolumeName()); }
1859  double TotalMass(std::string vol) const;
1861 
1863 
1876  double MassBetweenPoints
1877  (geo::Point_t const& p1, geo::Point_t const& p2) const;
1878  double MassBetweenPoints(double *p1, double *p2) const;
1880 
1881 
1883  template <typename Stream>
1884  void Print(Stream&& out, std::string indent = " ") const;
1885 
1887  // END Detector information
1888 
1889 
1895  template <typename GeoID>
1896  GeoID GetBeginID() const { GeoID id; GetBeginID(id); return id; }
1897 
1904  template <typename GeoID>
1905  GeoID GetNextID(GeoID const& id) const
1906  { auto nextID(id); IncrementID(nextID); return nextID; }
1907 
1914  template <typename GeoID>
1915  GeoID GetEndID() const { GeoID id; GetEndID(id); return id; }
1916 
1917 
1925  template <typename GeoID, typename ContextID>
1926  GeoID GetBeginID(ContextID const& id) const;
1927 
1937  template <typename GeoID, typename ContextID>
1938  GeoID GetEndID(ContextID const& id) const;
1939 
1940 
1943 
1944  //
1945  // group features
1946  //
1947 
1949 
1957  unsigned int Ncryostats() const { return Cryostats().size(); }
1958  unsigned int NElements() const { return Ncryostats(); }
1959  unsigned int NSiblingElements(geo::CryostatID const&) const
1960  { return Ncryostats(); }
1962 
1963  //
1964  // access
1965  //
1966 
1968 
1974  bool HasCryostat(geo::CryostatID const& cryoid) const
1975  { return cryoid.Cryostat < Ncryostats(); }
1976  bool HasElement(geo::CryostatID const& cryoid) const
1977  { return HasCryostat(cryoid); }
1979 
1981 
1993  CryostatGeo const& Cryostat(geo::CryostatID const& cryoid) const;
1994  CryostatGeo const& Cryostat(unsigned int const cstat = 0) const
1995  { return Cryostat(geo::CryostatID(cstat)); }
1996  CryostatGeo const& GetElement(geo::CryostatID const& cryoid) const
1997  { return Cryostat(cryoid); }
1999 
2001 
2009  CryostatGeo const* CryostatPtr(geo::CryostatID const& cryoid) const
2010  { return HasCryostat(cryoid)? &(Cryostats()[cryoid.Cryostat]): nullptr; }
2011  CryostatGeo const* GetElementPtr(geo::CryostatID const& cryoid) const
2012  { return CryostatPtr(cryoid); }
2014 
2016 
2023  geo::CryostatID::CryostatID_t FindCryostatAtPosition
2024  (geo::Point_t const& worldLoc) const;
2025  geo::CryostatID::CryostatID_t FindCryostatAtPosition
2026  (double const worldLoc[3]) const;
2028 
2029 
2037  geo::CryostatGeo const* PositionToCryostatPtr
2038  (geo::Point_t const& point) const;
2039 
2047  geo::CryostatID PositionToCryostatID(geo::Point_t const& point) const;
2048 
2049 
2051 
2059  CryostatGeo const& PositionToCryostat(geo::Point_t const& point) const;
2060  CryostatGeo const& PositionToCryostat(double const point[3]) const
2061  { return PositionToCryostat(geo::vect::makePointFromCoords(point)); }
2063 
2075  CryostatGeo const& PositionToCryostat
2076  (double const worldLoc[3], geo::CryostatID& cid) const;
2077 
2089  CryostatGeo const& PositionToCryostat
2090  (double const worldLoc[3], unsigned int &cstat) const;
2091 
2092  //
2093  // iterators
2094  //
2095 
2097  void GetBeginID(geo::CryostatID& id) const
2098  { id = geo::CryostatID(0, HasCryostat(geo::CryostatID(0))); }
2099 
2101  void GetEndID(geo::CryostatID& id) const
2102  { id = geo::CryostatID(Ncryostats(), false); }
2103 
2106  bool IncrementID(geo::CryostatID& id) const; // inline implementation
2107 
2111 
2115 
2119 
2123 
2138  IteratorBox<
2141  >
2142  IterateCryostatIDs() const { return { this }; }
2143 
2157  IteratorBox<
2160  >
2161  IterateCryostats() const { return { this }; }
2162 
2163  //
2164  // single object features
2165  //
2166 
2168  geo::Length_t CryostatHalfWidth(geo::CryostatID const& cid) const;
2170  geo::Length_t CryostatHalfWidth(unsigned int cstat = 0) const
2171  { return CryostatHalfWidth(geo::CryostatID(cstat)); }
2173 
2175  geo::Length_t CryostatHalfHeight(geo::CryostatID const& cid) const;
2177  geo::Length_t CryostatHalfHeight(unsigned int cstat = 0) const
2178  { return CryostatHalfHeight(geo::CryostatID(cstat)); }
2180 
2182  geo::Length_t CryostatLength(geo::CryostatID const& cid) const;
2184  geo::Length_t CryostatLength(unsigned int cstat = 0) const
2185  { return CryostatLength(geo::CryostatID(cstat)); }
2187 
2188 
2204  void CryostatBoundaries
2205  (double* boundaries, geo::CryostatID const& cid) const;
2206 
2222  void CryostatBoundaries
2223  (double* boundaries, unsigned int cstat = 0) const
2224  { CryostatBoundaries(boundaries, geo::CryostatID(cstat)); }
2225 
2226 
2227  //
2228  // object description
2229  //
2230 
2232 
2242  std::string GetCryostatVolumeName(geo::CryostatID const& cid) const;
2243  std::string GetCryostatVolumeName(unsigned int const cstat = 0) const
2244  { return GetCryostatVolumeName(geo::CryostatID(cstat)); }
2246 
2248 
2249 
2250 
2253 
2254  //
2255  // group features
2256  //
2257 
2266  unsigned int NTPC(unsigned int cstat = 0) const
2267  { return NTPC(geo::CryostatID(cstat)); }
2268 
2270  unsigned int MaxTPCs() const;
2271 
2273  unsigned int TotalNTPC() const;
2274 
2275 
2304  template <typename T>
2306  { return { Ncryostats(), MaxTPCs() }; }
2307 
2327  template <typename T>
2328  geo::TPCDataContainer<T> makeTPCData(T const& defValue) const
2329  { return { Ncryostats(), MaxTPCs(), defValue }; }
2330 
2331 
2332 
2334 
2344  unsigned int NTPC(geo::CryostatID const& cryoid) const
2345  {
2346  CryostatGeo const* pCryo = GetElementPtr(cryoid);
2347  return pCryo? pCryo->NElements(): 0;
2348  }
2349  unsigned int NElements(geo::CryostatID const& cryoid) const
2350  { return NTPC(cryoid); }
2351  unsigned int NSiblingElements(geo::TPCID const& tpcid) const
2352  { return NTPC(tpcid); }
2354 
2355 
2356  //
2357  // access
2358  //
2360  bool HasTPC(geo::TPCID const& tpcid) const
2361  {
2362  CryostatGeo const* pCryo = CryostatPtr(tpcid);
2363  return pCryo? pCryo->HasTPC(tpcid): false;
2364  }
2365 
2367  bool HasElement(geo::TPCID const& tpcid) const { return HasTPC(tpcid); }
2368 
2369 
2371 
2385  TPCGeo const& TPC
2386  (unsigned int const tpc = 0, unsigned int const cstat = 0) const
2387  { return TPC(geo::TPCID(cstat, tpc)); }
2388  TPCGeo const& TPC(geo::TPCID const& tpcid) const
2389  { return Cryostat(tpcid).TPC(tpcid); }
2390  TPCGeo const& GetElement(geo::TPCID const& tpcid) const
2391  { return TPC(tpcid); }
2393 
2395 
2403  TPCGeo const* TPCPtr(geo::TPCID const& tpcid) const
2404  {
2405  CryostatGeo const* pCryo = CryostatPtr(tpcid);
2406  return pCryo? pCryo->TPCPtr(tpcid): nullptr;
2407  } // TPCPtr()
2408  TPCGeo const* GetElementPtr(geo::TPCID const& tpcid) const
2409  { return TPCPtr(tpcid); }
2411 
2417  geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
2418  { return FindTPCAtPosition(geo::vect::makePointFromCoords(worldLoc)); }
2419 
2421 
2426  geo::TPCID FindTPCAtPosition(geo::Point_t const& point) const;
2427  geo::TPCID FindTPCAtPosition(TVector3 const& point) const
2428  { return FindTPCAtPosition(geo::vect::toPoint(point)); }
2430 
2436  geo::TPCGeo const* PositionToTPCptr(geo::Point_t const& point) const;
2437 
2438 
2440 
2446  geo::TPCGeo const& PositionToTPC(geo::Point_t const& point) const;
2447  TPCGeo const& PositionToTPC(double const point[3]) const
2448  { return PositionToTPC(geo::vect::makePointFromCoords(point)); }
2450 
2460  TPCGeo const& PositionToTPC
2461  (double const worldLoc[3], unsigned int &tpc, unsigned int &cstat) const;
2462 
2471  TPCGeo const& PositionToTPC
2472  (double const worldLoc[3], TPCID& tpcid) const;
2473 
2480  geo::TPCID PositionToTPCID(geo::Point_t const& point) const;
2481 
2485 
2487  void GetBeginID(geo::TPCID& id) const
2488  { GetBeginID(id.asCryostatID()); id.TPC = 0; }
2489 
2491  void GetEndID(geo::TPCID& id) const
2492  { GetEndID(id.asCryostatID()); id.TPC = 0; }
2493 
2496  bool IncrementID(geo::TPCID& id) const; // inline implementation
2497 
2500  { return { id, 0 }; }
2501 
2505  { return { id.Cryostat + 1, 0 }; }
2506 
2507 
2510  { return TPC_id_iterator(this, TPC_id_iterator::begin_pos); }
2511 
2514  { return TPC_id_iterator(this, TPC_id_iterator::end_pos); }
2515 
2519  { return TPC_id_iterator(this, GetBeginTPCID(cid)); }
2520 
2524  { return TPC_id_iterator(this, GetEndTPCID(cid)); }
2525 
2528  { return TPC_iterator(this, TPC_iterator::begin_pos); }
2529 
2532  { return TPC_iterator(this, TPC_iterator::end_pos); }
2533 
2536  { return TPC_iterator(this, GetBeginTPCID(cid)); }
2537 
2540  { return TPC_iterator(this, GetEndTPCID(cid)); }
2541 
2556  IteratorBox<
2559  >
2560  IterateTPCIDs() const { return { this }; }
2561 
2583  >
2584  IterateTPCIDs(geo::CryostatID const& cid) const { return { this, cid }; }
2585 
2587  void IterateTPCIDs(geo::TPCID const& pid) const = delete;
2588 
2590  void IterateTPCIDs(geo::PlaneID const& pid) const = delete;
2591 
2593  void IterateTPCIDs(geo::WireID const& pid) const = delete;
2594 
2596  void IterateTPCIDs(readout::TPCsetID const&) const = delete;
2597 
2599  void IterateTPCIDs(readout::ROPID const&) const = delete;
2600 
2616  IteratorBox
2618  IterateTPCs() const { return { this }; }
2619 
2640  >
2641  IterateTPCs(geo::CryostatID const& cid) const { return { this, cid }; }
2642 
2644  void IterateTPCs(geo::TPCID const& pid) const = delete;
2645 
2647  void IterateTPCs(geo::PlaneID const& pid) const = delete;
2648 
2650  void IterateTPCs(geo::WireID const& pid) const = delete;
2651 
2653  void IterateTPCs(readout::TPCsetID const&) const = delete;
2654 
2656  void IterateTPCs(readout::ROPID const&) const = delete;
2657 
2658 
2659  //
2660  // single object features
2661  //
2662 
2664 
2677  geo::Length_t DetHalfWidth(geo::TPCID const& tpcid) const;
2678  geo::Length_t DetHalfWidth
2679  (unsigned int tpc = 0, unsigned int cstat = 0) const
2680  { return DetHalfWidth(geo::TPCID(cstat, tpc)); }
2682 
2684 
2699  geo::Length_t DetHalfHeight(geo::TPCID const& tpcid) const;
2700  geo::Length_t DetHalfHeight
2701  (unsigned int tpc = 0, unsigned int cstat = 0) const
2702  { return DetHalfHeight(geo::TPCID(cstat, tpc)); }
2704 
2706 
2721  geo::Length_t DetLength(geo::TPCID const& tpcid) const;
2722  geo::Length_t DetLength(unsigned int tpc = 0, unsigned int cstat = 0) const
2723  { return DetLength(geo::TPCID(cstat, tpc)); }
2725 
2726 
2728 
2739  template <typename Point = DefaultPoint_t>
2741  { return TPC(tpcid).GetFrontFaceCenter<Point>(); }
2742  template <typename Point = DefaultPoint_t>
2743  Point GetTPCFrontFaceCenter
2744  (unsigned int tpc = 0, unsigned int cstat = 0) const
2745  { return GetTPCFrontFaceCenter<Point>(geo::TPCID(cstat, tpc)); }
2747 
2748 
2749  //
2750  // object description
2751  //
2752 
2754 
2766  std::string GetLArTPCVolumeName(geo::TPCID const& tpcid) const;
2767  std::string GetLArTPCVolumeName
2768  (unsigned int const tpc = 0, unsigned int const cstat = 0) const
2769  { return GetLArTPCVolumeName(geo::TPCID(cstat, tpc)); }
2771 
2773 
2774 
2775 
2778 
2779  //
2780  // group features
2781  //
2782 
2792  unsigned int Nplanes(unsigned int tpc = 0, unsigned int cstat = 0) const
2793  { return Nplanes(geo::TPCID(cstat, tpc)); }
2794 
2796  unsigned int MaxPlanes() const;
2797 
2825  template <typename T>
2827  { return { Ncryostats(), MaxTPCs(), MaxPlanes() }; }
2828 
2847  template <typename T>
2849  { return { Ncryostats(), MaxTPCs(), MaxPlanes(), defValue }; }
2850 
2851 
2853 
2863  unsigned int Nplanes(geo::TPCID const& tpcid) const
2864  {
2865  TPCGeo const* pTPC = GetElementPtr(tpcid);
2866  return pTPC? pTPC->NElements(): 0;
2867  }
2868  unsigned int NElements(geo::TPCID const& tpcid) const
2869  { return Nplanes(tpcid); }
2870  unsigned int NSiblingElements(geo::PlaneID const& planeid) const
2871  { return Nplanes(planeid); }
2873 
2874 
2886  unsigned int Nviews() const;
2887 
2895  [[deprecated("Iterate through geo::GeometryCore::IteratePlaneIDs() instead")]]
2896  std::set<PlaneID> const& PlaneIDs() const;
2897 
2898 
2899  //
2900  // access
2901  //
2902 
2904 
2911  bool HasPlane(geo::PlaneID const& planeid) const
2912  {
2913  geo::TPCGeo const* pTPC = TPCPtr(planeid);
2914  return pTPC? pTPC->HasPlane(planeid): false;
2915  }
2916  bool HasElement(geo::PlaneID const& planeid) const
2917  { return HasPlane(planeid); }
2919 
2921 
2937  PlaneGeo const& Plane
2938  (unsigned int const p, unsigned int const tpc = 0, unsigned int const cstat = 0)
2939  const
2940  { return Plane(geo::PlaneID(cstat, tpc, p)); }
2941  PlaneGeo const& Plane(geo::PlaneID const& planeid) const
2942  { return TPC(planeid).Plane(planeid); }
2943  PlaneGeo const& GetElement(geo::PlaneID const& planeid) const
2944  { return Plane(planeid); }
2946 
2948 
2956  PlaneGeo const* PlanePtr(geo::PlaneID const& planeid) const
2957  {
2958  geo::TPCGeo const* pTPC = TPCPtr(planeid);
2959  return pTPC? pTPC->PlanePtr(planeid): nullptr;
2960  } // PlanePtr()
2961  PlaneGeo const* GetElementPtr(geo::PlaneID const& planeid) const
2962  { return PlanePtr(planeid); }
2964 
2965  //
2966  // iterators
2967  //
2968 
2970  void GetBeginID(geo::PlaneID& id) const
2971  { GetBeginID(id.asTPCID()); id.Plane = 0; }
2972 
2974  void GetEndID(geo::PlaneID& id) const
2975  { GetEndID(id.asTPCID()); id.Plane = 0; }
2976 
2979  bool IncrementID(geo::PlaneID& id) const; // inline implementation
2980 
2982  geo::PlaneID GetBeginPlaneID(geo::CryostatID const& id) const
2983  { return { GetBeginTPCID(id), 0 }; }
2984 
2987  geo::PlaneID GetEndPlaneID(geo::CryostatID const& id) const
2988  { return { GetEndTPCID(id), 0 }; }
2989 
2992  { return { id, 0 }; }
2993 
2997  { return { GetNextID(id), 0 }; }
2998 
3002 
3006 
3009  plane_id_iterator begin_plane_id(geo::CryostatID const& ID) const
3010  { return plane_id_iterator(this, GetBeginPlaneID(ID)); }
3011 
3014  plane_id_iterator end_plane_id(geo::CryostatID const& ID) const
3015  { return plane_id_iterator(this, GetEndPlaneID(ID)); }
3016 
3020  { return plane_id_iterator(this, GetBeginPlaneID(ID)); }
3021 
3025  { return plane_id_iterator(this, GetEndPlaneID(ID)); }
3026 
3029  { return plane_iterator(this, plane_iterator::begin_pos); }
3030 
3033  { return plane_iterator(this, plane_iterator::end_pos); }
3034 
3037  plane_iterator begin_plane(geo::CryostatID const& ID) const
3038  { return plane_iterator(this, GetBeginPlaneID(ID)); }
3039 
3042  plane_iterator end_plane(geo::CryostatID const& ID) const
3043  { return plane_iterator(this, GetEndPlaneID(ID)); }
3044 
3047  { return plane_iterator(this, GetBeginPlaneID(ID)); }
3048 
3051  { return plane_iterator(this, GetEndPlaneID(ID)); }
3052 
3067  IteratorBox<
3070  >
3071  IteratePlaneIDs() const { return { this }; }
3072 
3095  >
3096  IteratePlaneIDs(geo::CryostatID const& cid) const { return { this, cid }; }
3097 
3119  >
3120  IteratePlaneIDs(geo::TPCID const& tid) const { return { this, tid }; }
3121 
3122 
3124  void IteratePlaneIDs(geo::PlaneID const& pid) const = delete;
3125 
3127  void IteratePlaneIDs(geo::WireID const& pid) const = delete;
3128 
3130  void IteratePlaneIDs(readout::TPCsetID const&) const = delete;
3131 
3133  void IteratePlaneIDs(readout::ROPID const&) const = delete;
3134 
3135 
3149  IteratorBox<
3152  >
3153  IteratePlanes() const { return { this }; }
3154 
3175  >
3176  IteratePlanes(geo::CryostatID const& cid) const { return { this, cid }; }
3177 
3196  plane_iterator, geo::TPCID,
3198  >
3199  IteratePlanes(geo::TPCID const& tid) const { return { this, tid }; }
3200 
3202  void IteratePlanes(geo::PlaneID const& pid) const = delete;
3203 
3205  void IteratePlanes(geo::WireID const& pid) const = delete;
3206 
3208  void IteratePlanes(readout::TPCsetID const&) const = delete;
3209 
3211  void IteratePlanes(readout::ROPID const&) const = delete;
3212 
3213 
3214  //
3215  // single object features
3216  //
3217 
3219 
3234  geo::Length_t PlanePitch(
3235  geo::TPCID const& tpcid,
3237  )
3238  const;
3239  geo::Length_t PlanePitch(geo::PlaneID const& pid1, geo::PlaneID const& pid2) const;
3240  geo::Length_t PlanePitch(unsigned int p1 = 0,
3241  unsigned int p2 = 1,
3242  unsigned int tpc = 0,
3243  unsigned int cstat = 0) const;
3245 
3251  View_t View(geo::PlaneID const& pid) const;
3252 
3262  SigType_t SignalType(geo::PlaneID const& pid) const;
3263 
3264 
3266 
3267 
3270 
3271  //
3272  // group features
3273  //
3274 
3285  unsigned int Nwires
3286  (unsigned int p, unsigned int tpc = 0, unsigned int cstat = 0) const
3287  { return Nwires(geo::PlaneID(cstat, tpc, p)); }
3288 
3290 
3300  unsigned int Nwires(geo::PlaneID const& planeid) const
3301  {
3302  PlaneGeo const* pPlane = GetElementPtr(planeid);
3303  return pPlane? pPlane->NElements(): 0;
3304  }
3305  unsigned int NElements(geo::PlaneID const& planeid) const
3306  { return Nwires(planeid); }
3307  unsigned int NSiblingElements(geo::WireID const& wireid) const
3308  { return Nwires(wireid); }
3309 
3311  unsigned int MaxWires() const;
3312 
3314 
3315 
3316  //
3317  // access
3318  //
3319 
3321 
3327  bool HasWire(geo::WireID const& wireid) const
3328  {
3329  geo::PlaneGeo const* pPlane = PlanePtr(wireid);
3330  return pPlane? pPlane->HasWire(wireid): false;
3331  }
3332  bool HasElement(geo::WireID const& wireid) const { return HasWire(wireid); }
3334 
3336 
3344  WireGeo const* WirePtr(geo::WireID const& wireid) const
3345  {
3346  geo::PlaneGeo const* pPlane = PlanePtr(wireid);
3347  return pPlane? pPlane->WirePtr(wireid): nullptr;
3348  } // WirePtr()
3349  WireGeo const* GetElementPtr(geo::WireID const& wireid) const
3350  { return WirePtr(wireid); }
3352 
3354 
3363  WireGeo const& Wire(geo::WireID const& wireid) const
3364  { return Plane(wireid).Wire(wireid); }
3365  WireGeo const& WireIDToWireGeo(geo::WireID const& wireid) const
3366  { return Wire(wireid); }
3367  WireGeo const& GetElement(geo::WireID const& wireid) const
3368  { return Wire(wireid); }
3370 
3371  //
3372  // iterators
3373  //
3374 
3376  void GetBeginID(geo::WireID& id) const
3377  { GetBeginID(id.asPlaneID()); id.Wire = 0; }
3378 
3380  void GetEndID(geo::WireID& id) const
3381  { GetEndID(id.asPlaneID()); id.Wire = 0; }
3382 
3385  bool IncrementID(geo::WireID& id) const; // inline implementation
3386 
3388  geo::WireID GetBeginWireID(geo::CryostatID const& id) const
3389  { return { GetBeginPlaneID(id), 0 }; }
3390 
3393  geo::WireID GetEndWireID(geo::CryostatID const& id) const
3394  { return { GetEndPlaneID(id), 0 }; }
3395 
3397  geo::WireID GetBeginWireID(geo::TPCID const& id) const
3398  { return { geo::PlaneID(id, 0), 0 }; }
3399 
3402  geo::WireID GetEndWireID(geo::TPCID const& id) const
3403  { return { geo::PlaneID(GetNextID(id), 0), 0 }; }
3404 
3407  { return { id, 0 }; }
3408 
3412  { return { GetNextID(id), 0 }; }
3413 
3417 
3420  { return wire_id_iterator(this, wire_id_iterator::end_pos); }
3421 
3423  wire_id_iterator begin_wire_id(geo::CryostatID const& id) const
3424  { return wire_id_iterator(this, GetBeginWireID(id)); }
3425 
3428  wire_id_iterator end_wire_id(geo::CryostatID const& id) const
3429  { return wire_id_iterator(this, GetEndWireID(id)); }
3430 
3432  wire_id_iterator begin_wire_id(geo::TPCID const& id) const
3433  { return wire_id_iterator(this, GetBeginWireID(id)); }
3434 
3436  wire_id_iterator end_wire_id(geo::TPCID const& id) const
3437  { return wire_id_iterator(this, GetEndWireID(id)); }
3438 
3441  { return wire_id_iterator(this, GetBeginWireID(id)); }
3442 
3445  { return wire_id_iterator(this, GetEndWireID(id)); }
3446 
3449  { return wire_iterator(this, wire_iterator::begin_pos); }
3450 
3453  { return wire_iterator(this, wire_iterator::end_pos); }
3454 
3456  wire_iterator begin_wire(geo::CryostatID const& id) const
3457  { return wire_iterator(begin_wire_id(id)); }
3458 
3460  wire_iterator end_wire(geo::CryostatID const& id) const
3461  { return wire_iterator(end_wire_id(id)); }
3462 
3464  wire_iterator begin_wire(geo::TPCID const& id) const
3465  { return wire_iterator(begin_wire_id(id)); }
3466 
3468  wire_iterator end_wire(geo::TPCID const& id) const
3469  { return wire_iterator(end_wire_id(id)); }
3470 
3473  { return wire_iterator(begin_wire_id(id)); }
3474 
3477  { return wire_iterator(end_wire_id(id)); }
3478 
3494  IteratorBox<
3497  >
3498  IterateWireIDs() const { return { this }; }
3499 
3522  >
3523  IterateWireIDs(geo::CryostatID const& cid) const { return { this, cid }; }
3524 
3545  geo::TPCID,
3547  >
3548  IterateWireIDs(geo::TPCID const& tid) const { return { this, tid }; }
3549 
3570  geo::PlaneID,
3572  >
3573  IterateWireIDs(geo::PlaneID const& pid) const { return { this, pid }; }
3574 
3576  void IterateWireIDs(geo::WireID const& pid) const = delete;
3577 
3579  void IterateWireIDs(readout::TPCsetID const&) const = delete;
3580 
3582  void IterateWireIDs(readout::ROPID const&) const = delete;
3583 
3584 
3598  IteratorBox<
3599  wire_iterator,
3601  >
3602  IterateWires() const { return { this }; }
3603 
3622  wire_iterator,
3625  >
3626  IterateWires(geo::CryostatID const& cid) const { return { this, cid }; }
3627 
3646  wire_iterator,
3647  geo::TPCID,
3649  >
3650  IterateWires(geo::TPCID const& tid) const { return { this, tid }; }
3651 
3670  wire_iterator,
3671  geo::PlaneID,
3673  >
3674  IterateWires(geo::PlaneID const& tid) const { return { this, tid }; }
3675 
3677  void IterateWires(geo::WireID const& pid) const = delete;
3678 
3680  void IterateWires(readout::TPCsetID const&) const = delete;
3681 
3683  void IterateWires(readout::ROPID const&) const = delete;
3684 
3685  //
3686  // single object features
3687  //
3688 
3690 
3706  geo::Length_t WirePitch(geo::PlaneID const& planeid) const;
3707  geo::Length_t WirePitch(unsigned int plane = 0,
3708  unsigned int tpc = 0,
3709  unsigned int cstat = 0) const
3710  { return WirePitch(geo::PlaneID(cstat, tpc, plane)); }
3712 
3725  geo::Length_t WirePitch(geo::View_t view) const;
3726 
3727 
3729 
3745  double WireAngleToVertical(geo::View_t view, geo::TPCID const& tpcid) const;
3746  double WireAngleToVertical(geo::View_t view, int TPC=0, int Cryo=0) const
3747  { return WireAngleToVertical(view, geo::TPCID(Cryo, TPC)); }
3749 
3751 
3752 
3753 
3764 
3766  //
3767  // simple geometry queries
3768  //
3769 
3782  void WireEndPoints
3783  (geo::WireID const& wireid, double *xyzStart, double *xyzEnd) const;
3784 
3801  unsigned int cstat, unsigned int tpc, unsigned int plane, unsigned int wire,
3802  double *xyzStart, double *xyzEnd
3803  ) const
3804  { WireEndPoints(geo::WireID(cstat, tpc, plane, wire), xyzStart, xyzEnd); }
3805 
3818  template <typename Point = DefaultPoint_t>
3819  Segment<Point> WireEndPoints(geo::WireID const& wireID) const;
3820 
3821  //
3822  // closest wire
3823  //
3824 
3863  geo::WireID NearestWireID
3864  (geo::Point_t const& point, geo::PlaneID const& planeid) const;
3865 
3867 
3882  geo::WireID NearestWireID
3883  (const double point[3], geo::PlaneID const& planeid) const;
3884  geo::WireID NearestWireID
3885  (std::vector<double> const& point, geo::PlaneID const& planeid) const;
3886  geo::WireID NearestWireID
3887  (const TVector3& point, geo::PlaneID const& planeid) const
3888  { return NearestWireID(geo::vect::toPoint(point), planeid); }
3889  geo::WireID NearestWireID(const double point[3],
3890  unsigned int const PlaneNo,
3891  unsigned int const TPCNo = 0,
3892  unsigned int const cstat = 0) const
3893  { return NearestWireID(point, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3894  geo::WireID NearestWireID(std::vector<double> const& point,
3895  unsigned int const PlaneNo,
3896  unsigned int const TPCNo = 0,
3897  unsigned int const cstat = 0) const
3898  { return NearestWireID(point, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3899  geo::WireID NearestWireID(const TVector3& point,
3900  unsigned int const PlaneNo,
3901  unsigned int const TPCNo = 0,
3902  unsigned int const cstat = 0) const
3903  { return NearestWireID(point, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3905  unsigned int const PlaneNo,
3906  unsigned int const TPCNo = 0,
3907  unsigned int const cstat = 0) const
3908  { return NearestWireID(point, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3910 
3920  geo::WireID::WireID_t NearestWire
3921  (geo::Point_t const& point, geo::PlaneID const& planeid) const;
3922 
3924 
3939  unsigned int NearestWire
3940  (const double worldLoc[3], geo::PlaneID const& planeid) const;
3941  unsigned int NearestWire
3942  (std::vector<double> const& worldLoc, geo::PlaneID const& planeid) const;
3943  unsigned int NearestWire
3944  (const TVector3& worldLoc, geo::PlaneID const& planeid) const
3945  { return NearestWire(geo::vect::toPoint(worldLoc), planeid); }
3946  unsigned int NearestWire(const double worldLoc[3],
3947  unsigned int const PlaneNo,
3948  unsigned int const TPCNo = 0,
3949  unsigned int const cstat = 0) const
3950  { return NearestWire(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3951  unsigned int NearestWire(std::vector<double> const& worldLoc,
3952  unsigned int const PlaneNo,
3953  unsigned int const TPCNo = 0,
3954  unsigned int const cstat = 0) const
3955  { return NearestWire(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3956  unsigned int NearestWire(const TVector3& worldLoc,
3957  unsigned int const PlaneNo,
3958  unsigned int const TPCNo = 0,
3959  unsigned int const cstat = 0) const
3960  { return NearestWire(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3961  unsigned int NearestWire(geo::Point_t const& worldLoc,
3962  unsigned int const PlaneNo,
3963  unsigned int const TPCNo = 0,
3964  unsigned int const cstat = 0) const
3965  { return NearestWire(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
3967 
3968 
3985  geo::Length_t WireCoordinate
3986  (double YPos, double ZPos, geo::PlaneID const& planeid) const;
3987 
4000  geo::Length_t WireCoordinate(double YPos, double ZPos,
4001  unsigned int PlaneNo,
4002  unsigned int TPCNo,
4003  unsigned int cstat) const
4004  { return WireCoordinate(YPos, ZPos, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4005 
4007 
4018  geo::Length_t WireCoordinate
4019  (geo::Point_t const& pos, geo::PlaneID const& planeid) const;
4020  geo::Length_t WireCoordinate
4021  (TVector3 const& pos, geo::PlaneID const& planeid) const
4022  { return WireCoordinate(geo::vect::toPoint(pos), planeid); }
4024 
4025  //
4026  // wire intersections
4027  //
4028 
4029  // The following functions are utilized to determine if two wires
4030  // in the TPC intersect or not, and if they do then
4031  // determine the coordinates of the intersection.
4032 
4053  bool IntersectLines(
4054  double A_start_x, double A_start_y, double A_end_x, double A_end_y,
4055  double B_start_x, double B_start_y, double B_end_x, double B_end_y,
4056  double& x, double& y
4057  ) const;
4058 
4080  bool IntersectSegments(
4081  double A_start_x, double A_start_y, double A_end_x, double A_end_y,
4082  double B_start_x, double B_start_y, double B_end_x, double B_end_y,
4083  double& x, double& y
4084  ) const;
4085 
4087 
4107  bool WireIDsIntersect(
4108  WireID const& wid1, WireID const& wid2,
4109  geo::Point_t& intersection
4110  ) const;
4111  bool WireIDsIntersect
4112  (WireID const& wid1, WireID const& wid2, TVector3& intersection) const;
4114 
4137  bool WireIDsIntersect
4138  (WireID const& wid1, WireID const& wid2, WireIDIntersection& widIntersect)
4139  const;
4140 
4158  bool IntersectionPoint(geo::WireID const& wid1,
4159  geo::WireID const& wid2,
4160  double &y,
4161  double &z) const;
4162 
4181  bool IntersectionPoint(unsigned int wire1,
4182  unsigned int wire2,
4183  unsigned int plane1,
4184  unsigned int plane2,
4185  unsigned int cstat,
4186  unsigned int tpc,
4187  double &y,
4188  double &z) const
4189  {
4190  return IntersectionPoint(
4191  geo::WireID(cstat, tpc, plane1, wire1),
4192  geo::WireID(cstat, tpc, plane2, wire2),
4193  y, z
4194  );
4195  }
4196 
4197 
4209  geo::PlaneID ThirdPlane
4210  (geo::PlaneID const& pid1, geo::PlaneID const& pid2) const;
4211 
4212 
4231  double ThirdPlaneSlope(geo::PlaneID const& pid1, double slope1,
4232  geo::PlaneID const& pid2, double slope2,
4233  geo::PlaneID const& output_plane) const;
4234 
4252  double ThirdPlaneSlope(geo::PlaneID const& pid1, double slope1,
4253  geo::PlaneID const& pid2, double slope2) const;
4254 
4256 
4271  double ThirdPlaneSlope(geo::PlaneID::PlaneID_t plane1, double slope1,
4272  geo::PlaneID::PlaneID_t plane2, double slope2,
4273  geo::TPCID const& tpcid) const
4274  {
4275  return ThirdPlaneSlope(
4276  geo::PlaneID(tpcid, plane1), slope1,
4277  geo::PlaneID(tpcid, plane2), slope2
4278  );
4279  }
4280  double ThirdPlaneSlope(unsigned int plane1, double slope1,
4281  unsigned int plane2, double slope2,
4282  unsigned int tpc, unsigned int cstat) const
4283  {
4284  return ThirdPlaneSlope
4285  (plane1, slope1, plane2, slope2, geo::TPCID(cstat, tpc));
4286  }
4288 
4289 
4306  double ThirdPlane_dTdW(geo::PlaneID const& pid1, double slope1,
4307  geo::PlaneID const& pid2, double slope2,
4308  geo::PlaneID const& output_plane) const;
4309 
4327  double ThirdPlane_dTdW(geo::PlaneID const& pid1, double slope1,
4328  geo::PlaneID const& pid2, double slope2) const;
4329 
4330 
4342  static double ComputeThirdPlaneSlope(
4343  double angle1, double slope1,
4344  double angle2, double slope2,
4345  double angle_target
4346  );
4347 
4364  static double ComputeThirdPlane_dTdW(
4365  double angle1, double pitch1, double dTdW1,
4366  double angle2, double pitch2, double dTdW2,
4367  double angle_target, double pitch_target
4368  );
4369 
4371 
4372 
4373 
4376 
4377  //
4378  // group features
4379  //
4380 
4382  unsigned int NOpDets() const;
4383 
4384 
4385  //
4386  // access
4387  //
4389  OpDetGeo const& OpDetGeoFromOpChannel(unsigned int OpChannel) const;
4391  OpDetGeo const& OpDetGeoFromOpDet(unsigned int OpDet) const;
4393 
4394 
4396 
4407  unsigned int GetClosestOpDet(geo::Point_t const& point) const;
4408  unsigned int GetClosestOpDet(double const* point) const;
4410 
4411 
4412  //
4413  // object description
4414  //
4415 
4424  std::string OpDetGeoName(unsigned int c = 0) const;
4425 
4427 
4428 
4429 
4432 
4434 
4435  //
4436  // group features
4437  //
4438 
4447  unsigned int NAuxDets() const { return AuxDets().size(); }
4448 
4455  unsigned int NAuxDetSensitive(size_t const& aid) const;
4456 
4457  //
4458  // access
4459  //
4460 
4469  AuxDetGeo const& AuxDet(unsigned int const ad = 0) const;
4470 
4480  unsigned int FindAuxDetAtPosition(double const worldLoc[3]) const;
4481 
4490  unsigned int FindAuxDetAtPosition(geo::Point_t const& point) const;
4491 
4498  void FindAuxDetSensitiveAtPosition(geo::Point_t const& point,
4499  std::size_t & adg,
4500  std::size_t & sv) const;
4501 
4509  void FindAuxDetSensitiveAtPosition(double const worldLoc[3],
4510  size_t & adg,
4511  size_t & sv) const;
4512 
4521  AuxDetGeo const& PositionToAuxDet
4522  (geo::Point_t const& point, unsigned int& ad) const;
4523 
4533  AuxDetGeo const& PositionToAuxDet
4534  (double const worldLoc[3], unsigned int& ad) const;
4535 
4545  const AuxDetSensitiveGeo& PositionToAuxDetSensitive
4546  (geo::Point_t const& point, size_t& ad, size_t& sv) const;
4547 
4558  const AuxDetSensitiveGeo& PositionToAuxDetSensitive(double const worldLoc[3],
4559  size_t & ad,
4560  size_t & sv) const;
4561 
4562  const AuxDetGeo& ChannelToAuxDet(std::string const& auxDetName,
4563  uint32_t const& channel) const; // return the AuxDetGeo for the given detector
4564  // name and channel
4565 
4566  const AuxDetSensitiveGeo& ChannelToAuxDetSensitive(std::string const& auxDetName,
4567  uint32_t const& channel) const; // return the AuxDetSensitiveGeo for the given
4568 
4570 
4571 
4572 
4575 
4576  //
4577  // group features
4578  //
4579 
4581  unsigned int Nchannels() const;
4582 
4585  unsigned int Nchannels(readout::ROPID const& ropid) const;
4586 
4591  std::set<geo::View_t> const& Views() const { return allViews; }
4592 
4593 
4594  //
4595  // access
4596  //
4597 
4606  bool HasChannel(raw::ChannelID_t channel) const;
4607 
4609 
4621  raw::ChannelID_t PlaneWireToChannel(WireID const& wireid) const;
4622  raw::ChannelID_t PlaneWireToChannel(unsigned int const plane,
4623  unsigned int const wire,
4624  unsigned int const tpc = 0,
4625  unsigned int const cstat = 0) const
4626  { return PlaneWireToChannel(geo::WireID(cstat, tpc, plane, wire)); }
4628 
4629  //
4630  // single object features
4631  //
4632 
4640  SigType_t SignalType(raw::ChannelID_t const channel) const;
4641 
4642 
4651  View_t View(raw::ChannelID_t const channel) const;
4652 
4653 
4660  std::vector<geo::WireID> ChannelToWire
4661  (raw::ChannelID_t const channel) const;
4662 
4663 
4666  readout::ROPID ChannelToROP(raw::ChannelID_t channel) const;
4667 
4668 
4669  //
4670  // geometry queries
4671  //
4672 
4681  raw::ChannelID_t NearestChannel
4682  (geo::Point_t const& worldLoc, geo::PlaneID const& planeid) const;
4683 
4685 
4698  raw::ChannelID_t NearestChannel
4699  (const double worldLoc[3], geo::PlaneID const& planeid) const;
4700  raw::ChannelID_t NearestChannel
4701  (std::vector<double> const& worldLoc, geo::PlaneID const& planeid) const;
4702  raw::ChannelID_t NearestChannel
4703  (const TVector3& worldLoc, geo::PlaneID const& planeid) const
4704  { return NearestChannel(geo::vect::toPoint(worldLoc), planeid); }
4705  raw::ChannelID_t NearestChannel(const double worldLoc[3],
4706  unsigned int const PlaneNo,
4707  unsigned int const TPCNo = 0,
4708  unsigned int const cstat = 0) const
4709  { return NearestChannel(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4710  raw::ChannelID_t NearestChannel(std::vector<double> const& worldLoc,
4711  unsigned int const PlaneNo,
4712  unsigned int const TPCNo = 0,
4713  unsigned int const cstat = 0) const
4714  { return NearestChannel(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4715  raw::ChannelID_t NearestChannel(const TVector3& worldLoc,
4716  unsigned int const PlaneNo,
4717  unsigned int const TPCNo = 0,
4718  unsigned int const cstat = 0) const
4719  { return NearestChannel(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4721  unsigned int const PlaneNo,
4722  unsigned int const TPCNo = 0,
4723  unsigned int const cstat = 0) const
4724  { return NearestChannel(worldLoc, geo::PlaneID(cstat, TPCNo, PlaneNo)); }
4726 
4740  bool ChannelsIntersect
4741  (raw::ChannelID_t c1, raw::ChannelID_t c2, double &y, double &z) const;
4742 
4744 
4745 
4746 
4749 
4750  //
4751  // group features
4752  //
4753 
4755 
4763  unsigned int NTPCsets(readout::CryostatID const& cryoid) const;
4764  unsigned int NSiblingElements(readout::TPCsetID const& tpcsetid) const
4765  { return NTPCsets(tpcsetid); }
4767 
4769  unsigned int MaxTPCsets() const;
4770 
4771 
4772  //
4773  // access
4774  //
4777  bool HasTPCset(readout::TPCsetID const& tpcsetid) const;
4778 
4780  bool HasElement(readout::TPCsetID const& tpcsetid) const
4781  { return HasTPCset(tpcsetid); }
4782 
4783 
4789  readout::TPCsetID FindTPCsetAtPosition(double const worldLoc[3]) const;
4790 
4791  //
4792  // mapping
4793  //
4795  readout::TPCsetID TPCtoTPCset(geo::TPCID const& tpcid) const;
4796 
4807  std::vector<geo::TPCID> TPCsetToTPCs
4808  (readout::TPCsetID const& tpcsetid) const;
4809 
4810 
4814 
4817  { GetBeginID(id.asCryostatID()); id.TPCset = 0; }
4818 
4820  void GetEndID(readout::TPCsetID& id) const
4821  { GetEndID(id.asCryostatID()); id.TPCset = 0; }
4822 
4825  bool IncrementID(readout::TPCsetID& id) const; // inline implementation
4826 
4828  readout::TPCsetID GetBeginTPCsetID(geo::CryostatID const& id) const
4829  { return { id, 0 }; }
4830 
4833  readout::TPCsetID GetEndTPCsetID(geo::CryostatID const& id) const
4834  { return { id.Cryostat + 1, 0 }; }
4835 
4836 
4840 
4844 
4847  TPCset_id_iterator begin_TPCset_id(geo::CryostatID const& cid) const
4848  { return TPCset_id_iterator(this, GetBeginTPCsetID(cid)); }
4849 
4852  TPCset_id_iterator end_TPCset_id(geo::CryostatID const& cid) const
4853  { return TPCset_id_iterator(this, GetEndTPCsetID(cid)); }
4854 
4869  IteratorBox<
4872  >
4873  IterateTPCsetIDs() const { return { this }; }
4874 
4896  >
4897  IterateTPCsetIDs(geo::CryostatID const& cid) const { return { this, cid }; }
4898 
4899 
4900 #if 0
4901  //
4902  // single object features
4903  //
4904 
4912  double TPCsetHalfWidth(readout::TPCsetID const& tpcsetid) const;
4913 
4921  double TPCsetHalfHeight(readout::TPCsetID const& tpcsetid) const;
4922 
4930  double TPCsetLength(readout::TPCsetID const& tpcsetid) const;
4931 
4932 
4938  geo::Point_t GetTPCsetFrontFaceCenter
4939  (readout::TPCsetID const& tpcsetid) const;
4940 
4941 
4942 #endif // 0
4943 
4945 
4946 
4947 
4950 
4951  //
4952  // group features
4953  //
4954 
4956 
4966  unsigned int NROPs(readout::TPCsetID const& tpcsetid) const;
4967  unsigned int NSiblingElements(readout::ROPID const& ropid) const
4968  { return NROPs(ropid); }
4970 
4972  unsigned int MaxROPs() const;
4973 
4974 
4975  //
4976  // access
4977  //
4980  bool HasROP(readout::ROPID const& ropid) const;
4981 
4984  bool HasElement(readout::ROPID const& ropid) const { return HasROP(ropid); }
4985 
4986 
4987  //
4988  // mapping
4989  //
5000  readout::ROPID WirePlaneToROP(geo::PlaneID const& planeid) const;
5001 
5012  std::vector<geo::PlaneID> ROPtoWirePlanes
5013  (readout::ROPID const& ropid) const;
5014 
5025  std::vector<geo::TPCID> ROPtoTPCs(readout::ROPID const& ropid) const;
5026 
5027 
5038  raw::ChannelID_t FirstChannelInROP(readout::ROPID const& ropid) const;
5039 
5043 
5045  void GetBeginID(readout::ROPID& id) const
5046  { GetBeginID(id.asTPCsetID()); id.ROP = 0; }
5047 
5049  void GetEndID(readout::ROPID& id) const
5050  { GetEndID(id.asTPCsetID()); id.ROP = 0; }
5051 
5054  bool IncrementID(readout::ROPID& id) const; // inline implementation
5055 
5057  readout::ROPID GetBeginROPID(geo::CryostatID const& id) const
5058  { return { GetBeginTPCsetID(id), 0 }; }
5059 
5062  readout::ROPID GetEndROPID(geo::CryostatID const& id) const
5063  { return { GetEndTPCsetID(id), 0 }; }
5064 
5067  { return { id, 0 }; }
5068 
5072  { return { GetNextID(id), 0 }; }
5073 
5076  { return ROP_id_iterator(this, ROP_id_iterator::begin_pos); }
5077 
5080  { return ROP_id_iterator(this, ROP_id_iterator::end_pos); }
5081 
5084  ROP_id_iterator begin_ROP_id(geo::CryostatID const& ID) const
5085  { return ROP_id_iterator(this, GetBeginROPID(ID)); }
5086 
5089  ROP_id_iterator end_ROP_id(geo::CryostatID const& ID) const
5090  { return ROP_id_iterator(this, GetEndROPID(ID)); }
5091 
5095  { return ROP_id_iterator(this, GetBeginROPID(ID)); }
5096 
5100  { return ROP_id_iterator(this, GetEndROPID(ID)); }
5101 
5116  IteratorBox<
5119  >
5120  IterateROPIDs() const { return { this }; }
5121 
5143  >
5144  IterateROPIDs(geo::CryostatID const& cid) const { return { this, cid }; }
5145 
5167  >
5168  IterateROPIDs(readout::TPCsetID const& sid) const { return { this, sid }; }
5169 
5170 
5183  geo::View_t View(readout::ROPID const& ropid) const;
5184 
5197  geo::SigType_t SignalType(readout::ROPID const& ropid) const;
5198 
5199 
5201 
5202 
5203 
5207 
5208  //
5209  // group features
5210  //
5211 
5213  unsigned int NOpChannels() const;
5214 
5216  unsigned int MaxOpChannel() const;
5217 
5218  // Number of hardware channels for a given optical detector
5219  unsigned int NOpHardwareChannels(int opDet) const;
5220 
5221 
5222  //
5223  // access
5224  //
5225 
5227  bool IsValidOpChannel(int opChannel) const;
5228 
5230  unsigned int OpChannel(int detNum, int hardwareChannel) const;
5231 
5233  unsigned int OpDetFromOpChannel(int opChannel) const;
5234 
5236  unsigned int HardwareChannelFromOpChannel(int opChannel) const;
5237 
5239  unsigned int OpDetFromCryo(unsigned int o, unsigned int c) const;
5240 
5242 
5243 
5244  //
5245  // unsorted methods
5246  //
5247 
5261  bool ValueInRange(double value, double min, double max) const;
5262 
5263 
5266 
5290  void LoadGeometryFile
5291  (std::string gdmlfile, std::string rootfile, bool bForceReload = false);
5292 
5311  void ApplyChannelMap(std::shared_ptr<geo::ChannelMapAlg> pChannelMap);
5313 
5314 
5315  protected:
5317  void SetDetectorName(std::string new_name) { fDetectorName = new_name; }
5318 
5321  { return fChannelMapAlg.get(); }
5322 
5324  CryostatList_t& Cryostats() { return fGeoData.cryostats; }
5326  CryostatList_t const& Cryostats() const { return fGeoData.cryostats; }
5328 
5330  AuxDetList_t& AuxDets() { return fGeoData.auxDets; }
5332  AuxDetList_t const& AuxDets() const { return fGeoData.auxDets; }
5334 
5335  private:
5336 
5337  void FindCryostat(std::vector<const TGeoNode*>& path, unsigned int depth);
5338 
5339  void MakeCryostat(std::vector<const TGeoNode*>& path, int depth);
5340 
5341  void FindAuxDet(std::vector<const TGeoNode*>& path, unsigned int depth);
5342 
5343  void MakeAuxDet(std::vector<const TGeoNode*>& path, int depth);
5344 
5346  bool WireIDIntersectionCheck
5347  (const geo::WireID& wid1, const geo::WireID& wid2) const;
5348 
5350  static bool PointWithinSegments(
5351  double A_start_x, double A_start_y, double A_end_x, double A_end_y,
5352  double B_start_x, double B_start_y, double B_end_x, double B_end_y,
5353  double x, double y
5354  );
5355 
5357  void SortGeometry(geo::GeoObjectSorter const& sorter);
5358 
5360  void UpdateAfterSorting();
5361 
5363  void ClearGeometry();
5364 
5367  static void CheckIndependentPlanesOnSameTPC
5368  (geo::PlaneID const& pid1, geo::PlaneID const& pid2, const char* caller);
5369 
5371 
5372  double fSurfaceY;
5373  std::string fDetectorName;
5374  std::string fGDMLfile;
5375  std::string fROOTfile;
5376  double fMinWireZDist;
5377  double fPositionWiggle;
5379  std::shared_ptr<const geo::ChannelMapAlg> fChannelMapAlg;
5381 
5382  // cached values
5383  std::set<geo::View_t> allViews;
5384 
5385  }; // class GeometryCore
5386 
5387 
5388 
5412  public:
5414  ROOTGeoNodeForwardIterator(TGeoNode const* start_node)
5415  { init(start_node); }
5416 
5418  TGeoNode const* operator* () const
5419  { return current_path.empty()? nullptr: current_path.back().self; }
5420 
5422  ROOTGeoNodeForwardIterator& operator++ ();
5423 
5425  std::vector<TGeoNode const*> get_path() const;
5426 
5427  protected:
5428  using Node_t = TGeoNode const*;
5429  struct NodeInfo_t {
5430  Node_t self; int sibling;
5431  NodeInfo_t(Node_t new_self, int new_sibling)
5432  : self(new_self), sibling(new_sibling) {}
5433  }; // NodeInfo_t
5434 
5436  std::vector<NodeInfo_t> current_path;
5437 
5438  void reach_deepest_descendant();
5439 
5440  void init(TGeoNode const* start_node);
5441 
5442  }; // class ROOTGeoNodeForwardIterator
5443 
5445  // END Geometry group --------------------------------------------------------
5446 
5447 } // namespace geo
5448 
5449 
5450 
5451 //******************************************************************************
5452 //*** inline implementation
5453 //***
5454 inline bool geo::GeometryCore::IncrementID(geo::CryostatID& id) const {
5455  ++id.Cryostat;
5456  if (id) id.isValid = HasCryostat(id); // if invalid already, it stays so
5457  return bool(id);
5458 } // geo::GeometryCore::IncrementID(geo::CryostatID)
5459 
5460 inline bool geo::GeometryCore::IncrementID(geo::TPCID& id) const {
5461  unsigned int const nTPCsInCryo = NTPC(id);
5462  if (++id.TPC < nTPCsInCryo) return bool(id); // if was invalid, it stays so
5463  // no more TPCs in this cryostat
5464  id.TPC = 0;
5465  return IncrementID(id.asCryostatID()); // also sets validity
5466 } // geo::GeometryCore::IncrementID(geo::TPCID)
5467 
5468 inline bool geo::GeometryCore::IncrementID(geo::PlaneID& id) const {
5469  // this implementation is non-optimal, in that the cryostat lookup is
5470  // performed both here and, potentially, in IncrementID(TPCID)
5471  unsigned int const nPlanesInTPC = Nplanes(id);
5472  if (++id.Plane < nPlanesInTPC) return bool(id); // if was invalid, stays so
5473  // no more planes in this TPCs
5474  id.Plane = 0;
5475  return IncrementID(id.asTPCID()); // also sets validity
5476 } // geo::GeometryCore::IncrementID(geo::PlaneID)
5477 
5479  // this implementation is non-optimal, in that the TPC lookup is
5480  // performed both here and, potentially, in IncrementID(PlaneID)
5481  unsigned int const nWiresInPlane = Nwires(id);
5482  if (++id.Wire < nWiresInPlane) return bool(id); // if was invalid, stays so
5483  // no more wires in this plane
5484  id.Wire = 0;
5485  return IncrementID(id.asPlaneID()); // also sets validity
5486 } // geo::GeometryCore::IncrementID(geo::WireID)
5487 
5489  unsigned int const nTPCsetsInCryo = NTPCsets(id);
5490  if (++id.TPCset < nTPCsetsInCryo)
5491  return bool(id); // if was invalid, it stays so
5492  // no more TPC sets in this cryostat
5493  id.TPCset = 0;
5494  return IncrementID(id.asCryostatID()); // also sets validity
5495 } // geo::GeometryCore::IncrementID(readout::TPCsetID)
5496 
5498  // this implementation is non-optimal, in that the cryostat lookup is
5499  // performed both here and, potentially, in IncrementID(TPCsetID)
5500  unsigned int const nROPinTPC = NROPs(id);
5501  if (++id.ROP < nROPinTPC) return bool(id); // if was invalid, stays so
5502  // no more readout planes in this TPC set
5503  id.ROP = 0;
5504  return IncrementID(id.asTPCsetID()); // also sets validity
5505 } // geo::GeometryCore::IncrementID(readout::ROPID)
5506 
5507 
5508 
5509 //******************************************************************************
5510 //*** template implementation
5511 //***
5512 //------------------------------------------------------------------------------
5513 template <typename Point>
5515  (geo::WireID const& wireid) const
5516 {
5517  geo::WireGeo const& wire = Wire(wireid);
5518  return { wire.GetStart<Point>(), wire.GetEnd<Point>() };
5519 } // geo::GeometryCore::WireEndPoints(WireID)
5520 
5521 
5522 //------------------------------------------------------------------------------
5523 template <typename Stream>
5525  (Stream&& out, std::string indent /* = " " */) const
5526 {
5527 
5528  out << "Detector " << DetectorName() << " has "
5529  << Ncryostats() << " cryostats and "
5530  << NAuxDets() << " auxiliary detectors:";
5531 
5532  for (geo::CryostatGeo const& cryostat: IterateCryostats()) {
5533  out << "\n" << indent;
5534  cryostat.PrintCryostatInfo
5535  (std::forward<Stream>(out), indent + " ", cryostat.MaxVerbosity);
5536 
5537  const unsigned int nTPCs = cryostat.NTPC();
5538  for(unsigned int t = 0; t < nTPCs; ++t) {
5539  const geo::TPCGeo& tpc = cryostat.TPC(t);
5540 
5541  out << "\n" << indent << " ";
5542  tpc.PrintTPCInfo
5543  (std::forward<Stream>(out), indent + " ", tpc.MaxVerbosity);
5544 
5545  const unsigned int nPlanes = tpc.Nplanes();
5546  for(unsigned int p = 0; p < nPlanes; ++p) {
5547  const geo::PlaneGeo& plane = tpc.Plane(p);
5548  const unsigned int nWires = plane.Nwires();
5549 
5550  out << "\n" << indent << " ";
5551  plane.PrintPlaneInfo
5552  (std::forward<Stream>(out), indent + " ", plane.MaxVerbosity);
5553 
5554  for(unsigned int w = 0; w < nWires; ++w) {
5555  const geo::WireGeo& wire = plane.Wire(w);
5556  geo::WireID wireID(plane.ID(), w);
5557 
5558  // the wire should be aligned on z axis, half on each side of 0,
5559  // in its local frame
5560  out << "\n" << indent << " " << wireID << " ";
5561  wire.PrintWireInfo
5562  (std::forward<Stream>(out), indent + " ", wire.MaxVerbosity);
5563  } // for wire
5564  } // for plane
5565  } // for TPC
5566 
5567  unsigned int nOpDets = cryostat.NOpDet();
5568  for (unsigned int iOpDet = 0; iOpDet < nOpDets; ++iOpDet) {
5569  geo::OpDetGeo const& opDet = cryostat.OpDet(iOpDet);
5570  out << "\n" << indent << " [OpDet #" << iOpDet << "] ";
5571  opDet.PrintOpDetInfo
5572  (std::forward<Stream>(out), indent + " ", opDet.MaxVerbosity);
5573  } // for
5574  } // for cryostat
5575 
5576  unsigned int const nAuxDets = NAuxDets();
5577  for (unsigned int iDet = 0; iDet < nAuxDets; ++iDet) {
5578  geo::AuxDetGeo const& auxDet = AuxDet(iDet);
5579 
5580  out << "\n" << indent << "[#" << iDet << "] ";
5581  auxDet.PrintAuxDetInfo
5582  (std::forward<Stream>(out), indent + " ", auxDet.MaxVerbosity);
5583 
5584  unsigned int const nSensitive = auxDet.NSensitiveVolume();
5585  switch (nSensitive) {
5586  case 0: break;
5587  case 1: {
5588  geo::AuxDetSensitiveGeo const& auxDetS = auxDet.SensitiveVolume(0U);
5589  out << "\n" << indent << " ";
5590  auxDetS.PrintAuxDetInfo
5591  (std::forward<Stream>(out), indent + " ", auxDetS.MaxVerbosity);
5592  break;
5593  }
5594  default:
5595  for (unsigned int iSens = 0; iSens < nSensitive; ++iSens) {
5596  out << "\n" << indent << "[#" << iSens << "] ";
5597  geo::AuxDetSensitiveGeo const& auxDetS
5598  = auxDet.SensitiveVolume(iSens);
5599  auxDetS.PrintAuxDetInfo
5600  (std::forward<Stream>(out), indent + " ", auxDetS.MaxVerbosity);
5601  } // for
5602  break;
5603  } // if sensitive detectors
5604 
5605  } // for auxiliary detector
5606 
5607  out << '\n';
5608 
5609 } // geo::GeometryCore::Print()
5610 
5611 
5612 //------------------------------------------------------------------------------
5613 // template member function specializations
5614 namespace geo {
5615 
5616  template <>
5617  inline geo::TPCID GeometryCore::GetBeginID<geo::TPCID, geo::CryostatID>
5618  (geo::CryostatID const& id) const
5619  { return GetBeginTPCID(id); }
5620 
5621  template <>
5622  inline geo::TPCID GeometryCore::GetEndID<geo::TPCID, geo::CryostatID>
5623  (geo::CryostatID const& id) const
5624  { return GetEndTPCID(id); }
5625 
5626  template <>
5627  inline geo::PlaneID GeometryCore::GetBeginID<geo::PlaneID, geo::CryostatID>
5628  (geo::CryostatID const& id) const
5629  { return GetBeginPlaneID(id); }
5630 
5631  template <>
5632  inline geo::PlaneID GeometryCore::GetEndID<geo::PlaneID, geo::CryostatID>
5633  (geo::CryostatID const& id) const
5634  { return GetEndPlaneID(id); }
5635 
5636 } // namespace geo
5637 
5638 //******************************************************************************
5639 //
5640 // geo::details::cryostat_id_iterator_base<>
5641 //
5642 template <typename GEOID>
5644  { return geometry() && geometry()->HasElement(localID()); }
5645 
5646 template <typename GEOID>
5648  -> ElementPtr_t
5649  { return geometry()->GetElementPtr(localID()); }
5650 
5651 template <typename GEOID>
5653  { limit = geometry()->NSiblingElements(localID()); }
5654 
5655 template <typename GEOID>
5657  { geometry()->GetBeginID(ID()); }
5658 
5659 template <typename GEOID>
5661  { geometry()->GetEndID(ID()); }
5662 
5663 template <typename GEOID>
5665  if (at_end()) return;
5666  if (++local_index() < limit) return;
5667  localID().isValid = false;
5668 } // geo::cryostat_id_iterator_base<GEOID>::next()
5669 
5670 
5671 //
5672 // geo::details::TPC_id_iterator_base<>
5673 //
5674 template <typename GEOID>
5676  return upper_iterator::geometry()
5677  && upper_iterator::geometry()->HasElement(localID());
5678 } // geo::details::TPC_id_iterator_base<>::operator bool()
5679 
5680 
5681 template <typename GEOID>
5682 inline
5684  { return upper_iterator::geometry()->GetElementPtr(localID()); }
5685 
5686 template <typename GEOID>
5688  // limit is how many sibling TPCs there are
5689  limit = upper_iterator::geometry()->NSiblingElements(localID());
5690 } // geo::details::TPC_id_iterator_base<GEOID>::set_local_limits()
5691 
5692 template <typename GEOID>
5694  // if at end (checked in the inherited context), do nothing
5695  if (upper_iterator::at_end()) return;
5696 
5697  // if after incrementing we haven't reached the limit, we are done
5698  if (++local_index() < limit) return;
5699 
5700  // we reached the end of the current elements list, we need to escalate:
5701  // - go to the next parent; if that becomes invalid, too bad, but we go on
5702  upper_iterator::next();
5703  // - set the index to the first element of the new parent
5704  local_index() = 0;
5705  // - update how many elements there are
5706  // (expect 0 if it is now at_end() -- and it does not even matter)
5707  set_local_limits();
5708 } // geo::details::TPC_id_iterator_base<GEOID>::next()
5709 
5710 
5711 //
5712 // geo::details::plane_id_iterator_base<>
5713 //
5714 template <typename GEOID>
5716  return upper_iterator::geometry()
5717  && upper_iterator::geometry()->HasElement(localID());
5718 } // geo::details::plane_id_iterator_base<>::operator bool()
5719 
5720 
5721 template <typename GEOID>
5723  -> ElementPtr_t
5724  { return upper_iterator::geometry()->GetElementPtr(localID()); }
5725 
5726 template <typename GEOID>
5728  // limit is how many sibling planes there are
5729  limit = upper_iterator::geometry()->NSiblingElements(localID());
5730 } // geo::details::plane_id_iterator_base<GEOID>::set_local_limits()
5731 
5732 template <typename GEOID>
5734  // if at end (checked in the inherited context), do nothing
5735  if (upper_iterator::at_end()) return;
5736 
5737  // if after incrementing we haven't reached the limit, we are done
5738  if (++local_index() < limit) return;
5739 
5740  // we reached the end of the current elements list, we need to escalate:
5741  // - go to the next parent; if that becomes invalid, too bad, but we go on
5742  upper_iterator::next();
5743  // - set the index to the first element of the new parent
5744  local_index() = 0;
5745  // - update how many elements there are
5746  // (expect 0 if it is now at_end() -- and it does not even matter)
5747  set_local_limits();
5748 } // geo::details::plane_id_iterator_base<GEOID>::next()
5749 
5750 
5751 //
5752 // geo::details::wire_id_iterator_base<>
5753 //
5754 template <typename GEOID>
5756  return upper_iterator::geometry()
5757  && upper_iterator::geometry()->HasElement(localID());
5758 } // geo::details::wire_id_iterator_base<>::operator bool()
5759 
5760 template <typename GEOID>
5762  -> ElementPtr_t
5763  { return upper_iterator::geometry()->GetElementPtr(localID()); }
5764 
5765 template <typename GEOID>
5767  // limit is how many sibling wires there are
5768  limit = upper_iterator::geometry()->NSiblingElements(localID());
5769 } // geo::details::wire_id_iterator_base<>::set_local_limits()
5770 
5771 template <typename GEOID>
5773  // if at end (checked in the inherited context), do nothing
5774  if (upper_iterator::at_end()) return;
5775 
5776  // if after incrementing we haven't reached the limit, we are done
5777  if (++local_index() < limit) return;
5778 
5779  // we reached the end of the current elements list, we need to escalate:
5780  // - go to the next parent; if that becomes invalid, too bad, but we go on
5781  upper_iterator::next();
5782  // - set the index to the first element of the new parent
5783  local_index() = 0;
5784  // - update how many elements there are
5785  // (expect 0 if it is now at_end() -- and it does not even matter)
5786  set_local_limits();
5787 } // geo::details::wire_id_iterator_base<>::next()
5788 
5789 
5790 //
5791 // comparison operators between ID iterators and element iterators
5792 //
5793 template <typename GEOIDITER>
5794 bool geo::details::operator==
5795  (geometry_element_iterator<GEOIDITER> const& iter, GEOIDITER const& id_iter)
5796 {
5797  return iter.id_iterator() == id_iter;
5798 } // operator==(iterator_t, id_iterator_t)
5799 
5800 template <typename GEOIDITER>
5801 bool geo::details::operator!=
5802  (geometry_element_iterator<GEOIDITER> const& iter, GEOIDITER const& id_iter)
5803 {
5804  return iter.id_iterator() != id_iter;
5805 } // operator!=(iterator_t, id_iterator_t)
5806 
5807 
5808 //
5809 // geo::details::TPCset_id_iterator_base<>
5810 //
5811 template <typename GEOID>
5813  return upper_iterator::geometry()
5814  && upper_iterator::geometry()->HasElement(localID());
5815 } // geo::details::TPCset_id_iterator_base<>::operator bool()
5816 
5817 
5818 template <typename GEOID>
5820  // limit is how many sibling TPCs there are
5821  limit = upper_iterator::geometry()->NSiblingElements(localID());
5822 } // geo::details::TPCset_id_iterator_base<GEOID>::set_local_limits()
5823 
5824 template <typename GEOID>
5826  // if at end (checked in the inherited context), do nothing
5827  if (upper_iterator::at_end()) return;
5828 
5829  // if after incrementing we haven't reached the limit, we are done
5830  if (++local_index() < limit) return;
5831 
5832  // we reached the end of the current elements list, we need to escalate:
5833  // - go to the next parent; if that becomes invalid, too bad, but we go on
5834  upper_iterator::next();
5835  // - set the index to the first element of the new parent
5836  local_index() = 0;
5837  // - update how many elements there are
5838  // (expect 0 if it is now at_end() -- and it does not even matter)
5839  set_local_limits();
5840 } // geo::details::TPCset_id_iterator_base<GEOID>::next()
5841 
5842 
5843 //
5844 // geo::details::ROP_id_iterator_base<>
5845 //
5846 template <typename GEOID>
5848  return upper_iterator::geometry()
5849  && upper_iterator::geometry()->HasElement(localID());
5850 } // geo::details::ROP_id_iterator_base<>::operator bool()
5851 
5852 
5853 template <typename GEOID>
5855  // limit is how many sibling planes there are
5856  limit = upper_iterator::geometry()->NSiblingElements(localID());
5857 } // geo::details::ROP_id_iterator_base<GEOID>::set_local_limits()
5858 
5859 template <typename GEOID>
5861  // if at end (checked in the inherited context), do nothing
5862  if (upper_iterator::at_end()) return;
5863 
5864  // if after incrementing we haven't reached the limit, we are done
5865  if (++local_index() < limit) return;
5866 
5867  // we reached the end of the current elements list, we need to escalate:
5868  // - go to the next parent; if that becomes invalid, too bad, but we go on
5869  upper_iterator::next();
5870  // - set the index to the first element of the new parent
5871  local_index() = 0;
5872  // - update how many elements there are
5873  // (expect 0 if it is now at_end() -- and it does not even matter)
5874  set_local_limits();
5875 } // geo::details::ROP_id_iterator_base<GEOID>::next()
5876 
5877 
5878 
5879 //******************************************************************************
5880 
5881 #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:175
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:156
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:298
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.