All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
SiStripGeom.h
Go to the documentation of this file.
1 #ifndef SISTRIPGEOM_H
2 #define SISTRIPGEOM_H 1
3 
4 #include<map>
5 #include<vector>
6 #include<string>
7 
8 
9 #include <CLHEP/Matrix/Matrix.h>
10 #include <CLHEP/Vector/ThreeVector.h>
11 // Include Gear header files
12 //#include <gear/GearParameters.h>
13 
14 #include "EVENT/SimTrackerHit.h"
15 
16 #include "UTIL/BitField64.h"
17 
18 /**
19 \addtogroup SiStripDigi SiStripDigi
20 @{
21 */
22 
23 namespace sistrip
24 {
25 
26 // Define constants
27 #define EPS 5 // in micrometers -- FIXME: Cambiado de 5 a 9 PROV
28 #define LAYERCOD 1000 // Const to encode and decode layers==disk
29 #define LADDERCOD 10 // Const to encode and decode ladders==petal
30 #define SENSORCOD 1 // Const to encode and decode sensors
31 
32 #define STRIPOFF 1 // Const to encode and decode strip offset
33 #define STRIPCODRPHI 1 // Const to encode and decode strip in RPhi
34 #define STRIPCODZ -1 // Const to encode and decode strip in Z
35 
36 // Define strip type
37 enum StripType { RPhi = 0, Z = 1 };
38 
39 // Define layer type
40 enum LayerType { pixel = 0, stripB = 1, stripF = 2};
41 
42 //! Gear geometry class - holds all geometry information about silicon strip
43 //! sensors. The data are taken directly from Gear xml file and values are
44 //! saved in the system of units defined in PhysicalConstants.h. The local
45 //! reference system is defined as follows: X-axis is perpendicular to the
46 //! beam axis and to the ladder (sensor) plane; Y-axis lies in a ladder
47 //! (sensor) plane and is also perpendicular to the beam axis; Z-axis is
48 //! parallel to the beam axis(for zero theta); (0,0,0) point is positioned
49 //! such as X, Y, Z coordinates are always positive. Strips are considered
50 //! to be either perpendicular to the beam axis or parallel with the beam
51 //! axis (SSDs) or both (DSSDs).
52 //!
53 //! @author Z. Drasal, Charles University Prague
54 //!
55 //! Thu Jul 14 (J. Duarte)
56 //! Converted to abstract class used by the builder to construct the
57 //! different subdetectors which going to use silicon strips (FTD,SIT,..)
58 
60 {
61  public:
62 
63  //!Constructor
64  SiStripGeom(const std::string & detector);
65  //!Destructor
66  virtual ~SiStripGeom();
67 
68  //!Method initializing class - reads Gear parameters from XML file
69  //!Pure virtual method, have to be implemented by a concrete instance
70  virtual void initGearParams() = 0;
71 
72  //!Pure virtual method, PROVISIONAL
73  //virtual std::map<std::string,short int> cellIDDecProv(EVENT::SimTrackerHit * & simHit) = 0;
74 
75  // MAGNETIC FIELD
76  //!Get magnetic field - x
77  virtual double getBx() { return _magField.getX(); }
78  //!Get magnetic field - y
79  virtual double getBy() { return _magField.getY(); }
80  //!Get magnetic field - z
81  virtual double getBz() { return _magField.getZ(); }
82  //!Get magnetic field - Three vector
83  virtual CLHEP::Hep3Vector get3MagField() { return _magField; }
84 
85  // GEOMETRY PROPERTIES
86  //!Get gear type
87  virtual inline std::string getGearType() { return _gearType; }
88 
89  // ENCODING
90  //! Returns the input cellID0 where the field sensor is put to 0
91  virtual int cellID0withSensor0(const int & cellID0) const =0 ;
92 
93  //!Encode cellID
94  //virtual int encodeCellID(short int layerID, short int ladderID, short int sensorID) const;
95  //!Decode cellID1
96  //virtual void decodeCellID(short int & layerID, short int & ladderID, short int & sensorID, int cellID) const;
97  virtual std::map<std::string,int> decodeCellID(const UTIL::BitField64 & cellDec) const = 0;
98  virtual std::map<std::string,int> decodeCellID(const int & cellDec) const = 0;
99 
100  //!Encode stripID
101  virtual int encodeStripID(StripType type, int stripID) const;
102  //!Decode stripID
103  virtual std::pair<StripType,int> decodeStripID(const int & encStripID) const = 0;
104  virtual std::pair<StripType,int> decodeStripID(const UTIL::BitField64 & cellDec) const = 0;
105  //!Stores the cellID0 and cellID1 of the LCIO object to the file
106  virtual void updateCanonicalCellID(const int & cellID, const int & stripType,
107  const int & stripID, UTIL::BitField64 * bf) = 0;
108 
109  // LAYER PROPERTIES
110  //!Get number of layers
111  virtual short int getNLayers() const {return _numberOfLayers;}
112  //!Get layer real ID
113  virtual int getLayerRealID(short int layerID) const;
114 
115  //!Transform real layer ID to C-type numbering 0 - n ...
116  virtual short int getLayerIDCTypeNo(int realLayerID) const;
117 
118  //!Get layer type
119  virtual short int getLayerType(short int layerID) const;
120 
121  //!Get layer radius
122  virtual double getLayerRadius(short int layerID) const;
123 
124  //!Get layer semiangle
125  virtual double getLayerHalfPhi(const int & layerID) const;
126  //!Get layer phi zero angle
127  virtual double getLayerPhi0(short int layerID) const;
128 
129 
130  // LADDER PROPERTIES
131  //!Get number of ladders
132  virtual short int getNLadders(short int layerID) const;
133 
134  //!Get ladder thickness
135  virtual double getLadderThick(short int layerID) const;
136  //!Get ladder width (the wider one for forward sensors)
137  virtual double getLadderWidth(short int layerID) const;
138  //!Get ladder length
139  virtual double getLadderLength(short int layerID) const;
140  //!Get ladder offset in Y
141  virtual double getLadderOffsetY(short int layerID) const;
142  //!Get ladder offset in Z
143  virtual double getLadderOffsetZ(short int layerID) const;
144 
145  //!Get ladder rotation - phi angle
146  virtual double getLadderPhi(short int layerID, short int ladderID) const;
147  //!Get ladder rotation - theta angle
148  virtual double getLadderTheta(short int layerID) const = 0;
149 
150 
151  // SENSOR PROPERTIES
152  //!Get number of sensors for given ladder
153  virtual short int getNSensors(short int layerID) const;
154 
155  //!Get number of strips in Z axis (in each sensor)
156 /* virtual int getSensorNStripsInZ(short int layerID) const;
157  //!Get number of strips in R-Phi (in each sensor)
158  virtual int getSensorNStripsInRPhi(short int layerID) const;
159  //!Get sensor pitch in Z axis for barrel-type and forward-type sensors
160  virtual double getSensorPitchInZ(short int layerID) const;
161 
162  //!Get sensor pitch in the R-Phi plane of the local coordinate system
163  //!(posZ must be in local coordinate system)
164  virtual double getSensorPitchInRPhi(short int layerID, double posZ) const = 0;*/
165  //! Get number of strips
166  virtual int getSensorNStrips(const int & layerID, const int & sensorID) const=0;
167  //! Get sensor pitch
168  virtual double getSensorPitch(const int & layerID, const int & sensorID,
169  const double & posZ) const = 0;
170 
171  //!Get sensor thickness
172  virtual double getSensorThick(short int layerID) const;
173  //!Get sensor width (the wider one for forward-type sensors)
174  virtual double getSensorWidthMax(short int layerID) const;
175  //!Get sensor width 2 (the narrower one for forward-type sensors)
176  virtual double getSensorWidthMin(short int layerID) const;
177  //!Get sensor length
178  virtual double getSensorLength(short int layerID) const;
179 
180  //!Get gap size inbetween sensors
181  virtual double getSensorGapInBetween(short int layerID) const;
182 
183  //!Get width of sensor rim in Z (passive part of silicon)
184  virtual double getSensorRimWidthInZ(short int layerID) const;
185 
186  //!Get width of sensor rim in R-Phi (passive part of silicon)
187  virtual double getSensorRimWidthInRPhi(short int layerID) const;
188 
189 
190  // TRANSFORMATION METHODS - GLOBAL REF. SYSTEM
191  //!Transform given point from global ref. system to local ref. system (sensor)
192  virtual CLHEP::Hep3Vector transformPointToLocal(short int layerID,
193  short int ladderID, short int sensorID, const CLHEP::Hep3Vector & point) = 0;
194 
195  //!Transform given vector from global ref. system to local ref. system (sensor)
196  virtual CLHEP::Hep3Vector transformVecToLocal(short int layerID,
197  short int ladderID, short int sensorID,
198  const CLHEP::Hep3Vector & vec) = 0;
199 
200  //!Transform given matrix from global ref. system to local ref. system (sensor)
201  virtual CLHEP::HepMatrix transformMatxToLocal(short int layerID,
202  short int ladderID, const CLHEP::HepMatrix & matrix) = 0;
203 
204 
205  // TRANSFORMATION METHODS - LOCAL REF. SYSTEM
206  //!Transform given point from local ref. system (sensor) to global ref. system
207  virtual CLHEP::Hep3Vector transformPointToGlobal(short int layerID,
208  short int ladderID, short int sensorID, const CLHEP::Hep3Vector & point) = 0;
209 
210  //!Transform given vector from local ref. system (sensor) to global ref. system
211  virtual CLHEP::Hep3Vector transformVecToGlobal(short int layerID,
212  short int ladderID, short int sensorID,
213  const CLHEP::Hep3Vector & vec) = 0;
214 
215  //!Transform given diagonal matrix from local ref. system (sensor) to global ref. system
216  virtual CLHEP::HepMatrix transformMatxToGlobal(short int layerID,
217  short int ladderID, const CLHEP::HepMatrix & matrix) = 0;
218 
219 
220  // OTHER METHODS - GLOBAL REF. SYSTEM
221  //!Get info whether the given point is inside of Si sensor
222  virtual bool isPointInsideSensor (short int layerID, short int ladderID,
223  short int sensorID, const CLHEP::Hep3Vector & point) const = 0;
224 
225 
226  // OTHER METHODS - LOCAL REF. SYSTEM
227  //!Get info whether the given point is out of Si sensor
228  virtual bool isPointOutOfSensor(short int layerID,
229  const CLHEP::Hep3Vector & point) const = 0;
230 
231  //!Get strip y-position
232  virtual double getStripPosY(const int & layerID, const int & sensorID,
233  const int & stripID, const double & posZ) const =0;
234  //!Get strip ID
235  virtual int getStripID(const int & layerID, const int & sensorID,
236  const double & posRPhi, const double & posZ) const = 0;
237 
238  //! Transforming a given point to the local ref. frame of a petal
239  //! which is rotated around its center an angle stAngle
240  virtual CLHEP::Hep3Vector transformPointToRotatedLocal(const int & diskID,
241  const int & sensorID, const CLHEP::Hep3Vector & point) const = 0;
242 
243  //! Transforming a given point from the reference system rotated around
244  //! the center of a petal to its local ref. frame (inverse of
245  //! transformPointToRotatedLocal)
246  virtual CLHEP::Hep3Vector transformPointFromRotatedLocal(const int & diskID,
247  const int & sensorID, const CLHEP::Hep3Vector & point) const = 0;
248 
249  //! Get director vector of a strip (inside the local Ref. system)
250  //! The vector is defined to describe the strip from z_local=0
251  virtual CLHEP::Hep3Vector getStripUnitVector(const int & diskID,
252  const int & sensorID, const int & stripID) const = 0;
253 
254  //! Get the point which crossed two strips
255  virtual CLHEP::Hep3Vector getCrossLinePoint(const int & diskID,
256  const int & sensorID,
257  const int & stripIDFront, const int & stripIDRear) const = 0;
258 
259  // PRINT METHODS
260  //!Method printing general Gear parameters
261  virtual void printGearParams() const = 0;
262 
263  //!Method printing sensor Gear parameters
264  virtual void printSensorParams(short int layerID) const = 0;
265 
266  protected:
267  std::string _gearType; // Not necessary //!< GearType
268 
269  // Magnetic field
270  CLHEP::Hep3Vector _magField;
271 
272  // Geometry parameters - layers (disks)
273  short int _numberOfLayers;
274 
275  std::vector<double> _layerHalfPhi;
276  std::vector<double> _layerThickness;
277  std::vector<double> _layerHalfThickness;
278  std::vector<double> _layerRadius;
279  std::vector<double> _layerZ; //Z-center NEW
280 
281  std::vector<int> _layerRealID;
282  std::vector<int> _layerType;
283 
284  std::vector<double> _layerPhi0;
285  std::vector<double> _layerTheta;
286 
287  // Geometry parameters - ladders
288  std::vector<int> _numberOfLadders;
289  std::vector<int> _laddersInLayer;
290  std::vector<double> _layerLadderLength;
291  std::vector<double> _layerLadderWidth;
292  std::vector<double> _layerLadderHalfWidth;
293  std::vector<double> _layerActiveSiOffset;
294  std::vector<double> _layerLadderGap;
295  std::vector<double> _layerPhiOffset;
296  std::vector<double> _ladderThick;
297  std::vector<double> _ladderWidth;
298  std::vector<double> _ladderLength;
299  std::vector<double> _ladderOffsetY;
300  std::vector<double> _ladderOffsetZ;
301 
302  // Geometry - sensors
303  std::vector<int> _numberOfSensors;
304  std::vector<int> _sensorNStripsInFront;
305  std::vector<int> _sensorNStripsInRear;
306  std::vector<double> _sensorPitchInFront;
307  std::vector<double> _sensorPitchInRear;
308  std::vector<double> _sensorThick;
309  std::vector<double> _sensorWidth;
310  std::vector<double> _sensorWidth2;
311  std::vector<double> _sensorLength;
312  std::vector<double> _sensorGapInBtw;
313  std::vector<double> _sensorRimWidthInZ;
314  std::vector<double> _sensorRimWidthInRPhi;
315 }; // Class
316 
317 } // Namespace
318 
319 /** @} */
320 
321 #endif // SISTRIPGEOM_H
virtual double getSensorRimWidthInZ(short int layerID) const
Get width of sensor rim in Z (passive part of silicon)
Definition: SiStripGeom.cc:495
std::vector< double > _sensorWidth
Definition: SiStripGeom.h:309
virtual void printGearParams() const =0
Method printing general Gear parameters.
virtual double getSensorThick(short int layerID) const
Get sensor thickness.
Definition: SiStripGeom.cc:421
virtual double getLadderPhi(short int layerID, short int ladderID) const
Get ladder rotation - phi angle.
Definition: SiStripGeom.cc:333
std::vector< double > _layerThickness
Definition: SiStripGeom.h:276
virtual CLHEP::Hep3Vector transformPointToLocal(short int layerID, short int ladderID, short int sensorID, const CLHEP::Hep3Vector &point)=0
Transform given point from global ref. system to local ref. system (sensor)
std::vector< int > _sensorNStripsInRear
Definition: SiStripGeom.h:305
std::vector< double > _ladderOffsetZ
Definition: SiStripGeom.h:300
std::vector< double > _ladderThick
Definition: SiStripGeom.h:296
std::vector< int > _numberOfLadders
Definition: SiStripGeom.h:288
virtual short int getLayerType(short int layerID) const
Get layer type.
Definition: SiStripGeom.cc:159
virtual CLHEP::Hep3Vector transformPointToRotatedLocal(const int &diskID, const int &sensorID, const CLHEP::Hep3Vector &point) const =0
Transforming a given point to the local ref.
virtual CLHEP::HepMatrix transformMatxToGlobal(short int layerID, short int ladderID, const CLHEP::HepMatrix &matrix)=0
Transform given diagonal matrix from local ref. system (sensor) to global ref. system.
virtual double getSensorLength(short int layerID) const
Get sensor length.
Definition: SiStripGeom.cc:467
CLHEP::Hep3Vector _magField
Definition: SiStripGeom.h:270
std::vector< double > _layerHalfPhi
Definition: SiStripGeom.h:275
virtual void printSensorParams(short int layerID) const =0
Method printing sensor Gear parameters.
std::vector< double > _layerHalfThickness
Definition: SiStripGeom.h:277
Gear geometry class - holds all geometry information about silicon strip sensors. ...
Definition: SiStripGeom.h:59
std::vector< int > _layerRealID
Definition: SiStripGeom.h:281
virtual short int getNLayers() const
Get number of layers.
Definition: SiStripGeom.h:111
virtual short int getNLadders(short int layerID) const
Get number of ladders.
Definition: SiStripGeom.cc:237
virtual short int getLayerIDCTypeNo(int realLayerID) const
Transform real layer ID to C-type numbering 0 - n ...
Definition: SiStripGeom.cc:142
std::vector< double > _ladderOffsetY
Definition: SiStripGeom.h:299
virtual double getLadderOffsetZ(short int layerID) const
Get ladder offset in Z.
Definition: SiStripGeom.cc:319
virtual double getSensorWidthMin(short int layerID) const
Get sensor width 2 (the narrower one for forward-type sensors)
Definition: SiStripGeom.cc:452
virtual CLHEP::HepMatrix transformMatxToLocal(short int layerID, short int ladderID, const CLHEP::HepMatrix &matrix)=0
Transform given matrix from global ref. system to local ref. system (sensor)
virtual double getStripPosY(const int &layerID, const int &sensorID, const int &stripID, const double &posZ) const =0
Get strip y-position.
virtual double getLadderLength(short int layerID) const
Get ladder length.
Definition: SiStripGeom.cc:291
std::vector< double > _sensorPitchInRear
Definition: SiStripGeom.h:307
std::vector< double > _layerTheta
Definition: SiStripGeom.h:285
virtual double getLayerRadius(short int layerID) const
Get layer radius.
Definition: SiStripGeom.cc:180
std::vector< int > _layerType
Definition: SiStripGeom.h:282
virtual bool isPointOutOfSensor(short int layerID, const CLHEP::Hep3Vector &point) const =0
Get info whether the given point is out of Si sensor.
std::vector< double > _sensorThick
Definition: SiStripGeom.h:308
virtual std::string getGearType()
Get gear type.
Definition: SiStripGeom.h:87
virtual CLHEP::Hep3Vector get3MagField()
Get magnetic field - Three vector.
Definition: SiStripGeom.h:83
std::vector< double > _layerZ
Definition: SiStripGeom.h:279
std::vector< double > _sensorRimWidthInZ
Definition: SiStripGeom.h:313
virtual ~SiStripGeom()
Destructor.
Definition: SiStripGeom.cc:37
virtual bool isPointInsideSensor(short int layerID, short int ladderID, short int sensorID, const CLHEP::Hep3Vector &point) const =0
Get info whether the given point is inside of Si sensor.
std::vector< double > _ladderLength
Definition: SiStripGeom.h:298
virtual double getLadderThick(short int layerID) const
Get ladder thickness.
Definition: SiStripGeom.cc:256
virtual double getBy()
Get magnetic field - y.
Definition: SiStripGeom.h:79
virtual short int getNSensors(short int layerID) const
Get number of sensors for given ladder.
Definition: SiStripGeom.cc:361
virtual double getBz()
Get magnetic field - z.
Definition: SiStripGeom.h:81
std::vector< double > _layerLadderWidth
Definition: SiStripGeom.h:291
virtual void updateCanonicalCellID(const int &cellID, const int &stripType, const int &stripID, UTIL::BitField64 *bf)=0
Stores the cellID0 and cellID1 of the LCIO object to the file.
short int _numberOfLayers
Definition: SiStripGeom.h:273
std::vector< double > _sensorGapInBtw
Definition: SiStripGeom.h:312
virtual double getSensorRimWidthInRPhi(short int layerID) const
Get width of sensor rim in R-Phi (passive part of silicon)
Definition: SiStripGeom.cc:509
std::vector< double > _layerActiveSiOffset
Definition: SiStripGeom.h:293
std::vector< int > _numberOfSensors
Definition: SiStripGeom.h:303
virtual CLHEP::Hep3Vector transformPointFromRotatedLocal(const int &diskID, const int &sensorID, const CLHEP::Hep3Vector &point) const =0
Transforming a given point from the reference system rotated around the center of a petal to its loca...
std::vector< int > _sensorNStripsInFront
Definition: SiStripGeom.h:304
std::vector< double > _layerPhiOffset
Definition: SiStripGeom.h:295
virtual CLHEP::Hep3Vector getCrossLinePoint(const int &diskID, const int &sensorID, const int &stripIDFront, const int &stripIDRear) const =0
Get the point which crossed two strips.
virtual int getStripID(const int &layerID, const int &sensorID, const double &posRPhi, const double &posZ) const =0
Get strip ID.
std::vector< double > _sensorWidth2
Definition: SiStripGeom.h:310
std::vector< double > _layerLadderGap
Definition: SiStripGeom.h:294
virtual int getSensorNStrips(const int &layerID, const int &sensorID) const =0
Get number of strips in Z axis (in each sensor)
std::vector< double > _ladderWidth
Definition: SiStripGeom.h:297
virtual double getBx()
Pure virtual method, PROVISIONAL.
Definition: SiStripGeom.h:77
virtual CLHEP::Hep3Vector getStripUnitVector(const int &diskID, const int &sensorID, const int &stripID) const =0
Get director vector of a strip (inside the local Ref.
virtual double getLadderOffsetY(short int layerID) const
Get ladder offset in Y.
Definition: SiStripGeom.cc:305
std::vector< int > _laddersInLayer
Definition: SiStripGeom.h:289
std::vector< double > _layerRadius
Definition: SiStripGeom.h:278
std::vector< double > _sensorPitchInFront
Definition: SiStripGeom.h:306
virtual double getLayerHalfPhi(const int &layerID) const
Get layer semiangle.
Definition: SiStripGeom.cc:199
virtual int cellID0withSensor0(const int &cellID0) const =0
Returns the input cellID0 where the field sensor is put to 0.
virtual std::pair< StripType, int > decodeStripID(const int &encStripID) const =0
Decode stripID.
virtual double getLadderTheta(short int layerID) const =0
Get ladder rotation - theta angle.
virtual void initGearParams()=0
Method initializing class - reads Gear parameters from XML file Pure virtual method, have to be implemented by a concrete instance.
virtual double getLayerPhi0(short int layerID) const
Get layer phi zero angle.
Definition: SiStripGeom.cc:218
std::vector< double > _sensorLength
Definition: SiStripGeom.h:311
virtual double getSensorPitch(const int &layerID, const int &sensorID, const double &posZ) const =0
Get sensor pitch.
virtual CLHEP::Hep3Vector transformPointToGlobal(short int layerID, short int ladderID, short int sensorID, const CLHEP::Hep3Vector &point)=0
Transform given point from local ref. system (sensor) to global ref. system.
std::vector< double > _sensorRimWidthInRPhi
Definition: SiStripGeom.h:314
virtual int encodeStripID(StripType type, int stripID) const
Encode stripID.
Definition: SiStripGeom.cc:65
virtual std::map< std::string, int > decodeCellID(const UTIL::BitField64 &cellDec) const =0
Encode cellID.
std::vector< double > _layerLadderHalfWidth
Definition: SiStripGeom.h:292
virtual int getLayerRealID(short int layerID) const
Get layer real ID.
Definition: SiStripGeom.cc:123
virtual double getSensorGapInBetween(short int layerID) const
Get gap size inbetween sensors.
Definition: SiStripGeom.cc:481
virtual CLHEP::Hep3Vector transformVecToLocal(short int layerID, short int ladderID, short int sensorID, const CLHEP::Hep3Vector &vec)=0
Transform given vector from global ref. system to local ref. system (sensor)
SiStripGeom(const std::string &detector)
Constructor.
Definition: SiStripGeom.cc:31
virtual double getSensorWidthMax(short int layerID) const
Get sensor width (the wider one for forward-type sensors)
Definition: SiStripGeom.cc:435
std::vector< double > _layerPhi0
Definition: SiStripGeom.h:284
std::vector< double > _layerLadderLength
Definition: SiStripGeom.h:290
virtual double getLadderWidth(short int layerID) const
Get ladder width (the wider one for forward sensors)
Definition: SiStripGeom.cc:277
virtual CLHEP::Hep3Vector transformVecToGlobal(short int layerID, short int ladderID, short int sensorID, const CLHEP::Hep3Vector &vec)=0
Transform given vector from local ref. system (sensor) to global ref. system.
std::string _gearType
Definition: SiStripGeom.h:267