ATLAS Offline Software
SCT_ForwardModuleSideDesign.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // SCT_ForwardModuleSideDesign.cxx
7 // Implementation file for class SCT_ForwardModuleSideDesign
9 // (c) ATLAS Detector software
11 // Version 1.16 29/10/2001 Alessandro Fornaini
12 // Modified: Grant Gorfine
14 
16 #include "CLHEP/Units/SystemOfUnits.h"
17 #include "CLHEP/Geometry/Vector3D.h"
19 
20 namespace InDetDD {
21 
22 // Constructor with parameters:
24  const int crystals,
25  const int diodes,
26  const int cells,
27  const int shift,
28  const bool swapStripReadout,
29  InDetDD::CarrierType carrierType,
30  const double radius1,
31  const double halfHeight1,
32  const double radius2,
33  const double halfHeight2,
34  const double step,
35  const double etaCenter,
36  const double phiCenter,
37  int readoutSide) :
38  SCT_ModuleSideDesign(thickness,
39  true, // phi
40  false, // eta: For trapezoid we cant swap z (xEta) axis.
41  true, // depth
42  crystals,diodes,cells,shift,swapStripReadout,carrierType,readoutSide),
43  m_geometry(radius1,halfHeight1,radius2,halfHeight2,diodes,step,crystals),
44  m_frame(etaCenter,phiCenter,radius1)
45 {
46  if (crystals > 1) {
47  double radius = 0.5 * (radius1 + radius2 + halfHeight2 - halfHeight1);
48  m_frame=SCT_ForwardFrameTransformation(etaCenter,phiCenter,radius);
49  }
51 }
52 
53 double SCT_ForwardModuleSideDesign::sinStripAngleReco(double x, double y) const {
54  // If theta is angle between the edges of a sensor, then tan(theta/2) = (maxW - minW) / 2 / length
55  // and tan(theta/2) = width/2 / radius
56  // So 1/r = (maxW - minW) / (width * length)
57  double oneOverRadius = (maxWidth() - minWidth()) / (width() * length());
58  // We measure the angle from the y (eta) axis towards the x (phi) axis, hence the -ve sign.
59  double sinAngle = -x * oneOverRadius / sqrt(
60  (1 + y * oneOverRadius) * (1 + y * oneOverRadius) + x * oneOverRadius * x * oneOverRadius);
61 
62  return sinAngle;
63 }
64 
65 void
67  double & etaDist, double & phiDist) const
68 {
69  m_geometry.distanceToDetectorEdge(localPosition,
70  m_frame.polarFromCartesian(localPosition),
71  etaDist, phiDist);
72 }
73 
74 bool
75 SCT_ForwardModuleSideDesign::nearBondGap(const SiLocalPosition & localPosition, double etaTol) const
76 {
77  return m_geometry.nearBondGap(localPosition, etaTol);
78 }
79 
80 // check if the position is in active area
81 bool SCT_ForwardModuleSideDesign::inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap) const
82 {
83  //const SCT_ForwardPolarPosition polar=m_frame.polarFromCartesian(chargePos);
84  //return m_geometry.inActiveArea(m_frame.polarFromCartesian(chargePos));
85  return m_geometry.inActiveArea(chargePos, checkBondGap);
86 }
87 
88 // give distance to the nearest diode in units of pitch, from 0.0 to 0.5,
89 // this method should be fast as it is called for every surface charge
90 // in the SCT_SurfaceChargesGenerator
92 {
95 }
96 
97 
98 // give the strip pitch (dependence on position needed for forward)
100 {
101  const SCT_ForwardPolarPosition polar=m_frame.polarFromCartesian(chargePos);
102  // No longer make inActive check
103  // if (!m_geometry.inActiveArea(polar)) return 0;
104  return m_geometry.stripPitch(polar);
105 }
106 
107 // give the strip pitch (dependence on position needed for forward)
109 {
110  // Use center.
111  const SCT_ForwardPolarPosition polarCenter(m_frame.radius(), 0);
112  // No longer make inActive check
113  // if (!m_geometry.inActiveArea(polar)) return 0;
114  return m_geometry.stripPitch(polarCenter);
115 }
116 
117 
118 
119 // this method returns the extremities of a strip passing by the point
120 std::pair<SiLocalPosition,SiLocalPosition> SCT_ForwardModuleSideDesign::endsOfStrip(const SiLocalPosition &position) const
121 {
122  const SCT_ForwardPolarPosition polarPosition =
123  m_frame.polarFromCartesian(position);
124  const double theta = polarPosition.theta();
125  const double innerRadius = (m_geometry.radius1()-m_geometry.halfHeight1())/cos(theta);
126  double outerRadius;
127  if (crystals()==1) {
128  outerRadius = (m_geometry.radius1()+m_geometry.halfHeight1())/cos(theta);
129  } else {
130  outerRadius = (m_geometry.radius2()+m_geometry.halfHeight2())/cos(theta);
131  }
132  const SCT_ForwardPolarPosition innerPointPolar = SCT_ForwardPolarPosition(innerRadius,theta);
133  const SCT_ForwardPolarPosition outerPointPolar = SCT_ForwardPolarPosition(outerRadius,theta);
134  const SiLocalPosition innerPoint = m_frame.cartesianFromPolar(innerPointPolar);
135  const SiLocalPosition outerPoint = m_frame.cartesianFromPolar(outerPointPolar);
136 
137  return std::pair<SiLocalPosition,SiLocalPosition>(innerPoint,outerPoint);
138 }
139 
140 
141 // method for stereo angle computation - returns a vector parallel to the
142 // strip being hit
143 HepGeom::Vector3D<double> SCT_ForwardModuleSideDesign::phiMeasureSegment(const SiLocalPosition &position) const
144 {
145  const SCT_ForwardPolarPosition secondPolarPosition(0,0);
146  const SiLocalPosition secondPosition = m_frame.cartesianFromPolar(secondPolarPosition);
147 
148  HepGeom::Vector3D<double> notUnitVector;
149  notUnitVector[phiAxis()]=position.xPhi()-secondPosition.xPhi();
150  notUnitVector[etaAxis()]=position.xEta()-secondPosition.xEta();
151 
152  return notUnitVector.unit();
153 }
154 
156 {
157  return m_geometry.length();
158 }
159 
161 {
162  return m_geometry.width();
163 }
164 
166 {
167  return m_geometry.minWidth();
168 }
169 
171 {
172  return m_geometry.maxWidth();
173 }
174 
176 {
177  return m_geometry.deadAreaLength();
178 }
179 
181 {
183 }
184 
186 {
188 }
189 
190 //this method returns the position of the centre of a strips
193 {
194  // This method returns the position of the centre of the cell
195 
196  // NB. No check is made that cellId is valid or in the correct range.
197 
198  int strip = cellId.strip();
199 
200  double clusterCenter = strip - 0.5*cells() + 0.5;
201 
202  const double theta = m_geometry.angularPitch()*clusterCenter;
203  const double r = radius() / cos(theta);
204 
205  // positions in polar coordinates and then cartesian
206  const SCT_ForwardPolarPosition polarPosition(r, theta);
207  return m_frame.cartesianFromPolar(polarPosition);
208 }
209 
210 //this method returns the position of the centre of the cluster of strips
213  int clusterSize) const
214 {
215  // This method returns the position of the centre of the cluster starting at cellId.strip()
216 
217  // NB. No check is made that cellId is valid or in the correct range.
218 
219  if (clusterSize < 1) clusterSize = 1;
220 
221  int strip = cellId.strip();
222 
223  double clusterCenter = strip - 0.5*cells() + 0.5;
224  if (clusterSize>1) clusterCenter += 0.5 * (clusterSize-1);
225 
226  const double theta = angularPitch()*clusterCenter;
227  const double r = radius() / cos(theta);
228 
229  // positions in polar coordinates and then cartesian
230  const SCT_ForwardPolarPosition polarPosition(r,theta);
231  return m_frame.cartesianFromPolar(polarPosition);
232 }
233 
236 {
237  int strip = cellId.strip();
238 
239  double clusterCenter = strip - 0.5*cells() + 0.5;
240 
241  const double theta = m_geometry.angularPitch()*clusterCenter;
242  const double r = radius() / cos(theta);
243 
244  // positions in polar coordinates and then cartesian
245  const SCT_ForwardPolarPosition polarPosition(r, theta);
246  SiLocalPosition center = m_frame.cartesianFromPolar(polarPosition);
247 
248  // The strip is not rectangular put we return pitch at radius.
249  double stripWidth = angularPitch()*r;
250  double stripLength = length() / cos(theta);
251 
252  SiLocalPosition width(stripLength, stripWidth);
253  return SiDiodesParameters(center, width);
254 }
255 
256 
257 SiCellId
259 {
260  // NB We do not distinguish between the two crystals anymore.
261  // Check if we are in the active region. No bondgap check.
262  if (!inActiveArea(localPosition, false)) return {}; // return an invalid id
263 
264  const SCT_ForwardPolarPosition polar = m_frame.polarFromCartesian(localPosition);
265  double theta = polar.theta();
266 
267  double dstrip = theta/angularPitch() + 0.5*diodes();
268 
269  if (dstrip < 0) return {}; // return an invalid id
270  int strip = static_cast<int>(dstrip);
271  if (strip > diodes()) return {};// return an invalid id if strip # greater
272  // than number of diodes.
273  return {strip-shift()}; // strip numbering starts from first readout strip.
274  // Those to the left will have negative numbers.
275 }
276 
277 
280 {
281  return InDetDD::Trapezoid;
282 }
283 
284 const Trk::SurfaceBounds &
286 {
287  return m_bounds;
288 }
289 
290 } // namespace InDetDD
beamspotman.r
def r
Definition: beamspotman.py:676
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
InDetDD::SCT_ForwardModuleSideDesign::angularPitch
double angularPitch() const
Angular pitch.
Definition: SCT_ForwardModuleSideDesign.h:208
InDetDD::SCT_ForwardModuleSideDesign::length
virtual double length() const
Method to calculate length of a module.
Definition: SCT_ForwardModuleSideDesign.cxx:155
InDetDD::SCT_ForwardPolarPosition::theta
double theta() const
theta coordinate of point:
Definition: SCT_ForwardPolarPosition.h:79
InDetDD::SCT_ForwardModuleSideDesign::nearBondGap
virtual bool nearBondGap(const SiLocalPosition &localPosition, double etaTol) const
Test if near bond gap within tolerances.
Definition: SCT_ForwardModuleSideDesign.cxx:75
InDetDD::SCT_ModuleSideDesign
Definition: SCT_ModuleSideDesign.h:40
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
InDetDD::SCT_ForwardModuleSideDesign::minWidth
virtual double minWidth() const
Method to calculate minimum width of a module.
Definition: SCT_ForwardModuleSideDesign.cxx:165
InDetDD::SCT_ForwardModuleSideGeometry::halfHeight1
double halfHeight1() const
inner crystal half height:
Definition: SCT_ForwardModuleSideGeometry.h:171
InDetDD::SCT_ModuleSideDesign::strip
virtual int strip(int stripId1Dim) const
Definition: SCT_ModuleSideDesign.h:275
InDetDD::SCT_ForwardModuleSideGeometry::deadAreaUpperBoundary
double deadAreaUpperBoundary() const
give upper boundary of dead area
Definition: SCT_ForwardModuleSideGeometry.cxx:216
InDetDD::SCT_ForwardFrameTransformation::polarFromCartesian
SCT_ForwardPolarPosition polarFromCartesian(const SiLocalPosition &cartesian) const
create a SCT_ForwardPolarPosition from a SiLocalPosition
Definition: SCT_ForwardFrameTransformation.cxx:54
InDetDD::SCT_ForwardModuleSideGeometry::minWidth
double minWidth() const
Method to calculate minimum width of a module.
Definition: SCT_ForwardModuleSideGeometry.cxx:187
InDetDD::SCT_ForwardModuleSideGeometry::radius2
double radius2() const
r from outer crystal (if present) center to beam:
Definition: SCT_ForwardModuleSideGeometry.h:176
InDetDD::SCT_ForwardModuleSideDesign::m_bounds
Trk::TrapezoidBounds m_bounds
Definition: SCT_ForwardModuleSideDesign.h:175
InDetDD::SCT_ForwardPolarPosition
Definition: SCT_ForwardPolarPosition.h:25
InDetDD::SCT_ForwardModuleSideGeometry::deadAreaLowerBoundary
double deadAreaLowerBoundary() const
give lower boundary of dead area
Definition: SCT_ForwardModuleSideGeometry.cxx:222
InDetDD::SCT_ForwardModuleSideGeometry::radius1
double radius1() const
r from inner crystal center to beam:
Definition: SCT_ForwardModuleSideGeometry.h:161
InDetDD::SCT_ForwardModuleSideDesign::radius
double radius() const
Nominal center radius of double wafer.
Definition: SCT_ForwardModuleSideDesign.h:184
SCT_ForwardModuleSideDesign.h
InDetDD::SCT_ForwardModuleSideDesign::parameters
virtual SiDiodesParameters parameters(const SiCellId &cellId) const
readout or diode id -> position, size
Definition: SCT_ForwardModuleSideDesign.cxx:235
InDetDD::SCT_ForwardModuleSideDesign::shape
virtual DetectorShape shape() const
Shape of element.
Definition: SCT_ForwardModuleSideDesign.cxx:279
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
InDetDD::SCT_ForwardModuleSideGeometry::deadAreaLength
double deadAreaLength() const
give length of dead area
Definition: SCT_ForwardModuleSideGeometry.cxx:204
InDetDD::SCT_ModuleSideDesign::crystals
int crystals() const
number of crystals within module side:
Definition: SCT_ModuleSideDesign.h:216
InDetDD::SCT_ModuleSideDesign::shift
int shift() const
number of edge strips before first readout strip.
Definition: SCT_ModuleSideDesign.h:232
InDetDD::SiCellId::strip
int strip() const
Get strip number. Equivalent to phiIndex().
Definition: SiCellId.h:131
x
#define x
InDetDD::SCT_ModuleSideDesign::cells
int cells() const
number of readout stips within module side:
Definition: SCT_ModuleSideDesign.h:228
InDetDD::SCT_ForwardModuleSideDesign::maxWidth
virtual double maxWidth() const
Method to calculate maximum width of a module.
Definition: SCT_ForwardModuleSideDesign.cxx:170
InDetDD::SCT_ForwardModuleSideDesign::deadAreaLength
virtual double deadAreaLength() const
give length of dead area
Definition: SCT_ForwardModuleSideDesign.cxx:175
InDetDD::SCT_ForwardFrameTransformation::radius
double radius() const
r from module center to beam:
Definition: SCT_ForwardFrameTransformation.h:101
InDetDD::SCT_ForwardModuleSideDesign::deadAreaUpperBoundary
virtual double deadAreaUpperBoundary() const
give upper boundary of dead area
Definition: SCT_ForwardModuleSideDesign.cxx:180
InDetDD::SiLocalPosition
Definition: SiLocalPosition.h:31
InDetDD::SiLocalPosition::xPhi
double xPhi() const
position along phi direction:
Definition: SiLocalPosition.h:123
InDetDD::SCT_ForwardModuleSideDesign::endsOfStrip
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const
this method returns the ends of the strip
Definition: SCT_ForwardModuleSideDesign.cxx:120
InDetDD::SCT_ForwardModuleSideGeometry::angularPitch
double angularPitch() const
Definition: SCT_ForwardModuleSideGeometry.h:196
InDetDD::SCT_ForwardFrameTransformation
Definition: SCT_ForwardFrameTransformation.h:27
InDetDD::SCT_ForwardModuleSideDesign::localPositionOfCluster
virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const
Definition: SCT_ForwardModuleSideDesign.cxx:212
InDetDD::SCT_ForwardModuleSideDesign::SCT_ForwardModuleSideDesign
SCT_ForwardModuleSideDesign()
Forbidden default constructor.
InDetDD::SCT_ForwardModuleSideDesign::scaledDistanceToNearestDiode
virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const
give distance to the nearest diode in units of pitch, from 0.0 to 0.5, this method should be fast as ...
Definition: SCT_ForwardModuleSideDesign.cxx:91
InDetDD::SiLocalPosition::xEta
double xEta() const
position along eta direction:
Definition: SiLocalPosition.h:118
InDetDD::SCT_ForwardModuleSideGeometry::distanceToDetectorEdge
void distanceToDetectorEdge(const SiLocalPosition &localPosition, const SCT_ForwardPolarPosition &polarPos, double &etaDist, double &phiDist) const
Definition: SCT_ForwardModuleSideGeometry.cxx:84
InDetDD::SCT_ForwardModuleSideGeometry::inActiveArea
bool inActiveArea(const SiLocalPosition &chargePosition, bool checkBondGap=true) const
check if position is in active area
Definition: SCT_ForwardModuleSideGeometry.cxx:110
InDetDD::SCT_ForwardModuleSideDesign::distanceToDetectorEdge
virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, double &phiDist) const
Returns distance to nearest detector active edge +ve = inside -ve = outside.
Definition: SCT_ForwardModuleSideDesign.cxx:66
InDetDD::SCT_ForwardModuleSideDesign::inActiveArea
virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap=true) const
check if the position is in active area
Definition: SCT_ForwardModuleSideDesign.cxx:81
InDetDD::SCT_ForwardModuleSideGeometry::stripPitch
double stripPitch(const SCT_ForwardPolarPosition &polarPos) const
give the strip pitch (dependence on position needed for forward)
Definition: SCT_ForwardModuleSideGeometry.cxx:154
InDetDD::SCT_ForwardModuleSideDesign::stripPitch
virtual double stripPitch() const
give the strip pitch (For Forward returns pitch at center)
Definition: SCT_ForwardModuleSideDesign.cxx:108
InDetDD::SCT_ForwardModuleSideGeometry::length
double length() const
Method to calculate length of a module.
Definition: SCT_ForwardModuleSideGeometry.cxx:175
InDetDD::SCT_ModuleSideDesign::diodes
int diodes() const
number of strips within crystal:
Definition: SCT_ModuleSideDesign.h:220
InDetDD::SCT_ForwardModuleSideDesign::cellIdOfPosition
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const
position -> id
Definition: SCT_ForwardModuleSideDesign.cxx:258
InDetDD::SCT_ForwardModuleSideGeometry::halfHeight2
double halfHeight2() const
outer crystal (if present) half height:
Definition: SCT_ForwardModuleSideGeometry.h:181
InDetDD::SCT_ForwardFrameTransformation::cartesianFromPolar
SiLocalPosition cartesianFromPolar(const SCT_ForwardPolarPosition &polar) const
create a SiLocalPosition from a SCT_ForwardPolarPosition
Definition: SCT_ForwardFrameTransformation.cxx:65
InDetDD::DetectorDesign::phiAxis
Axis phiAxis() const
local axis corresponding to phi direction:
Definition: DetectorDesign.h:263
InDetDD::SCT_ForwardModuleSideDesign::phiMeasureSegment
virtual HepGeom::Vector3D< double > phiMeasureSegment(const SiLocalPosition &position) const
method for stereo angle computation - returns a vector parallel to the strip being hit
Definition: SCT_ForwardModuleSideDesign.cxx:143
InDetDD::SCT_ForwardModuleSideDesign::localPositionOfCell
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
id -> position
Definition: SCT_ForwardModuleSideDesign.cxx:192
InDetDD::SCT_ForwardModuleSideDesign::m_frame
SCT_ForwardFrameTransformation m_frame
polar / cartesian frame transformation
Definition: SCT_ForwardModuleSideDesign.h:174
InDetDD::SCT_ForwardModuleSideDesign::bounds
virtual const Trk::SurfaceBounds & bounds() const
Element boundary.
Definition: SCT_ForwardModuleSideDesign.cxx:285
InDetDD::SCT_ForwardModuleSideGeometry::width
double width() const
Method to calculate average width of a module.
Definition: SCT_ForwardModuleSideGeometry.cxx:181
InDetDD::DetectorShape
DetectorShape
Definition: DetectorDesign.h:41
Trk::TrapezoidBounds
Definition: TrapezoidBounds.h:43
InDetDD::SCT_ForwardModuleSideGeometry::scaledDistanceToNearestDiode
double scaledDistanceToNearestDiode(const SCT_ForwardPolarPosition &polarPos) const
give distance to the nearest diode in units of pitch, from 0.0 to 0.5, this method should be fast as ...
Definition: SCT_ForwardModuleSideGeometry.cxx:163
InDetDD::SiCellId
Definition: SiCellId.h:29
InDetDD::SCT_ForwardModuleSideDesign::sinStripAngleReco
double sinStripAngleReco(double phiCoord, double etaCoord) const
Give strip angle in the reco frame.
Definition: SCT_ForwardModuleSideDesign.cxx:53
SiDiodesParameters.h
InDetDD::SCT_ForwardModuleSideDesign::m_geometry
SCT_ForwardModuleSideGeometry m_geometry
geometry of module side
Definition: SCT_ForwardModuleSideDesign.h:173
y
#define y
InDetDD::CarrierType
CarrierType
Definition: InDetDD_Defs.h:17
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::SCT_ForwardModuleSideGeometry::nearBondGap
bool nearBondGap(const SiLocalPosition &localPosition, double etaTol) const
Test if near bond gap within tolerances.
Definition: SCT_ForwardModuleSideGeometry.cxx:99
LArCellBinning.step
step
Definition: LArCellBinning.py:158
InDetDD::SCT_ForwardModuleSideDesign::deadAreaLowerBoundary
virtual double deadAreaLowerBoundary() const
give lower boundary of dead area
Definition: SCT_ForwardModuleSideDesign.cxx:185
InDetDD::DetectorDesign::etaAxis
Axis etaAxis() const
local axis corresponding to eta direction:
Definition: DetectorDesign.h:259
InDetDD::SCT_ForwardModuleSideGeometry::maxWidth
double maxWidth() const
Method to calculate maximum width of a module.
Definition: SCT_ForwardModuleSideGeometry.cxx:193
InDetDD::SCT_ForwardModuleSideDesign::width
virtual double width() const
Method to calculate average width of a module.
Definition: SCT_ForwardModuleSideDesign.cxx:160
InDetDD::Trapezoid
@ Trapezoid
Definition: DetectorDesign.h:42
InDetDD::SiDiodesParameters
Definition: SiDiodesParameters.h:25