LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
AuxDetSensitiveGeo.h
Go to the documentation of this file.
1 
9 #ifndef LARCOREALG_GEOMETRY_AUXDETSENSITIVEGEO_H
10 #define LARCOREALG_GEOMETRY_AUXDETSENSITIVEGEO_H
11 
12 // LArSoft libraries
16 
17 // ROOT libraries
18 #include "TGeoVolume.h"
19 #include "TGeoMatrix.h" // TGeoHMatrix
20 
21 // C/C++ standard libraries
22 #include <vector>
23 
24 
25 class TGeoNode;
26 
27 namespace geo {
28 
31  public:
33 
51 
54 
57 
59 
60  AuxDetSensitiveGeo(std::vector<const TGeoNode*> const& path,
61  int depth);
62  AuxDetSensitiveGeo(const TGeoVolume* volume, TGeoHMatrix const& rotation);
63  AuxDetSensitiveGeo(const TGeoVolume* volume, TGeoHMatrix&& rotation);
64 
72  void GetCenter(double* xyz, double localz=0.0) const;
73 
80  geo::Point_t GetCenter(double localz = 0.0) const;
81 
84 
87  void GetNormalVector(double* xyzDir) const;
88 
89  //box geometry
90  double Length() const { return fLength; }
91  double HalfLength() const { return Length() / 2.0; }
92  double HalfWidth1() const { return fHalfWidth1; }
93  double HalfWidth2() const { return fHalfWidth2; }
94  double HalfCenterWidth() const { return (HalfWidth1() + HalfWidth2()) / 2.0; }
95  double HalfHeight() const { return fHalfHeight; }
96  const TGeoVolume* TotalVolume() const { return fTotalVolume; }
97 
99  geo::Length_t DistanceToPoint(geo::Point_t const& point) const
101  { return (point - GetCenter()).R(); }
102  geo::Length_t DistanceToPoint(double const* point) const;
104 
107 
109  void LocalToWorld(const double* auxdet, double* world) const
110  { fTrans.LocalToWorld(auxdet, world); }
111 
114  { return fTrans.toWorldCoords(local); }
115 
117  void LocalToWorldVect(const double* auxdet, double* world) const
118  { fTrans.LocalToWorldVect(auxdet, world); }
119 
122  { return fTrans.toWorldCoords(local); }
123 
125  void WorldToLocal(const double* world, double* auxdet) const
126  { fTrans.WorldToLocal(world, auxdet); }
127 
130  { return fTrans.toLocalCoords(world); }
131 
133  void WorldToLocalVect(const double* world, double* auxdet) const
134  { fTrans.WorldToLocalVect(world, auxdet); }
135 
138  { return fTrans.toLocalCoords(world); }
139 
141 
142 
162  template <typename Stream>
163  void PrintAuxDetInfo
164  (Stream&& out, std::string indent = "", unsigned int verbosity = 0) const;
165 
167  static constexpr unsigned int MaxVerbosity = 2;
168 
169  private:
170 
173 
175  const TGeoVolume* fTotalVolume;
176  double fLength;
177  double fHalfWidth1;
178  double fHalfWidth2;
179  double fHalfHeight;
180 
182  void InitShapeSize();
183 
184  }; // class AuxDetSensitiveGeo
185 
186 } // namespace geo
187 
188 
189 //------------------------------------------------------------------------------
190 //--- template implementation
191 //---
192 template <typename Stream>
194  Stream&& out,
195  std::string indent /* = "" */,
196  unsigned int verbosity /* = 0 */
197 ) const {
198 
199  //----------------------------------------------------------------------------
200  out << "centered at " << GetCenter() << " cm";
201 
202  if (verbosity-- <= 0) return; // 0
203 
204  //----------------------------------------------------------------------------
206  out << ", size ( " << (2.0 * HalfWidth1());
207  if (coordIs.nonEqual(HalfWidth1(), HalfWidth2()))
208  out << "/" << (2.0 * HalfWidth2());
209  out << " x " << (2.0 * HalfHeight()) << " x " << Length() << " ) cm";
210 
211  if (verbosity-- <= 0) return; // 1
212 
213  //----------------------------------------------------------------------------
214  out << ", normal facing " << GetNormalVector();
215 
216 // if (verbosity-- <= 0) return; // 2
217 
218  //----------------------------------------------------------------------------
219 
220 } // geo::AuxDetSensitiveGeo::PrintAuxDetInfo()
221 
222 
223 //------------------------------------------------------------------------------
224 
225 #endif // LARCOREALG_GEOMETRY_AUXDETSENSITIVEGEO_H
double fLength
length of volume, along z direction in local
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:167
constexpr bool nonEqual(Value_t a, Value_t b) const
Returns whether a and b are farther than the threshold.
void WorldToLocalVect(const double *world, double *auxdet) const
Transform direction vector from world to local.
double Length_t
Type used for coordinates and distances. They are measured in centimeters.
Definition: geo_vectors.h:140
geo::Vector_t GetNormalVector() const
Returns the unit normal vector to the detector.
double HalfCenterWidth() const
Provides simple real number checks.
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
double fHalfWidth1
1st half width of volume, at -z/2 in local coordinates
double fHalfHeight
half height of volume
void LocalToWorld(double const *local, double *world) const
Transforms a point from local frame to world frame.
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
geo::Vector_t toWorldCoords(LocalVector_t const &local) const
Transform direction vector from local to world.
AuxDetSensitiveGeo(std::vector< const TGeoNode * > const &path, int depth)
Class for approximate comparisons.
void InitShapeSize()
Extracts the size of the detector from the geometry information.
LocalVector_t toLocalCoords(geo::Vector_t const &world) const
Transform direction vector from world to local.
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
Local-to-world transformations with LArSoft geometry vectors.
std::string indent(std::size_t const i)
const TGeoVolume * TotalVolume() const
void LocalToWorldVect(const double *auxdet, double *world) const
Transform direction vector from local to world.
geo::Length_t DistanceToPoint(geo::Point_t const &point) const
Returns the distance of point from the center of the detector.
Definition of data types for geometry description.
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this auxiliary sensitive detector.
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
static constexpr unsigned int MaxVerbosity
Maximum verbosity supported by PrintAuxDetInfo().
void WorldToLocal(const double *world, double *auxdet) const
Transform point from world frame to local auxiliary detector frame.
geo::Point3DBase_t< AuxDetSensitiveGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML auxiliary detector frame.
GenPoint3DBase_t< double, C > Point3DBase_t
Type of 3D point with representation in double precision.
Definition: geo_vectors.h:95
double fHalfWidth2
2nd half width (width1==width2 for boxes), at +z/2
GenVector3DBase_t< double, C > Vector3DBase_t
Definition: geo_vectors.h:90
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
void LocalToWorld(const double *auxdet, double *world) const
Transform point from local auxiliary detector frame to world frame.
Float_t e
Definition: plot.C:34
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:187
Namespace collecting geometry-related classes utilities.
LocalPoint_t toLocalCoords(geo::Point_t const &world) const
Transform point from world frame to local auxiliary detector frame.
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.
void GetCenter(double *xyz, double localz=0.0) const
Return the center position of an AuxDet.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local auxiliary detector frame to world frame.
geo::Vector3DBase_t< AuxDetSensitiveGeoCoordinatesTag > LocalVector_t
Type of displacement vectors in the local GDML auxiliary detector frame.