LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
AuxDetSensitiveGeo.cxx
Go to the documentation of this file.
1 
6 // class header
8 
9 // LArSoft libraries
10 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect namespace
11 
13 #include "TGeoBBox.h"
14 #include "TGeoNode.h"
15 #include "TGeoTrd2.h"
16 #include "TGeoVolume.h"
17 
18 // Framework includes
20 
21 // C++ standard libraries
22 #include <sstream> // std::ostringstream
23 
24 namespace geo {
25 
26  //-----------------------------------------
28  : fTrans(std::move(trans)), fTotalVolume(node->GetVolume())
29  {
30 
31  MF_LOG_DEBUG("Geometry") << "detector sensitive total volume is " << fTotalVolume->GetName();
32 
33  InitShapeSize();
34  }
35 
36  //......................................................................
37  Point_t AuxDetSensitiveGeo::GetCenter(double localz /* = 0.0 */) const
38  {
39  return toWorldCoords(LocalPoint_t{0.0, 0.0, localz});
40  }
41 
42  //......................................................................
43 
44  // Return the unit normal vector (0,0,1) in local coordinates to global coordinates
46  {
47  return toWorldCoords(Zaxis<LocalVector_t>());
48  }
49 
50  //......................................................................
51  Length_t AuxDetSensitiveGeo::DistanceToPoint(double const* point) const
52  {
54  }
55 
56  //......................................................................
57  std::string AuxDetSensitiveGeo::AuxDetInfo(std::string indent /* = "" */,
58  unsigned int verbosity /* = 1 */) const
59  {
60  std::ostringstream sstr;
61  PrintAuxDetInfo(sstr, indent, verbosity);
62  return sstr.str();
63  }
64 
65  //......................................................................
67  {
68  // set the ends depending on whether the shape is a box or trapezoid
69  std::string volName(fTotalVolume->GetName());
70  if (volName.find("Trap") != std::string::npos) {
71 
72  // Small Width
73  // ____ Height is the thickness
74  // / \ T of the trapezoid
75  // / \ |
76  // / \ | Length
77  // /__________\ _
78  // Width
79  fHalfHeight = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDy1(); // same as Dy2()
80  fLength = 2.0 * ((TGeoTrd2*)fTotalVolume->GetShape())->GetDz();
81  fHalfWidth1 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx1(); // at -Dz
82  fHalfWidth2 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx2(); // at +Dz
83  }
84  else {
85  fHalfWidth1 = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
86  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
87  fLength = 2.0 * ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
89  }
90  }
91 }
double fLength
length of volume, along z direction in local
double Length_t
Type used for coordinates and distances. They are measured in centimeters.
Definition: geo_vectors.h:133
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Vector_t
Type for representation of momenta in 3D space.
Definition: geo_vectors.h:160
Encapsulate the geometry of the sensitive portion of an auxiliary detector .
GENVECTOR_CONSTEXPR Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
Vector_t GetNormalVector() const
Returns the unit normal vector to the detector.
Point3DBase_t< AuxDetSensitiveGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML auxiliary detector frame.
double fHalfWidth1
1st half width of volume, at -z/2 in local coordinates
STL namespace.
double fHalfHeight
half height of volume
Point_t GetCenter(double localz=0.0) const
Returns the geometric center of the sensitive volume.
AuxDetSensitiveGeo(TGeoNode const *node, TransformationMatrix &&trans)
void InitShapeSize()
Extracts the size of the detector from the geometry information.
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
std::string indent(std::size_t const i)
Utilities to extend the interface of geometry vectors.This library provides facilities that can be us...
Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local auxiliary detector frame to world frame.
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this auxiliary sensitive detector.
Length_t DistanceToPoint(Point_t const &point) const
Returns the distance of point from the center of the detector.
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:180
std::string AuxDetInfo(std::string indent="", unsigned int verbosity=1) const
Returns a string with auxiliary sensitive detector information.
#define MF_LOG_DEBUG(id)
double fHalfWidth2
2nd half width (width1==width2 for boxes), at +z/2
ROOT libraries.
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.