ATLAS Offline Software
Loading...
Searching...
No Matches
StripStereoAnnulusDesign.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef INDETREADOUTGEOMETRY_STRIPSTEREOANNULUSDESIGN_H
6#define INDETREADOUTGEOMETRY_STRIPSTEREOANNULUSDESIGN_H
7
8//
9// StereoAnnulus shaped sensor design.
10// Ref. N.P. Hessey "Building a Stereo-angle into strip-sensors for the ATLAS-Upgrade Inner-Tracker Endcaps"
11// 2012.
12//
13// Local reference system is centred on the beamline (i.e. not in the wafer centre; it is made in GeoModel as
14// an intersection of a tube with a (translated) generic trap. x is along the centre strip; y is in phi direction;
15// z is the depth direction. Strips are on the +ve z side.
16//
17// /) ^ y
18// / ) |
19// ) ) --> x
20// \ )
21// \‍) z towards you and you are looking at the strip side
22//
23// A sensor can have many rows of strips, with varying numbers of strips in each row. Row-lengths can be different.
24//
25// Strips are identified by a single index, starting at 0 in the inner-most row low-y side,
26// and ending at totalNStrips - 1
27//
28//
29
30// Base class
32
36
37#include "CLHEP/Geometry/Vector3D.h" // For unused phiMeasureSegment
38#include "CLHEP/Geometry/Transform3D.h"
39
40#include <vector>
41#include <stdexcept> // For throw stuff
42
43namespace Trk {
44class SurfaceBounds;
45}
46
47namespace InDetDD {
49//Vectors passed to constructor below will become single values once row is removed...
51public:
53 const SiDetectorDesign::Axis &thicknessDirection,
54 const double &thickness,
55 const int &readoutSide,
56 const InDetDD::CarrierType &carrier,
57 const int &nRows,
58 const std::vector<int> &nStrips,
59 const std::vector<double> &pitch,
60 const std::vector<double> &stripStart,
61 const std::vector<double> &stripEnd,
62 const double &stereoAngle,
63 const double &centreR,
64 const bool &usePC,
66
68 const SiDetectorDesign::Axis &thicknessDirection,
69 const double &thickness,
70 const int &readoutSide,
71 const InDetDD::CarrierType &carrier,
72 const int &nRows,
73 const std::vector<int> &nStrips,
74 const std::vector<double> &pitch,
75 const std::vector<double> &stripStart,
76 const std::vector<double> &stripEnd,
77 const double &stereoAngle,
78 const double &centreR,//this is the centre radius for e.g. the local/global position
79 const double &waferCentreR,//this is the centre radius needed for calculating the bounds, It is common to all elements on the same wafer/module/sensor (i.e. with a common MotherDesign)
80 const bool &usePC,
82
84
88
92
93 virtual Amg::Vector3D sensorCenter() const override;
94
95 // Copy constructor and assignment:
98 std::pair<int,int> getStripRow(SiCellId cellId) const final;
99 virtual int strip1Dim(int strip, int row) const override;
100 SiLocalPosition stripPosAtR(int strip, int row, double r) const;
101 virtual int diodesInRow(const int row) const override;
102//
103// Pure virtual methods in base class:
104//
105 // Distance to nearest detector active edge (+ve = inside, -ve = outside)
106 virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist,
107 double &phiDist) const override;
108
109 // check if the position is in active area
110 virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const override;
111
112 // Element boundary
113 virtual const Trk::SurfaceBounds &bounds() const override;
114
115 // Retrieve the two ends of a "strip"
116 virtual std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip(
117 const SiLocalPosition &position) const override;
118
119 // Phi-pitch (strip-width). Two names for same thing
120 virtual double stripPitch(const SiLocalPosition &localPosition) const override;
121 double stripPitch(const SiCellId &cellId) const;
122 virtual double stripPitch() const override;
123 virtual double phiPitch(const SiLocalPosition &localPosition) const override;
124 double phiPitch(const SiCellId &cellId) const;
125 virtual double phiPitch() const override;
126
127
128 // above methods return mm
129 // Use these methods if you're working with polar coordinates
130 // AnnulusBoundsPC, in all other cases use phiPitch() from above
131 double phiPitchPhi(const SiLocalPosition &localPosition) const;
132 double phiPitchPhi(const SiCellId &cellId) const;
133 double phiPitchPhi() const;
134
135 // distance to the nearest diode in units of pitch, from 0.0 to 0.5,
136 // this method should be fast as it is called for every surface charge
137 // in the SCT_SurfaceChargesGenerator
138 // an active area check, done in the Generator anyway, is removed here
139 virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const override;
140
141 // readout or diode id -> position, size
142 virtual SiDiodesParameters parameters(const SiCellId &cellId) const override;
143 virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const override;
144 virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const override;
145
146 // these return local position in STRIP PC
147 // Use only if you work with the polar coordinates, in all other
148 // cases, use the un-suffixes methods above
150 SiLocalPosition localPositionOfClusterPC(const SiCellId &cellId, int clusterSize) const;
151
152 // position -> id
153 virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const override;
154 // id to position
155 SiLocalPosition positionFromStrip(const SiCellId &cellId) const;
156 virtual SiLocalPosition positionFromStrip(const int stripNumber) const override;
157
158 // row and strip from 1-dim strip number
159 virtual int row(int stripId1Dim) const override;
160 virtual int strip(int stripId1Dim) const override;
161
162 // Find and fill a vector with all neighbour strips of a given cell
163 virtual void neighboursOfCell(const SiCellId &cellId,
164 std::vector<SiCellId> &neighbours) const override;
165 virtual SiCellId cellIdInRange(const SiCellId &) const override;
166
167 // For Strip sensors, readout cell == diode cell. Overload the SCT_ModuleSideDesign
168 // member
169 virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const override;
170
171 //Returns the wafer centre Radius (needed for annulus shape)
172 double waferCentreR() const;
173
174 //Returns the "element" centre radius - the same as above for elements
175 //representing a full wafer with multiple rows,
176 //different for elements where each row is its own element
177 double centreR() const;
178
179 InDetDD::DetectorType type() const override final;
180
181 // ---------------------------------------------------------------------------------------
182 // DEPRECATED at least for Strips
183 virtual HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const override;
184
185 // Method to calculate length of a strip. Which strip??
186 virtual double length() const override;
187
188 // Method to calculate average width of a module. What is it used for??
189 virtual double width() const override;
190
191 // Method to calculate minimum width of a module
192 virtual double minWidth() const override;
193
194 // Method to calculate maximum width of a module
195 virtual double maxWidth() const override;
196
197 // Pitch in eta direction Deprecated for strips: it varies in endcap
198 virtual double etaPitch() const override;
199
200 // Return true if hit local direction is the same as readout direction.
201 virtual bool swapHitPhiReadoutDirection() const override;
202 virtual bool swapHitEtaReadoutDirection() const override;
203
204 virtual bool nearBondGap(const SiLocalPosition &, double) const override;
205
207 virtual DetectorShape shape() const override;
208
209 virtual double sinStripAngleReco(double phiCoord, double etaCoord) const override;
210
211 // ------------------------------------------------------------------------------------------
212
213//
214// Accessors
215//
216 double pitch(const SiCellId &cellId) const;
217 double stripLength(const SiCellId &cellId) const;
218
219 double minR() const;
220 double maxR() const;
221 double phiWidth() const;
222 double stereo() const;
223
224 // Give upper and lower boundaries, and length, of dead area
225 virtual double deadAreaUpperBoundary() const override;
226 virtual double deadAreaLowerBoundary() const override;
227 virtual double deadAreaLength() const override;
228private:
231 std::vector<int> m_firstStrip; // Length is one more than the number of rows; Last entry is total number of strips.
236 const double m_R;
239 std::unique_ptr<Trk::SurfaceBounds> m_bounds;
240 //members to avoid repeating cos/sin calculations
246};
247
249// Inline methods:
252 return m_nStrips[row];
253}
254
255// Unfortunately SCT introduced the name stripPitch as an alternative to phiPitch so
256// everything gets doubled
257
259 return phiPitch(pos);
260}
261
262inline double StripStereoAnnulusDesign::stripPitch(const SiCellId &cellId) const {
263 return phiPitch(cellId);
264}
265
266inline double StripStereoAnnulusDesign::stripPitch() const { // Don't use; which strip?
267 return phiPitch();
268}
269
271// Return pitch in mm for the strip at this position, at this point's distance along the strip.
272 const SiCellId cellId = cellIdOfPosition(pos);
273 const int row = cellId.etaIndex();
274 const double radius = (m_usePC) ? pos.xEta() : std::hypot(pos.xEta(), pos.xPhi());
275 return m_pitch[row] * radius;
276}
277
278inline double StripStereoAnnulusDesign::phiPitch(const SiCellId &cellId) const {
279// Return pitch in mm for centre of this strip.
280 const int row = cellId.etaIndex();
282}
283
285// Return pitch in mm for the row just below or including the centre
286 const int middleRow = m_nRows*0.5;
287 const int middleStrip = m_nStrips[middleRow]*0.5;
288 return phiPitch(SiCellId(middleStrip, middleRow));
289}
290
292 // even though SiLocalPosition might not be in PC, the etaIndex should be correct
293 const SiCellId cellId = cellIdOfPosition(pos);
294 const int row = cellId.etaIndex();
295 return m_pitch[row];
296}
297
298inline double StripStereoAnnulusDesign::phiPitchPhi(const SiCellId &cellId) const {
299 const int row = cellId.etaIndex();
300 return m_pitch[row];
301}
302
304 const int middleRow = m_nRows *0.5;
305 const int middleStrip = m_nStrips[middleRow] *0.5;
306 return phiPitchPhi(SiCellId(middleStrip, middleRow));
307}
308
309inline bool StripStereoAnnulusDesign::nearBondGap(const SiLocalPosition &, double) const {
310// No bond gap in strip modules
311 return false;
312}
313
315 int strip = cellId.phiIndex();
316 int row = cellId.etaIndex();
317
318 return SiReadoutCellId(strip, row);
319}
320
321
322inline double StripStereoAnnulusDesign::minR() const {
323 return m_stripStartRadius[0];
324}
325
326inline double StripStereoAnnulusDesign::maxR() const {
327 return m_stripEndRadius.back();
328}
329
330
332 return m_nStrips[0] * m_pitch[0];
333}
334
335inline double StripStereoAnnulusDesign::stereo() const {
336 return m_stereo;
337}
338
339inline int StripStereoAnnulusDesign::row(int stripId1Dim) const {
340
341 //This method is scheduled for deletion
342 std::vector<int>::const_iterator endPtr = std::upper_bound(m_firstStrip.begin(), m_firstStrip.end(), stripId1Dim);
343 int rowNum = std::distance(m_firstStrip.begin(), endPtr) - 1;
344 if (rowNum < 0 || rowNum >= m_nRows) {
345 const std::string errMsg=std::string("StripId1Dim index out of acceptable range ") + __FILE__+std::string(": ")+std::to_string(__LINE__);
346 throw std::runtime_error(errMsg);
347 }
348 return rowNum;
349}
350
351inline int StripStereoAnnulusDesign::strip(int stripId1Dim) const {
352 int rowNum = row(stripId1Dim);
353
354 int strip2D = stripId1Dim - m_firstStrip[rowNum];
355 if (strip2D < 0 || strip2D >= m_firstStrip[rowNum + 1]) {
356 std::cout << "str1D " << stripId1Dim << " gives strip " << strip2D << " which is outside range 0 - " <<
357 m_firstStrip[rowNum + 1] << "\n";
358 }
359 return strip2D;
360}
361
363 return m_waferCentreR;
364}
365
367 return m_R;
368}
369
373
376 return 0.;
377}
378
380 return 0.;
381}
382
384 return 0.;
385}
386
388 return false;
389}
390
392 return false;
393 }
394} // namespace InDetDD
395#endif // INDETREADOUTGEOMETRY_STRIPSTEREOANNULUSDESIGN_H
Eigen::Matrix< double, 3, 1 > Vector3D
double thickness() const
Method which returns thickness of the silicon wafer.
int readoutSide() const
ReadoutSide.
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 phiIndex() const
Get phi index. Equivalent to strip().
Definition SiCellId.h:122
int etaIndex() const
Get eta index.
Definition SiCellId.h:114
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: ...
Identifier for the strip or pixel readout cell.
virtual bool nearBondGap(const SiLocalPosition &, double) const override
Test if near bond gap within tolerances, only relevant for SCT.
virtual double deadAreaUpperBoundary() const override
DEPRECATED for StripStereoAnnulusDesign; no dead area.
std::unique_ptr< Trk::SurfaceBounds > m_bounds
SiLocalPosition beamToStripPC(const SiLocalPosition &pos) const
StripStereoAnnulusDesign(const StripStereoAnnulusDesign &design)
virtual int strip1Dim(int strip, int row) const override
only relevant for SCT.
virtual void neighboursOfCell(const SiCellId &cellId, std::vector< SiCellId > &neighbours) const override
Get the neighbouring diodes of a given diode: Cell for which the neighbours must be found List of cel...
virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap=true) const override
check if the position is in active area
SiLocalPosition stripToBeamPC(const SiLocalPosition &pos) const
virtual double maxWidth() const override
Method to calculate maximum width of a module.
const std::vector< double > m_stripStartRadius
StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, const SiDetectorDesign::Axis &thicknessDirection, const double &thickness, const int &readoutSide, const InDetDD::CarrierType &carrier, const int &nRows, const std::vector< int > &nStrips, const std::vector< double > &pitch, const std::vector< double > &stripStart, const std::vector< double > &stripEnd, const double &stereoAngle, const double &centreR, const bool &usePC, InDetDD::DetectorType detectorType=InDetDD::Undefined)
SiLocalPosition stripPosAtR(int strip, int row, double r) const
virtual int row(int stripId1Dim) const override
InDetDD::DetectorType type() const override final
Type of element.
virtual double phiPitch() const override
Pitch in phi direction.
virtual double width() const override
Method to calculate average width of a module.
virtual double deadAreaLength() const override
give length of dead area
virtual DetectorShape shape() const override
Shape of element.
virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const override
virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const override
give distance to the nearest diode in units of pitch, from 0.0 to 0.5, this method should be fast as ...
virtual double sinStripAngleReco(double phiCoord, double etaCoord) const override
Give strip angle in the reco frame.
SiLocalPosition beamToStripPCpolar(const SiLocalPosition &pos) const
Version of StripStereoAnnulusDesign::beamToStripPC transform based exclusively in a polar system.
virtual SiCellId cellIdInRange(const SiCellId &) const override
DEPRECATED: only used in a stupid example (2014) Check if cell is in range.
virtual double deadAreaLowerBoundary() const override
give lower boundary of dead area
virtual bool swapHitPhiReadoutDirection() const override
Return true if hit local direction is the same as readout direction.
SiLocalPosition stripToBeamPCpolar(const SiLocalPosition &pos) const
Version of StripStereoAnnulusDesign::stripToBeamPC transform based exclusively in a polar system.
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const override
id -> position
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const override
Give end points of the strip that covers the given position.
SiLocalPosition beamToStrip(const SiLocalPosition &pos) const
virtual HepGeom::Vector3D< double > phiMeasureSegment(const SiLocalPosition &position) const override
Helper method for stereo angle computation, DEPRECATED.
double pitch(const SiCellId &cellId) const
SiLocalPosition localPositionOfCellPC(const SiCellId &cellId) const
This is for debugging only.
double stripLength(const SiCellId &cellId) const
std::pair< int, int > getStripRow(SiCellId cellId) const final
Get the strip and row number of the cell.
virtual bool swapHitEtaReadoutDirection() const override
virtual const Trk::SurfaceBounds & bounds() const override
Get a reference to the module bounds object.
virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, double &phiDist) const override
Returns distance to nearest detector active edge +ve = inside -ve = outside.
virtual double stripPitch() const override
give the strip pitch (For Forward returns pitch at center)
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const override
position -> id
SiLocalPosition stripToBeam(const SiLocalPosition &pos) const
virtual Amg::Vector3D sensorCenter() const override
Return the centre of a sensor in the local reference frame.
const std::vector< double > m_stripEndRadius
SiLocalPosition localPositionOfClusterPC(const SiCellId &cellId, int clusterSize) const
This is for debugging only.
StripStereoAnnulusDesign & operator=(const StripStereoAnnulusDesign &design)
virtual double etaPitch() const override
SiLocalPosition positionFromStrip(const SiCellId &cellId) const
virtual double length() const override
Method to calculate length of a module.
virtual SiDiodesParameters parameters(const SiCellId &cellId) const override
Return strip width, centre, length etc. Hard to find if this is used or not.
virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const override
diode id -> readout id
virtual int strip(int stripId1Dim) const override
virtual double minWidth() const override
Method to calculate minimum width of a module.
virtual int diodesInRow(const int row) const override
Abstract base class for surface bounds to be specified.
STL class.
int r
Definition globals.cxx:22
Eigen::Matrix< double, 3, 1 > Vector3D
Message Stream Member.
Ensure that the ATLAS eigen extensions are properly loaded.
STL namespace.
#define private