LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
geo::OpDetGeo Class Reference

#include "OpDetGeo.h"

Classes

struct  OpDetGeoCoordinatesTag
 Tag for vectors in the "local" GDML coordinate frame of the TPC. More...
 

Public Types

Types for geometry-local reference vectors.

These types represents points and displacement vectors in the reference frame defined in the optical 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::OpDetGeo have the same type but are not compatible.

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

Public Member Functions

 OpDetGeo (std::vector< const TGeoNode * > &path, int depth)
 
void GetCenter (double *xyz, double localz=0.0) const
 
geo::Point_t const & GetCenter () const
 
double RMin () const
 
double RMax () const
 
double HalfL () const
 
double Length () const
 
double ThetaZ () const
 
double ThetaZ (bool degrees) const
 
const TGeoNode * Node () const
 
template<typename Stream >
void PrintOpDetInfo (Stream &&out, std::string indent="", unsigned int verbosity=0) const
 Prints information about this optical detector. More...
 
double CosThetaFromNormal (geo::Point_t const &point) const
 Get cos(angle) to normal of this detector - used for solid angle calcs. More...
 
double CosThetaFromNormal (double const *xyz) const
 Get cos(angle) to normal of this detector - used for solid angle calcs. More...
 
double DistanceToPoint (geo::Point_t const &point) const
 Returns the distance of the specified point from detector center [cm]. More...
 
double DistanceToPoint (double const *xyz) const
 Returns the distance of the specified point from detector center [cm]. More...
 
Coordinate transformation

Local points and displacement vectors are described by the types geo::OpDetGeo::LocalPoint_t and geo::OpDetGeo::LocalVector_t, respectively.

void LocalToWorld (const double *opdet, double *world) const
 Transform point from local optical detector frame to world frame. More...
 
geo::Point_t toWorldCoords (LocalPoint_t const &local) const
 Transform point from local optical detector frame to world frame. More...
 
void LocalToWorldVect (const double *opdet, 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 *opdet) const
 Transform point from world frame to local optical detector frame. More...
 
LocalPoint_t toLocalCoords (geo::Point_t const &world) const
 Transform point from world frame to local optical detector frame. More...
 
void WorldToLocalVect (const double *world, double *opdet) 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 PrintOpDetInfo(). More...
 

Private Types

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

Private Attributes

LocalTransformation_t fTrans
 Optical-detector-to-world transformation. More...
 
const TGeoNode * fOpDetNode
 Pointer to theopdet node. More...
 
geo::Point_t fCenter
 Stored geometric center of the optical detector. More...
 

Detailed Description

Definition at line 30 of file OpDetGeo.h.

Member Typedef Documentation

Type of points in the local GDML TPC frame.

Definition at line 52 of file OpDetGeo.h.

Type of displacement vectors in the local GDML TPC frame.

Definition at line 55 of file OpDetGeo.h.

Constructor & Destructor Documentation

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

Definition at line 32 of file OpDetGeo.cxx.

References fCenter, fOpDetNode, and toWorldCoords().

33  : fTrans(path, depth)
34  {
35  fOpDetNode = path[depth];
36 
37  fCenter = toWorldCoords(geo::origin<LocalPoint_t>());
38 
39  }
const TGeoNode * fOpDetNode
Pointer to theopdet node.
Definition: OpDetGeo.h:163
geo::Point_t fCenter
Stored geometric center of the optical detector.
Definition: OpDetGeo.h:164
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local optical detector frame to world frame.
Definition: OpDetGeo.h:100
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162

Member Function Documentation

double geo::OpDetGeo::CosThetaFromNormal ( geo::Point_t const &  point) const

Get cos(angle) to normal of this detector - used for solid angle calcs.

Definition at line 104 of file OpDetGeo.cxx.

References toLocalCoords().

Referenced by CosThetaFromNormal(), Length(), and phot::PhotonVisibilityService::SolidAngleFactor().

104  {
105  auto const& local = toLocalCoords(point);
106  return local.Z() / local.R();
107  }
LocalPoint_t toLocalCoords(geo::Point_t const &world) const
Transform point from world frame to local optical detector frame.
Definition: OpDetGeo.h:116
double geo::OpDetGeo::CosThetaFromNormal ( double const *  xyz) const

Get cos(angle) to normal of this detector - used for solid angle calcs.

Definition at line 108 of file OpDetGeo.cxx.

References CosThetaFromNormal().

109  { return CosThetaFromNormal(geo::vect::makeFromCoords<geo::Point_t>(xyz)); }
double CosThetaFromNormal(geo::Point_t const &point) const
Get cos(angle) to normal of this detector - used for solid angle calcs.
Definition: OpDetGeo.cxx:104
double geo::OpDetGeo::DistanceToPoint ( geo::Point_t const &  point) const

Returns the distance of the specified point from detector center [cm].

Definition at line 97 of file OpDetGeo.cxx.

References GetCenter().

Referenced by phot::CreateHybridLibrary::CreateHybridLibrary(), phot::PhotonVisibilityService::DistanceToOpDet(), DistanceToPoint(), geo::CryostatGeo::GetClosestOpDet(), phot::PhotonLibraryHybrid::GetCount(), and Length().

98  { return (point - GetCenter()).R(); }
geo::Point_t const & GetCenter() const
Definition: OpDetGeo.h:63
double geo::OpDetGeo::DistanceToPoint ( double const *  xyz) const

Returns the distance of the specified point from detector center [cm].

Definition at line 99 of file OpDetGeo.cxx.

References DistanceToPoint().

100  { return DistanceToPoint(geo::vect::makeFromCoords<geo::Point_t>(xyz)); }
double DistanceToPoint(geo::Point_t const &point) const
Returns the distance of the specified point from detector center [cm].
Definition: OpDetGeo.cxx:97
void geo::OpDetGeo::GetCenter ( double *  xyz,
double  localz = 0.0 
) const

Return the center position of an opdet

Parameters
xyz: 3-D array. The returned location.
localz: Distance along the length of the volume (cm). Default is center of wire

Definition at line 47 of file OpDetGeo.cxx.

References LocalToWorld().

Referenced by phot::CreateHybridLibrary::CreateHybridLibrary(), cosmic::BeamFlashTrackMatchTaggerAlg::FillFlashProperties(), opdet::FlashHypothesisAnaAlg::FillOpDetPositions(), larg4::OpDetLookup::FindClosestOpDet(), and larg4::OpFastScintillation::RecordPhotonsProduced().

48  {
49  double xyzLocal[3] = {0.,0.,localz};
50  this->LocalToWorld(xyzLocal, xyz);
51  }
void LocalToWorld(const double *opdet, double *world) const
Transform point from local optical detector frame to world frame.
Definition: OpDetGeo.h:96
geo::Point_t const& geo::OpDetGeo::GetCenter ( ) const
inline

Definition at line 63 of file OpDetGeo.h.

References fCenter, HalfL(), RMax(), and RMin().

Referenced by DistanceToPoint(), PrintOpDetInfo(), and ThetaZ().

63 { return fCenter; }
geo::Point_t fCenter
Stored geometric center of the optical detector.
Definition: OpDetGeo.h:164
double geo::OpDetGeo::HalfL ( ) const

Definition at line 62 of file OpDetGeo.cxx.

References fOpDetNode.

Referenced by GetCenter(), Length(), and ThetaZ().

63  {
64  return ((TGeoTube*)fOpDetNode->GetVolume()->GetShape())->GetDZ();
65  }
const TGeoNode * fOpDetNode
Pointer to theopdet node.
Definition: OpDetGeo.h:163
double geo::OpDetGeo::Length ( ) const
inline

Definition at line 67 of file OpDetGeo.h.

References CosThetaFromNormal(), DistanceToPoint(), fTrans, HalfL(), geo::LocalTransformation< StoredMatrix >::LocalToWorld(), LocalToWorld(), and ThetaZ().

Referenced by PrintOpDetInfo().

67 { return 2.0 * HalfL(); }
double HalfL() const
Definition: OpDetGeo.cxx:62
void geo::OpDetGeo::LocalToWorld ( const double *  opdet,
double *  world 
) const
inline

Transform point from local optical detector frame to world frame.

Definition at line 96 of file OpDetGeo.h.

Referenced by geo::DUNE_opdet_sort(), GetCenter(), Length(), and geo::opdet_sort().

97  { fTrans.LocalToWorld(opdet, world); }
void LocalToWorld(double const *local, double *world) const
Transforms a point from local frame to world frame.
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162
void geo::OpDetGeo::LocalToWorldVect ( const double *  opdet,
double *  world 
) const
inline

Transform direction vector from local to world.

Definition at line 104 of file OpDetGeo.h.

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

105  { fTrans.LocalToWorldVect(opdet, world); }
void LocalToWorldVect(double const *local, double *world) const
Transforms a vector from local frame to world frame.
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162
const TGeoNode* geo::OpDetGeo::Node ( ) const
inline

Definition at line 130 of file OpDetGeo.h.

References fOpDetNode, art::detail::indent(), and PrintOpDetInfo().

130 { return fOpDetNode; }
const TGeoNode * fOpDetNode
Pointer to theopdet node.
Definition: OpDetGeo.h:163
template<typename Stream >
void geo::OpDetGeo::PrintOpDetInfo ( Stream &&  out,
std::string  indent = "",
unsigned int  verbosity = 0 
) const

Prints information about this optical 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 angle from z axis

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

Definition at line 175 of file OpDetGeo.h.

References GetCenter(), Length(), RMax(), RMin(), and ThetaZ().

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

179  {
180 
181  //----------------------------------------------------------------------------
182  out << "centered at " << GetCenter() << " cm";
183 
184  if (verbosity-- <= 0) return; // 0
185 
186  //----------------------------------------------------------------------------
187  out << ", radius: " << RMax() << " cm";
188  if (RMin() != 0.0) out << " (inner: " << RMin() << " cm)";
189  out << ", length: " << Length() << " cm";
190 
191  if (verbosity-- <= 0) return; // 1
192 
193  //----------------------------------------------------------------------------
194  out << ", theta(z): " << ThetaZ() << " rad";
195 
196 // if (verbosity-- <= 0) return; // 2
197 
198  //----------------------------------------------------------------------------
199 
200 } // geo::OpDetGeo::PrintOpDetInfo()
double RMin() const
Definition: OpDetGeo.cxx:69
double RMax() const
Definition: OpDetGeo.cxx:55
double Length() const
Definition: OpDetGeo.h:67
geo::Point_t const & GetCenter() const
Definition: OpDetGeo.h:63
double ThetaZ() const
Definition: OpDetGeo.cxx:75
double geo::OpDetGeo::RMax ( ) const

Definition at line 55 of file OpDetGeo.cxx.

References fOpDetNode.

Referenced by GetCenter(), and PrintOpDetInfo().

56  {
57  return ((TGeoTube*)fOpDetNode->GetVolume()->GetShape())->GetRmax();
58  }
const TGeoNode * fOpDetNode
Pointer to theopdet node.
Definition: OpDetGeo.h:163
double geo::OpDetGeo::RMin ( ) const

Definition at line 69 of file OpDetGeo.cxx.

References fOpDetNode.

Referenced by GetCenter(), and PrintOpDetInfo().

70  {
71  return ((TGeoTube*)fOpDetNode->GetVolume()->GetShape())->GetRmin();
72  }
const TGeoNode * fOpDetNode
Pointer to theopdet node.
Definition: OpDetGeo.h:163
double geo::OpDetGeo::ThetaZ ( ) const

returns angle of detector with respect to z axis in the Y-Z plane, in radians

Definition at line 75 of file OpDetGeo.cxx.

References evd::details::end(), GetCenter(), HalfL(), util::pi(), and toWorldCoords().

Referenced by Length(), PrintOpDetInfo(), and ThetaZ().

76  {
77  auto const& center = GetCenter();
78  auto const& end = toWorldCoords(LocalPoint_t{ 0.0, 0.0, HalfL() });
79 
80  // TODO change this into something generic
81  //either y or x will be 0, so ading both will always catch the right
82  //one
83  double angle = (end.Y()-center.Y()+end.X()-center.X()) /
84  std::abs(end.Y()-center.Y()+center.X()-end.X()) *
85  std::acos((end.Z() - center.Z())/HalfL());
86  if (angle < 0) angle += util::pi();
87  return angle;
88  }
double HalfL() const
Definition: OpDetGeo.cxx:62
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local optical detector frame to world frame.
Definition: OpDetGeo.h:100
geo::Point_t const & GetCenter() const
Definition: OpDetGeo.h:63
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
geo::Point3DBase_t< OpDetGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML TPC frame.
Definition: OpDetGeo.h:52
double geo::OpDetGeo::ThetaZ ( bool  degrees) const

returns angle of detector with respect to z axis in the Y-Z plane

Definition at line 91 of file OpDetGeo.cxx.

References util::RadiansToDegrees(), and ThetaZ().

92  { return degree? util::RadiansToDegrees(ThetaZ()): ThetaZ(); }
double ThetaZ() const
Definition: OpDetGeo.cxx:75
constexpr T RadiansToDegrees(T angle)
Converts the argument angle from radians into degrees ( )
LocalPoint_t geo::OpDetGeo::toLocalCoords ( geo::Point_t const &  world) const
inline

Transform point from world frame to local optical detector frame.

Definition at line 116 of file OpDetGeo.h.

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

Referenced by CosThetaFromNormal().

117  { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162
LocalVector_t geo::OpDetGeo::toLocalCoords ( geo::Vector_t const &  world) const
inline

Transform direction vector from world to local.

Definition at line 124 of file OpDetGeo.h.

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

125  { return fTrans.toLocalCoords(world); }
LocalPoint_t toLocalCoords(GlobalPoint_t const &world) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162
geo::Point_t geo::OpDetGeo::toWorldCoords ( LocalPoint_t const &  local) const
inline

Transform point from local optical detector frame to world frame.

Definition at line 100 of file OpDetGeo.h.

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

Referenced by OpDetGeo(), and ThetaZ().

101  { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
geo::Vector_t geo::OpDetGeo::toWorldCoords ( LocalVector_t const &  local) const
inline

Transform direction vector from local to world.

Definition at line 108 of file OpDetGeo.h.

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

109  { return fTrans.toWorldCoords(local); }
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162
GlobalPoint_t toWorldCoords(LocalPoint_t const &local) const
Transforms a point from local frame to world frame.
void geo::OpDetGeo::WorldToLocal ( const double *  world,
double *  opdet 
) const
inline

Transform point from world frame to local optical detector frame.

Definition at line 112 of file OpDetGeo.h.

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

113  { fTrans.WorldToLocal(world, opdet); }
void WorldToLocal(double const *world, double *local) const
Transforms a point from world frame to local frame.
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162
void geo::OpDetGeo::WorldToLocalVect ( const double *  world,
double *  opdet 
) const
inline

Transform direction vector from world to local.

Definition at line 120 of file OpDetGeo.h.

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

121  { fTrans.WorldToLocalVect(world, opdet); }
LocalTransformation_t fTrans
Optical-detector-to-world transformation.
Definition: OpDetGeo.h:162
void WorldToLocalVect(const double *world, double *local) const
Transforms a vector from world frame to local frame.

Member Data Documentation

geo::Point_t geo::OpDetGeo::fCenter
private

Stored geometric center of the optical detector.

Definition at line 164 of file OpDetGeo.h.

Referenced by GetCenter(), and OpDetGeo().

const TGeoNode* geo::OpDetGeo::fOpDetNode
private

Pointer to theopdet node.

Definition at line 163 of file OpDetGeo.h.

Referenced by HalfL(), Node(), OpDetGeo(), RMax(), and RMin().

LocalTransformation_t geo::OpDetGeo::fTrans
private

Optical-detector-to-world transformation.

Definition at line 162 of file OpDetGeo.h.

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

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

Maximum verbosity supported by PrintOpDetInfo().

Definition at line 156 of file OpDetGeo.h.

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


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