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 // convert an arbitrary local position (e.g. a cluster centre) to STRIP PC,
152 // with the same conventions as localPositionOfCellPC, but without snapping
153 // to the centre of the nearest strip
155
156 // position -> id
157 virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const override;
158 // id to position
159 SiLocalPosition positionFromStrip(const SiCellId &cellId) const;
160 virtual SiLocalPosition positionFromStrip(const int stripNumber) const override;
161
162 // row and strip from 1-dim strip number
163 virtual int row(int stripId1Dim) const override;
164 virtual int strip(int stripId1Dim) const override;
165
166 // Find and fill a vector with all neighbour strips of a given cell
167 virtual void neighboursOfCell(const SiCellId &cellId,
168 std::vector<SiCellId> &neighbours) const override;
169 virtual SiCellId cellIdInRange(const SiCellId &) const override;
170
171 // For Strip sensors, readout cell == diode cell. Overload the SCT_ModuleSideDesign
172 // member
173 virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const override;
174
175 //Returns the wafer centre Radius (needed for annulus shape)
176 double waferCentreR() const;
177
178 //Returns the "element" centre radius - the same as above for elements
179 //representing a full wafer with multiple rows,
180 //different for elements where each row is its own element
181 double centreR() const;
182
183 InDetDD::DetectorType type() const override final;
184
185 // ---------------------------------------------------------------------------------------
186 // DEPRECATED at least for Strips
187 virtual HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const override;
188
189 // Method to calculate length of a strip. Which strip??
190 virtual double length() const override;
191
192 // Method to calculate average width of a module. What is it used for??
193 virtual double width() const override;
194
195 // Method to calculate minimum width of a module
196 virtual double minWidth() const override;
197
198 // Method to calculate maximum width of a module
199 virtual double maxWidth() const override;
200
201 // Pitch in eta direction Deprecated for strips: it varies in endcap
202 virtual double etaPitch() const override;
203
204 // Return true if hit local direction is the same as readout direction.
205 virtual bool swapHitPhiReadoutDirection() const override;
206 virtual bool swapHitEtaReadoutDirection() const override;
207
208 virtual bool nearBondGap(const SiLocalPosition &, double) const override;
209
211 virtual DetectorShape shape() const override;
212
213 virtual double sinStripAngleReco(double phiCoord, double etaCoord) const override;
214
215 // ------------------------------------------------------------------------------------------
216
217//
218// Accessors
219//
220 double pitch(const SiCellId &cellId) const;
221 double stripLength(const SiCellId &cellId) const;
222
223 double minR() const;
224 double maxR() const;
225 double phiWidth() const;
226 double stereo() const;
227
228 // Give upper and lower boundaries, and length, of dead area
229 virtual double deadAreaUpperBoundary() const override;
230 virtual double deadAreaLowerBoundary() const override;
231 virtual double deadAreaLength() const override;
232private:
235 std::vector<int> m_firstStrip; // Length is one more than the number of rows; Last entry is total number of strips.
240 const double m_R;
243 std::unique_ptr<Trk::SurfaceBounds> m_bounds;
244 //members to avoid repeating cos/sin calculations
250};
251
253// Inline methods:
256 return m_nStrips[row];
257}
258
259// Unfortunately SCT introduced the name stripPitch as an alternative to phiPitch so
260// everything gets doubled
261
263 return phiPitch(pos);
264}
265
266inline double StripStereoAnnulusDesign::stripPitch(const SiCellId &cellId) const {
267 return phiPitch(cellId);
268}
269
270inline double StripStereoAnnulusDesign::stripPitch() const { // Don't use; which strip?
271 return phiPitch();
272}
273
275// Return pitch in mm for the strip at this position, at this point's distance along the strip.
276 const SiCellId cellId = cellIdOfPosition(pos);
277 const int row = cellId.etaIndex();
278 const double radius = (m_usePC) ? pos.xEta() : std::hypot(pos.xEta(), pos.xPhi());
279 return m_pitch[row] * radius;
280}
281
282inline double StripStereoAnnulusDesign::phiPitch(const SiCellId &cellId) const {
283// Return pitch in mm for centre of this strip.
284 const int row = cellId.etaIndex();
286}
287
289// Return pitch in mm for the row just below or including the centre
290 const int middleRow = m_nRows*0.5;
291 const int middleStrip = m_nStrips[middleRow]*0.5;
292 return phiPitch(SiCellId(middleStrip, middleRow));
293}
294
296 // even though SiLocalPosition might not be in PC, the etaIndex should be correct
297 const SiCellId cellId = cellIdOfPosition(pos);
298 const int row = cellId.etaIndex();
299 return m_pitch[row];
300}
301
302inline double StripStereoAnnulusDesign::phiPitchPhi(const SiCellId &cellId) const {
303 const int row = cellId.etaIndex();
304 return m_pitch[row];
305}
306
308 const int middleRow = m_nRows *0.5;
309 const int middleStrip = m_nStrips[middleRow] *0.5;
310 return phiPitchPhi(SiCellId(middleStrip, middleRow));
311}
312
313inline bool StripStereoAnnulusDesign::nearBondGap(const SiLocalPosition &, double) const {
314// No bond gap in strip modules
315 return false;
316}
317
319 int strip = cellId.phiIndex();
320 int row = cellId.etaIndex();
321
322 return SiReadoutCellId(strip, row);
323}
324
325
326inline double StripStereoAnnulusDesign::minR() const {
327 return m_stripStartRadius[0];
328}
329
330inline double StripStereoAnnulusDesign::maxR() const {
331 return m_stripEndRadius.back();
332}
333
334
336 return m_nStrips[0] * m_pitch[0];
337}
338
339inline double StripStereoAnnulusDesign::stereo() const {
340 return m_stereo;
341}
342
343inline int StripStereoAnnulusDesign::row(int stripId1Dim) const {
344
345 //This method is scheduled for deletion
346 std::vector<int>::const_iterator endPtr = std::upper_bound(m_firstStrip.begin(), m_firstStrip.end(), stripId1Dim);
347 int rowNum = std::distance(m_firstStrip.begin(), endPtr) - 1;
348 if (rowNum < 0 || rowNum >= m_nRows) {
349 const std::string errMsg=std::string("StripId1Dim index out of acceptable range ") + __FILE__+std::string(": ")+std::to_string(__LINE__);
350 throw std::runtime_error(errMsg);
351 }
352 return rowNum;
353}
354
355inline int StripStereoAnnulusDesign::strip(int stripId1Dim) const {
356 int rowNum = row(stripId1Dim);
357
358 int strip2D = stripId1Dim - m_firstStrip[rowNum];
359 if (strip2D < 0 || strip2D >= m_firstStrip[rowNum + 1]) {
360 std::cout << "str1D " << stripId1Dim << " gives strip " << strip2D << " which is outside range 0 - " <<
361 m_firstStrip[rowNum + 1] << "\n";
362 }
363 return strip2D;
364}
365
367 return m_waferCentreR;
368}
369
371 return m_R;
372}
373
377
380 return 0.;
381}
382
384 return 0.;
385}
386
388 return 0.;
389}
390
392 return false;
393}
394
396 return false;
397 }
398} // namespace InDetDD
399#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
SiLocalPosition localPositionPC(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
Definition testRead.cxx:27