LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
AuxDetSensitiveGeo.cxx
Go to the documentation of this file.
1 
8 // class header
10 
11 // LArSoft libraries
12 #include "larcorealg/Geometry/geo_vectors_utils.h" // geo::vect namespace
13 
15 #include "TGeoBBox.h"
16 #include "TGeoNode.h"
17 #include "TGeoTrd2.h"
18 #include "TGeoVolume.h"
19 
20 // Framework includes
22 
23 // C++ standard libraries
24 #include <sstream> // std::ostringstream
25 
26 namespace geo {
27 
28  //-----------------------------------------
30  : fTrans(std::move(trans)), fTotalVolume(node.GetVolume())
31  {
32 
33  MF_LOG_DEBUG("Geometry") << "detector sensitive total volume is " << fTotalVolume->GetName();
34 
35  InitShapeSize();
36  }
37 
38  //......................................................................
39  geo::Point_t AuxDetSensitiveGeo::GetCenter(double localz /* = 0.0 */) const
40  {
41  return toWorldCoords(LocalPoint_t{0.0, 0.0, localz});
42  }
43 
44  //......................................................................
45 
46  // Return the unit normal vector (0,0,1) in local coordinates to global coordinates
48  {
49  return toWorldCoords(geo::Zaxis<LocalVector_t>());
50  }
51 
52  //......................................................................
54  {
56  }
57 
58  //......................................................................
59  std::string AuxDetSensitiveGeo::AuxDetInfo(std::string indent /* = "" */,
60  unsigned int verbosity /* = 1 */) const
61  {
62  std::ostringstream sstr;
63  PrintAuxDetInfo(sstr, indent, verbosity);
64  return sstr.str();
65  } // AuxDetSensitiveGeo::AuxDetInfo()
66 
67  //......................................................................
69  {
70  // set the ends depending on whether the shape is a box or trapezoid
71  std::string volName(fTotalVolume->GetName());
72  if (volName.find("Trap") != std::string::npos) {
73 
74  // Small Width
75  // ____ Height is the thickness
76  // / \ T of the trapezoid
77  // / \ |
78  // / \ | Length
79  // /__________\ _
80  // Width
81  fHalfHeight = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDy1(); // same as Dy2()
82  fLength = 2.0 * ((TGeoTrd2*)fTotalVolume->GetShape())->GetDz();
83  fHalfWidth1 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx1(); // at -Dz
84  fHalfWidth2 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx2(); // at +Dz
85  }
86  else {
87  fHalfWidth1 = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
88  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
89  fLength = 2.0 * ((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
91  }
92  } // AuxDetSensitiveGeo::InitShapeSize()
93 }
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
geo::Point_t GetCenter(double localz=0.0) const
Returns the geometric center of the sensitive volume.
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.
geo::Vector_t GetNormalVector() const
Returns the unit normal vector to the detector.
double fHalfWidth1
1st half width of volume, at -z/2 in local coordinates
STL namespace.
double fHalfHeight
half height of volume
AuxDetSensitiveGeo(TGeoNode const &node, geo::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.
geo::Length_t DistanceToPoint(geo::Point_t const &point) const
Returns the distance of point from the center of the detector.
void PrintAuxDetInfo(Stream &&out, std::string indent="", unsigned int verbosity=0) const
Prints information about this auxiliary sensitive 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)
geo::Point3DBase_t< AuxDetSensitiveGeoCoordinatesTag > LocalPoint_t
Type of points in the local GDML auxiliary detector frame.
double fHalfWidth2
2nd half width (width1==width2 for boxes), at +z/2
GENVECTOR_CONSTEXPR::geo::Point_t makePointFromCoords(Coords &&coords)
Creates a geo::Point_t from its coordinates (see makeFromCoords()).
Namespace collecting geometry-related classes utilities.
ROOT::Math::Transform3D TransformationMatrix
Type of transformation matrix used in geometry.
geo::Point_t toWorldCoords(LocalPoint_t const &local) const
Transform point from local auxiliary detector frame to world frame.