TPCGeo.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file larcorealg/Geometry/TPCGeo.h
3 /// \brief Encapsulate the construction of a single detector plane
4 /// \ingroup Geometry
5 ///
6 /// \author brebel@fnal.gov
7 ////////////////////////////////////////////////////////////////////////
8 #ifndef LARCOREALG_GEOMETRY_TPCGEO_H
9 #define LARCOREALG_GEOMETRY_TPCGEO_H
10 
11 // LArSoft libraries
18 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect
20 
21 // ROOT libraries
22 #include "TGeoVolume.h"
23 #include "TGeoMatrix.h"
24 #include "TVector3.h"
25 
26 // C/C++ standard library
27 #include <set>
28 #include <vector>
29 
30 
31 class TGeoNode;
32 
33 namespace geo {
34 
35  //......................................................................
36  /// @brief Geometry information for a single TPC.
37  /// @ingroup Geometry
38  class TPCGeo: public BoxBoundedGeo {
39 
40  using DefaultVector_t = TVector3; // ... not for long
41  using DefaultPoint_t = TVector3; // ... not for long
42 
43  public:
44 
45  using PlaneCollection_t = std::vector<geo::PlaneGeo>;
47 
48  /// Type returned by `IterateElements()`.
50 
51  /// @{
52  /**
53  * @name Types for geometry-local reference vectors.
54  *
55  * These types represents points and displacement vectors in the reference
56  * frame defined in the TPC geometry box from the GDML geometry
57  * description.
58  *
59  * No alias is explicitly defined for the LArSoft global vector types,
60  * `geo::Point_t` and `geo::Vector_t`.
61  *
62  * Remember the `LocalPoint_t` and `LocalVector_t` vectors from different
63  * instances of `geo::TPCGeo` have the same type but are not compatible.
64  */
65 
66  /// Tag for vectors in the "local" GDML coordinate frame of the TPC.
68 
69  /// Type of points in the local GDML TPC frame.
71 
72  /// Type of displacement vectors in the local GDML TPC frame.
74 
75  ///@}
76 
77  /// Type of 2D vector projection on a plane.
79 
80  /// Data structure with plane and drift projections of a 3D vector.
82 
83 
84  // Construct a representation of a single plane of the detector
85  TPCGeo(
86  TGeoNode const& node, geo::TransformationMatrix&& trans,
87  PlaneCollection_t&& planes
88  );
89 
90 
91  /// @{
92  /// @name TPC properties
93 
94  /// Half width (associated with x coordinate) of active TPC volume [cm].
95  double ActiveHalfWidth() const { return fActiveHalfWidth; }
96  /// Width (associated with x coordinate) of active TPC volume [cm].
97  double ActiveWidth() const { return 2.0 * ActiveHalfWidth(); }
98  /// Half height (associated with y coordinate) of active TPC volume [cm].
99  double ActiveHalfHeight() const { return fActiveHalfHeight; }
100  /// Height (associated with y coordinate) of active TPC volume [cm].
101  double ActiveHeight() const { return 2.0 * ActiveHalfHeight(); }
102  /// Length (associated with z coordinate) of active TPC volume [cm].
103  double ActiveLength() const { return fActiveLength; }
104  /// Length (associated with z coordinate) of active TPC volume [cm].
105  double ActiveHalfLength() const { return fActiveLength / 2.0; }
106  /// Width is associated with x coordinate [cm].
107  double HalfWidth() const { return fHalfWidth; }
108  /// Width is associated with x coordinate [cm].
109  double Width() const { return 2.0 * HalfWidth(); }
110  /// Height is associated with y coordinate [cm].
111  double HalfHeight() const { return fHalfHeight; }
112  /// Height is associated with y coordinate [cm].
113  double Height() const { return 2.0 * HalfHeight(); }
114  /// Length is associated with z coordinate [cm].
115  double Length() const { return fLength; }
116  /// Length is associated with z coordinate [cm].
117  double HalfLength() const { return fLength / 2.0; }
118  double ActiveMass() const { return fActiveVolume->Weight(); }
119  const TGeoVolume* ActiveVolume() const { return fActiveVolume; }
120  const TGeoVolume* TotalVolume() const { return fTotalVolume; }
121 
122  /// Returns the direction `Width()` is measured on.
123  template <typename Vector>
124  decltype(auto) WidthDir() const { return geo::vect::convertTo<Vector>(fWidthDir); }
125 
126  /// Returns the direction `Width()` is measured on.
127  decltype(auto) WidthDir() const { return WidthDir<DefaultVector_t>(); }
128 
129  /// Returns the direction `Height()` is measured on.
130  template <typename Vector>
131  decltype(auto) HeightDir() const { return geo::vect::convertTo<Vector>(fHeightDir); }
132 
133  /// Returns the direction `Height()` is measured on.
134  decltype(auto) HeightDir() const { return HeightDir<DefaultVector_t>(); }
135 
136  /// Returns the direction `Length()` is measured on.
137  template <typename Vector>
138  decltype(auto) LengthDir() const { return geo::vect::convertTo<Vector>(fLengthDir); }
139 
140  /// Returns the direction `Length()` is measured on.
141  decltype(auto) LengthDir() const { return LengthDir<DefaultVector_t>(); }
142 
143  /// Returns an enumerator value describing the drift direction.
145 
146  /// Returns the direction of the drift (vector pointing toward the planes).
147  template <typename Vector>
148  Vector DriftDir() const;
149 
150  /// Returns the direction of the drift (vector pointing toward the planes).
151  DefaultVector_t DriftDir() const { return DriftDir<DefaultVector_t>(); }
152 
153  /// Drift distance is defined as the distance between the last anode plane
154  /// and the opposite face of the TPC, in centimeters.
155  double DriftDistance() const { return ComputeDriftDistance(); }
156 
157  /// @}
158 
159 
160  /// @{
161  /// @name Plane access
162 
163  //@{
164  /// Number of planes in this tpc
165  unsigned int Nplanes() const { return fPlanes.size(); }
166  unsigned int NElements() const { return fPlanes.size(); }
167  //@}
168 
169  //@{
170  /**
171  * @brief Returns whether a plane with index iplane is present in this TPC
172  * @param iplane index of plane in this TPC
173  * @return whether the plane with index iplane is present in this TPC
174  */
175  bool HasPlane(unsigned int iplane) const { return iplane < Nplanes(); }
176  bool HasElement(unsigned int iplane) const { return HasPlane(iplane); }
177  //@}
178 
179  //@{
180  /**
181  * @brief Returns whether the plane in planeid is present in this TPC
182  * @param planeid full plane ID
183  * @return whether the plane in planeid is present in this TPC
184  *
185  * The cryostat and TPC numbers in planeid are ignored, as it is ignored
186  * whether planeid is invalid.
187  */
188  bool HasPlane(geo::PlaneID const& planeid) const
189  { return HasPlane(planeid.Plane); }
190  bool HasElement(geo::PlaneID const& planeid) const
191  { return HasPlane(planeid); }
192  //@}
193 
194  /// Return the plane in the tpc with View_t view.
195  PlaneGeo const& Plane(geo::View_t view) const;
196 
197 
198  /// Return the iplane'th plane in the TPC.
199  /// @throws cet::exception (category "PlaneOutOfRange") if no such plane
200  PlaneGeo const& Plane(unsigned int iplane) const;
201 
202  //@{
203  /**
204  * @brief Returns the plane in planeid from this TPC
205  * @param planeid full plane ID
206  * @return a constant reference to the plane in planeid
207  * @throws cet::exception (category "PlaneOutOfRange") if no such plane
208  *
209  * The cryostat and TPC numbers in planeid are ignored, as it is ignored
210  * whether planeid is invalid.
211  */
212  const PlaneGeo& Plane(PlaneID const& planeid) const
213  { return Plane(planeid.Plane); }
214  const PlaneGeo& GetElement(PlaneID const& planeid) const
215  { return Plane(planeid); }
216  //@}
217 
218  /**
219  * @brief Returns the plane number iplane from this TPC
220  * @param iplane the number of local plane
221  * @return a constant pointer to the plane, or nullptr if it does not exist
222  */
223  PlaneGeo const* PlanePtr(unsigned int iplane) const
224  { return HasPlane(iplane)? &(fPlanes[iplane]): nullptr; }
225 
226  //@{
227  /**
228  * @brief Returns the plane in planeid from this TPC
229  * @param planeid full plane ID
230  * @return a constant pointer to the plane, or nullptr if it does not exist
231  *
232  * The cryostat and TPC numbers in planeid are ignored, as it is ignored
233  * whether planeid is invalid.
234  */
235  PlaneGeo const* PlanePtr(PlaneID const& planeid) const
236  { return PlanePtr(planeid.Plane); }
237  PlaneGeo const* GetElementPtr(PlaneID const& planeid) const
238  { return PlanePtr(planeid); }
239  //@}
240 
241  /// Returns the wire plane with the smallest surface
242  geo::PlaneGeo const& SmallestPlane() const;
243 
244  /// Returns the first wire plane (the closest to TPC center).
245  geo::PlaneGeo const& FirstPlane() const { return fPlanes[0]; }
246 
247  /// Returns the last wire plane (the farther from TPC center).
248  geo::PlaneGeo const& LastPlane() const { return fPlanes[Nplanes() - 1]; }
249 
250  /// @brief Returns the largest number of wires among the planes in this TPC
251  unsigned int MaxWires() const;
252 
253  // @{
254  /**
255  * @brief Returns an object for iterating through all `geo::PlaneGeo`.
256  * @return an (undisclosed) object for iterating through all `geo::PlaneGeo`
257  *
258  * For example, this snippet computes `MaxWires()` of `TPC` (a `TPCGeo`):
259  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
260  * unsigned int maxWires = 0U;
261  * for (geo::PlaneGeo const& plane: TPC.IteratePlanes())
262  * maxWires = std::max(maxWires, plane.Nwires());
263  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
264  * The resulting sequence exposes the planes within the TPC in their
265  * ID order, from plane `0` to `Nplanes() - 1`.
266  */
269  // @}
270 
271  /// Returns a set of all views covered in this TPC.
272  std::set<geo::View_t> Views() const;
273 
274  /// @}
275 
276  /// @{
277  /// @name TPC geometry properties
278 
279  /// Returns the center of the TPC volume in world coordinates [cm]
280  template <typename Point>
281  Point GetCenter() const;
282 
283  /// Returns the center of the TPC volume in world coordinates [cm]
284  DefaultPoint_t GetCenter() const { return GetCenter<DefaultPoint_t>(); }
285 
286  /// Returns the center of the TPC active volume in world coordinates [cm]
287  template <typename Point>
289  { return geo::vect::convertTo<Point>(fActiveCenter); }
290 
291  /// Returns the center of the TPC active volume in world coordinates [cm]
293  { return GetActiveVolumeCenter<DefaultPoint_t>(); }
294 
295  /// Returns the center of the active volume face opposite to the wire planes
296  /// [cm]
297  template <typename Point>
299  { return geo::vect::convertTo<Point>(GetCathodeCenterImpl()); }
300 
301  /// Returns the center of the active volume face opposite to the wire planes
302  /// [cm]
304  { return GetCathodeCenter<DefaultPoint_t>(); }
305 
306  /// Returns the center of the active TPC volume side facing negative _z_.
307  template <typename Point>
309  { return geo::vect::convertTo<Point>(GetFrontFaceCenterImpl()); }
310 
311  /// Returns the center of the active TPC volume side facing negative _z_.
313  { return GetFrontFaceCenter<geo::Point_t>(); }
314 
315  /// Returns the bounding box of this TPC.
317  { return *this; }
318 
319  /// Returns the box of the active volume of this TPC.
321  { return fActiveBox; }
322 
323 
324  /// Returns the coordinates of the center of the specified plane [cm]
325  /// @deprecated Use `Plane(p).GetCenter()` or equivalent.
326  const double* PlaneLocation(unsigned int p) const;
327  double Plane0Pitch(unsigned int p) const;
328  double PlanePitch(unsigned int p1=0,
329  unsigned int p2=1) const;
330  double WirePitch(unsigned plane = 0) const;
331 
332  /// Returns the identifier of this TPC
333  geo::TPCID const& ID() const { return fID; }
334 
335  /// @}
336 
337 
338  /// @{
339  /// @name Projection on a wire plane
340  ///
341  /// These methods deal with projection of points and vectors on a plane,
342  /// using a geometric reference base which is not dependent on the wire
343  /// direction. Technically, the objects are projected on the reference
344  /// plane, that happens to be the first wire plane.
345  /// In practice, the important bit is that all entities are consistently
346  /// decomposed into a drift component and a remaining component. If which
347  /// plane the projection happens on should matter, then geo::PlaneGeo can be
348  /// used directly (but note that geo::PlaneGeo defines _two_ different
349  /// frames, and the names of the frame equivalent to the one used here are
350  /// different).
351  ///
352 
353  /// Returns the plane used for reference by projection methods.
354  geo::PlaneGeo const& ReferencePlane() const { return FirstPlane(); }
355 
356  /// Returns the ID of the plane used for reference by projection methods.
358  { return ReferencePlane().ID(); }
359 
360  //@{
361  /**
362  * @brief Return the direction of reference plane width.
363  * @tparam Vector type of vector to return (current default: `TVector3`)
364  * @see RefDepthDir(), DriftDir()
365  *
366  * The precise definition of the vector is arbitrary, but it is defined
367  * to lie on the wire plane and so that RefWidthDir(), RefDepthDir() and
368  * a vector opposite to DriftDir() make a orthonormal base.
369  * That base (width, depth, normal) is guaranteed to be positive defined.
370  */
371  template <typename Vector>
373  DefaultPoint_t RefWidthDir() const { return RefWidthDir<DefaultPoint_t>(); }
374  //@}
375 
376  //@{
377  /**
378  * @brief Return the direction of reference plane depth.
379  * @tparam Vector type of vector to return (current default: `TVector3`)
380  * @see RefWidthDir(), DriftDir()
381  *
382  * The precise definition of the vector is arbitrary, but it is defined
383  * to lie on the wire plane and so that RefWidthDir(), RefDepthDir() and
384  * a vector opposite to DriftDir() make a orthonormal base.
385  * That base (width, depth, normal) is guaranteed to be positive defined.
386  */
387  template <typename Vector>
389  DefaultPoint_t RefDepthDir() const { return RefDepthDir<DefaultPoint_t>(); }
390  //@}
391 
392 
393  //@{
394  /**
395  * @brief Returns the distance of the specified point from reference plane.
396  * @param point a point in world coordinates [cm]
397  * @return the signed distance from the plane
398  *
399  * The distance is defined positive if the point lies in the inner side
400  * with respect to the reference plane.
401  *
402  * It should match the drift distance from that plane.
403  */
404  double DistanceFromReferencePlane(geo::Point_t const& point) const
405  { return ReferencePlane().DistanceFromPlane(point); }
406  double DistanceFromReferencePlane(TVector3 const& point) const
408  //@}
409 
410 
411  //@{
412  /**
413  * @brief Shifts the position of an electron drifted by a distance.
414  * @param position _(modified)_ the position of the electron
415  * @param distance drift distance to shift the electron by [cm]
416  * @see geo::Plane::DriftPoint(), ReferencePlane()
417  *
418  * This operation is delegated to the reference plane
419  * (see `geo::Plane::DriftPoint()`).
420  */
422  { ReferencePlane().DriftPoint(position, distance); }
423  void DriftPoint(TVector3& position, double distance) const
424  { ReferencePlane().DriftPoint(position, distance); }
425  //@}
426 
427 
428  //@{
429  /**
430  * @brief Decomposes a 3D point in two components.
431  * @param point the point to be decomposed
432  * @return the two components of point, on the plane and orthogonal to it
433  *
434  * The point is decomposed in:
435  *
436  * 1. a component orthogonal to the reference plane, expressed as a signed
437  * real number
438  * 2. a component lying on the reference plane, expressed as a 2D vector
439  *
440  * The distance is from the reference plane
441  * (`DistanceFromReferencePlane()`).
442  * The projection on the plane is obtained following the same convention
443  * as `PointProjection()`.
444  */
446  { return ReferencePlane().DecomposePointWidthDepth(point); }
447  DecomposedVector_t DecomposePoint(TVector3 const& point) const
448  { return DecomposePoint(geo::vect::toPoint(point)); }
449  //@}
450 
451  //@{
452  /**
453  * @brief Returns the reference point used by `PointProjection()`.
454  * @tparam Point type of point to be returned
455  *
456  * The returned point is such that its decomposition results in a null
457  * projection and a 0 distance from the plane.
458  */
459  template <typename Point>
461  { return ReferencePlane().GetCenter<Point>(); }
463  { return ProjectionReferencePoint<DefaultPoint_t>(); }
464  //@}
465 
466  //@{
467  /**
468  * @brief Returns the projection of the specified point on the plane.
469  * @param point the 3D point to be projected, in world coordinates
470  * @return a 2D vector representing the projection of point on the plane
471  *
472  * The returned vector is a 2D vector expressing the projection of the point
473  * (from world coordinates) on the reference plane.
474  * The vector is expressed as @f$ ( w, d ) @f$, components following the
475  * width direction (`RefWidthDir()`) and the depth direction
476  * (`RefDepthDir()`) respectively. The origin point is returned by
477  * `ProjectionReferencePoint()`.
478  * All coordinates are in centimeters.
479  */
481  { return ReferencePlane().PointWidthDepthProjection(point); }
483  { return Projection(point); }
484  Projection_t PointProjection(TVector3 const& point) const
485  { return Projection(geo::vect::toPoint(point)); }
486  //@}
487 
488  //@{
489  /**
490  * @brief Returns the projection of the specified vector on the plane.
491  * @param v the 3D vector to be projected, in world units [cm]
492  * @return a 2D vector representing the projection of v on the plane
493  *
494  * The returned vector is a 2D vector expressing the projection of the
495  * vector (from world units) on the reference plane.
496  * The vector is expressed as @f$ ( w, d ) @f$, components following the
497  * width direction (`RefWidthDir()`) and the depth direction
498  * (`RefDepthDir()`) respectively.
499  * All coordinates are in centimeters.
500  */
504  { return Projection(v); }
505  Projection_t VectorProjection(TVector3 const& v) const
506  { return Projection(geo::vect::toVector(v)); }
507  //@}
508 
509  //@{
510  /**
511  * @brief Returns the 3D vector from composition of projection and distance.
512  * @tparam Point type of point to be returned
513  * @param decomp decomposed point
514  * @return the 3D vector from composition of projection and distance
515  * @see DecomposePoint(), ComposePoint(double, Projection_t const&)
516  *
517  * This is the "inverse" operation respect to `DecomposePoint()`.
518  * The argument stores the two components, orthogonal and parallel to the
519  * plane, and compose them into a 3D point which departs from the reference
520  * point (`ProjectionReferencePoint()`) by those components.
521  * See `ComposePoint(double, Projection_t const&)` for more details.
522  */
523  template <typename Point>
524  Point ComposePoint(DecomposedVector_t const& decomp) const
525  { return ReferencePlane().ComposePoint<Point>(decomp); }
527  { return ComposePoint<DefaultPoint_t>(decomp); }
528  //@}
529 
530  //@{
531  /**
532  * @brief Returns the 3D point from composition of projection and distance.
533  * @tparam Point type of point to be returned
534  * @param distance distance of the target point from the reference plane
535  * @param proj projection of the target point on the reference plane
536  * @return the 3D point from composition of projection and distance
537  * @see DecomposePoint()
538  *
539  * The returned point is the reference point, translated by two 3D vectors:
540  *
541  * 1. a vector parallel to the plane normal, with norm the input distance
542  * 2. a vector lying on the plane, whose projection via `PointProjection()`
543  * gives the input projection
544  *
545  * The choice of the projection reference point embodies the same convention
546  * used in `PointProjection()` and `DecomposePoint()`.
547  *
548  */
549  template <typename Point>
550  Point ComposePoint(double distance, Projection_t const& proj) const
551  { return ReferencePlane().ComposePoint<Point>(distance, proj); }
553  { return ComposePoint<DefaultPoint_t>(distance, proj); }
554  //@}
555 
556  /// @}
557 
558 
559  /// @{
560  /// @name Coordinate transformation
561 
562  /// Transform point from local TPC frame to world frame.
563  void LocalToWorld(const double* tpc, double* world) const
564  { fTrans.LocalToWorld(tpc, world); }
565 
566  /// Transform point from local TPC frame to world frame.
567  TVector3 LocalToWorld(const TVector3& local) const
568  { return fTrans.LocalToWorld<TVector3>(local); }
569 
570  /// Transform point from local TPC frame to world frame.
572  { return fTrans.toWorldCoords(local); }
573 
574  /// Transform direction vector from local to world.
575  void LocalToWorldVect(const double* tpc, double* world) const
576  { fTrans.LocalToWorldVect(tpc, world); }
577 
578  /// Transform direction vector from local to world.
579  TVector3 LocalToWorldVect(const TVector3& local) const
580  { return fTrans.LocalToWorldVect<TVector3>(local); }
581 
582  /// Transform direction vector from local to world.
584  { return fTrans.toWorldCoords(local); }
585 
586  /// Transform point from world frame to local TPC frame.
587  void WorldToLocal(const double* world, double* tpc) const
588  { fTrans.WorldToLocal(world, tpc); }
589 
590  /// Transform point from world frame to local TPC frame.
591  TVector3 WorldToLocal(TVector3 const& world) const
592  { return fTrans.WorldToLocal<TVector3>(world); }
593 
594  /// Transform point from world frame to local TPC frame.
596  { return fTrans.toLocalCoords(world); }
597 
598  /// Transform direction vector from world to local.
599  void WorldToLocalVect(const double* world, double* tpc) const
600  { fTrans.WorldToLocalVect(world, tpc); }
601 
602  /// Transform direction vector from world to local.
603  TVector3 WorldToLocalVect(TVector3 const& world) const
604  { return fTrans.WorldToLocalVect<TVector3>(world); }
605 
606  /// Transform direction vector from world to local.
608  { return fTrans.toLocalCoords(world); }
609 
610  /// @}
611 
612 
613  /**
614  * @brief Returns the expected drift direction based on geometry
615  *
616  * The return value is coded as follow:
617  *
618  * * +1: positive x
619  * * +2: positive y
620  * * +3: positive z
621  * * -1: negative x
622  * * -2: negative y
623  * * -3: negative z
624  * * 0: other (or algorithm failed)
625  *
626  * The current implementation is based on the assumption that electrons in
627  * the middle of TPC will drift toward the wire planes, and it "never
628  * fails".
629  */
630  short int DetectDriftDirection() const;
631 
632 
633 
634  /// Apply sorting to the PlaneGeo objects
635  void SortSubVolumes(geo::GeoObjectSorter const& sorter);
636 
637  /// Performs all updates after cryostat has sorted TPCs
638  void UpdateAfterSorting(geo::TPCID tpcid);
639 
640 
641  /**
642  * @brief Prints information about this TPC.
643  * @tparam Stream type of output stream to use
644  * @param out stream to send the information to
645  * @param indent prepend each line with this string
646  * @param verbosity amount of information printed
647  *
648  * Note that the first line out the output is _not_ indented.
649  *
650  * Verbosity levels
651  * -----------------
652  *
653  * * 0: only TPC ID
654  * * 1 _(default)_: also center and size
655  * * 2: also drift direction, cathode position and number of planes
656  * * 3: also maximum number of wires per plane
657  * * 4: also information on main direction
658  * * 5: also information on bounding box
659  *
660  * The constant `MaxVerbosity` is set to the highest supported verbosity
661  * level.
662  */
663  template <typename Stream>
664  void PrintTPCInfo
665  (Stream&& out, std::string indent = "", unsigned int verbosity = 1) const;
666 
667  /**
668  * @brief Returns a string with information about this TPC.
669  * @see `PrintTPCInfo()`
670  *
671  * Arguments and provided information are the same as in `PrintTPCInfo()`.
672  */
674  (std::string indent = "", unsigned int verbosity = 1) const;
675 
676  /// Maximum verbosity supported by `PrintTPCInfo()`.
677  static constexpr unsigned int MaxVerbosity = 6;
678 
679 
680  /**
681  * @brief Returns whether the specified coordinate is in a range
682  * @param c the coordinate
683  * @param min lower boundary of the range
684  * @param max upper boundary of the range
685  * @param wiggle expansion factor for the range
686  * @return whether the specified coordinate is in a range
687  *
688  * If the wiggle is larger than 1, the range is expanded by the wiggle factor.
689  * If the wiggle is less than 1, the range is shrinked.
690  */
691  static bool CoordinateContained
692  (double c, double min, double max, double wiggle = 1.)
693  {
694  return (c >= (min > 0? min / wiggle: min * wiggle))
695  && (c <= (max < 0? max / wiggle: max * wiggle));
696  } // CoordinateContained()
697 
698  static bool CoordinateContained
699  (double c, double const* range, double wiggle = 1.)
700  { return CoordinateContained(c, range[0], range[1], wiggle); }
701 
702 
703  private:
704 
705  void FindPlane(GeoNodePath_t& path, size_t depth);
706  void MakePlane(GeoNodePath_t& path, size_t depth);
707 
708  private:
709 
711  <ROOT::Math::Transform3D, LocalPoint_t, LocalVector_t>;
712 
713  LocalTransformation_t fTrans; ///< TPC-to-world transformation.
714 
715  PlaneCollection_t fPlanes; ///< List of planes in this plane.
716  TGeoVolume* fActiveVolume; ///< Active volume of LAr, called volTPCActive in GDML file.
717  TGeoVolume* fTotalVolume; ///< Total volume of TPC, called volTPC in GDML file.
718  DriftDirection_t fDriftDirection; ///< Direction of the electron drift in the TPC.
719  std::vector<double> fPlane0Pitch; ///< Pitch between planes.
720  std::vector< std::vector<double> > fPlaneLocation; ///< xyz locations of planes in the TPC.
721  geo::Point_t fActiveCenter; ///< Center of the active volume, in world coordinates [cm].
722 
723  double fActiveHalfWidth; ///< Half width of active volume.
724  double fActiveHalfHeight; ///< Half height of active volume.
725  double fActiveLength; ///< Length of active volume.
726  double fHalfWidth; ///< Half width of total volume.
727  double fHalfHeight; ///< Half height of total volume.
728  double fLength; ///< Length of total volume.
729 
730  geo::Vector_t fWidthDir; ///< Direction width refers to.
731  geo::Vector_t fHeightDir; ///< Direction height refers to.
732  geo::Vector_t fLengthDir; ///< Direction length refers to.
733  geo::Vector_t fDriftDir; ///< Direction electrons drift along.
734 
735  geo::BoxBoundedGeo fActiveBox; ///< Box of the active volume.
736 
737  geo::TPCID fID; ///< ID of this TPC.
738 
739  /// Index of the plane for each view (InvalidID if none).
740  std::vector<geo::PlaneID::PlaneID_t> fViewToPlaneNumber;
741 
742  /// Recomputes the drift direction; needs planes to have been initialised.
743  void ResetDriftDirection();
744 
745  /// Computes the distance between the cathode and the last wire plane
746  /// (last respect to the sorting order).
747  double ComputeDriftDistance() const;
748 
749  /// Refills the plane vs. view cache of the TPC.
750  void UpdatePlaneViewCache();
751 
752  /// Updates plane cached information.
753  void UpdatePlaneCache();
754 
755  /// Recomputes the TPC boundary.
756  void InitTPCBoundaries();
757 
758  /// Sorts (in place) the specified `PlaneGeo` objects by drift distance.
759  void SortPlanes(std::vector<geo::PlaneGeo>&) const;
760 
763 
764  };
765 }
766 
767 
768 //------------------------------------------------------------------------------
769 //--- template implementation
770 //---
771 //------------------------------------------------------------------------------
772 template <typename Vector>
774  { return geo::vect::convertTo<Vector>(fDriftDir); }
775 
776 
777 //------------------------------------------------------------------------------
778 template <typename Point>
780 
781  // convert the origin (default constructed TVector)
782  return geo::vect::convertTo<Point>(toWorldCoords(LocalPoint_t{ 0.0, 0.0, 0.0 }));
783 
784 } // geo::TPCGeo::GetCenter()
785 
786 
787 //------------------------------------------------------------------------------
788 template <typename Stream>
790  Stream&& out,
791  std::string indent /* = "" */,
792  unsigned int verbosity /* = 1 */
793 ) const {
794 
795  //----------------------------------------------------------------------------
796  out << "TPC " << std::string(ID());
797 
798  if (verbosity-- <= 0) return; // 0
799 
800  //----------------------------------------------------------------------------
801  out
802  << " (" << Width() << " x " << Height() << " x " << Length() << ") cm^3 at "
803  << GetCenter<geo::Point_t>();
804 
805  if (verbosity-- <= 0) return; // 1
806 
807  //----------------------------------------------------------------------------
808 
809  out << "\n" << indent
810  << "drift direction " << DriftDir<geo::Vector_t>()
811  << " from cathode around " << GetCathodeCenter<geo::Point_t>()
812  << " through " << DriftDistance() << " cm toward "
813  << Nplanes() << " wire planes"
814  ;
815 
816  if (verbosity-- <= 0) return; // 2
817 
818  //----------------------------------------------------------------------------
819  out << "\n" << indent
820  << "maximum wires on any plane: " << MaxWires();
821 
822  if (verbosity-- <= 0) return; // 3
823 
824  //----------------------------------------------------------------------------
825  out << "\n" << indent
826  << "active volume ("
827  << ActiveWidth() << " x " << ActiveHeight() << " x " << ActiveLength()
828  << ") cm^3, front face at " << GetFrontFaceCenter<geo::Point_t>()
829  << " cm;"
830  << "\n" << indent << "main directions:"
831  << " width " << WidthDir<geo::Vector_t>()
832  << " height " << HeightDir<geo::Vector_t>()
833  << " length " << LengthDir<geo::Vector_t>()
834  ;
835 
836  if (verbosity-- <= 0) return; // 4
837 
838  //----------------------------------------------------------------------------
839  // print also the containing box
840  geo::BoxBoundedGeo const& box = BoundingBox();
841  out << "\n" << indent
842  << "bounding box: " << box.Min() << " -- " << box.Max();
843 
844 // if (verbosity-- <= 0) return; // 5
845 
846  //----------------------------------------------------------------------------
847  // print also the active box
848  geo::BoxBoundedGeo const& activeBox = ActiveBoundingBox();
849  out << "\n" << indent
850  << "active volume box: " << activeBox.Min() << " -- " << activeBox.Max();
851 
852 // if (verbosity-- <= 0) return; // 6
853 
854  //----------------------------------------------------------------------------
855 } // geo::TPCGeo::PrintTPCInfo()
856 
857 #endif // LARCOREALG_GEOMETRY_TPCGEO_H
858 ////////////////////////////////////////////////////////////////////////
geo::TPCID const & ID() const
Returns the identifier of this TPC.
Definition: TPCGeo.h:333
void InitTPCBoundaries()
Recomputes the TPC boundary.
Definition: TPCGeo.cxx:464
double DistanceFromReferencePlane(TVector3 const &point) const
Definition: TPCGeo.h:406
geo::Point_t GetCathodeCenterImpl() const
Definition: TPCGeo.cxx:330
DefaultPoint_t ComposePoint(DecomposedVector_t const &decomp) const
Definition: TPCGeo.h:526
PlaneGeo const * PlanePtr(PlaneID const &planeid) const
Returns the plane in planeid from this TPC.
Definition: TPCGeo.h:235
bool HasPlane(unsigned int iplane) const
Returns whether a plane with index iplane is present in this TPC.
Definition: TPCGeo.h:175
Utilities to extend the interface of geometry vectors.
const PlaneGeo & Plane(PlaneID const &planeid) const
Returns the plane in planeid from this TPC.
Definition: TPCGeo.h:212
void DriftPoint(TVector3 &position, double distance) const
Definition: TPCGeo.h:423
Vector DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
Definition: TPCGeo.h:773
geo::BoxBoundedGeo fActiveBox
Box of the active volume.
Definition: TPCGeo.h:735
std::vector< double > fPlane0Pitch
Pitch between planes.
Definition: TPCGeo.h:719
double PlanePitch(unsigned int p1=0, unsigned int p2=1) const
Definition: TPCGeo.cxx:388
WidthDepthProjection_t VectorWidthDepthProjection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: PlaneGeo.h:1127
void UpdatePlaneCache()
Updates plane cached information.
Definition: TPCGeo.cxx:506
void PrintTPCInfo(Stream &&out, std::string indent="", unsigned int verbosity=1) const
Prints information about this TPC.
Definition: TPCGeo.h:789
Point GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Definition: TPCGeo.h:288
void MakePlane(GeoNodePath_t &path, size_t depth)
Point ComposePoint(double distance, Projection_t const &proj) const
Returns the 3D point from composition of projection and distance.
Definition: TPCGeo.h:550
std::vector< geo::PlaneGeo > PlaneCollection_t
Definition: TPCGeo.h:45
void FindPlane(GeoNodePath_t &path, size_t depth)
geo::Vector_t toWorldCoords(LocalVector_t const &local) const
Transform direction vector from local to world.
Definition: TPCGeo.h:583
double DistanceFromReferencePlane(geo::Point_t const &point) const
Returns the distance of the specified point from reference plane.
Definition: TPCGeo.h:404
Projection_t VectorProjection(geo::Vector_t const &v) const
Definition: TPCGeo.h:503
LocalVector_t toLocalCoords(geo::Vector_t const &world) const
Transform direction vector from world to local.
Definition: TPCGeo.h:607
decltype(auto) LengthDir() const
Returns the direction Length() is measured on.
Definition: TPCGeo.h:138
double fLength
Length of total volume.
Definition: TPCGeo.h:728
geo::Point3DBase_t< TPCGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: TPCGeo.h:70
Point ComposePoint(DecomposedVector_t const &decomp) const
Returns the 3D vector from composition of projection and distance.
Definition: TPCGeo.h:524
DefaultPoint_t RefWidthDir() const
Definition: TPCGeo.h:373
double ComputeDriftDistance() const
Definition: TPCGeo.cxx:450
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::string string
Definition: nybbler.cc:12
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:99
const TGeoVolume * TotalVolume() const
Definition: TPCGeo.h:120
unsigned int Nplanes() const
Number of planes in this tpc.
Definition: TPCGeo.h:165
double fActiveHalfWidth
Half width of active volume.
Definition: TPCGeo.h:723
Projection_t PointProjection(TVector3 const &point) const
Definition: TPCGeo.h:484
Point GetCathodeCenter() const
Definition: TPCGeo.h:298
geo::Point_t GetFrontFaceCenterImpl() const
Definition: TPCGeo.cxx:374
The data type to uniquely identify a Plane.
Definition: geo_types.h:472
Geometry information for a single TPC.
Definition: TPCGeo.h:38
geo::PlaneGeo const & FirstPlane() const
Returns the first wire plane (the closest to TPC center).
Definition: TPCGeo.h:245
::geo::Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
PlaneCollection_t fPlanes
List of planes in this plane.
Definition: TPCGeo.h:715
geo::BoxBoundedGeo const & ActiveBoundingBox() const
Returns the box of the active volume of this TPC.
Definition: TPCGeo.h:320
Point ComposePoint(WireDecomposedVector_t const &decomp) const
Returns the 3D point from composition of projection and distance.
Definition: PlaneGeo.h:1024
::geo::Vector_t toVector(Vector const &v)
Convert the specified vector into a geo::Vector_t.
std::vector< geo::PlaneID::PlaneID_t > fViewToPlaneNumber
Index of the plane for each view (InvalidID if none).
Definition: TPCGeo.h:740
WidthDepthProjection_t PointWidthDepthProjection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: PlaneGeo.h:1107
Vector RefWidthDir() const
Return the direction of reference plane width.
Definition: TPCGeo.h:372
double ActiveMass() const
Definition: TPCGeo.h:118
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:164
geo::Vector3DBase_t< TPCGeoCoordinatesTag > LocalVector_t
Type of displacement vectors in the local GDML TPC frame.
Definition: TPCGeo.h:73
void LocalToWorld(double const *local, double *world) const
Transforms a point from local frame to world frame.
double HalfLength() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:117
void UpdateAfterSorting(geo::TPCID tpcid)
Performs all updates after cryostat has sorted TPCs.
Definition: TPCGeo.cxx:220
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
TVector3 WorldToLocal(TVector3 const &world) const
Transform point from world frame to local TPC frame.
Definition: TPCGeo.h:591
static bool CoordinateContained(double c, double min, double max, double wiggle=1.)
Returns whether the specified coordinate is in a range.
Definition: TPCGeo.h:692
DefaultPoint_t ProjectionReferencePoint() const
Definition: TPCGeo.h:462
void SortSubVolumes(geo::GeoObjectSorter const &sorter)
Apply sorting to the PlaneGeo objects.
Definition: TPCGeo.cxx:201
geo::Vector_t fHeightDir
Direction height refers to.
Definition: TPCGeo.h:731
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:571
geo::TPCID fID
ID of this TPC.
Definition: TPCGeo.h:737
double Width() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:109
double Height() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:113
DefaultPoint_t RefDepthDir() const
Definition: TPCGeo.h:389
TVector3 LocalToWorld(const TVector3 &local) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:567
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: PlaneGeo.h:643
double Length() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:115
Interface to algorithm class for sorting geo::XXXGeo objects.
TPCGeo(TGeoNode const &node, geo::TransformationMatrix &&trans, PlaneCollection_t &&planes)
Definition: TPCGeo.cxx:40
Point ProjectionReferencePoint() const
Returns the reference point used by PointProjection().
Definition: TPCGeo.h:460
Projection_t Projection(geo::Vector_t const &v) const
Returns the projection of the specified vector on the plane.
Definition: TPCGeo.h:501
ROOT::Math::DisplacementVector2D< ROOT::Math::Cartesian2D< double >, WidthDepthReferenceTag > WidthDepthProjection_t
Definition: PlaneGeo.h:151
geo::Vector_t fWidthDir
Direction width refers to.
Definition: TPCGeo.h:730
double ActiveHalfLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:105
double fHalfWidth
Half width of total volume.
Definition: TPCGeo.h:726
Vector RefDepthDir() const
Return the direction of reference plane depth.
Definition: TPCGeo.h:388
WidthDepthDecomposer_t::DecomposedVector_t WDDecomposedVector_t
Definition: PlaneGeo.h:163
geo::PlaneGeo const & SmallestPlane() const
Returns the wire plane with the smallest surface.
Definition: TPCGeo.cxx:276
enum geo::driftdir DriftDirection_t
Drift direction: positive or negative.
Local-to-world transformations with LArSoft geometry vectors.
double fActiveLength
Length of active volume.
Definition: TPCGeo.h:725
geo::PlaneGeo::WDDecomposedVector_t DecomposedVector_t
Data structure with plane and drift projections of a 3D vector.
Definition: TPCGeo.h:81
PlaneCollection_t const & ElementIteratorBox
Type returned by IterateElements().
Definition: TPCGeo.h:49
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:95
ElementIteratorBox IterateElements() const
Returns an object for iterating through all geo::PlaneGeo.
Definition: TPCGeo.cxx:308
void WorldToLocal(const double *world, double *tpc) const
Transform point from world frame to local TPC frame.
Definition: TPCGeo.h:587
Point GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:479
Geometry information for a single wire plane.The plane is represented in the geometry by a solid whic...
Definition: PlaneGeo.h:82
TVector3 DefaultPoint_t
Definition: TPCGeo.h:41
bool HasElement(geo::PlaneID const &planeid) const
Definition: TPCGeo.h:190
geo::PlaneGeo::WidthDepthProjection_t Projection_t
Type of 2D vector projection on a plane.
Definition: TPCGeo.h:78
void UpdatePlaneViewCache()
Refills the plane vs. view cache of the TPC.
Definition: TPCGeo.cxx:489
p
Definition: test.py:223
bool HasPlane(geo::PlaneID const &planeid) const
Returns whether the plane in planeid is present in this TPC.
Definition: TPCGeo.h:188
bool HasElement(unsigned int iplane) const
Definition: TPCGeo.h:176
TGeoVolume * fTotalVolume
Total volume of TPC, called volTPC in GDML file.
Definition: TPCGeo.h:717
DriftDirection_t fDriftDirection
Direction of the electron drift in the TPC.
Definition: TPCGeo.h:718
const TGeoVolume * ActiveVolume() const
Definition: TPCGeo.h:119
double WirePitch(unsigned plane=0) const
Definition: TPCGeo.cxx:396
const PlaneGeo & GetElement(PlaneID const &planeid) const
Definition: TPCGeo.h:214
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
double ActiveHeight() const
Height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:101
geo::Point_t Min() const
Returns the corner point with the smallest coordinates.
static int max(int a, int b)
The data type to uniquely identify a TPC.
Definition: geo_types.h:386
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
DefaultVector_t DriftDir() const
Returns the direction of the drift (vector pointing toward the planes).
Definition: TPCGeo.h:151
TVector3 WorldToLocalVect(TVector3 const &world) const
Transform direction vector from world to local.
Definition: TPCGeo.h:603
unsigned int MaxWires() const
Returns the largest number of wires among the planes in this TPC.
Definition: TPCGeo.cxx:297
Definition of data types for geometry description.
double Plane0Pitch(unsigned int p) const
Definition: TPCGeo.cxx:324
DriftDirection_t DriftDirection() const
Returns an enumerator value describing the drift direction.
Definition: TPCGeo.h:144
void SortPlanes(std::vector< geo::PlaneGeo > &) const
Sorts (in place) the specified PlaneGeo objects by drift distance.
Definition: TPCGeo.cxx:529
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:103
Provides a base class aware of world box coordinates.
Projection_t Projection(geo::Point_t const &point) const
Returns the projection of the specified point on the plane.
Definition: TPCGeo.h:480
std::vector< std::vector< double > > fPlaneLocation
xyz locations of planes in the TPC.
Definition: TPCGeo.h:720
Encapsulate the geometry of a wire.
Tag for vectors in the "local" GDML coordinate frame of the TPC.
Definition: TPCGeo.h:67
geo::PlaneGeo const & ReferencePlane() const
Returns the plane used for reference by projection methods.
Definition: TPCGeo.h:354
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:111
Vector DepthDir() const
Return the direction of plane depth.
Definition: PlaneGeo.h:236
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:184
DecomposedVector_t DecomposePoint(TVector3 const &point) const
Definition: TPCGeo.h:447
std::string TPCInfo(std::string indent="", unsigned int verbosity=1) const
Returns a string with information about this TPC.
Definition: TPCGeo.cxx:244
Projection_t VectorProjection(TVector3 const &v) const
Definition: TPCGeo.h:505
void LocalToWorldVect(const double *tpc, double *world) const
Transform direction vector from local to world.
Definition: TPCGeo.h:575
TGeoVolume * fActiveVolume
Active volume of LAr, called volTPCActive in GDML file.
Definition: TPCGeo.h:716
double DriftDistance() const
Definition: TPCGeo.h:155
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
decltype(auto) HeightDir() const
Returns the direction Height() is measured on.
Definition: TPCGeo.h:131
Selection of the type of transformation matrix used in geometry.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
std::vector< TGeoNode const * > GeoNodePath_t
Definition: WireGeo.h:72
Encapsulate the construction of a single detector plane.
double DistanceFromPlane(geo::Point_t const &point) const
Returns the distance of the specified point from the wire plane.
Definition: PlaneGeo.h:621
PlaneGeo const * PlanePtr(unsigned int iplane) const
Returns the plane number iplane from this TPC.
Definition: TPCGeo.h:223
PlaneGeo const * GetElementPtr(PlaneID const &planeid) const
Definition: TPCGeo.h:237
short int DetectDriftDirection() const
Returns the expected drift direction based on geometry.
Definition: TPCGeo.cxx:157
Point GetFrontFaceCenter() const
Returns the center of the active TPC volume side facing negative z.
Definition: TPCGeo.h:308
DefaultPoint_t GetCathodeCenter() const
Definition: TPCGeo.h:303
double ActiveWidth() const
Width (associated with x coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:97
geo::PlaneID const & ID() const
Returns the identifier of this plane.
Definition: PlaneGeo.h:203
geo::PlaneGeo const & LastPlane() const
Returns the last wire plane (the farther from TPC center).
Definition: TPCGeo.h:248
geo::Vector_t fLengthDir
Direction length refers to.
Definition: TPCGeo.h:732
geo::BoxBoundedGeo const & BoundingBox() const
Returns the bounding box of this TPC.
Definition: TPCGeo.h:316
unsigned int NElements() const
Definition: TPCGeo.h:166
LocalTransformation_t fTrans
TPC-to-world transformation.
Definition: TPCGeo.h:713
geo::WireGeo::GeoNodePath_t GeoNodePath_t
Definition: TPCGeo.h:46
void ResetDriftDirection()
Recomputes the drift direction; needs planes to have been initialised.
Definition: TPCGeo.cxx:402
DefaultPoint_t ComposePoint(double distance, Projection_t const &proj) const
Definition: TPCGeo.h:552
DecomposedVector_t DecomposePoint(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: TPCGeo.h:445
void WorldToLocalVect(const double *world, double *tpc) const
Transform direction vector from world to local.
Definition: TPCGeo.h:599
Vector WidthDir() const
Return the direction of plane width.
Definition: PlaneGeo.h:221
WDDecomposedVector_t DecomposePointWidthDepth(geo::Point_t const &point) const
Decomposes a 3D point in two components.
Definition: PlaneGeo.h:1088
geo::Vector_t fDriftDir
Direction electrons drift along.
Definition: TPCGeo.h:733
GenPoint3DBase_t< double, C > Point3DBase_t
Type of 3D point with representation in double precision.
Definition: geo_vectors.h:92
GenVector3DBase_t< double, C > Vector3DBase_t
Definition: geo_vectors.h:87
std::set< geo::View_t > Views() const
Returns a set of all views covered in this TPC.
Definition: TPCGeo.cxx:313
geo::PlaneID const & ReferencePlaneID() const
Returns the ID of the plane used for reference by projection methods.
Definition: TPCGeo.h:357
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
Definition: TPCGeo.cxx:263
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
TVector3 DefaultVector_t
Definition: TPCGeo.h:40
ElementIteratorBox IteratePlanes() const
Definition: TPCGeo.h:268
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintTPCInfo().
Definition: TPCGeo.h:677
LArSoft geometry interface.
Definition: ChannelGeo.h:16
Projection_t PointProjection(geo::Point_t const &point) const
Definition: TPCGeo.h:482
TVector3 LocalToWorldVect(const TVector3 &local) const
Transform direction vector from local to world.
Definition: TPCGeo.h:579
geo::Point_t fActiveCenter
Center of the active volume, in world coordinates [cm].
Definition: TPCGeo.h:721
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.
DefaultPoint_t GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Definition: TPCGeo.h:292
geo::Point_t Max() const
Returns the corner point with the largest coordinates.
void LocalToWorld(const double *tpc, double *world) const
Transform point from local TPC frame to world frame.
Definition: TPCGeo.h:563
LocalPoint_t toLocalCoords(geo::Point_t const &world) const
Transform point from world frame to local TPC frame.
Definition: TPCGeo.h:595
const double * PlaneLocation(unsigned int p) const
Definition: TPCGeo.cxx:382
geo::Point_t GetFrontFaceCenter() const
Returns the center of the active TPC volume side facing negative z.
Definition: TPCGeo.h:312
double fHalfHeight
Half height of total volume.
Definition: TPCGeo.h:727
double HalfWidth() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:107
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.
DefaultPoint_t GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:284
decltype(auto) WidthDir() const
Returns the direction Width() is measured on.
Definition: TPCGeo.h:124
double fActiveHalfHeight
Half height of active volume.
Definition: TPCGeo.h:724
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:779
void DriftPoint(geo::Point_t &position, double distance) const
Shifts the position of an electron drifted by a distance.
Definition: TPCGeo.h:421