ATLAS Offline Software
SCT_ForwardModuleSideGeometry.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // SCT_ForwardModuleSideGeometry.cxx
7 // Implementation file for class SCT_ForwardModuleSideGeometry
9 // (c) ATLAS Detector software
11 // Version 1.6 09/7/2001 Alessandro Fornaini
13 
15 #include <cmath>
16 
17 namespace InDetDD {
18 
19  using std::cos;
20  using std::sin;
21 
22 // Constructor with parameters:
24  const double halfHeight1,
25  const double radius2,
26  const double halfHeight2,
27  const int strips,
28  const double step,
29  const int nCrystals ) :
30  m_radius1(radius1),
31  m_halfHeight1(halfHeight1),
32  m_radius2(radius2),
33  m_halfHeight2(halfHeight2),
34  m_strips(strips),
35  m_step(step) ,
36  m_nCrystals(nCrystals),
37  m_leftSide(step*strips*(-0.5)),
38  m_rightSide(step*strips*0.5),
39  m_upperSide1(radius1+halfHeight1),
40  m_lowerSide1(radius1-halfHeight1),
41  m_upperSide2(radius2+halfHeight2),
42  m_lowerSide2(radius2-halfHeight2)
43 
44 
45 {
46  if (m_radius1<0) m_radius1=0.0;
47  if (m_halfHeight1<0) m_halfHeight1=0.0;
48  if (m_radius2<0) m_radius2=0.0;
49  if (m_halfHeight2<0) m_halfHeight2=0.0;
50  if (m_strips<0) m_strips=0;
51  if (m_step<0) m_step=0.0;
52  if (m_nCrystals==0) m_nCrystals=1;
53  if (m_nCrystals<2) {
54  m_radius2=0;
55  m_halfHeight2=0;
56  }
57 
58  if (m_nCrystals==1) {
61  } else {
64  }
65 
67 
68  if (m_nCrystals==1) {
69  m_deadRegionUpper = 0;
70  m_deadRegionLower = 0;
71  } else {
74  }
75 
76 }
77 
78 
79 
80 // Returns distance to nearest detector edge
81 // +ve = inside
82 // -ve = outside
83 void
85  const SCT_ForwardPolarPosition & polar,
86  double & etaDist, double & phiDist) const
87 {
88 
89  // Distance to top/bottom.
90  // Calculation symmetric around zero so we can use abs.
91  etaDist = m_halfLength - std::abs(localPosition.xEta());
92 
93  // For phi distance use r*phiDiff.
94  phiDist = polar.r() * (m_rightSide - std::abs(polar.theta()));
95 
96 }
97 
98 
99 bool SCT_ForwardModuleSideGeometry::nearBondGap(const SiLocalPosition & localPosition, double etaTol) const
100 {
101  if (m_nCrystals == 1) return false; // No bond gap (eg for truncated middle detectors)
102 
103  return ((localPosition.xEta() < m_deadRegionUpper + etaTol ) &&
104  (localPosition.xEta() > m_deadRegionLower - etaTol));
105 
106 }
107 
108 
109 // check if the position is in active area
111  bool checkBondGap) const
112 {
113  double xEta = chargePos.xEta();
114  double xPhi = chargePos.xPhi();
115 
116  if (std::abs(xEta) > m_halfLength) return false;
117 
118  if (checkBondGap && m_nCrystals > 1) {
119  // Check if in bond gap
120  if (xEta > m_deadRegionLower && xEta < m_deadRegionUpper) return false;
121  }
122 
123  // edge at xEta
124  double edge = (xEta + m_radius) * m_tangent;
125 
126  return (std::abs(xPhi) < edge);
127 }
128 
129 // DEPRECATED
130 // check if the position is in active area
132  &polarPos ) const
133 {
134  bool conditionTheta=false;
135  bool conditionEtaOne=false;
136  bool conditionEtaTwo=false;
137  double polarR = polarPos.r();
138  double polarTheta = polarPos.theta();
139  double cosPolarTheta = cos(polarTheta);
140 
141 
142  if (polarR*cosPolarTheta<m_upperSide1 &&
143  polarR*cosPolarTheta>m_lowerSide1)
144  conditionEtaOne=true;
145  if (polarR*cosPolarTheta<m_upperSide2 &&
146  polarR*cosPolarTheta>m_lowerSide2)
147  conditionEtaTwo=true;
148  if (polarTheta<m_rightSide &&
149  polarTheta>m_leftSide) conditionTheta=true;
150  return (conditionEtaOne || conditionEtaTwo) && conditionTheta;
151 }
152 
153 // give the strip pitch (dependence on position needed for forward)
155  &polarPos) const
156 {
157  return 2.0*polarPos.r()*std::abs(sin(m_step*0.5));
158 }
159 
160 // give distance to the nearest diode in units of pitch, from 0.0 to 0.5,
161 // this method should be fast as it is called for every surface charge
162 // in the SCT_SurfaceChargesGenerator
164 {
165  int stripIndex;
166  if (polarPos.theta()>0) stripIndex =
167  static_cast<int>(polarPos.theta()/m_step);
168  else stripIndex = static_cast<int>(polarPos.theta()/m_step-1);
169  const double thetaStrip = (stripIndex+0.5)*m_step;
170  const double pitch = 2.0*polarPos.r()*std::abs(sin(m_step*0.5));
171  return polarPos.r()*std::abs(sin(polarPos.theta()-thetaStrip))/pitch;
172 }
173 
174 // Method to calculate length of a module
176 {
177  return 2 * m_halfLength;
178 }
179 
180 // Method to calculate average width of a module
182 {
183  return 2 * m_radius * m_tangent;
184 }
185 
186 // Method to calculate minimum width of a module
188 {
189  return 2 * m_lowerSide1 * m_tangent;
190 }
191 
192 // Method to calculate maximum width of a module
194 {
195  if (m_nCrystals==1) {
196  return 2 * m_upperSide1 * m_tangent;
197  }
198  else {
199  return 2 * m_upperSide2 * m_tangent;
200  }
201 }
202 
203 // give length of dead area
205 {
206  if (m_nCrystals==1) {
207  return 0;
208  } else {
210  }
211 
212 }
213 
214 
215 // give upper boundary of dead area
217 {
218  return m_deadRegionUpper;
219 }
220 
221 // give lower boundary of dead area
223 {
224  return m_deadRegionLower;
225 }
226 
227 } // namespace InDetDD
InDetDD::SCT_ForwardModuleSideGeometry::m_halfHeight2
double m_halfHeight2
outer crystal (if present) half height
Definition: SCT_ForwardModuleSideGeometry.h:139
InDetDD::SCT_ForwardModuleSideGeometry::m_upperSide1
double m_upperSide1
upper side of crystal 1
Definition: SCT_ForwardModuleSideGeometry.h:145
InDetDD::SCT_ForwardModuleSideGeometry::m_leftSide
double m_leftSide
left border of module in angle
Definition: SCT_ForwardModuleSideGeometry.h:143
InDetDD::SCT_ForwardPolarPosition::theta
double theta() const
theta coordinate of point:
Definition: SCT_ForwardPolarPosition.h:79
InDetDD::SCT_ForwardModuleSideGeometry::SCT_ForwardModuleSideGeometry
SCT_ForwardModuleSideGeometry()
InDetDD::SCT_ForwardModuleSideGeometry::m_halfLength
double m_halfLength
top = +halfLength, bot = -halfLength
Definition: SCT_ForwardModuleSideGeometry.h:150
InDetDD::SCT_ForwardModuleSideGeometry::deadAreaUpperBoundary
double deadAreaUpperBoundary() const
give upper boundary of dead area
Definition: SCT_ForwardModuleSideGeometry.cxx:216
InDetDD::SCT_ForwardModuleSideGeometry::minWidth
double minWidth() const
Method to calculate minimum width of a module.
Definition: SCT_ForwardModuleSideGeometry.cxx:187
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::m_strips
int m_strips
number of strips (same for both crystals)
Definition: SCT_ForwardModuleSideGeometry.h:140
SCT_ForwardModuleSideGeometry.h
InDetDD::SCT_ForwardModuleSideGeometry::m_deadRegionLower
double m_deadRegionLower
relative to center of detector.
Definition: SCT_ForwardModuleSideGeometry.h:152
InDetDD::SCT_ForwardModuleSideGeometry::m_radius
double m_radius
r from nominal element center to beam
Definition: SCT_ForwardModuleSideGeometry.h:135
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::SiLocalPosition
Definition: SiLocalPosition.h:31
InDetDD::SiLocalPosition::xPhi
double xPhi() const
position along phi direction:
Definition: SiLocalPosition.h:123
InDetDD::SCT_ForwardPolarPosition::r
double r() const
r coordinate of point:
Definition: SCT_ForwardPolarPosition.h:74
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::m_halfHeight1
double m_halfHeight1
inner crystal half height
Definition: SCT_ForwardModuleSideGeometry.h:137
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_ForwardModuleSideGeometry::m_upperSide2
double m_upperSide2
upper side of crystal 2
Definition: SCT_ForwardModuleSideGeometry.h:147
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_ForwardModuleSideGeometry::length
double length() const
Method to calculate length of a module.
Definition: SCT_ForwardModuleSideGeometry.cxx:175
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
InDetDD::SCT_ForwardModuleSideGeometry::m_lowerSide1
double m_lowerSide1
lower side of crystal 1
Definition: SCT_ForwardModuleSideGeometry.h:146
InDetDD::SCT_ForwardModuleSideGeometry::width
double width() const
Method to calculate average width of a module.
Definition: SCT_ForwardModuleSideGeometry.cxx:181
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::SCT_ForwardModuleSideGeometry::m_radius1
double m_radius1
r from inner crystal center to beam
Definition: SCT_ForwardModuleSideGeometry.h:136
InDetDD::SCT_ForwardModuleSideGeometry::m_deadRegionUpper
double m_deadRegionUpper
relative to center of detector.
Definition: SCT_ForwardModuleSideGeometry.h:151
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
InDetDD::SCT_ForwardModuleSideGeometry::m_nCrystals
int m_nCrystals
number of crystals per module side
Definition: SCT_ForwardModuleSideGeometry.h:142
LArCellBinning.step
step
Definition: LArCellBinning.py:158
InDetDD::SCT_ForwardModuleSideGeometry::m_step
double m_step
strip step in angle (same for both crystals)
Definition: SCT_ForwardModuleSideGeometry.h:141
InDetDD::SCT_ForwardModuleSideGeometry::m_tangent
double m_tangent
tan(theta) at edge = (halfWidth) / (radius)
Definition: SCT_ForwardModuleSideGeometry.h:153
InDetDD::SCT_ForwardModuleSideGeometry::m_lowerSide2
double m_lowerSide2
lower side of crystal 2
Definition: SCT_ForwardModuleSideGeometry.h:148
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
InDetDD::SCT_ForwardModuleSideGeometry::maxWidth
double maxWidth() const
Method to calculate maximum width of a module.
Definition: SCT_ForwardModuleSideGeometry.cxx:193
InDetDD::SCT_ForwardModuleSideGeometry::m_rightSide
double m_rightSide
right border of module in angle
Definition: SCT_ForwardModuleSideGeometry.h:144
InDetDD::SCT_ForwardModuleSideGeometry::m_radius2
double m_radius2
r from outer crystal (if present) center to beam
Definition: SCT_ForwardModuleSideGeometry.h:138