ATLAS Offline Software
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 
18 namespace 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,
27  InDetDD::CarrierType carrierType,
28  const double stripPitch,
29  const double stripLength,
30  const double xEtaStripPatternCentre,
31  const double xPhiStripPatternCentre,
32  const double totalDeadLength,
33  int readoutSide) :
34  SCT_ModuleSideDesign(thickness,
35  true, true, true, // phi,eta,depth axes symmetric
36  crystals,diodes,cells,shift,swapStripReadout,carrierType,readoutSide),
37  m_stripPitch(stripPitch),
38  m_stripLength(stripLength),
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
64 void
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 
84 bool 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 
120 std::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 
134 {
136 }
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
156 HepGeom::Vector3D<double> SCT_BarrelModuleSideDesign::phiMeasureSegment(const SiLocalPosition& ) const
157 {
158  HepGeom::Vector3D<double> segment;
159  segment[etaAxis()]=1;
160  return segment;
161 }
162 
163 // give length of dead area
165 {
166  return m_totalDeadLength;
167 }
168 
169 // give upper boundary of dead area (origin in module centre)
171 {
172  return m_totalDeadLength/2;
173 }
174 // give lower boundary of dead area (origin in module centre)
176 {
177  return -m_totalDeadLength/2;
178 }
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 
201 SCT_BarrelModuleSideDesign::localPositionOfCluster(const SiCellId & cellId, int clusterSize) const
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.
227  SiLocalPosition center=localPositionOfCell(cellId);
228  double xPhiSize=m_stripPitch;
229  double xEtaSize=2*m_xEtaAbsSizeHigh;
230  SiLocalPosition width(xEtaSize,xPhiSize);
231  return SiDiodesParameters(center,width);
232 }
233 
234 SiCellId
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 
250 const Trk::SurfaceBounds &
252 {
253  return m_bounds;
254 }
255 
256 } // namespace InDetDD
InDetDD::SCT_BarrelModuleSideDesign::parameters
virtual SiDiodesParameters parameters(const SiCellId &cellId) const
readout or diode id -> position, size
Definition: SCT_BarrelModuleSideDesign.cxx:224
Trk::RectangleBounds
Definition: RectangleBounds.h:38
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
InDetDD::SCT_BarrelModuleSideDesign::m_bounds
Trk::RectangleBounds m_bounds
surface bound description
Definition: SCT_BarrelModuleSideDesign.h:169
InDetDD::SCT_BarrelModuleSideDesign::width
virtual double width() const
Method to calculate average width of a module.
Definition: SCT_BarrelModuleSideDesign.cxx:138
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
InDetDD::SCT_BarrelModuleSideDesign::maxWidth
virtual double maxWidth() const
Method to calculate maximum width of a module.
Definition: SCT_BarrelModuleSideDesign.cxx:148
InDetDD::SCT_ModuleSideDesign
Definition: SCT_ModuleSideDesign.h:40
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
InDetDD::SCT_ModuleSideDesign::strip
virtual int strip(int stripId1Dim) const
Definition: SCT_ModuleSideDesign.h:275
InDetDD::SCT_BarrelModuleSideDesign::inActiveArea
virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap=true) const
check if the position is in active area
Definition: SCT_BarrelModuleSideDesign.cxx:92
InDetDD::SCT_BarrelModuleSideDesign::minWidth
virtual double minWidth() const
Method to calculate minimum width of a module.
Definition: SCT_BarrelModuleSideDesign.cxx:143
InDetDD::SCT_BarrelModuleSideDesign::endsOfStrip
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const
this method returns the ends of the strip
Definition: SCT_BarrelModuleSideDesign.cxx:120
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
InDetDD::SCT_BarrelModuleSideDesign::m_stripLength
double m_stripLength
strip length
Definition: SCT_BarrelModuleSideDesign.h:163
InDetDD::SCT_ModuleSideDesign::cells
int cells() const
number of readout stips within module side:
Definition: SCT_ModuleSideDesign.h:228
InDetDD::SCT_BarrelModuleSideDesign::phiMeasureSegment
virtual HepGeom::Vector3D< double > phiMeasureSegment(const SiLocalPosition &) const
method for stereo angle computation - returns a vector parallel to the strip being hit
Definition: SCT_BarrelModuleSideDesign.cxx:156
InDetDD::SCT_BarrelModuleSideDesign::deadAreaLowerBoundary
virtual double deadAreaLowerBoundary() const
give lower boundary of dead area
Definition: SCT_BarrelModuleSideDesign.cxx:175
InDetDD::SiLocalPosition
Definition: SiLocalPosition.h:31
InDetDD::SiLocalPosition::xPhi
double xPhi() const
position along phi direction:
Definition: SiLocalPosition.h:123
InDetDD::SCT_BarrelModuleSideDesign::m_xEtaStripPatternCentre
double m_xEtaStripPatternCentre
geom position on G4 volume, care needed
Definition: SCT_BarrelModuleSideDesign.h:164
InDetDD::SCT_BarrelModuleSideDesign::m_xPhiStripPatternCentre
double m_xPhiStripPatternCentre
geom position on G4 volume, care needed
Definition: SCT_BarrelModuleSideDesign.h:165
InDetDD::SCT_BarrelModuleSideDesign::deadAreaLength
virtual double deadAreaLength() const
give length of dead area
Definition: SCT_BarrelModuleSideDesign.cxx:164
InDetDD::SiLocalPosition::xEta
double xEta() const
position along eta direction:
Definition: SiLocalPosition.h:118
InDetDD::SCT_ModuleSideDesign::diodes
int diodes() const
number of strips within crystal:
Definition: SCT_ModuleSideDesign.h:220
InDetDD::SCT_BarrelModuleSideDesign::m_xEtaAbsSizeHigh
double m_xEtaAbsSizeHigh
active area in xEta
Definition: SCT_BarrelModuleSideDesign.h:168
InDetDD::SCT_BarrelModuleSideDesign::scaledDistanceToNearestDiode
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...
Definition: SCT_BarrelModuleSideDesign.cxx:111
InDetDD::SCT_BarrelModuleSideDesign::cellIdOfPosition
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const
position -> id
Definition: SCT_BarrelModuleSideDesign.cxx:235
InDetDD::SCT_BarrelModuleSideDesign::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_BarrelModuleSideDesign.cxx:65
InDetDD::SCT_BarrelModuleSideDesign::m_xEtaAbsSizeLow
double m_xEtaAbsSizeLow
Definition: SCT_BarrelModuleSideDesign.h:168
InDetDD::SCT_BarrelModuleSideDesign::deadAreaUpperBoundary
virtual double deadAreaUpperBoundary() const
give upper boundary of dead area
Definition: SCT_BarrelModuleSideDesign.cxx:170
InDetDD::SCT_BarrelModuleSideDesign::nearBondGap
virtual bool nearBondGap(const SiLocalPosition &localPosition, double etaTol) const
Test if near bond gap within tolerances.
Definition: SCT_BarrelModuleSideDesign.cxx:84
InDetDD::SCT_BarrelModuleSideDesign::localPositionOfCell
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
id -> position
Definition: SCT_BarrelModuleSideDesign.cxx:183
InDetDD::SiCellId
Definition: SiCellId.h:29
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
SiDiodesParameters.h
SCT_BarrelModuleSideDesign.h
InDetDD::CarrierType
CarrierType
Definition: InDetDD_Defs.h:17
InDetDD::SCT_BarrelModuleSideDesign::m_xPhiAbsSize
double m_xPhiAbsSize
size in xPhi/2 for active area
Definition: SCT_BarrelModuleSideDesign.h:167
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::SCT_BarrelModuleSideDesign::m_totalDeadLength
double m_totalDeadLength
includes detector edge and gap between decetors
Definition: SCT_BarrelModuleSideDesign.h:166
InDetDD::SCT_BarrelModuleSideDesign::localPositionOfCluster
virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const
Definition: SCT_BarrelModuleSideDesign.cxx:201
InDetDD::DetectorDesign::etaAxis
Axis etaAxis() const
local axis corresponding to eta direction:
Definition: DetectorDesign.h:259
InDetDD::SCT_BarrelModuleSideDesign::bounds
virtual const Trk::SurfaceBounds & bounds() const
Return the surface bounds.
Definition: SCT_BarrelModuleSideDesign.cxx:251
InDetDD::SCT_BarrelModuleSideDesign::SCT_BarrelModuleSideDesign
SCT_BarrelModuleSideDesign()
InDetDD::SCT_BarrelModuleSideDesign::length
virtual double length() const
Method to calculate length of a module.
Definition: SCT_BarrelModuleSideDesign.cxx:133
InDetDD::SCT_BarrelModuleSideDesign::m_stripPitch
double m_stripPitch
strip pitch, 80 um in barrel SCT
Definition: SCT_BarrelModuleSideDesign.h:162
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
InDetDD::SiDiodesParameters
Definition: SiDiodesParameters.h:25