GeometryCore.h
Go to the documentation of this file.
1 /**
2 * @file GeometryCore.h
3 * @brief Access the description of detector geometry
4 * @author brebel@fnal.gov
5 * @see GeometryCore.cxx
6 *
7 * Structure of the header:
8 *
9 * namespace geo {
10 *
11 * // forward class declarations
12 *
13 * namespace details {
14 *
15 * // geometry iterator base class
16 *
17 * }
18 *
19 * // geometry iterators declaration
20 * // - cryostat_id_iterator
21 * // - TPC_id_iterator
22 * // - plane_id_iterator
23 * // - wire_id_iterator
24 *
25 * // GeometryData_t definition (part of GeometryCore)
26 *
27 * // GeometryCore declaration
28 *
29 * }
30 *
31 *
32 *
33 * Revised <seligman@nevis.columbia.edu> 29-Jan-2009
34 * Revise the class to make it into more of a general detector interface
35 * Revised <petrillo@fnal.gov> 27-Apr-2015
36 * Factorization into a framework-independent GeometryCore.h and a
37 * art framework interface
38 * Revised <petrillo@fnal.gov> 30-Apr-2015
39 * Redesign of the iterators
40 */
41 #ifndef GEO_GEOMETRYCORE_H
42 #define GEO_GEOMETRYCORE_H
43 
44 // GArSoft libraries
45 #include "Geometry/LocalTransformation.h"
47 
48 // Framework and infrastructure libraries
49 #include "fhiclcpp/ParameterSet.h"
50 
51 // ROOT libraries
52 #include <TVector3.h>
53 // #include <Rtypes.h>
54 
55 // C/C++ standard libraries
56 #include <cstddef> // size_t
57 #include <string>
58 #include <vector>
59 #include <set>
60 #include <memory> // std::shared_ptr<>
61 #include <iterator> // std::forward_iterator_tag
62 #include <type_traits> // std::is_base_of<>
63 #include <map>
64 #include <utility>
65 
66 // ROOT class prototypes
67 class TGeoManager;
68 class TGeoNode;
69 class TGeoMaterial;
70 
71 /// Namespace collecting geometry-related classes utilities
72 namespace gar {
73  namespace geo {
74 
75  class GeometryCore;
76  namespace seg {
77  class ChannelMapAlg;
78  class SegmentationAlg;
79  }
80 
81  typedef enum ROCType_ {HFILLER, IROC, IOROC, OOROC} ROCType;
82 
83  typedef struct ChanWithPos_
84  {
85  unsigned int id;
86  TVector3 pos;
87  TVector3 padrowdir; // unit vector along pad row. Sign not guaranteed.
89  } ChanWithPos;
90 
91  typedef std::vector<gar::geo::ChanWithPos> ChanWithNeighbors;
92 
93  //Calorimeter Struct Data
95  {
96  enum LayoutType {
97  BarrelLayout = 0,
99  ConicalLayout
100  };
101 
103  double extent[6];
106  double outer_phi0;
107  double inner_phi0;
108  double phi0;
109  double gap0;
110  double gap1;
111  double gap2;
112 
113  struct Layer {
115  : distance(0),
116  phi0(0),
117  absorberThickness(0),
118  inner_nRadiationLengths(0),
119  inner_nInteractionLengths(0),
120  outer_nRadiationLengths(0),
121  outer_nInteractionLengths(0),
122  inner_thickness(0),
123  outer_thickness(0),
124  sensitive_thickness(0),
125  cellSize0(0),
126  cellSize1(0)
127  {}
128 
129  double distance;
130  double phi0;
139  double cellSize0;
140  double cellSize1;
141  };
142 
143  std::vector<Layer> layers ;
144  };
145 
147 
148  //
149  // iterators
150  //
151  namespace details {
152 
153  /// Base class for geometry iterators, containing some type definitions
155  public:
156 
157  //@{
158  /// Structures to distinguish the constructors
159  struct BeginPos_t {};
160  struct EndPos_t {};
161  struct UndefinedPos_t {};
162 
163  static constexpr BeginPos_t begin_pos = {};
164  static constexpr EndPos_t end_pos = {};
165  static constexpr UndefinedPos_t undefined_pos = {};
166  //@}
167 
168  }; // class geometry_iterator_types
169 
170  /// Base class for geometry iterators (note: this is not an iterator)
172  public:
173 
174  /// Constructor: associates with the specified geometry
175  geometry_iterator_base(const gar::geo::GeometryCore *geom): pGeo(geom) {}
176 
177  protected:
178  /// Returns a pointer to the geometry
179  geo::GeometryCore const* geometry() const { return pGeo; }
180 
181  /// Default constructor; do not use a default-constructed iterator as-is!
183 
184  private:
185  const gar::geo::GeometryCore *pGeo = nullptr; ///< pointer to the geometry
186 
187  }; // class geometry_iterator_base
188 
189 
190  // forward declarations:
191  template <typename GEOIDITER>
193 
194  //@{
195  /// Comparison operator: geometry ID and element point to the same ID
196  template <typename GEOIDITER>
197  bool operator== (
199  GEOIDITER const& id_iter
200  );
201  template <typename GEOIDITER>
202  inline bool operator== (GEOIDITER const& id_iter,
204  { return iter == id_iter; }
205  //@}
206 
207  //@{
208  /// Comparison operator: geometry ID and element point to different IDs
209  template <typename GEOIDITER>
210  bool operator!= (
212  GEOIDITER const& id_iter
213  );
214  template <typename GEOIDITER>
215  inline bool operator!= (
216  GEOIDITER const& id_iter,
218  )
219  { return iter != id_iter; }
220  //@}
221 
222  /**
223  * @brief Forward iterator browsing all geometry elements in the detector
224  * @tparam GEOITER type of geometry ID iterator
225  *
226  * This iterator works as the corresponding ID iterator in the template
227  * argument. The difference is the dereferenciation operator: this one
228  * obtains the geometry element directly, or throws on failure.
229  * The boolean conversion operator checks that it can obtain a pointer to
230  * the geometry element.
231  *
232  * In particular, get() and ID() methods still return the pointer to the
233  * geometry element and its ID, respectively.
234  *
235  * It can also be initialized and compare with the corresponding ID
236  * iterator.
237  */
238  template <typename GEOIDITER>
240  public std::forward_iterator_tag, public geometry_iterator_types
241  {
242  public:
243  using id_iterator_t = GEOIDITER;
244 
245  static_assert(
247  "template class for geometry_element_iterator"
248  " must be a geometry iterator"
249  );
250 
252 
253  //@{
254  /// types mirrored from the ID iterator
255  using LocalID_t = typename id_iterator_t::LocalID_t;
256  using GeoID_t = typename id_iterator_t::GeoID_t;
260  using ElementPtr_t = typename id_iterator_t::ElementPtr_t;
261  //@}
262 
263  //@{
264  /// Expose inherited constants
268  //@}
269 
270  /// Geometry class pointed by the iterator
272 
273  /// Default constructor; effect not defined: assign to it before using!
274  geometry_element_iterator() = default;
275 
276  /// Constructor: points to begin
278  : id_iter(geom) {}
279 
280  //@{
281  /// Constructor: points to the same element as the specified ID iterator
282  geometry_element_iterator(id_iterator_t const& iter): id_iter(iter) {}
283  geometry_element_iterator(id_iterator_t&& iter): id_iter(iter) {}
284  //@}
285 
286  /// Constructor: points to the specified geometry element
288  (gar::geo::GeometryCore const* geom, GeoID_t const& start_from)
289  : id_iter(geom, start_from)
290  {}
291 
292  /// Constructor: points to beginning
294  (gar::geo::GeometryCore const* geom, BeginPos_t const pos)
295  : id_iter(geom, pos)
296  {}
297 
298  /// Constructor: points to end
300  (gar::geo::GeometryCore const* geom, EndPos_t const pos)
301  : id_iter(geom, pos)
302  {}
303 
304  /// Returns true if the two iterators point to the same object
305  bool operator== (iterator const& as) const
306  { return id_iterator() == as.id_iterator(); }
307 
308  /// Returns true if the two iterators point to different objects
309  bool operator!= (iterator const& as) const
310  { return id_iterator() != as.id_iterator(); }
311 
312  /**
313  * @brief Returns the geometry element the iterator points to
314  * @return a constant reference to the element the iterator points to
315  * @throw cet::exception (category "geometry_iterator") if no valid
316  * geometry element is currently pointed by the iterator
317  */
318  Element_t const& operator* () const
319  {
320  ElementPtr_t ptr = get();
321  if (ptr) return *ptr;
322  throw cet::exception("geometry_iterator")
323  << "iterator attempted to obtain geometry element "
324  << std::string(ID());
325  } // operator*()
326 
327  /// Returns a pointer to the element the iterator points to (or nullptr)
328  Element_t const* operator-> () const { return get(); }
329 
330  /// Prefix increment: returns this iterator pointing to the next element
331  iterator& operator++ () { ++id_iterator(); return *this; }
332 
333  /// Postfix increment: returns the current iterator, then increments it
334  iterator operator++ (int)
335  { iterator old(*this); ++id_iterator(); return old; }
336 
337  /// Returns whether the iterator is pointing to a valid geometry element
338  operator bool() const
339  { return bool(id_iterator()) && (id_iterator().get() != nullptr); }
340 
341  /// Returns a pointer to the geometry element, or nullptr if invalid
342  ElementPtr_t get() const { return id_iterator().get(); }
343 
344  /// Returns the ID of the pointed geometry element
345  LocalID_t const& ID() const { return *(id_iterator()); }
346 
347  protected:
348  friend bool geo::details::operator== <id_iterator_t>
349  (iterator const& iter, id_iterator_t const& id_iter);
350  friend bool geo::details::operator== <id_iterator_t>
351  (id_iterator_t const& id_iter, iterator const& iter);
352  friend bool geo::details::operator!= <id_iterator_t>
353  (iterator const& iter, id_iterator_t const& id_iter);
354  friend bool geo::details::operator!= <id_iterator_t>
355  (id_iterator_t const& id_iter, iterator const& iter);
356 
357  //@{
358  /// Access to the base ID iterator
359  id_iterator_t const& id_iterator() const { return id_iter; }
360  id_iterator_t& id_iterator() { return id_iter; }
361  //@}
362 
363  private:
364  id_iterator_t id_iter; ///< iterator performing the job
365 
366  }; // class geometry_element_iterator<>
367 
368  } // namespace details
369 
370  template <typename Iter, Iter (GeometryCore::*BeginFunc)() const, Iter (GeometryCore::*EndFunc)() const>
371  class IteratorBox {
372  public:
373  using iterator = Iter;
374 
375  IteratorBox(GeometryCore const* geom):
376  b((geom->*BeginFunc)()), e((geom->*EndFunc)()) {}
377 
378  iterator begin() const { return b; }
379  iterator end() const { return e; }
380 
381  iterator cbegin() const { return b; }
382  iterator cend() const { return e; }
383 
384  protected:
386  }; // IteratorBox<>
387 
388  //
389  // GeometryCore
390  //
391 
392  /** **************************************************************************
393  * @brief Description of geometry of one entire detector
394  *
395  * @note All lengths are specified in centimetres
396  *
397  *
398  * How to correctly instantiate a GeometryCore object
399  * ---------------------------------------------------
400  *
401  * Instantiation is a multi-step procedure:
402  * 1. construct a GeometryCore object (the "service provider"),
403  * with the full configuration; at this step, configuration is just stored
404  * 2. load a geometry with GeometryCore::LoadGeometryFile();
405  * this loads the detector geometry information
406  * 3. prepare a channel map algorithm object (might use for example
407  * GeometryCore::DetectorName() or the detector geometry from the
408  * newly created object, but any use of channel mapping related functions
409  * is forbidden and it would yield undefined behaviour (expected to be
410  * catastrophic)
411  * 4. acquire the channel mapping algorithm with
412  * GeometryCore::ApplyChannelMap(); at this point, the ChannelMapAlg object
413  * is asked to initialize itself and to perform whatever modifications to
414  * the geometry provider is needed.
415  *
416  * Step 3 (creation of the channel mapping algorithm object) can be performed
417  * at any time before step 4, provided that no GeometryCore instance is needed
418  * for it.
419  *
420  *
421  * Configuration parameters
422  * -------------------------
423  *
424  * - *Name* (string; mandatory): string identifying the detector; it can be
425  * different from the base name of the file used to initialize the geometry;
426  * standard names are recommended by each experiment.
427  * This name can be used, for example, to select which channel mapping
428  * algorithm to use.
429  * - *SurfaceY* (real; mandatory): depth of the detector, in centimetrs;
430  * see SurfaceY() for details
431  * - *MinWireZDist* (real; default: 3)
432  * - *PositionEpsilon* (real; default: 0.01%) set the default tolerance
433  * (see DefaultWiggle())
434  *
435  */
436  class GeometryCore {
437  public:
438  // import iterators
439  /**
440  * @brief Initialize geometry from a given configuration
441  * @param pset configuration parameters
442  *
443  * This constructor does not load any geometry description.
444  * The next step is to do exactly that, by GeometryCore::LoadGeometryFile().
445  */
446  GeometryCore(fhicl::ParameterSet const& pset);
447 
448  /// Destructor
449  ~GeometryCore();
450 
451  // You shall not copy or move or assign me!
452  GeometryCore(GeometryCore const&) = delete;
453  GeometryCore(GeometryCore&&) = delete;
454  GeometryCore& operator= (GeometryCore const&) = delete;
455  GeometryCore& operator= (GeometryCore&&) = delete;
456 
457 
458  /**
459  * @brief Returns the tolerance used in looking for positions
460  * @return the tolerance value
461  *
462  * This parameter is used as tolerance ("wiggle") for methods that require
463  * Typically, it's a additional fraction of tolerance: 0 means no tolerance,
464  * 0.1 means 10% tolerance.
465  *
466  * @todo Confirm the definition of wiggle: this one is taken from other doc
467  */
468  double DefaultWiggle() const { return fPositionWiggle; }
469 
470  /**
471  * @brief Returns the full directory path to the geometry file source
472  * @return the full directory path to the geometry file source
473  *
474  * This is the full path of the source of the detector geometry GeometryCore
475  * relies on.
476  */
477  std::string ROOTFile() const { return fROOTfile; }
478 
479  /**
480  * @brief Returns the full directory path to the GDML file source
481  * @return the full directory path to the GDML file source
482  *
483  * This is the full path of the source of the detector geometry handed to
484  * the detector simulation (GEANT).
485  */
486  std::string GDMLFile() const { return fGDMLfile; }
487 
488  /// @name Detector information
489  /// @{
490 
491  //
492  // global features
493  //
494  /// Returns a string with the name of the detector, as configured
495  std::string DetectorName() const { return fDetectorName; }
496 
497 
498  //
499  // position
500  //
501 
502  /**
503  * @brief Fills the arguments with the boundaries of the world
504  * @param xlo (output) pointer to the lower x coordinate
505  * @param xlo (output) pointer to the upper x coordinate
506  * @param ylo (output) pointer to the lower y coordinate
507  * @param ylo (output) pointer to the upper y coordinate
508  * @param zlo (output) pointer to the lower z coordinate
509  * @param zlo (output) pointer to the upper z coordinate
510  * @throw cet::exception (`"GeometryCore"` category) if no world found
511  *
512  * This method fills the boundaries of the world volume, that is the one
513  * known as `"volWorld"` in the geometry.
514  *
515  * If a pointer is null, its coordinate is skipped.
516  *
517  * @todo Replace it with a TPC boundaries style thing?
518  * @todo Unify the coordinates type
519  */
520  void WorldBox(float* xlo, float* xhi,
521  float* ylo, float* yhi,
522  float* zlo, float* zhi) const;
523 
524  /**
525  * @brief The position of the detector respect to earth surface
526  * @return typical y position at surface in units of cm
527  *
528  * This is the depth (y) of the surface (where earth meets air) for this
529  * detector site.
530  * The number is expressed in world coordinates and in centimetres,
531  * and it represents the y coordinate of earth surface.
532  * A negative value means that the origin of coordinates, typically matching
533  * the detector centre, is above surface.
534  *
535  * @todo check that this is actually how it is used
536  */
537  //
538  double SurfaceY() const { return fSurfaceY; }
539 
540 
541  //
542  // object description and information
543  //
544 
545  /// Access to the ROOT geometry description manager
546  TGeoManager* ROOTGeoManager() const;
547 
548  float GetOriginX() const { return fOriginX; }
549 
550  float GetOriginY() const { return fOriginY; }
551 
552  float GetOriginZ() const { return fOriginZ; }
553 
554  float GetWorldX() const { return fWorldX; }
555 
556  float GetWorldY() const { return fWorldY; }
557 
558  float GetWorldZ() const { return fWorldZ; }
559 
560  float GetWorldHalfWidth() const { return fWorldHalfWidth; }
561 
562  float GetWorldHalfHeight() const { return fWorldHalfHeight; }
563 
564  float GetWorldLength() const { return fWorldLength; }
565 
566  float GetRockX() const { return fRockX; }
567 
568  float GetRockY() const { return fRockY; }
569 
570  float GetRockZ() const { return fRockZ; }
571 
572  float GetRockHalfWidth() const { return fRockHalfWidth; }
573 
574  float GetRockHalfHeight() const { return fRockHalfHeight; }
575 
576  float GetRockLength() const { return fRockLength; }
577 
578  float GetEnclosureX() const { return fEnclosureX; }
579 
580  float GetEnclosureY() const { return fEnclosureY; }
581 
582  float GetEnclosureZ() const { return fEnclosureZ; }
583 
584  float GetEnclosureHalfWidth() const { return fEnclosureHalfWidth; }
585 
586  float GetEnclosureHalfHeight() const { return fEnclosureHalfHeight; }
587 
588  float GetEnclosureLength() const { return fEnclosureLength; }
589 
590  float GetMPDX() const { return fMPDX; }
591 
592  float GetMPDY() const { return fMPDY; }
593 
594  float GetMPDZ() const { return fMPDZ; }
595 
596  float GetMPDHalfWidth() const { return fMPDHalfWidth; }
597 
598  float GetMPDHalfHeight() const { return fMPDHalfHeight; }
599 
600  float GetMPDLength() const { return fMPDLength; }
601 
602  float GetLArTPCX() const { return fLArTPCX; }
603 
604  float GetLArTPCY() const { return fLArTPCY; }
605 
606  float GetLArTPCZ() const { return fLArTPCZ; }
607 
608  float GetActiveLArTPCX() const { return fLArTPCXCent; }
609 
610  float GetActiveLArTPCY() const { return fLArTPCYCent; }
611 
612  float GetActiveLArTPCZ() const { return fLArTPCZCent; }
613 
614  float GetLArTPCHalfWidth() const { return fLArTPCHalfWidth; }
615 
616  float GetLArTPCHalfHeight() const { return fLArTPCHalfHeight; }
617 
618  float GetLArTPCLength() const { return fLArTPCLength; }
619 
620  float GetActiveLArTPCHalfWidth() const { return fLArTPCActiveHalfWidth; }
621 
622  float GetActiveLArTPCHalfHeight() const { return fLArTPCActiveHalfHeight; }
623 
624  float GetActiveLArTPCLength() const { return fLArTPCActiveLength; }
625 
626  unsigned int GetNLayers(std::string det) const;
627 
628  std::map< gar::geo::LayeredCalorimeterData::LayoutType, std::shared_ptr<gar::geo::LayeredCalorimeterData> > GetECALLayeredCalorimeterData() const { return fECALLayeredCalorimeterData; }
629 
630  float GArLiteXCent() const { return fGArLiteXCent; }
631 
632  float GArLiteYCent() const { return fGArLiteYCent; }
633 
634  float GArLiteZCent() const { return fGArLiteZCent; }
635 
636  float GArLiteRadius() const { return fGArLiteRadius; }
637 
638  float GArLiteLength() const { return fGArLiteLength; }
639 
640  /**
641  * @brief Returns the name of the deepest volume containing specified point
642  * @param point the location to query, in world coordinates
643  * @return name of the volume containing the point
644  *
645  * @todo Use a reference to TVector3
646  * @todo Use a double[3] instead?
647  * @todo declare it const
648  * @todo what happens if none?
649  * @todo Unify the coordinates type
650  */
651  const std::string VolumeName(TVector3 const& point) const;
652 
653 
654  /**
655  * @brief Returns all the nodes with volumes with any of the specified names
656  * @param vol_names list of names of volumes
657  * @return list of nodes found
658  *
659  * All the nodes in the geometry are checked, and all the ones that contain
660  * a volume with a name among the ones specified in vol_names are saved
661  * in the collection and returned.
662  */
663  std::vector<TGeoNode const*> FindVolumePath(std::string const& vol_name) const;
664 
665  bool FindFirstVolume(std::string const& name, std::vector<const TGeoNode*>& path) const;
666 
667  void StoreECALNodes(std::map<std::string, std::vector<const TGeoNode*>> &map) const;
668 
669  /**
670  * @brief Returns all the nodes with volumes with any of the specified names
671  * @param vol_names list of names of volumes
672  * @return list of nodes found
673  *
674  * All the nodes in the geometry are checked, and all the ones that contain
675  * a volume with a name among the ones specified in vol_names are saved
676  * in the collection and returned.
677  */
678  std::vector<TGeoNode const*> FindAllVolumes(std::set<std::string> const& vol_names) const;
679 
680  /**
681  * @brief Returns paths of all nodes with volumes with the specified names
682  * @param vol_names list of names of volumes
683  * @return list paths of the found nodes
684  *
685  * All the nodes in the geometry are checked, and the path of all the ones
686  * that contain a volume with a name among the ones specified in vol_names
687  * is saved in the collection and returned.
688  * A node path is a ordered list of all nodes leading to the final one,
689  * starting from thetop level (root) down. The node at the `back()` of the
690  * path is the one with name in vol_names.
691  * No empty paths are returned.
692  */
693  std::vector<std::vector<TGeoNode const*>> FindAllVolumePaths(std::set<std::string> const& vol_names) const;
694 
695  //Return the node of the point
696  template <typename T>
697  TGeoNode* FindNode(T const &x, T const &y, T const &z) const;
698 
699  //Return the node of the point
700  TGeoNode* FindNode(std::array<double, 3> const& point) const;
701 
702  //Return the node of the point
703  TGeoNode* FindNode(TVector3 const& point) const;
704 
705  //Transform world coordinates in local coordinates
706  bool WorldToLocal(std::array<double, 3> const& world, std::array<double, 3> &local, gar::geo::LocalTransformation<TGeoHMatrix> &trans) const;
707 
708  //Transform local coordinates in world coordinates
709  bool LocalToWorld(std::array<double, 3> const& local, std::array<double, 3> &world, gar::geo::LocalTransformation<TGeoHMatrix> const &trans) const;
710 
711  /**
712  * @brief Name of the deepest material containing the point xyz
713  * @return material of the origin by default
714  *
715  * @todo make this constant
716  * @todo remove return value constantness (or make it a reference)
717  * @todo Unify the coordinates type
718  */
719  const std::string MaterialName(TVector3 const& point);
720 
721 
722  /// Returns the material at the specified position
723  /// @todo Unify the coordinates type
724  TGeoMaterial const* Material(double x, double y, double z) const;
725 
726  /// Returns the total mass [kg] of the specified volume (default: world)
727  /// @todo Use GetWorldVolumeName() as default instead
728  double TotalMass(const char* vol = "volWorld") const;
729 
730  // this requires a bit more explanation about what this mass density is...
731  /**
732  * @brief Return the column density between two points
733  * @param p1 pointer to array holding (x, y, z) of the first point
734  * @param p2 pointer to array holding (x, y, z) of the second point
735  * @return the mass
736  *
737  * Both points are specified in world coordinates.
738  *
739  * @todo Unify the coordinates type
740  */
741  /// Returns the mass between two coordinates
742  double MassBetweenPoints(double *p1, double *p2) const;
743 
744  /// @}
745 
746  //
747  // single object features
748  //
749 
750  //@{
751  /**
752  * @brief Returns the radius of the TPC (y or z direction)
753  * @return the radius of the TPC (y or z direction)
754  */
755  float TPCRadius() const { return fTPCRadius; }
756  //@}
757 
758  //@{
759  /**
760  * @brief Returns the length of the TPC (x direction)
761  * @return the value of the length of the specified TPC
762  */
763  float TPCLength() const { return fTPCLength; }
764  //@}
765 
766 
767  //@{
768  /**
769  * @brief Returns number of TPC drift volumes
770  */
771  int TPCNumDriftVols() const { return fTPCNumDriftVols; }
772  //@}
773 
774  //@{
775  /**
776  * @brief Returns the X location of the center of the TPC in cm
777  */
778  float TPCXCent() const { return fTPCXCent; }
779  //@}
780 
781  //@{
782  /**
783  * @brief Returns the Y location of the center of the TPC in cm
784  */
785  float TPCYCent() const { return fTPCYCent; }
786  //@}
787 
788  //@{
789  /**
790  * @brief Returns the Z location of the center of the TPC in cm
791  */
792  float TPCZCent() const { return fTPCZCent; }
793  //@}
794 
795  unsigned int NChannels() const;
796 
797  //
798  // object description
799  //
800 
801  //@{
802  /**
803  * @brief Return the name of GAr TPC volume
804  * @return the name of the GArTPC volume
805  *
806  * This information is used by Geant4 simulation
807  *
808  */
809  std::string GetGArTPCVolumeName() const {return "TPC_Drift"; }
810  //@}
811 
812  //
813  // geometry queries
814  //
815 
816  //@{
817  /**
818  * @brief Returns the ID of the channel nearest to the specified position
819  * @param worldLoc 3D coordinates of the point (world reference frame)
820  * @return the ID of the channel, or raw::InvalidChannelID if invalid wire
821  *
822  * The different versions allow different way to provide the position.
823  *
824  * @todo remove the integers version
825  * @todo Verify the raw::InvalidChannelID part
826  */
827  unsigned int NearestChannel(float const worldLoc[3]) const;
828  unsigned int NearestChannel(std::vector<float> const& worldLoc) const;
829  unsigned int NearestChannel(TVector3 const& worldLoc) const;
830  void NearestChannelInfo(float const* xyz, gar::geo::ChanWithNeighbors &cwn) const;
831  //@}
832 
833  //@{
834  /**
835  * @brief radii query methods passing through to the channel map algorithm
836  */
837  float GetIROCInnerRadius() const;
838  float GetIROCOuterRadius() const;
839  float GetOROCInnerRadius() const;
840  float GetOROCOuterRadius() const;
841  float GetOROCPadHeightChangeRadius() const;
842  //@}
843 
844 
845  //@{
846  /**
847  * @brief Returns the ID of the channel representing a gap
848  * if you call NearestChannel and get this channel number, then charge is lost
849  */
850 
851  unsigned int GapChannelNumber() const;
852 
853  void ChannelToPosition(unsigned int const channel, float* const worldLoc) const;
854 
855  //
856  // unsorted methods
857  //
858 
859  /**
860  * @brief Returns whether a value is within the specified range
861  * @param value the value to be tested
862  * @param min the lower boundary
863  * @param max the upper boundary
864  * @return whether the value is within range
865  *
866  * If min is larger than max, they are swapped.
867  * A tolerance of 10^-6 (absolute) is used.
868  *
869  * @todo Use wiggle instead of 10^-6
870  * @todo resort source code for a bit of speed up
871  */
872  bool ValueInRange(double value, double min, double max) const;
873 
874  /// @name Geometry initialization
875  /// @{
876 
877  /**
878  * @brief Loads the geometry information from the specified files
879  * @param gdmlfile path to file to be used for Geant4 simulation
880  * @param rootfile path to file for internal geometry representation
881  * @param bForceReload reload even if there is already a valid geometry
882  * @see ApplyChannelMap()
883  *
884  * Both paths must directly resolve to an available file, as no search
885  * is performed for them.
886  *
887  * The gdmlfile parameter does not have to necessarily be in GDML format,
888  * as long as it's something supported by Geant4. This file is not used by
889  * the geometry, but its path is provided on request by the simulation
890  * modules (see GArSoft `LArG4` module).
891  * The rootfile also does not need to be a ROOT file, but just anything
892  * that TGeoManager::Import() supports. This file is parsed immediately
893  * and the internal geometry representation is built out of it.
894  *
895  * @note After calling this method, the detector geometry information can
896  * be considered complete, but the geometry service provider is not fully
897  * initialized yet, since it's still necessary to provide or update the
898  * channel mapping.
899  */
900  void LoadGeometryFile(std::string const& gdmlfile, std::string const& rootfile, bool bForceReload = false);
901 
902  /**
903  * @brief Initializes the geometry to work with this channel map
904  * @param pChannelMap a pointer to the channel mapping algorithm to be used
905  * @see LoadGeometryFile()
906  *
907  * The specified channel mapping is used with this geometry.
908  * The algorithm object is asked and allowed to make the necessary
909  * modifications to the geometry description.
910  * These modifications typically involve some resorting of the objects.
911  *
912  * The ownership of the algorithm object is shared, usually with a calling
913  * framework: we maintain it alive as long as we need it (and no other code
914  * can delete it), and we delete it only if no other code is sharing the
915  * ownership.
916  *
917  * This method needs to be called after LoadGeometryFile() to complete the
918  * geometry initialization.
919  */
920  void ApplyChannelMap(std::shared_ptr<gar::geo::seg::ChannelMapAlg> pChannelMap);
921  /// @}
922 
923  void ApplyECALSegmentationAlg(std::shared_ptr<gar::geo::seg::SegmentationAlg> pECALSegmentationAlg);
924 
925  void ApplyMinervaSegmentationAlg(std::shared_ptr<gar::geo::seg::SegmentationAlg> pMinervaSegmentationAlg);
926 
927  void ApplyMuIDSegmentationAlg(std::shared_ptr<gar::geo::seg::SegmentationAlg> pMuIDSegmentationAlg);
928 
929  /// Returns the object handling the channel map
930  gar::geo::seg::ChannelMapAlg const* ChannelMap() const { return fChannelMapAlg.get(); }
931 
932  /// Returns the object handling the ECAL segmentation
933  gar::geo::seg::SegmentationAlg const* ECALSegmentationAlg() const { return fECALSegmentationAlg.get(); }
934 
935  ///Returns the object handling the Sc Tracker segmentation
936  gar::geo::seg::SegmentationAlg const* MinervaSegmentationAlg() const { return fMinervaSegmentationAlg.get(); }
937 
938  ///Returns the object handling the MuID segmentation
939  gar::geo::seg::SegmentationAlg const* MuIDSegmentationAlg() const { return fMuIDSegmentationAlg.get(); }
940 
941  //Returns the ECAL minimum radius of the Inner Barrel
942  float GetECALInnerBarrelRadius() const { return fECALRinner; }
943 
944  //Returns the ECAL minimum radius of the Outer Barrel
945  float GetECALOuterBarrelRadius() const { return fECALRouter; }
946 
947  //Returns the ECAL minimum radius of the Inner Endcap
948  float GetECALInnerEndcapRadius() const { return fECALECapRinner; }
949 
950  //Returns the ECAL minimum radius of the Outer Endcap
951  float GetECALOuterEndcapRadius() const { return fECALECapRouter; }
952 
953  //Returns the PV thickness
954  float GetPVThickness() const { return fPVThickness; }
955 
956  //Returns the number of sides of the barrel
957  int GetECALInnerSymmetry() const { return fECALSymmetry; }
958 
959  //Returns the inner angle of the polyhedra
960  float GetECALInnerAngle() const { return (( fECALSymmetry - 2 ) * M_PI / fECALSymmetry); }
961 
962  //Returns the side length of the polyhedra
963  float GetECALBarrelSideLength() const { return ( 2 * std::sin( M_PI / fECALSymmetry ) * fECALRouter ); }
964 
965  //Returns the apothem length of the polyhedra
966  float GetECALBarrelApothemLength() const { return ( std::cos( M_PI / fECALSymmetry ) * fECALRouter ); }
967 
968  //Returns the side length of the polyhedra
969  float GetECALEndcapSideLength() const { return ( 2 * std::sin( M_PI / fECALSymmetry ) * fECALECapRouter ); }
970 
971  //Returns the apothem length of the polyhedra
972  float GetECALEndcapApothemLength() const { return ( std::cos( M_PI / fECALSymmetry ) * fECALECapRouter ); }
973 
974  //Returns the ECAL start of the endcap
975  float GetECALEndcapStartX() const { return fECALEndcapStartX; }
976 
977  //Returns the ECAL outer x of the endcap
978  float GetECALEndcapOuterX() const { return fECALEndcapOuterX; }
979 
980  //Has Rock in Geometry
981  bool HasRock() const { return fHasRock; }
982 
983  //Has Enclosure in Geometry
984  bool HasEnclosure() const { return fHasEnclosure; }
985 
986  //Has LArTPC in Geometry
987  bool HasLArTPCDetector() const { return fHasLArTPCDetector; }
988 
989  //Has Gas TPC in Geometry
990  bool HasGasTPCDetector() const { return fHasGasTPCDetector; }
991 
992  //Has ECAL in Geometry
993  bool HasECALDetector() const { return fHasECALDetector; }
994 
995  //ND-GAr lite
996  bool HasTrackerScDetector() const { return fHasTrackerScDetector; }
997 
998  //Muon ID detector (only Barrel so far)
999  bool HasMuonDetector() const { return fHasMuonDetector; }
1000 
1001  //Returns the MuID minimum radius of the Inner Barrel
1002  float GetMuIDInnerBarrelRadius() const { return fMuIDRinner; }
1003 
1004  //Returns the MuID minimum radius of the Outer Barrel
1005  float GetMuIDOuterBarrelRadius() const { return fMuIDRouter; }
1006 
1007  //Returns the number of sides of the barrel MuID
1008  int GetMuIDInnerSymmetry() const { return fMuIDSymmetry; }
1009 
1010  //Returns the inner angle of the polyhedra
1011  float GetMuIDInnerAngle() const { return (( fMuIDSymmetry - 2 ) * M_PI / fMuIDSymmetry); }
1012 
1013  //Returns the side length of the polyhedra MuID
1014  float GetMuIDBarrelSideLength() const { return ( 2 * std::sin( M_PI / fMuIDSymmetry ) * fMuIDRouter ); }
1015 
1016  //Returns the apothem length of the polyhedra MuID
1017  float GetMuIDBarrelApothemLength() const { return ( std::cos( M_PI / fMuIDSymmetry ) * fMuIDRouter ); }
1018 
1019  std::string GetWorldVolumeName() const { return "volWorld"; }
1020 
1021  bool PointInWorld(TVector3 const& point) const;
1022 
1023  bool PointInDetEnclosure(TVector3 const& point) const;
1024 
1025  bool PointInMPD(TVector3 const& point) const;
1026 
1027  bool PointInGArTPC(TVector3 const& point) const;
1028 
1029  bool PointInLArTPC(TVector3 const& point) const;
1030 
1031  bool PointInECALBarrel(TVector3 const& point) const;
1032 
1033  bool PointInECALEndcap(TVector3 const& point) const;
1034 
1035  float GetSensVolumeThickness(const TVector3& point) const;
1036 
1037  const std::array<double, 3> FindShapeSize(const TGeoNode *node) const;
1038 
1039  gar::raw::CellID_t GetCellID(const TGeoNode *node, const unsigned int& det_id, const unsigned int& stave, const unsigned int& module, const unsigned int& layer, const unsigned int& slice, const std::array<double, 3>& localPosition) const;
1040 
1041  const std::string GetECALCellIDEncoding() const;
1042 
1043  const std::string GetMinervaCellIDEncoding() const;
1044 
1045  const std::string GetMuIDCellIDEncoding() const;
1046 
1047  std::array<double, 3> GetPosition(const TGeoNode *node, const gar::raw::CellID_t &cID) const;
1048 
1049  bool isTile(const std::array<double, 3>& point, const gar::raw::CellID_t& cID) const;
1050 
1051  double getStripWidth(const std::array<double, 3>& point) const;
1052 
1053  double getTileSize(const std::array<double, 3>& point) const;
1054 
1055  double getStripLength(const std::array<double, 3>& point, const gar::raw::CellID_t &cID) const;
1056 
1057  std::pair<TVector3, TVector3> GetStripEnds(const std::array<double, 3>& point, const gar::raw::CellID_t &cID) const;
1058 
1059  std::pair<float, float> CalculateLightPropagation(const std::array<double, 3>& point, const std::array<double, 3> &local, const gar::raw::CellID_t &cID) const;
1060 
1061  std::array<double, 3> ReconstructStripHitPosition(const std::array<double, 3>& point, const std::array<double, 3>& local, const float &xlocal, const gar::raw::CellID_t &cID) const;
1062 
1063  protected:
1064 
1065  /// Sets the detector name
1066  void SetDetectorName(std::string new_name) { fDetectorName = new_name; }
1067 
1068  void GetGeometryParameters();
1069  void FinalizeGeometryParameters();
1070  //Prints information on the detector geometry
1071  void PrintGeometry() const;
1072 
1073  void StoreTPCParameters();
1074  void GetDetectorsPresent();
1075 
1076  private:
1077 
1078  void InitVariables();
1079 
1080  /// Deletes the detector geometry structures
1081  void ClearGeometry();
1082 
1083  void StoreECALParameters();
1084  //Muon ID detector
1085  void StoreMuIDParameters();
1086  void StoreOtherParameters();
1087 
1088  void SetDetectorOrigin();
1089 
1090  bool FindWorldVolume();
1091 
1092  bool FindRockVolume();
1093 
1094  bool FindEnclosureVolume();
1095 
1096  bool FindMPDVolume();
1097 
1098  bool FindLArTPCVolume();
1099 
1100  bool FindActiveTPCVolume();
1101 
1102  bool FindActiveLArTPCVolume();
1103 
1104  bool FindGasTPCVolume();
1105 
1106  bool FindECALVolume();
1107 
1108  bool FindMuIDVolume();
1109 
1110  //Sets the ECAL inner barrel minimum radius
1111  bool FindECALInnerBarrelRadius();
1112 
1113  //Sets the ECAL outer barrel minimum radius
1114  bool FindECALOuterBarrelRadius();
1115 
1116  //Sets the ECAL inner endcap minimum radius
1117  bool FindECALInnerEndcapRadius();
1118 
1119  //Sets the ECAL outer endcap minimum radius
1120  bool FindECALOuterEndcapRadius();
1121 
1122  //Sets the PV thickness
1123  bool FindPVThickness();
1124 
1125  //Sets the number of sides of the ecal barrel
1126  bool FindECALInnerSymmetry();
1127 
1128  //Sets the position of the xplane of the ECAL endcap
1129  bool FindECALEndcapStartX();
1130 
1131  //Sets the position of the xplan of the end of the ECAL endcap
1132  bool FindECALEndcapOuterX();
1133 
1134  //Sets the number of layers in the ECAL
1135  bool FindECALnLayers();
1136 
1137  //Sets the ECAL Layered struct
1138  bool MakeECALLayeredCalorimeterData();
1139 
1140  //Sets the MuID inner barrel minimum radius
1141  bool FindMuIDInnerBarrelRadius();
1142 
1143  //Sets the MuID outer barrel minimum radius
1144  bool FindMuIDOuterBarrelRadius();
1145 
1146  //Sets the number of sides of the MuID barrel
1147  bool FindMuIDInnerSymmetry();
1148 
1149  //Sets the number of layers in the MuID
1150  bool FindMuIDnLayers();
1151 
1152  bool FindTrackerScVolume();
1153 
1154  bool FindTrackerScnPlanes();
1155 
1156  double fSurfaceY; ///< The point where air meets earth for this detector.
1157  std::string fDetectorName; ///< Name of the detector.
1158  std::string fGDMLfile; ///< path to geometry file used for Geant4 simulation
1159  std::string fROOTfile; ///< path to geometry file for geometry in GeometryCore
1160  double fMinWireZDist; ///< Minimum distance in Z from a point in which
1161  ///< to look for the closest wire
1162  double fPositionWiggle; ///< accounting for rounding errors when testing positions
1163  bool fPointInWarnings; ///< Generate warnings from failed inputs to PointIn* methods
1164  bool fECALEndcapOutside; ///< Is the ECAL Endcap outside the PV
1165 
1166  float fOriginX = 0.; //Origin of the ND-GAr
1167  float fOriginY = 0.; //Origin of the ND-GAr
1168  float fOriginZ = 0.; //Origin of the ND-GAr
1169 
1170  float fTPCRadius = 0.; ///< Radius of the TPC
1171  float fTPCLength = 0.; ///< length of the TPC
1172 
1173  int fTPCNumDriftVols = 2; ///< 2 if standard ALICE detector, 1 if single drift vol
1174  // we may need to add here a flag saying which side of the TPC the ROCs
1175  // are on if we are to support both of them. And provide initialization
1176  // and a getter
1177 
1178  float fTPCXCent = 0.; ///< center of TPC: X
1179  float fTPCYCent = 0.; ///< center of TPC: Y
1180  float fTPCZCent = 0.; ///< center of TPC: Z
1181 
1182  float fWorldX = 0.;
1183  float fWorldY = 0.;
1184  float fWorldZ = 0.;
1185 
1186  float fRockX = 0.;
1187  float fRockY = 0.;
1188  float fRockZ = 0.;
1189 
1190  float fEnclosureX = 0.;
1191  float fEnclosureY = 0.;
1192  float fEnclosureZ = 0.;
1193 
1194  float fMPDX = 0.;
1195  float fMPDY = 0.;
1196  float fMPDZ = 0.;
1197 
1198  float fLArTPCX = 0.;
1199  float fLArTPCY = 0.;
1200  float fLArTPCZ = 0.;
1201 
1202  float fLArTPCXCent = 0.;
1203  float fLArTPCYCent = 0.;
1204  float fLArTPCZCent = 0.;
1205 
1206  float fWorldHalfWidth = 0.;
1207  float fWorldHalfHeight = 0.;
1208  float fWorldLength = 0.;
1209 
1210  float fRockHalfWidth = 0.;
1211  float fRockHalfHeight = 0.;
1212  float fRockLength = 0.;
1213 
1214  float fEnclosureHalfWidth = 0.;
1215  float fEnclosureHalfHeight = 0.;
1216  float fEnclosureLength = 0.;
1217 
1218  float fMPDHalfWidth = 0.;
1219  float fMPDHalfHeight = 0.;
1220  float fMPDLength = 0.;
1221 
1222  float fLArTPCHalfWidth = 0.;
1223  float fLArTPCHalfHeight = 0.;
1224  float fLArTPCLength = 0.;
1225 
1226  float fLArTPCActiveHalfWidth = 0.;
1227  float fLArTPCActiveHalfHeight = 0.;
1228  float fLArTPCActiveLength = 0.;
1229 
1230  float fGArLiteXCent = 0;
1231  float fGArLiteYCent = 0;
1232  float fGArLiteZCent = 0;
1233 
1234  float fGArLiteRadius = 0;
1235  float fGArLiteLength = 0;
1236 
1237  std::map<std::string, std::vector<const TGeoNode*> > fECALNodePath; ///< Stored map of vectors of nodes for the ecal to speedup node searching
1238 
1239  bool fHasRock;
1245 
1246  //Related to the ECAL
1247  float fECALRinner; ///< Minimum radius of the ECAL inner barrel
1248  float fECALRouter; ///< Minimum radius of the ECAL outer barrel
1251  float fPVThickness; ///< Pressure Vessel thickness
1252  int fECALSymmetry; ///< Number of sides of the Barrel
1253  float fECALEndcapStartX; ///< Position of the start xplane of the ECAL endcap
1254  float fECALEndcapOuterX; ///< Position of the end xplane of the ECAL endcap
1255  unsigned int fECALnLayers; ///< number of ECAL layers from the seg algorithm
1256 
1257  //Related to GArLite
1258  unsigned int fTrackerScnPlanes;
1259 
1260  //Related to the MuID
1262  float fMuIDRinner; ///< Minimum radius of the MuID inner barrel
1263  float fMuIDRouter; ///< Minimum radius of the MuID outer barrel
1264  int fMuIDSymmetry; ///< Number of sides of the MuID Barrel
1265  unsigned int fMuIDnLayers; ///< number of MuID layers from the seg algorithm
1266 
1267  typedef std::shared_ptr<const gar::geo::seg::ChannelMapAlg> ChannelMapPtr;
1268  ChannelMapPtr fChannelMapAlg; ///< Object containing the channel to wire mapping
1269 
1270  typedef std::shared_ptr<const gar::geo::seg::SegmentationAlg> ECALSegmentationAlgPtr;
1271  ECALSegmentationAlgPtr fECALSegmentationAlg; ///< Object containing the segmentation for the ECAL
1272 
1273  typedef std::shared_ptr<const gar::geo::seg::SegmentationAlg> MinervaSegmentationAlgPtr;
1274  MinervaSegmentationAlgPtr fMinervaSegmentationAlg; ///< Object containing the segmentation for the Sc Tracker
1275 
1276  typedef std::shared_ptr<const gar::geo::seg::SegmentationAlg> MuIDSegmentationAlgPtr;
1277  MuIDSegmentationAlgPtr fMuIDSegmentationAlg; ///< Object containing the segmentation for the Sc Tracker
1278 
1279  //ECAL layered struct containing all informations about the ECAL layers
1280  typedef std::map< gar::geo::LayeredCalorimeterData::LayoutType, std::shared_ptr<gar::geo::LayeredCalorimeterData> > ECALLayeredCalorimeterData;
1281  ECALLayeredCalorimeterData fECALLayeredCalorimeterData;
1282 
1283  }; // class GeometryCore
1284 
1285  template<> TGeoNode* GeometryCore::FindNode<float>(float const &x, float const &y, float const &z) const;
1286  template<> TGeoNode* GeometryCore::FindNode<double>(double const &x, double const &y, double const &z) const;
1287 
1288  /** **************************************************************************
1289  * @brief Iterator to navigate through all the nodes
1290  *
1291  * Note that this is not a fully standard forward iterator in that it lacks
1292  * of the postfix operator. The reason is that it's too expensive and it
1293  * should be avoided.
1294  * Also I did not bother declaring the standard type definitions
1295  * (that's just laziness).
1296  *
1297  * An example of iteration:
1298  *
1299  * TGeoNode const* pCurrentNode;
1300  *
1301  * ROOTGeoNodeForwardIterator iNode(geom->ROOTGeoManager()->GetTopNode());
1302  * while ((pCurrentNode = *iNode)) {
1303  * // do something with pCurrentNode
1304  * ++iNode;
1305  * } // while
1306  *
1307  * These iterators are one use only, and they can't be reset after a loop
1308  * is completed.
1309  */
1311  public:
1312  /// Constructor: start from this node
1313  ROOTGeoNodeForwardIterator(TGeoNode const* start_node){ init(start_node); }
1314 
1315  /// Returns the pointer to the current node, or nullptr if none
1316  TGeoNode const* operator* () const { return current_path.empty()? nullptr: current_path.back().self; }
1317 
1318  /// Points to the next node, or to nullptr if there are no more
1319  ROOTGeoNodeForwardIterator& operator++ ();
1320 
1321  /// Returns the full path of the current node
1322  std::vector<TGeoNode const*> get_path() const;
1323 
1324  protected:
1325  using Node_t = TGeoNode const*;
1326  struct NodeInfo_t {
1327  Node_t self; int sibling;
1328  NodeInfo_t(Node_t new_self, int new_sibling)
1329  : self(new_self), sibling(new_sibling) {}
1330  }; // NodeInfo_t
1331 
1332  /// which node, which sibling?
1333  std::vector<NodeInfo_t> current_path;
1334 
1335  void reach_deepest_descendant();
1336 
1337  void init(TGeoNode const* start_node);
1338 
1339  }; // class ROOTGeoNodeForwardIterator
1340 
1341 } // namespace geo
1342 
1343 } // namespace gar
1344 
1345 
1346 //******************************************************************************
1347 //*** template implementation
1348 //***
1349 
1350 //
1351 // comparison operators between ID iterators and element iterators
1352 //
1353 template <typename GEOIDITER>
1354 bool gar::geo::details::operator==
1355 (geometry_element_iterator<GEOIDITER> const& iter, GEOIDITER const& id_iter)
1356 {
1357  return iter.id_iterator() == id_iter;
1358 } // operator==(iterator_t, id_iterator_t)
1359 
1360 template <typename GEOIDITER>
1361 bool gar::geo::details::operator!=
1362 (geometry_element_iterator<GEOIDITER> const& iter, GEOIDITER const& id_iter)
1363 {
1364  return iter.id_iterator() != id_iter;
1365 } // operator!=(iterator_t, id_iterator_t)
1366 
1367 //******************************************************************************
1368 
1369 #endif // GEO_GEOMETRYCORE_H
static QCString name
Definition: declinfo.cpp:673
bool HasRock() const
Definition: GeometryCore.h:981
std::vector< gar::geo::ChanWithPos > ChanWithNeighbors
Definition: GeometryCore.h:91
float GetActiveLArTPCHalfHeight() const
Definition: GeometryCore.h:622
bool fECALEndcapOutside
Is the ECAL Endcap outside the PV.
float GetActiveLArTPCZ() const
Definition: GeometryCore.h:612
float GetEnclosureX() const
Definition: GeometryCore.h:578
float GetEnclosureHalfWidth() const
Definition: GeometryCore.h:584
float fMuIDRouter
Minimum radius of the MuID outer barrel.
float GetRockHalfWidth() const
Definition: GeometryCore.h:572
constexpr auto undefined_pos
std::shared_ptr< const gar::geo::seg::ChannelMapAlg > ChannelMapPtr
typename id_iterator_t::GeoID_t GeoID_t
Definition: GeometryCore.h:256
Base class for geometry iterators, containing some type definitions.
Definition: GeometryCore.h:154
float GetMPDLength() const
Definition: GeometryCore.h:600
std::string GetGArTPCVolumeName() const
Return the name of GAr TPC volume.
Definition: GeometryCore.h:809
float fECALEndcapOuterX
Position of the end xplane of the ECAL endcap.
MinervaSegmentationAlgPtr fMinervaSegmentationAlg
Object containing the segmentation for the Sc Tracker.
int GetECALInnerSymmetry() const
Definition: GeometryCore.h:957
constexpr auto end_pos
bool HasLArTPCDetector() const
Definition: GeometryCore.h:987
float GetActiveLArTPCHalfWidth() const
Definition: GeometryCore.h:620
float fMuIDRinner
Minimum radius of the MuID inner barrel.
float GetRockLength() const
Definition: GeometryCore.h:576
geometry_iterator_base()
Default constructor; do not use a default-constructed iterator as-is!
Definition: GeometryCore.h:182
float GetMuIDInnerBarrelRadius() const
std::string string
Definition: nybbler.cc:12
unsigned int ID
int TPCNumDriftVols() const
Returns number of TPC drift volumes.
Definition: GeometryCore.h:771
float GetWorldY() const
Definition: GeometryCore.h:556
std::shared_ptr< const gar::geo::seg::SegmentationAlg > MinervaSegmentationAlgPtr
float GetMPDZ() const
Definition: GeometryCore.h:594
float GetOriginX() const
Definition: GeometryCore.h:548
float fPVThickness
Pressure Vessel thickness.
typename id_iterator_t::EndPos_t EndPos_t
Definition: GeometryCore.h:259
typename std::remove_pointer< ElementPtr_t >::type Element_t
Geometry class pointed by the iterator.
Definition: GeometryCore.h:271
float GetLArTPCHalfWidth() const
Definition: GeometryCore.h:614
float GArLiteLength() const
Definition: GeometryCore.h:638
ECALSegmentationAlgPtr fECALSegmentationAlg
Object containing the segmentation for the ECAL.
float GetRockZ() const
Definition: GeometryCore.h:570
xmlNodePtr FindNode(xmlDocPtr xml_doc, string node_path)
float TPCXCent() const
Returns the X location of the center of the TPC in cm.
Definition: GeometryCore.h:778
float GArLiteYCent() const
Definition: GeometryCore.h:632
Description of geometry of one entire detector.
Definition: GeometryCore.h:436
iterator begin() const
Definition: GeometryCore.h:378
gar::geo::ROCType roctype
Definition: GeometryCore.h:88
bool fPointInWarnings
Generate warnings from failed inputs to PointIn* methods.
float GetECALOuterEndcapRadius() const
Definition: GeometryCore.h:951
uint8_t channel
Definition: CRTFragment.hh:201
iterator cend() const
Definition: GeometryCore.h:382
init
Definition: train.py:42
bool HasEnclosure() const
Definition: GeometryCore.h:984
bool HasGasTPCDetector() const
Definition: GeometryCore.h:990
float GetPVThickness() const
Definition: GeometryCore.h:954
struct gar::geo::ChanWithPos_ ChanWithPos
geometry_element_iterator(gar::geo::GeometryCore const *geom)
Constructor: points to begin.
Definition: GeometryCore.h:277
float GetMuIDInnerAngle() const
float GetMPDX() const
Definition: GeometryCore.h:590
Class to transform between world and local coordinates.
float fECALRouter
Minimum radius of the ECAL outer barrel.
Forward iterator browsing all geometry elements in the detector.
Definition: GeometryCore.h:192
std::string fROOTfile
path to geometry file for geometry in GeometryCore
float fECALEndcapStartX
Position of the start xplane of the ECAL endcap.
details::geometry_iterator_types::EndPos_t EndPos_t
float GetWorldZ() const
Definition: GeometryCore.h:558
float GetECALInnerAngle() const
Definition: GeometryCore.h:960
float GetLArTPCX() const
Definition: GeometryCore.h:602
details::geometry_iterator_types::BeginPos_t BeginPos_t
float GetOriginZ() const
Definition: GeometryCore.h:552
unsigned int fTrackerScnPlanes
geometry_iterator_base(const gar::geo::GeometryCore *geom)
Constructor: associates with the specified geometry.
Definition: GeometryCore.h:175
typename id_iterator_t::BeginPos_t BeginPos_t
Definition: GeometryCore.h:258
gar::geo::seg::ChannelMapAlg const * ChannelMap() const
Returns the object handling the channel map.
Definition: GeometryCore.h:930
static constexpr double as
Definition: Units.h:101
float GetECALBarrelApothemLength() const
Definition: GeometryCore.h:966
const double e
std::vector< NodeInfo_t > current_path
which node, which sibling?
constexpr auto begin_pos
float TPCRadius() const
Returns the radius of the TPC (y or z direction)
Definition: GeometryCore.h:755
float GetECALInnerEndcapRadius() const
Definition: GeometryCore.h:948
unsigned int fECALnLayers
number of ECAL layers from the seg algorithm
ECALLayeredCalorimeterData fECALLayeredCalorimeterData
IteratorBox(GeometryCore const *geom)
Definition: GeometryCore.h:375
std::string fDetectorName
Name of the detector.
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:364
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
Definition: GeometryCore.h:486
std::map< gar::geo::LayeredCalorimeterData::LayoutType, std::shared_ptr< gar::geo::LayeredCalorimeterData > > ECALLayeredCalorimeterData
float GetActiveLArTPCLength() const
Definition: GeometryCore.h:624
enum gar::geo::ROCType_ ROCType
float GetRockX() const
Definition: GeometryCore.h:566
ROOTGeoNodeForwardIterator(TGeoNode const *start_node)
Constructor: start from this node.
float TPCZCent() const
Returns the Z location of the center of the TPC in cm.
Definition: GeometryCore.h:792
double SurfaceY() const
The position of the detector respect to earth surface.
Definition: GeometryCore.h:538
float GetRockHalfHeight() const
Definition: GeometryCore.h:574
float GetEnclosureZ() const
Definition: GeometryCore.h:582
Iterator to navigate through all the nodes.
float fECALRinner
Minimum radius of the ECAL inner barrel.
bool HasTrackerScDetector() const
Definition: GeometryCore.h:996
float GetOriginY() const
Definition: GeometryCore.h:550
float GetWorldHalfHeight() const
Definition: GeometryCore.h:562
unsigned int fMuIDnLayers
number of MuID layers from the seg algorithm
Definition of basic calo raw digits.
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
static int max(int a, int b)
gar::geo::seg::SegmentationAlg const * ECALSegmentationAlg() const
Returns the object handling the ECAL segmentation.
Definition: GeometryCore.h:933
long long int CellID_t
Definition: CaloRawDigit.h:24
float GetWorldLength() const
Definition: GeometryCore.h:564
int fECALSymmetry
Number of sides of the Barrel.
MuIDSegmentationAlgPtr fMuIDSegmentationAlg
Object containing the segmentation for the Sc Tracker.
typename id_iterator_t::UndefinedPos_t UndefinedPos_t
Definition: GeometryCore.h:257
float GetLArTPCZ() const
Definition: GeometryCore.h:606
gar::geo::seg::SegmentationAlg const * MinervaSegmentationAlg() const
Returns the object handling the Sc Tracker segmentation.
Definition: GeometryCore.h:936
float GetEnclosureHalfHeight() const
Definition: GeometryCore.h:586
typename id_iterator_t::ElementPtr_t ElementPtr_t
Definition: GeometryCore.h:260
double DefaultWiggle() const
Returns the tolerance used in looking for positions.
Definition: GeometryCore.h:468
float GetWorldX() const
Definition: GeometryCore.h:554
float GetECALEndcapStartX() const
Definition: GeometryCore.h:975
float GetMuIDOuterBarrelRadius() const
float GetActiveLArTPCY() const
Definition: GeometryCore.h:610
int fMuIDSymmetry
Number of sides of the MuID Barrel.
#define M_PI
Definition: includeROOT.h:54
float GetECALEndcapApothemLength() const
Definition: GeometryCore.h:972
float GetECALOuterBarrelRadius() const
Definition: GeometryCore.h:945
float GetMuIDBarrelSideLength() const
General GArSoft Utilities.
details::geometry_iterator_types::UndefinedPos_t UndefinedPos_t
bool HasECALDetector() const
Definition: GeometryCore.h:993
std::shared_ptr< const gar::geo::seg::SegmentationAlg > ECALSegmentationAlgPtr
std::map< std::string, std::vector< const TGeoNode * > > fECALNodePath
Stored map of vectors of nodes for the ecal to speedup node searching.
double fMinWireZDist
to look for the closest wire
float GetEnclosureY() const
Definition: GeometryCore.h:580
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
float GArLiteXCent() const
Definition: GeometryCore.h:630
float GetMPDY() const
Definition: GeometryCore.h:592
bool operator!=(GEOIDITER const &id_iter, geometry_element_iterator< GEOIDITER > const &iter)
Comparison operator: geometry ID and element point to different IDs.
Definition: GeometryCore.h:743
float TPCYCent() const
Returns the Y location of the center of the TPC in cm.
Definition: GeometryCore.h:785
float GetEnclosureLength() const
Definition: GeometryCore.h:588
geometry_element_iterator(id_iterator_t const &iter)
Constructor: points to the same element as the specified ID iterator.
Definition: GeometryCore.h:282
bool HasMuonDetector() const
Definition: GeometryCore.h:999
static QCString type
Definition: declinfo.cpp:672
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:359
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
Definition: GeometryCore.h:495
float GetMuIDBarrelApothemLength() const
Base class for geometry iterators (note: this is not an iterator)
Definition: GeometryCore.h:171
float GetMPDHalfHeight() const
Definition: GeometryCore.h:598
static bool * b
Definition: config.cpp:1043
float GetECALInnerBarrelRadius() const
Definition: GeometryCore.h:942
void SetDetectorName(std::string new_name)
Sets the detector name.
float GetLArTPCLength() const
Definition: GeometryCore.h:618
list x
Definition: train.py:276
std::string fGDMLfile
path to geometry file used for Geant4 simulation
float TPCLength() const
Returns the length of the TPC (x direction)
Definition: GeometryCore.h:763
iterator cbegin() const
Definition: GeometryCore.h:381
NodeInfo_t(Node_t new_self, int new_sibling)
LocalID_t const & ID() const
Returns the ID of the pointed geometry element.
Definition: GeometryCore.h:345
float GetECALBarrelSideLength() const
Definition: GeometryCore.h:963
double fSurfaceY
The point where air meets earth for this detector.
double fPositionWiggle
accounting for rounding errors when testing positions
Structures to distinguish the constructors.
Definition: GeometryCore.h:159
float GetRockY() const
Definition: GeometryCore.h:568
QuadExpr operator*(double v, const QuadExpr &e)
Definition: QuadExpr.h:39
iterator end() const
Definition: GeometryCore.h:379
LArSoft geometry interface.
Definition: ChannelGeo.h:16
int GetMuIDInnerSymmetry() const
ChannelMapPtr fChannelMapAlg
Object containing the channel to wire mapping.
gar::geo::seg::SegmentationAlg const * MuIDSegmentationAlg() const
Returns the object handling the MuID segmentation.
Definition: GeometryCore.h:939
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:179
float GetLArTPCY() const
Definition: GeometryCore.h:604
bool operator==(GEOIDITER const &id_iter, geometry_element_iterator< GEOIDITER > const &iter)
Comparison operator: geometry ID and element point to the same ID.
Definition: GeometryCore.h:729
std::string GetWorldVolumeName() const
int bool
Definition: qglobal.h:345
std::string ROOTFile() const
Returns the full directory path to the geometry file source.
Definition: GeometryCore.h:477
float GetActiveLArTPCX() const
Definition: GeometryCore.h:608
float GetMPDHalfWidth() const
Definition: GeometryCore.h:596
std::shared_ptr< const gar::geo::seg::SegmentationAlg > MuIDSegmentationAlgPtr
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::map< gar::geo::LayeredCalorimeterData::LayoutType, std::shared_ptr< gar::geo::LayeredCalorimeterData > > GetECALLayeredCalorimeterData() const
Definition: GeometryCore.h:628
float GetECALEndcapOuterX() const
Definition: GeometryCore.h:978
float GetLArTPCHalfHeight() const
Definition: GeometryCore.h:616
float GetWorldHalfWidth() const
Definition: GeometryCore.h:560
float GArLiteRadius() const
Definition: GeometryCore.h:636
typename id_iterator_t::LocalID_t LocalID_t
types mirrored from the ID iterator
Definition: GeometryCore.h:255
float GetECALEndcapSideLength() const
Definition: GeometryCore.h:969
float GArLiteZCent() const
Definition: GeometryCore.h:634
LayeredCalorimeterStruct LayeredCalorimeterData
Definition: GeometryCore.h:146