All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
VXDGeometry.h
Go to the documentation of this file.
1 #ifndef VXDGeometry_h
2 #define VXDGeometry_h 1
3 
4 //#include "lcio.h"
5 #include <map>
6 #include <vector>
7 //#include <gsl/gsl_rng.h>
8 
9 #include <gear/GearMgr.h>
10 #include "CLHEP/Vector/TwoVector.h"
11 
12 /**
13 \addtogroup TrackDigi TrackDigi
14 @{
15 
16 /** Helper struct for VXD ladder geometry */
17 struct VXDLadder{
18  double phi{}; // phi of ladder - rotation araound z-axis
19  gear::Vector3D trans{}; // translation after rotation
20 // CLHEP::Hep2Vector p0 ; // 'left' end of ladder in r-phi
21 // CLHEP::Hep2Vector p1 ; // 'right' end of ladder in r-phi
22 // CLHEP::Hep2Vector u ; // unit vector along ladder in r-phi
23 };
24 typedef std::vector< std::vector< VXDLadder > > VXDLadders ;
25 
26 /** Helper struct for VXD layer geometry */
27 struct VXDLayer{
28  double rMin{};
29  double rMax{};
30  double length{};
31  double width{};
32  double thickness{};
33  double gap{};
34  double ladderArea{};
35  int nLadders{};
36 };
37 
38 typedef std::vector< VXDLayer > VXDLayers ;
39 
40 
41 
42 /** ======= VXDGeometry ========== <br>
43  * Helper class for VXD geomtry transformations: from lab frame to ladder frame
44  * coordinates and inverse.
45  * The ladder reference system has its origin at the middle of the sensitive box in x and y,
46  * where the x-coordinate runs along the thickness of the ladder and t he y coordinate runs along its
47  * width. The z coordinate is the same as in the lab frame.
48  *
49  * <br>
50  * @version $Id$
51  * @author F.Gaede, DESY
52  */
53 class VXDGeometry {
54 
55 public:
56 
57  VXDGeometry(const VXDGeometry&) = delete;
58  VXDGeometry& operator=(const VXDGeometry&) = delete;
59 
60  VXDGeometry(gear::GearMgr* gearMgr) ;
61 
62 
63  /** Return the pair (layerID, ladderID) for the given position,
64  * (-1,-1) if not in sensitive volume (in the given layer).
65  */
66  std::pair<int,int> getLadderID( gear::Vector3D labPos, int layerID=-1 ) ;
67 
68  /** Convert a position in the lab frame to local ladder coordinates
69  * (x_ladder==0 is the middle of the sensitive).
70  */
71  gear::Vector3D lab2LadderPos( gear::Vector3D labPos, int layerID, int ladderID) ;
72 
73  /** Convert a position in local ladder coordinates
74  * (x_ladder==0 is the middle of the sensitive) to the lab frame.
75  */
76  gear::Vector3D ladder2LabPos( gear::Vector3D ladderPos, int layerID, int ladderID) ;
77 
78  /** Convert a direction in the lab frame to local ladder coordinates
79  * (x_ladder==0 is the middle of the sensitive).
80  */
81  gear::Vector3D lab2LadderDir( gear::Vector3D labPos, int layerID, int ladderID) ;
82 
83  /** Convert a direction in local ladder coordinates
84  * (x_ladder==0 is the middle of the sensitive) to the lab frame.
85  */
86  gear::Vector3D ladder2LabDir( gear::Vector3D ladderPos, int layerID, int ladderID) ;
87 
88  void test() ;
89 
90 
91 protected:
92 
93  void init() ;
94  VXDGeometry(){}
95 
96  gear::GearMgr* _gearMgr{};
97  VXDLadders _vxdLadders{};
98  VXDLayers _vxdLayers{};
99 
100 } ;
101 /** @} */
102 #endif