PlaneGeo.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file Plane.h
3 /// \brief Encapsulate the construction of a single detector plane
4 ///
5 /// \version $Id: PlaneGeo.h,v 1.5 2012-11-28 03:25:00 gsdavies Exp $
6 /// \author messier@indiana.edu
7 ////////////////////////////////////////////////////////////////////////
8 #ifndef GEO_PLANEGEO_H
9 #define GEO_PLANEGEO_H
10 
11 #include <vector>
12 class TGeoNode;
13 class TGeoVolume;
14 class TGeoHMatrix;
15 class TGeoCombiTrans;
16 
17 namespace geo {
18  class CellGeo;
19  /// Enumerate the possible locations of the cell readout
20  typedef enum _readout {
21  kTop, ///< Vertical modules readout on the top
22  kWest, ///< Horizontal modules readout on the west
23  kEast, ///< Horizontal modules readout on the east
24  kAnySide ///< Don't care which side the read out is on
25  } Readout_t;
26  /// Enumerate the possible plane projections
27  typedef enum _plane_proj {
28  kX, ///< Vertical planes which measure X
29  kY, ///< Horizontal planes which measure Y
30  kXorY ///< X or Y views
31  } View_t;
32 
33  //......................................................................
34 
35  /// Geometry information for a single readout plane
36  class PlaneGeo {
37  public:
38  /// Construct a representation of a single plane of the detector
39  PlaneGeo(std::vector<const TGeoNode*>& n, unsigned int depth);
40  ~PlaneGeo();
41 
42  /// Number of cells in this plane
43  unsigned int Ncells() const { return fCell.size(); }
44 
45  /// Return the icell'th cell in the plane. Should start from
46  /// bottom and count up in case of horizontals. Should count from
47  /// west to east in case of verticals
48  const CellGeo* Cell(int icell) const {
49  if (icell < 0 || icell >= (int)fCell.size()) return 0;
50  return fCell[icell]; }
51 
52  /// Which coordinate does this plane measure
53  View_t View() const { return fView; }
54 
55  /// Transform point from local plane frame to world frame
56  void LocalToWorld(const double* plane, double* world) const;
57 
58  /// Transform direction vector from local to world
59  void LocalToWorldVect(const double* plane, double* world) const;
60 
61  /// Transform point from world frame to local plane frame
62  void WorldToLocal(const double* world, double* plane) const;
63 
64  /// Transform direction vector from world to local
65  void WorldToLocalVect(const double* world, double* plane) const;
66 
67  /// Translate plane and all cells in plane by dx, dy and dz
68  /// Original transform will be stored in a separate TGeoHMatrix
69  void TranslatePlane(double dx, double dy = 0, double dz = 0,
70  double phi = 0, double theta= 0, double psi = 0);
71 
72  /// Translate plane using a previously defined TGeoCombiTrans
73  /// Original transform will be stored in a separate TGeoHMatrix
74  void TranslatePlane(TGeoCombiTrans* comb);
75 
76  /// Restore geometry to original
77  void RestoreOriginal();
78 
79  private:
80  void FindCells(std::vector<const TGeoNode*>& n, unsigned int depth);
81  void MakeCell(std::vector<const TGeoNode*>& n, unsigned int depth);
82 
83  private:
84  TGeoHMatrix* fGeoMatrix; ///< Plane to world transform
85  TGeoHMatrix* fGeoMatrixOriginal; ///< Original plane to world transform
86  bool fIsOriginal; ///< Is fGeoMatrix the original transform?
87  Readout_t fReadout; ///< Which end is the readout on?
88  View_t fView; ///< Does this plane measure X or Y?
89  std::vector<CellGeo*> fCell; ///< List of cells in this plane
90  };
91 }
92 
93 #endif
94 ////////////////////////////////////////////////////////////////////////
X or Y views.
Definition: PlaneGeo.h:30
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
void FindCells(std::vector< const TGeoNode * > &n, unsigned int depth)
Definition: PlaneGeo.cxx:115
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
PlaneGeo(std::vector< const TGeoNode * > &n, unsigned int depth)
Construct a representation of a single plane of the detector.
Definition: PlaneGeo.cxx:42
Vertical modules readout on the top.
Definition: PlaneGeo.h:21
_plane_proj
Enumerate the possible plane projections.
Definition: PlaneGeo.h:27
void WorldToLocal(const double *world, double *plane) const
Transform point from world frame to local plane frame.
Definition: PlaneGeo.cxx:162
View_t fView
Does this plane measure X or Y?
Definition: PlaneGeo.h:88
Horizontal modules readout on the west.
Definition: PlaneGeo.h:22
Horizontal planes which measure Y.
Definition: PlaneGeo.h:29
_readout
Enumerate the possible locations of the cell readout.
Definition: PlaneGeo.h:20
bool fIsOriginal
Is fGeoMatrix the original transform?
Definition: PlaneGeo.h:86
TGeoHMatrix * fGeoMatrixOriginal
Original plane to world transform.
Definition: PlaneGeo.h:85
Readout_t fReadout
Which end is the readout on?
Definition: PlaneGeo.h:87
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
double dy[NP][NC]
double dx[NP][NC]
double dz[NP][NC]
TGeoHMatrix * fGeoMatrix
Plane to world transform.
Definition: PlaneGeo.h:84
enum geo::_readout Readout_t
Enumerate the possible locations of the cell readout.
Geometry information for a single readout plane.
Definition: PlaneGeo.h:36
void TranslatePlane(double dx, double dy=0, double dz=0, double phi=0, double theta=0, double psi=0)
Definition: PlaneGeo.cxx:179
std::vector< CellGeo * > fCell
List of cells in this plane.
Definition: PlaneGeo.h:89
Don&#39;t care which side the read out is on.
Definition: PlaneGeo.h:24
void LocalToWorldVect(const double *plane, double *world) const
Transform direction vector from local to world.
Definition: PlaneGeo.cxx:155
void MakeCell(std::vector< const TGeoNode * > &n, unsigned int depth)
Definition: PlaneGeo.cxx:140
Encapsulate the cell geometry.
Definition: CellGeo.h:25
Helper for AttenCurve.
Definition: Path.h:10
Horizontal modules readout on the east.
Definition: PlaneGeo.h:23
void RestoreOriginal()
Restore geometry to original.
Definition: PlaneGeo.cxx:216
void LocalToWorld(const double *plane, double *world) const
Transform point from local plane frame to world frame.
Definition: PlaneGeo.cxx:148
void WorldToLocalVect(const double *world, double *plane) const
Transform direction vector from world to local.
Definition: PlaneGeo.cxx:172