Public Member Functions | Private Attributes | List of all members
gar::geo::AuxDetSensitiveGeo Class Reference

#include <AuxDetSensitiveGeo.h>

Public Member Functions

 AuxDetSensitiveGeo (std::vector< const TGeoNode * > &path, int depth)
 
 AuxDetSensitiveGeo (const TGeoVolume *volume, TGeoHMatrix *rotation)
 
 ~AuxDetSensitiveGeo ()
 
void GetCenter (double *xyz, double localz=0.0) const
 
void GetNormalVector (double *xyzDir) const
 
double Length () const
 
double HalfWidth1 () const
 
double HalfWidth2 () const
 
double HalfHeight () const
 
const TGeoVolume * TotalVolume () const
 
double DistanceToPoint (double *xyz) const
 
void LocalToWorld (const double *local, double *world) const
 
void LocalToWorldVect (const double *local, double *world) const
 
void WorldToLocal (const double *world, double *local) const
 
void WorldToLocalVect (const double *world, double *local) const
 

Private Attributes

TGeoHMatrix * fGeoMatrix
 Transformation matrix to world frame. 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 20 of file AuxDetSensitiveGeo.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file AuxDetSensitiveGeo.cxx.

30  : fTotalVolume(0)
31  {
32 
33  TGeoVolume *vc = path[depth]->GetVolume();
34  if(vc){
35  fTotalVolume = vc;
36  if(!fTotalVolume)
37  throw cet::exception("AuxDetSensitiveGeo") << "cannot find AuxDetSensitive volume\n";
38 
39  }// end if found volume
40 
41  MF_LOG_DEBUG("Geometry") << "detector sensitive total volume is " << fTotalVolume->GetName();
42 
43  // Build the matrix that takes us to the top world frame
44  // build a matrix to take us from the local to the world coordinates
45  // in one step
46  fGeoMatrix = new TGeoHMatrix(*path[0]->GetMatrix());
47  for(int i = 1; i <= depth; ++i){
48  fGeoMatrix->Multiply(path[i]->GetMatrix());
49  }
50 
51  // set the ends depending on whether the shape is a box or trapezoid
52  std::string volName(fTotalVolume->GetName());
53  if( volName.find("Trap") != std::string::npos ) {
54 
55  // Small Width
56  // ____ Height is the thickness
57  // / \ T of the trapezoid
58  // / \ |
59  // / \ | Length
60  // /__________\ _
61  // Width
62  fHalfHeight = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDy1(); // same as Dy2()
63  fLength = 2.0*((TGeoTrd2*)fTotalVolume->GetShape())->GetDz();
64  fHalfWidth1 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx1(); // at -Dz
65  fHalfWidth2 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx2(); // at +Dz
66  }
67  else {
68  fHalfWidth1 = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
69  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
70  fLength = 2.0*((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
72  }
73 
74  }
TGeoHMatrix * fGeoMatrix
Transformation matrix to world frame.
std::string string
Definition: nybbler.cc:12
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
#define MF_LOG_DEBUG(id)
double fLength
length of volume, along z direction in local
double fHalfWidth1
1st half width of volume, at -z/2 in local coordinates
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
gar::geo::AuxDetSensitiveGeo::AuxDetSensitiveGeo ( const TGeoVolume *  volume,
TGeoHMatrix *  rotation 
)

Definition at line 77 of file AuxDetSensitiveGeo.cxx.

79  : fGeoMatrix(rotation)
81  {
82 
83  MF_LOG_DEBUG("Geometry") << "detector sensitive total volume is " << fTotalVolume->GetName();
84 
85  // set the ends depending on whether the shape is a box or trapezoid
86  std::string volName(fTotalVolume->GetName());
87  if( volName.find("Trap") != std::string::npos ) {
88 
89  // Small Width
90  // ____ Height is the thickness
91  // / \ T of the trapezoid
92  // / \ |
93  // / \ | Length
94  // /__________\ _
95  // Width
96  fHalfHeight = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDy1(); // same as Dy2()
97  fLength = 2.0*((TGeoTrd2*)fTotalVolume->GetShape())->GetDz();
98  fHalfWidth1 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx1(); // at -Dz
99  fHalfWidth2 = ((TGeoTrd2*)fTotalVolume->GetShape())->GetDx2(); // at +Dz
100  }
101  else {
102  fHalfWidth1 = ((TGeoBBox*)fTotalVolume->GetShape())->GetDX();
103  fHalfHeight = ((TGeoBBox*)fTotalVolume->GetShape())->GetDY();
104  fLength = 2.0*((TGeoBBox*)fTotalVolume->GetShape())->GetDZ();
106  }
107 
108  }
TGeoHMatrix * fGeoMatrix
Transformation matrix to world frame.
std::string string
Definition: nybbler.cc:12
static const std::string volume[nvol]
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
#define MF_LOG_DEBUG(id)
double fLength
length of volume, along z direction in local
double fHalfWidth1
1st half width of volume, at -z/2 in local coordinates
gar::geo::AuxDetSensitiveGeo::~AuxDetSensitiveGeo ( )

Definition at line 111 of file AuxDetSensitiveGeo.cxx.

112  {
113  if(fGeoMatrix) delete fGeoMatrix;
114  return;
115  }
TGeoHMatrix * fGeoMatrix
Transformation matrix to world frame.

Member Function Documentation

double gar::geo::AuxDetSensitiveGeo::DistanceToPoint ( double *  xyz) const

Definition at line 174 of file AuxDetSensitiveGeo.cxx.

175  {
176  double Center[3];
177  GetCenter(Center);
178  return std::sqrt((Center[0]-xyz[0])*(Center[0]-xyz[0]) +
179  (Center[1]-xyz[1])*(Center[1]-xyz[1]) +
180  (Center[2]-xyz[2])*(Center[2]-xyz[2]));
181  }
void GetCenter(double *xyz, double localz=0.0) const
void gar::geo::AuxDetSensitiveGeo::GetCenter ( double *  xyz,
double  localz = 0.0 
) const

Return the center position of an AuxDet

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

Definition at line 158 of file AuxDetSensitiveGeo.cxx.

159  {
160  double xyzLocal[3] = {0.,0.,localz};
161  this->LocalToWorld(xyzLocal, xyz);
162  }
void LocalToWorld(const double *local, double *world) const
void gar::geo::AuxDetSensitiveGeo::GetNormalVector ( double *  xyzDir) const

Definition at line 166 of file AuxDetSensitiveGeo.cxx.

167  {
168  double normal[3]={0.,0.,1.};
169  this->LocalToWorldVect(normal,xyzDir);
170  }
void LocalToWorldVect(const double *local, double *world) const
double gar::geo::AuxDetSensitiveGeo::HalfHeight ( ) const
inline

Definition at line 36 of file AuxDetSensitiveGeo.h.

36 { return fHalfHeight; }
double fHalfHeight
half height of volume
double gar::geo::AuxDetSensitiveGeo::HalfWidth1 ( ) const
inline

Definition at line 34 of file AuxDetSensitiveGeo.h.

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

Definition at line 35 of file AuxDetSensitiveGeo.h.

35 { return fHalfWidth2; }
double fHalfWidth2
2nd half width (width1==width2 for boxes), at +z/2
double gar::geo::AuxDetSensitiveGeo::Length ( ) const
inline

Definition at line 33 of file AuxDetSensitiveGeo.h.

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

Transform a position from local frame to world frame

Parameters
local: 3D array. Position in the local frame Input.
world: 3D array. Position in the world frame. Returned.

Definition at line 121 of file AuxDetSensitiveGeo.cxx.

122  {
123  fGeoMatrix->LocalToMaster(local,world);
124  }
TGeoHMatrix * fGeoMatrix
Transformation matrix to world frame.
void gar::geo::AuxDetSensitiveGeo::LocalToWorldVect ( const double *  local,
double *  world 
) const

Transform a 3-vector from local frame to world frame

Parameters
local: 3D array. Position in the local frame Input.
world: 3D array. Position in the world frame. Returned.

Definition at line 130 of file AuxDetSensitiveGeo.cxx.

131  {
132  fGeoMatrix->LocalToMasterVect(local,world);
133  }
TGeoHMatrix * fGeoMatrix
Transformation matrix to world frame.
const TGeoVolume* gar::geo::AuxDetSensitiveGeo::TotalVolume ( ) const
inline

Definition at line 37 of file AuxDetSensitiveGeo.h.

37 { return fTotalVolume; }
const TGeoVolume * fTotalVolume
Total volume of AuxDet, called vol*.
void gar::geo::AuxDetSensitiveGeo::WorldToLocal ( const double *  world,
double *  local 
) const

Transform a position from world frame to local frame

Parameters
world: 3D array. Position in the world frame. Input.
local: 3D array. Position in the local frame Returned.

Definition at line 139 of file AuxDetSensitiveGeo.cxx.

140  {
141  fGeoMatrix->MasterToLocal(world,local);
142  }
TGeoHMatrix * fGeoMatrix
Transformation matrix to world frame.
void gar::geo::AuxDetSensitiveGeo::WorldToLocalVect ( const double *  world,
double *  local 
) const

Transform a 3-vector from world frame to local frame

Parameters
world: 3D array. Position in the world frame. Input.
local: 3D array. Position in the local frame Returned.

Definition at line 148 of file AuxDetSensitiveGeo.cxx.

149  {
150  fGeoMatrix->MasterToLocalVect(world,local);
151  }
TGeoHMatrix * fGeoMatrix
Transformation matrix to world frame.

Member Data Documentation

TGeoHMatrix* gar::geo::AuxDetSensitiveGeo::fGeoMatrix
private

Transformation matrix to world frame.

Definition at line 48 of file AuxDetSensitiveGeo.h.

double gar::geo::AuxDetSensitiveGeo::fHalfHeight
private

half height of volume

Definition at line 53 of file AuxDetSensitiveGeo.h.

double gar::geo::AuxDetSensitiveGeo::fHalfWidth1
private

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

Definition at line 51 of file AuxDetSensitiveGeo.h.

double gar::geo::AuxDetSensitiveGeo::fHalfWidth2
private

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

Definition at line 52 of file AuxDetSensitiveGeo.h.

double gar::geo::AuxDetSensitiveGeo::fLength
private

length of volume, along z direction in local

Definition at line 50 of file AuxDetSensitiveGeo.h.

const TGeoVolume* gar::geo::AuxDetSensitiveGeo::fTotalVolume
private

Total volume of AuxDet, called vol*.

Definition at line 49 of file AuxDetSensitiveGeo.h.


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