LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
geo::AuxDetSensitiveGeo Class Reference

#include "AuxDetSensitiveGeo.h"

Classes

struct  AuxDetSensitiveGeoCoordinatesTag
 

Public Types

Types for geometry-local reference vectors.

These types represents points and displacement vectors in the reference frame defined in the auxiliary detector geometry box from the GDML geometry description.

No alias is explicitly defined for the LArSoft global vector types, geo::Point_t and geo::Vector_t.

Remember the LocalPoint_t and LocalVector_t vectors from different instances of geo::AuxDetSensitiveGeo have the same type but are not compatible.

using LocalPoint_t = geo::Point3DBase_t< AuxDetSensitiveGeoCoordinatesTag >
 Type of points in the local GDML auxiliary detector frame. More...
 
using LocalVector_t = geo::Vector3DBase_t< AuxDetSensitiveGeoCoordinatesTag >
 Type of displacement vectors in the local GDML auxiliary detector frame. More...
 

Public Member Functions

 AuxDetSensitiveGeo (std::vector< const TGeoNode * > const &path, int depth)
 
 AuxDetSensitiveGeo (const TGeoVolume *volume, TGeoHMatrix const &rotation)
 
 AuxDetSensitiveGeo (const TGeoVolume *volume, TGeoHMatrix &&rotation)
 
void GetCenter (double *xyz, double localz=0.0) const
 Return the center position of an AuxDet. More...
 
geo::Point_t GetCenter (double localz=0.0) const
 Returns the geometric center of the sensitive volume. More...
 
geo::Vector_t GetNormalVector () const
 Returns the unit normal vector to the detector. More...
 
void GetNormalVector (double *xyzDir) const
 
double Length () const
 
double HalfLength () const
 
double HalfWidth1 () const
 
double HalfWidth2 () const
 
double HalfCenterWidth () const
 
double HalfHeight () const
 
const TGeoVolume * TotalVolume () const
 
template<typename Stream >
void PrintAuxDetInfo (Stream &&out, std::string indent="", unsigned int verbosity=0) const
 Prints information about this auxiliary sensitive detector. More...
 
geo::Length_t DistanceToPoint (geo::Point_t const &point) const
 Returns the distance of point from the center of the detector. More...
 
geo::Length_t DistanceToPoint (double const *point) const
 Returns the distance of point from the center of the detector. More...
 
Coordinate transformation
void LocalToWorld (const double *auxdet, double *world) const
 Transform point from local auxiliary detector frame to world frame. More...
 
geo::Point_t toWorldCoords (LocalPoint_t const &local) const
 Transform point from local auxiliary detector frame to world frame. More...
 
void LocalToWorldVect (const double *auxdet, double *world) const
 Transform direction vector from local to world. More...
 
geo::Vector_t toWorldCoords (LocalVector_t const &local) const
 Transform direction vector from local to world. More...
 
void WorldToLocal (const double *world, double *auxdet) const
 Transform point from world frame to local auxiliary detector frame. More...
 
LocalPoint_t toLocalCoords (geo::Point_t const &world) const
 Transform point from world frame to local auxiliary detector frame. More...
 
void WorldToLocalVect (const double *world, double *auxdet) const
 Transform direction vector from world to local. More...
 
LocalVector_t toLocalCoords (geo::Vector_t const &world) const
 Transform direction vector from world to local. More...
 

Static Public Attributes

static constexpr unsigned int MaxVerbosity = 2
 Maximum verbosity supported by PrintAuxDetInfo(). More...
 

Private Types

using LocalTransformation_t = geo::LocalTransformationGeo< TGeoHMatrix, LocalPoint_t, LocalVector_t >
 

Private Member Functions

void InitShapeSize ()
 Extracts the size of the detector from the geometry information. More...
 

Private Attributes

LocalTransformation_t fTrans
 Auxiliary detector-to-world transformation. More...
 
const TGeoVolume * fTotalVolume
 Total volume of AuxDet, called vol*. More...
 
double fLength
 length of volume, along z direction in local More...
 
double fHalfWidth1
 1st half width of volume, at -z/2 in local coordinates More...
 
double fHalfWidth2
 2nd half width (width1==width2 for boxes), at +z/2 More...
 
double fHalfHeight
 half height of volume More...
 

Detailed Description

Definition at line 30 of file AuxDetSensitiveGeo.h.

Member Typedef Documentation

Type of points in the local GDML auxiliary detector frame.

Definition at line 53 of file AuxDetSensitiveGeo.h.

Type of displacement vectors in the local GDML auxiliary detector frame.

Definition at line 56 of file AuxDetSensitiveGeo.h.

Constructor & Destructor Documentation

geo::AuxDetSensitiveGeo::AuxDetSensitiveGeo ( std::vector< const TGeoNode * > const &  path,
int  depth 
)

Definition at line 26 of file AuxDetSensitiveGeo.cxx.

References fTotalVolume, InitShapeSize(), and LOG_DEBUG.

27  : fTrans(path, depth)
28  {
29 
30  fTotalVolume = path[depth]->GetVolume();
31  if(!fTotalVolume){
32  throw cet::exception("AuxDetSensitiveGeo") << "cannot find AuxDetSensitive volume\n";
33  }
34 
35  LOG_DEBUG("Geometry") << "detector sensitive total volume is " << fTotalVolume->GetName();
36 
37  InitShapeSize();
38 
39  }
void InitShapeSize()
Extracts the size of the detector from the geometry information.
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
#define LOG_DEBUG(id)
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
geo::AuxDetSensitiveGeo::AuxDetSensitiveGeo ( const TGeoVolume *  volume,
TGeoHMatrix const &  rotation 
)

Definition at line 42 of file AuxDetSensitiveGeo.cxx.

References fTotalVolume, InitShapeSize(), and LOG_DEBUG.

44  : fTrans(rotation)
45  , fTotalVolume(volume)
46  {
47  assert(fTotalVolume);
48  LOG_DEBUG("Geometry") << "detector sensitive total volume is " << fTotalVolume->GetName();
49 
50  InitShapeSize();
51 
52  }
void InitShapeSize()
Extracts the size of the detector from the geometry information.
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
#define LOG_DEBUG(id)
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
geo::AuxDetSensitiveGeo::AuxDetSensitiveGeo ( const TGeoVolume *  volume,
TGeoHMatrix &&  rotation 
)

Definition at line 55 of file AuxDetSensitiveGeo.cxx.

References fTotalVolume, InitShapeSize(), and LOG_DEBUG.

57  : fTrans(std::move(rotation))
58  , fTotalVolume(volume)
59  {
60  assert(fTotalVolume);
61  LOG_DEBUG("Geometry") << "detector sensitive total volume is " << fTotalVolume->GetName();
62 
63  InitShapeSize();
64 
65  }
void InitShapeSize()
Extracts the size of the detector from the geometry information.
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
#define LOG_DEBUG(id)
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.

Member Function Documentation

geo::Length_t geo::AuxDetSensitiveGeo::DistanceToPoint ( geo::Point_t const &  point) const
inline

Returns the distance of point from the center of the detector.

Definition at line 100 of file AuxDetSensitiveGeo.h.

Referenced by DistanceToPoint(), and TotalVolume().

101  { return (point - GetCenter()).R(); }
void GetCenter(double *xyz, double localz=0.0) const
Return the center position of an AuxDet.
geo::Length_t geo::AuxDetSensitiveGeo::DistanceToPoint ( double const *  point) const

Returns the distance of point from the center of the detector.

Definition at line 97 of file AuxDetSensitiveGeo.cxx.

References DistanceToPoint(), and geo::vect::makePointFromCoords().

geo::Length_t DistanceToPoint(geo::Point_t const &point) const
Returns the distance of point from the center of the detector.
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
void geo::AuxDetSensitiveGeo::GetCenter ( double *  xyz,
double  localz = 0.0 
) const

Return the center position of an AuxDet.

Parameters
xyz_(output)_ the returned location: { x, y, z } [cm]
localz(default: 0) distance along the length of the volume (z) [cm]
Deprecated:
Use the version returning a vector instead.

Definition at line 72 of file AuxDetSensitiveGeo.cxx.

Referenced by PrintAuxDetInfo(), and TotalVolume().

72  {
73  auto const& center = GetCenter(localz);
74  xyz[0] = center.X();
75  xyz[1] = center.Y();
76  xyz[2] = center.Z();
77  } // AuxDetSensitiveGeo::GetCenter(double*)
void GetCenter(double *xyz, double localz=0.0) const
Return the center position of an AuxDet.
geo::Point_t geo::AuxDetSensitiveGeo::GetCenter ( double  localz = 0.0) const

Returns the geometric center of the sensitive volume.

Parameters
localz(default: 0) distance from the center along the length of the volume (z) [cm]
Returns
the geometric center of the sensitive volume [cm]

Definition at line 68 of file AuxDetSensitiveGeo.cxx.

References toWorldCoords().

69  { return toWorldCoords(LocalPoint_t{ 0.0, 0.0, localz }); }
geo::Point3DBase_t< AuxDetSensitiveGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML auxiliary detector frame.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local auxiliary detector frame to world frame.
geo::Vector_t geo::AuxDetSensitiveGeo::GetNormalVector ( ) const

Returns the unit normal vector to the detector.

Definition at line 82 of file AuxDetSensitiveGeo.cxx.

References toWorldCoords().

Referenced by GetNormalVector(), and PrintAuxDetInfo().

83  { return toWorldCoords(geo::Zaxis<LocalVector_t>()); }
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local auxiliary detector frame to world frame.
void geo::AuxDetSensitiveGeo::GetNormalVector ( double *  xyzDir) const

Fills the unit normal vector to the detector.

Deprecated:
Use the version returning a vector instead.

Definition at line 88 of file AuxDetSensitiveGeo.cxx.

References GetNormalVector(), and norm.

88  {
89  auto const& norm = GetNormalVector();
90  xyzDir[0] = norm.X();
91  xyzDir[1] = norm.Y();
92  xyzDir[2] = norm.Z();
93  } // AuxDetSensitiveGeo::GetNormalVector(double*)
geo::Vector_t GetNormalVector() const
Returns the unit normal vector to the detector.
Float_t norm
double geo::AuxDetSensitiveGeo::HalfCenterWidth ( ) const
inline

Definition at line 94 of file AuxDetSensitiveGeo.h.

References HalfWidth1(), and HalfWidth2().

94 { return (HalfWidth1() + HalfWidth2()) / 2.0; }
double geo::AuxDetSensitiveGeo::HalfHeight ( ) const
inline
double geo::AuxDetSensitiveGeo::HalfLength ( ) const
inline

Definition at line 91 of file AuxDetSensitiveGeo.h.

References Length().

91 { return Length() / 2.0; }
double geo::AuxDetSensitiveGeo::HalfWidth1 ( ) const
inline

Definition at line 92 of file AuxDetSensitiveGeo.h.

References fHalfWidth1.

Referenced by HalfCenterWidth(), geo::AuxDetChannelMapAlg::NearestSensitiveAuxDet(), geo::ChannelMapAlg::NearestSensitiveAuxDet(), and PrintAuxDetInfo().

92 { return fHalfWidth1; }
double fHalfWidth1
1st half width of volume, at -z/2 in local coordinates
double geo::AuxDetSensitiveGeo::HalfWidth2 ( ) const
inline

Definition at line 93 of file AuxDetSensitiveGeo.h.

References fHalfWidth2.

Referenced by HalfCenterWidth(), geo::AuxDetChannelMapAlg::NearestSensitiveAuxDet(), geo::ChannelMapAlg::NearestSensitiveAuxDet(), and PrintAuxDetInfo().

93 { return fHalfWidth2; }
double fHalfWidth2
2nd half width (width1==width2 for boxes), at +z/2
void geo::AuxDetSensitiveGeo::InitShapeSize ( )
private

Extracts the size of the detector from the geometry information.

Definition at line 102 of file AuxDetSensitiveGeo.cxx.

References fHalfHeight, fHalfWidth1, fHalfWidth2, fLength, and fTotalVolume.

Referenced by AuxDetSensitiveGeo().

102  {
103  // set the ends depending on whether the shape is a box or trapezoid
104  std::string volName(fTotalVolume->GetName());
105  if( volName.find("Trap") != std::string::npos ) {
106 
107  // Small Width
108  // ____ Height is the thickness
109  // / \ T of the trapezoid
110  // / \ |
111  // / \ | Length
112  // /__________\ _
113  // Width
114  fHalfHeight = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDy1(); // same as Dy2()
115  fLength = 2.0*((TGeoTrd2*)fTotalVolume->GetShape())->GetDz();
116  fHalfWidth1 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx1(); // at -Dz
117  fHalfWidth2 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx2(); // at +Dz
118  }
119  else {
120  fHalfWidth1 = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
121  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
122  fLength = 2.0*((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
124  }
125  } // AuxDetSensitiveGeo::InitShapeSize()
double fLength
length of volume, along z direction in local
double fHalfWidth1
1st half width of volume, at -z/2 in local coordinates
double fHalfHeight
half height of volume
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
double fHalfWidth2
2nd half width (width1==width2 for boxes), at +z/2
double geo::AuxDetSensitiveGeo::Length ( ) const
inline

Definition at line 90 of file AuxDetSensitiveGeo.h.

References fLength.

Referenced by HalfLength(), geo::AuxDetChannelMapAlg::NearestSensitiveAuxDet(), geo::ChannelMapAlg::NearestSensitiveAuxDet(), and PrintAuxDetInfo().

90 { return fLength; }
double fLength
length of volume, along z direction in local
void geo::AuxDetSensitiveGeo::LocalToWorld ( const double *  auxdet,
double *  world 
) const
inline

Transform point from local auxiliary detector frame to world frame.

Definition at line 109 of file AuxDetSensitiveGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::LocalToWorld().

110  { fTrans.LocalToWorld(auxdet, world); }
void LocalToWorld(double const *local, double *world) const
Transforms a point from local frame to world frame.
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
void geo::AuxDetSensitiveGeo::LocalToWorldVect ( const double *  auxdet,
double *  world 
) const
inline

Transform direction vector from local to world.

Definition at line 117 of file AuxDetSensitiveGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::LocalToWorldVect().

118  { fTrans.LocalToWorldVect(auxdet, world); }
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
template<typename Stream >
void geo::AuxDetSensitiveGeo::PrintAuxDetInfo ( Stream &&  out,
std::string  indent = "",
unsigned int  verbosity = 0 
) const

Prints information about this auxiliary sensitive detector.

Template Parameters
Streamtype of output stream to use
Parameters
outstream to send the information to
indentprepend each line with this string
verbosityamount of information printed

Note that the first line out the output is not indented.

Verbosity levels

  • 0 _(default)_: only center
  • 1: also size
  • 2: also normal direction

The constant MaxVerbosity is set to the highest supported verbosity level.

Definition at line 193 of file AuxDetSensitiveGeo.h.

References e, GetCenter(), GetNormalVector(), HalfHeight(), HalfWidth1(), HalfWidth2(), Length(), and lar::util::RealComparisons< RealType >::nonEqual().

Referenced by geo::GeometryCore::Print(), and toLocalCoords().

197  {
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()
geo::Vector_t GetNormalVector() const
Returns the unit normal vector to the detector.
Provides simple real number checks.
Float_t e
Definition: plot.C:34
void GetCenter(double *xyz, double localz=0.0) const
Return the center position of an AuxDet.
LocalPoint_t geo::AuxDetSensitiveGeo::toLocalCoords ( geo::Point_t const &  world) const
inline

Transform point from world frame to local auxiliary detector frame.

Definition at line 129 of file AuxDetSensitiveGeo.h.

References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toLocalCoords().

130  { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
LocalVector_t geo::AuxDetSensitiveGeo::toLocalCoords ( geo::Vector_t const &  world) const
inline

Transform direction vector from world to local.

Definition at line 137 of file AuxDetSensitiveGeo.h.

References fTrans, art::detail::indent(), PrintAuxDetInfo(), and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toLocalCoords().

138  { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
const TGeoVolume* geo::AuxDetSensitiveGeo::TotalVolume ( ) const
inline

Definition at line 96 of file AuxDetSensitiveGeo.h.

References DistanceToPoint(), fTotalVolume, and GetCenter().

Referenced by geo::sortAuxDetSensitiveStandard().

96 { return fTotalVolume; }
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
geo::Point_t geo::AuxDetSensitiveGeo::toWorldCoords ( LocalPoint_t const &  local) const
inline

Transform point from local auxiliary detector frame to world frame.

Definition at line 113 of file AuxDetSensitiveGeo.h.

References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toWorldCoords().

Referenced by GetCenter(), and GetNormalVector().

114  { return fTrans.toWorldCoords(local); }
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.
geo::Vector_t geo::AuxDetSensitiveGeo::toWorldCoords ( LocalVector_t const &  local) const
inline

Transform direction vector from local to world.

Definition at line 121 of file AuxDetSensitiveGeo.h.

References fTrans, and geo::LocalTransformationGeo< StoredMatrix, LocalPoint, LocalVector >::toWorldCoords().

122  { return fTrans.toWorldCoords(local); }
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 geo::AuxDetSensitiveGeo::WorldToLocal ( const double *  world,
double *  auxdet 
) const
inline

Transform point from world frame to local auxiliary detector frame.

Definition at line 125 of file AuxDetSensitiveGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::WorldToLocal().

Referenced by geo::AuxDetChannelMapAlg::NearestSensitiveAuxDet(), and geo::ChannelMapAlg::NearestSensitiveAuxDet().

126  { fTrans.WorldToLocal(world, auxdet); }
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
void geo::AuxDetSensitiveGeo::WorldToLocalVect ( const double *  world,
double *  auxdet 
) const
inline

Transform direction vector from world to local.

Definition at line 133 of file AuxDetSensitiveGeo.h.

References fTrans, and geo::LocalTransformation< StoredMatrix >::WorldToLocalVect().

134  { fTrans.WorldToLocalVect(world, auxdet); }
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.

Member Data Documentation

double geo::AuxDetSensitiveGeo::fHalfHeight
private

half height of volume

Definition at line 179 of file AuxDetSensitiveGeo.h.

Referenced by HalfHeight(), and InitShapeSize().

double geo::AuxDetSensitiveGeo::fHalfWidth1
private

1st half width of volume, at -z/2 in local coordinates

Definition at line 177 of file AuxDetSensitiveGeo.h.

Referenced by HalfWidth1(), and InitShapeSize().

double geo::AuxDetSensitiveGeo::fHalfWidth2
private

2nd half width (width1==width2 for boxes), at +z/2

Definition at line 178 of file AuxDetSensitiveGeo.h.

Referenced by HalfWidth2(), and InitShapeSize().

double geo::AuxDetSensitiveGeo::fLength
private

length of volume, along z direction in local

Definition at line 176 of file AuxDetSensitiveGeo.h.

Referenced by InitShapeSize(), and Length().

const TGeoVolume* geo::AuxDetSensitiveGeo::fTotalVolume
private

Total volume of AuxDet, called vol*.

Definition at line 175 of file AuxDetSensitiveGeo.h.

Referenced by AuxDetSensitiveGeo(), InitShapeSize(), and TotalVolume().

LocalTransformation_t geo::AuxDetSensitiveGeo::fTrans
private

Auxiliary detector-to-world transformation.

Definition at line 174 of file AuxDetSensitiveGeo.h.

Referenced by LocalToWorld(), LocalToWorldVect(), toLocalCoords(), toWorldCoords(), WorldToLocal(), and WorldToLocalVect().

constexpr unsigned int geo::AuxDetSensitiveGeo::MaxVerbosity = 2
static

Maximum verbosity supported by PrintAuxDetInfo().

Definition at line 167 of file AuxDetSensitiveGeo.h.

Referenced by geo::GeometryCore::Print().


The documentation for this class was generated from the following files: