All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
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 (TGeoNode const &node, geo::TransformationMatrix &&trans)
 
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...
 
std::string AuxDetInfo (std::string indent="", unsigned int verbosity=1) const
 Returns a string with auxiliary sensitive detector information. 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
 
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< ROOT::Math::Transform3D, 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 34 of file AuxDetSensitiveGeo.h.

Member Typedef Documentation

Type of points in the local GDML auxiliary detector frame.

Definition at line 57 of file AuxDetSensitiveGeo.h.

Definition at line 183 of file AuxDetSensitiveGeo.h.

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

Definition at line 60 of file AuxDetSensitiveGeo.h.

Constructor & Destructor Documentation

geo::AuxDetSensitiveGeo::AuxDetSensitiveGeo ( TGeoNode const &  node,
geo::TransformationMatrix &&  trans 
)

Definition at line 31 of file AuxDetSensitiveGeo.cxx.

32  : fTrans(std::move(trans))
33  , fTotalVolume(node.GetVolume())
34  {
35 
36  MF_LOG_DEBUG("Geometry") << "detector sensitive total volume is " << fTotalVolume->GetName();
37 
38  InitShapeSize();
39 
40  }
void InitShapeSize()
Extracts the size of the detector from the geometry information.
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
LocalTransformation_t fTrans
Auxiliary detector-to-world transformation.

Member Function Documentation

std::string geo::AuxDetSensitiveGeo::AuxDetInfo ( std::string  indent = "",
unsigned int  verbosity = 1 
) const

Returns a string with auxiliary sensitive detector information.

See Also
PrintAuxDetInfo()

The arguments and provided information are the same as in PrintAuxDetInfo().

Definition at line 78 of file AuxDetSensitiveGeo.cxx.

79  {
80  std::ostringstream sstr;
81  PrintAuxDetInfo(sstr, indent, verbosity);
82  return sstr.str();
83  } // AuxDetSensitiveGeo::AuxDetInfo()
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this auxiliary sensitive detector.
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 101 of file AuxDetSensitiveGeo.h.

102  { 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

Definition at line 72 of file AuxDetSensitiveGeo.cxx.

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 47 of file AuxDetSensitiveGeo.cxx.

47  {
48  auto const& center = GetCenter(localz);
49  xyz[0] = center.X();
50  xyz[1] = center.Y();
51  xyz[2] = center.Z();
52  } // 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 43 of file AuxDetSensitiveGeo.cxx.

44  { 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 57 of file AuxDetSensitiveGeo.cxx.

58  { 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 63 of file AuxDetSensitiveGeo.cxx.

63  {
64  auto const& norm = GetNormalVector();
65  xyzDir[0] = norm.X();
66  xyzDir[1] = norm.Y();
67  xyzDir[2] = norm.Z();
68  } // AuxDetSensitiveGeo::GetNormalVector(double*)
geo::Vector_t GetNormalVector() const
Returns the unit normal vector to the detector.
auto norm(Vector const &v)
Return norm of the specified vector.
double geo::AuxDetSensitiveGeo::HalfCenterWidth ( ) const
inline

Definition at line 95 of file AuxDetSensitiveGeo.h.

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

Definition at line 96 of file AuxDetSensitiveGeo.h.

96 { return fHalfHeight; }
double fHalfHeight
half height of volume
double geo::AuxDetSensitiveGeo::HalfLength ( ) const
inline

Definition at line 92 of file AuxDetSensitiveGeo.h.

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

Definition at line 93 of file AuxDetSensitiveGeo.h.

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

Definition at line 94 of file AuxDetSensitiveGeo.h.

94 { 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 87 of file AuxDetSensitiveGeo.cxx.

87  {
88  // set the ends depending on whether the shape is a box or trapezoid
89  std::string volName(fTotalVolume->GetName());
90  if( volName.find("Trap") != std::string::npos ) {
91 
92  // Small Width
93  // ____ Height is the thickness
94  // / \ T of the trapezoid
95  // / \ |
96  // / \ | Length
97  // /__________\ _
98  // Width
99  fHalfHeight = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDy1(); // same as Dy2()
100  fLength = 2.0*((TGeoTrd2*)fTotalVolume->GetShape())->GetDz();
101  fHalfWidth1 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx1(); // at -Dz
102  fHalfWidth2 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx2(); // at +Dz
103  }
104  else {
105  fHalfWidth1 = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
106  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
107  fLength = 2.0*((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
109  }
110  } // 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 91 of file AuxDetSensitiveGeo.h.

91 { 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 110 of file AuxDetSensitiveGeo.h.

111  { 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 118 of file AuxDetSensitiveGeo.h.

119  { 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 207 of file AuxDetSensitiveGeo.h.

211  {
212 
213  //----------------------------------------------------------------------------
214  out << "centered at " << GetCenter() << " cm";
215 
216  if (verbosity-- <= 0) return; // 0
217 
218  //----------------------------------------------------------------------------
220  out << ", size ( " << (2.0 * HalfWidth1());
221  if (coordIs.nonEqual(HalfWidth1(), HalfWidth2()))
222  out << "/" << (2.0 * HalfWidth2());
223  out << " x " << (2.0 * HalfHeight()) << " x " << Length() << " ) cm";
224 
225  if (verbosity-- <= 0) return; // 1
226 
227  //----------------------------------------------------------------------------
228  out << ", normal facing " << GetNormalVector();
229 
230 // if (verbosity-- <= 0) return; // 2
231 
232  //----------------------------------------------------------------------------
233 
234 } // geo::AuxDetSensitiveGeo::PrintAuxDetInfo()
geo::Vector_t GetNormalVector() const
Returns the unit normal vector to the detector.
do i e
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 130 of file AuxDetSensitiveGeo.h.

131  { 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 138 of file AuxDetSensitiveGeo.h.

139  { 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 97 of file AuxDetSensitiveGeo.h.

97 { 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 114 of file AuxDetSensitiveGeo.h.

115  { return fTrans.toWorldCoords(local); }
then 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 122 of file AuxDetSensitiveGeo.h.

123  { return fTrans.toWorldCoords(local); }
then 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 126 of file AuxDetSensitiveGeo.h.

127  { 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 134 of file AuxDetSensitiveGeo.h.

135  { 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 190 of file AuxDetSensitiveGeo.h.

double geo::AuxDetSensitiveGeo::fHalfWidth1
private

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

Definition at line 188 of file AuxDetSensitiveGeo.h.

double geo::AuxDetSensitiveGeo::fHalfWidth2
private

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

Definition at line 189 of file AuxDetSensitiveGeo.h.

double geo::AuxDetSensitiveGeo::fLength
private

length of volume, along z direction in local

Definition at line 187 of file AuxDetSensitiveGeo.h.

const TGeoVolume* geo::AuxDetSensitiveGeo::fTotalVolume
private

Total volume of AuxDet, called vol*.

Definition at line 186 of file AuxDetSensitiveGeo.h.

LocalTransformation_t geo::AuxDetSensitiveGeo::fTrans
private

Auxiliary detector-to-world transformation.

Definition at line 185 of file AuxDetSensitiveGeo.h.

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

Maximum verbosity supported by PrintAuxDetInfo().

Definition at line 178 of file AuxDetSensitiveGeo.h.


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