Go to the documentation of this file.
1 #ifndef GEO_CELLGEO_H
2 #define GEO_CELLGEO_H
6 #include "TGeoMatrix.h"
8 #include <vector>
9 class TGeoNode;
10 class TGeoHMatrix;
11 class TVector3;
13 namespace geo {
14  /// \brief Encapsulate the cell geometry
15  //
16  /// A note on the cell geometry: Cells are constructed such that, in
17  /// their local frame, their profile occupies the x-y plane with
18  /// their long dimension running along the z-axis. The dimension
19  /// transverse to the beam runs along the local x and is called the
20  /// width. The dimension parallel to the beam runs along the local y
21  /// and is called the depth. The length of the cell runs along the
22  /// local z-axis with z increasing as one moves toward the readout
23  /// end of the cell.
24  //
25  class CellGeo {
26  public:
27  CellGeo(const std::vector<const TGeoNode*>& n, int depth);
28  ~CellGeo();
30  void GetCenter(double* xyz, double localz=0.0) const;
31  void GetCenter(TVector3& xyz, double localz=0.0) const;
32  double DistToReadOut(double localz) const;
33  double HalfW() const;
34  double HalfL() const;
35  double HalfD() const;
37  void LocalToWorld(const double* local, double* world) const;
38  void LocalToWorldVect(const double* local, double* world) const;
39  void WorldToLocal(const double* local, double* world) const;
40  void WorldToLocalVect(const double* local, double* world) const;
43  /// Translate plane and all cells in plane by dx, dy and dz
44  /// New transform will be stored in a separate TGeoHMatrix
45  void TranslateCell(double dx, double dy = 0, double dz = 0);
47  /// Translate plane using a previously defined TGeoCombiTrans
48  /// New transform will be stored in a separate TGeoHMatrix
49  void TranslateCell(TGeoCombiTrans* comb);
51  /// Restore geometry to original
52  void RestoreOriginal();
54  const TGeoNode* Node() const { return fCellNode; }
55  const CellUniqueId& Id() const { return fId; }
57  static void clear(){fgParentMatrices.clear();}
58  private:
59  CellUniqueId fId; ///< Node ID number
60  const TGeoNode* fCellNode; ///< Pointer to the cell node
62  /// Transformation matrix to world frame
63  TGeoHMatrix GetGeoMatrix() const;
64  /// Adjusted matrix, if TranslateCell() has been called
65  TGeoHMatrix* fTranslatedMatrix;
67  /// Index into fgParentMatrices
69  /// Collection of unique parent matrices seen
70  static std::vector<TGeoHMatrix> fgParentMatrices;
71  };
72 }
75 #endif
double HalfL() const
Definition: CellGeo.cxx:198
double HalfD() const
Definition: CellGeo.cxx:205
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
void WorldToLocal(const double *local, double *world) const
Definition: CellGeo.cxx:100
void LocalToWorld(const double *local, double *world) const
Definition: CellGeo.cxx:80
const TGeoNode * fCellNode
Pointer to the cell node.
Definition: CellGeo.h:60
double HalfW() const
Definition: CellGeo.cxx:191
void WorldToLocalVect(const double *local, double *world) const
Definition: CellGeo.cxx:110
CellGeo(const std::vector< const TGeoNode * > &n, int depth)
Construct a cell geometry.
Definition: CellGeo.cxx:23
Give every cell in the geometry a unique ID number based on the TGeo path to the node.
const CellUniqueId & Id() const
Definition: CellGeo.h:55
double DistToReadOut(double localz) const
Definition: CellGeo.cxx:184
void LocalToWorldVect(const double *local, double *world) const
Definition: CellGeo.cxx:90
const TGeoNode * Node() const
Definition: CellGeo.h:54
double dy[NP][NC]
double dx[NP][NC]
static std::vector< TGeoHMatrix > fgParentMatrices
Collection of unique parent matrices seen.
Definition: CellGeo.h:70
double dz[NP][NC]
#define local
Definition: gzguts.h:107
Encapsulate the geometry of one entire detector (near, far, ndos)
std::void_t< T > n
void TranslateCell(double dx, double dy=0, double dz=0)
Definition: CellGeo.cxx:117
TGeoHMatrix GetGeoMatrix() const
Transformation matrix to world frame.
Definition: CellGeo.cxx:211
unsigned long long int CellUniqueId
Definition: CellUniqueId.h:15
static void clear()
Definition: CellGeo.h:57
TGeoHMatrix * fTranslatedMatrix
Adjusted matrix, if TranslateCell() has been called.
Definition: CellGeo.h:65
int fParentMatrixIdx
Index into fgParentMatrices.
Definition: CellGeo.h:68
CellUniqueId fId
Node ID number.
Definition: CellGeo.h:59
Encapsulate the cell geometry.
Definition: CellGeo.h:25
Helper for AttenCurve.
Definition: Path.h:10
void RestoreOriginal()
Restore geometry to original.
Definition: CellGeo.cxx:148