ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_BarrelModuleSideDesign.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_BarrelModuleSideDesign.cxx
7// Implementation file for class SCT_BarrelModuleSideDesign
9
12
13#include "CLHEP/Units/SystemOfUnits.h"
14#include "CLHEP/Geometry/Vector3D.h"
15
16#include <cmath>
17
18namespace InDetDD {
19
20// Constructor with parameters:
22 const int crystals,
23 const int diodes,
24 const int cells,
25 const int shift,
26 const bool swapStripReadout,
28 const double stripPitch,
29 const double stripLength,
30 const double xEtaStripPatternCentre,
31 const double xPhiStripPatternCentre,
32 const double totalDeadLength,
33 int readoutSide) :
35 true, true, true, // phi,eta,depth axes symmetric
39 m_xEtaStripPatternCentre(xEtaStripPatternCentre),
40 m_xPhiStripPatternCentre(xPhiStripPatternCentre),
41 m_totalDeadLength(totalDeadLength)
42{
44 if(crystals==1) {
46 if (m_xEtaAbsSizeLow == 0) m_xEtaAbsSizeLow = -1.0 * CLHEP::mm; // Anything negative will do
48 }
49 else if(crystals==2) {
52 } else {
53 std::cout << "wrong number of crystals!\n";
55 }
56
58}
59
60
61// Returns distance to nearest detector edge
62// +ve = inside
63// -ve = outside
64void
66 double & etaDist, double & phiDist) const
67{
68 // As the calculation is symmetric around 0,0 we only have to test it for one side.
69 double xEta = std::abs(localPosition.xEta() - m_xEtaStripPatternCentre);
70 double xPhi = std::abs(localPosition.xPhi() - m_xPhiStripPatternCentre);
71
72 double xEtaEdge = 0.5 * length();
73 double xPhiEdge = 0.5 * width();
74
75 // Distance to top/bottom
76 etaDist = xEtaEdge - xEta;
77
78 // Distance to right/left edge
79 phiDist = xPhiEdge - xPhi;
80
81}
82
83
84bool SCT_BarrelModuleSideDesign::nearBondGap(const SiLocalPosition & localPosition, double etaTol) const
85{
86 // Symmetric around xEta = 0 so we can use absolute value.
87 if (m_totalDeadLength==0) return false;
88 return ( std::abs(localPosition.xEta()) < 0.5*m_totalDeadLength + etaTol);
89}
90
91// check if the position is in active area
93 bool checkBondGap) const
94{
95 // in Phi
96 if (std::abs(chargePos.xPhi()-m_xPhiStripPatternCentre) > m_xPhiAbsSize) return false;
97
98 // in Eta
99 double relEta = std::abs(chargePos.xEta() - m_xEtaStripPatternCentre);
100 if (relEta > m_xEtaAbsSizeHigh) return false;
101
102 // bond gap
103 return !(checkBondGap && (relEta < m_xEtaAbsSizeLow));
104}
105
106
107// distance to the nearest diode in units of pitch, from 0.0 to 0.5,
108// this method should be fast as it is called for every surface charge
109// in the SCT_SurfaceChargesGenerator
110// an active area check, done in the Generator anyway, is removed here
112{
113 double dstrip=std::abs(chargePos.xPhi()-m_xPhiStripPatternCentre)/m_stripPitch;
114 dstrip=dstrip-static_cast<double>(int(dstrip))-0.5;
115 // the above -0.5 is because we have an even number of strips, centre of detector
116 // is in the middle of an interstrip gap
117 return std::abs(dstrip);
118}
119
120std::pair<SiLocalPosition,SiLocalPosition> SCT_BarrelModuleSideDesign::endsOfStrip(const SiLocalPosition &position) const
121{
122 // this method returns the ends of the strip
123 // assume input xPhi
124
127
128 std::pair<SiLocalPosition,SiLocalPosition> two_ends(end1,end2);
129 return two_ends;
130}
131
132
137
139{
140 return m_stripPitch*diodes();
141}
142
144{
145 return width();
146}
147
149{
150 return width();
151}
152
153
154// method for stereo angle computation - returns a vector parallel to the
155// strip being hit
157{
158 HepGeom::Vector3D<double> segment;
159 segment[etaAxis()]=1;
160 return segment;
161}
162
163// give length of dead area
168
169// give upper boundary of dead area (origin in module centre)
174// give lower boundary of dead area (origin in module centre)
179
180
181
184{
185
186 // NB. No check is made that cellId is valid or in the correct range.
187
188 int strip = cellId.strip();
189
190 // center of cluster (in units of number of strips) from detector center
191 double clusterCenter = strip - 0.5*cells() + 0.5;
192
193 double xPhi=m_xPhiStripPatternCentre + m_stripPitch * clusterCenter;
194
195 // Return the position.
196 // no matter how many crystals we have, xEta of the position is in the centre!
198}
199
202{
203 // This method returns the position of the centre of the cluster starting at cellId.strip()
204
205 // NB. No check is made that cellId is valid or in the correct range.
206
207 if (clusterSize < 1) clusterSize = 1;
208
209 int strip = cellId.strip();
210
211 // center of cluster (in units of number of strips) from detector center
212 double clusterCenter = strip - 0.5*cells() + 0.5;
213 if (clusterSize>1) clusterCenter += 0.5 * (clusterSize-1);
214
215 double xPhi=m_xPhiStripPatternCentre + m_stripPitch * clusterCenter;
216
217 // Return the position.
218 // no matter how many crystals we have, xEta of the position is in the centre!
220}
221
222
225{
226 // NB. We treat the two crytals as one.
228 double xPhiSize=m_stripPitch;
229 double xEtaSize=2*m_xEtaAbsSizeHigh;
230 SiLocalPosition width(xEtaSize,xPhiSize);
231 return SiDiodesParameters(center,width);
232}
233
236{
237 // NB We do not distinguish between the two crystals anymore.
238 // Check if we are in the active region. No bondgap check.
239 if (!inActiveArea(localPosition, false)) return {}; // return an invalid id
240 double xPhi=localPosition.xPhi();
241 double dstrip=(xPhi-m_xPhiStripPatternCentre)/m_stripPitch+0.5*diodes();
242 if (dstrip < 0) return {}; // return an invalid id
243 int strip = static_cast<int>(dstrip);
244 if (strip > diodes()) return {};// return an invalid id if strip # greater than number of diodes.
245 return {strip-shift()}; // strip numbering starts from first readout strip.
246 // Those to the left will have negative numbers.
247
248}
249
250const Trk::SurfaceBounds &
252{
253 return m_bounds;
254}
255
256} // namespace InDetDD
Axis etaAxis() const
local axis corresponding to eta direction:
double thickness() const
Method which returns thickness of the silicon wafer.
InDetDD::CarrierType carrierType() const
Return carrier type (ie electrons or holes)
int readoutSide() const
ReadoutSide.
double m_xEtaStripPatternCentre
geom position on G4 volume, care needed
virtual double width() const
Method to calculate average width of a module.
virtual double stripPitch() const
strip pitch
virtual double deadAreaLength() const
give length of dead area
virtual HepGeom::Vector3D< double > phiMeasureSegment(const SiLocalPosition &) const
method for stereo angle computation - returns a vector parallel to the strip being hit
virtual double length() const
Method to calculate length of a module.
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
id -> position
Trk::RectangleBounds m_bounds
surface bound description
virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const
double m_xPhiAbsSize
size in xPhi/2 for active area
virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, double &phiDist) const
Returns distance to nearest detector active edge +ve = inside -ve = outside.
virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const
distance to the nearest diode in units of pitch, from 0.0 to 0.5, this method should be fast as it is...
virtual const Trk::SurfaceBounds & bounds() const
Return the surface bounds.
virtual bool nearBondGap(const SiLocalPosition &localPosition, double etaTol) const
Test if near bond gap within tolerances.
virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap=true) const
check if the position is in active area
double m_xPhiStripPatternCentre
geom position on G4 volume, care needed
virtual double deadAreaLowerBoundary() const
give lower boundary of dead area
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const
position -> id
virtual double minWidth() const
Method to calculate minimum width of a module.
double m_stripPitch
strip pitch, 80 um in barrel SCT
virtual SiDiodesParameters parameters(const SiCellId &cellId) const
readout or diode id -> position, size
virtual double deadAreaUpperBoundary() const
give upper boundary of dead area
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const
this method returns the ends of the strip
double m_totalDeadLength
includes detector edge and gap between decetors
virtual double maxWidth() const
Method to calculate maximum width of a module.
int diodes() const
number of strips within crystal:
int cells() const
number of readout stips within module side:
int crystals() const
number of crystals within module side:
virtual int strip(int stripId1Dim) const
int shift() const
number of edge strips before first readout strip.
SCT_ModuleSideDesign(const double thickness, const bool phiSymmetric, const bool etaSymmetric, const bool depthSymmetric, const int crystals, const int diodes, const int cells, const int shift, const bool swapStripReadout, InDetDD::CarrierType carrierType, int readoutSide)
Constructor with parameters: local axis corresponding to eta direction local axis corresponding to ph...
Identifier for the strip or pixel cell.
Definition SiCellId.h:29
int strip() const
Get strip number. Equivalent to phiIndex().
Definition SiCellId.h:131
Class to handle the position of the centre and the width of a diode or a cluster of diodes Version 1....
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
double xPhi() const
position along phi direction:
double xEta() const
position along eta direction:
Bounds for a rectangular, planar surface.
Abstract base class for surface bounds to be specified.
Message Stream Member.