ATLAS Offline Software
PixelModuleDesign.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // PixelModuleDesign.cxx
7 // Implementation file for class PixelModuleDesign
9 // (c) ATLAS Pixel Detector software
11 // Version 1.9 18/03/2002 Alessandro Fornaini
12 // Modified: Grant Gorfine
14 
16 #include "Identifier/Identifier.h"
19 
20 #include <cmath>
21 #include <utility>
22 
23 namespace InDetDD {
24 
25 using std::abs;
26 
27 // Constructor with parameters:
28 
29 PixelModuleDesign::PixelModuleDesign(const double thickness,
30  const bool phiSymmetric,
31  const bool etaSymmetric,
32  const bool depthSymmetric,
33  const int circuitsPerColumn,
34  const int circuitsPerRow,
35  const int cellColumnsPerCircuit,
36  const int cellRowsPerCircuit,
37  const int diodeColumnsPerCircuit,
38  const int diodeRowsPerCircuit,
39  PixelDiodeTree &&diode_tree,
40  InDetDD::CarrierType carrierType,
41  int readoutSide,
42  bool is3D,
43  InDetDD::DetectorType detectorType,
44  PixelReadoutTechnology readoutTechnology
45  ) :
46 
47  SiDetectorDesign(thickness,
48  phiSymmetric, etaSymmetric, depthSymmetric,
49  carrierType,
50  readoutSide),
51  m_diodeTree(std::move(diode_tree)),
52  m_readoutScheme(circuitsPerColumn,circuitsPerRow,
53  cellColumnsPerCircuit,cellRowsPerCircuit,
54  diodeColumnsPerCircuit,diodeRowsPerCircuit),
55  m_bounds(),
56  m_detectorType(detectorType),
57  m_readoutTechnology(readoutTechnology),
58  m_is3D(is3D)
59 {
60 }
61 
62 PixelModuleDesign::PixelModuleDesign(const double thickness,
63  const int circuitsPerColumn,
64  const int circuitsPerRow,
65  const int cellColumnsPerCircuit,
66  const int cellRowsPerCircuit,
67  const int diodeColumnsPerCircuit,
68  const int diodeRowsPerCircuit,
69  PixelDiodeTree &&diode_tree,
70  InDetDD::CarrierType carrierType,
71  int readoutSide,
72  bool is3D,
73  InDetDD::DetectorType detectorType,
74  PixelReadoutTechnology readoutTechnology
75  ) :
76  PixelModuleDesign(thickness,
77  true,true,true, //if symmetry not explicitly set, assume fully symmetric
78  circuitsPerColumn,circuitsPerRow,cellColumnsPerCircuit,cellRowsPerCircuit,
79  diodeColumnsPerCircuit,diodeRowsPerCircuit,std::move(diode_tree),carrierType,readoutSide,
80  is3D,detectorType, readoutTechnology)
81 {
82 }
83 
84 // Returns distance to nearest detector edge
85 // +ve = inside
86 // -ve = outside
87 void
89  double & etaDist, double & phiDist) const
90 {
91  // This assume element is centered at 0,0
92  // As the calculation is symmetric around 0,0 we only have to test it for one side.
93  double xEta = abs(localPosition.xEta());
94  double xPhi = abs(localPosition.xPhi());
95 
96  double xEtaEdge = 0.5*length();
97  double xPhiEdge = 0.5*width();
98 
99  // Distance to top/bottom
100  etaDist = xEtaEdge - xEta;
101 
102  // Distance to right/left edge
103  phiDist = xPhiEdge - xPhi;
104 
105 }
106 
108 {
109  std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
112 
113  return SiDiodesParameters(SiLocalPosition(Amg::Vector2D{si_param.position()[0],si_param.position()[1]}),
114  SiLocalPosition(Amg::Vector2D{si_param.width()[0],si_param.width()[1]}));
115 }
116 
118 {
119  std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
121  auto pos=m_diodeTree.findFromIdx(diode_idx);
122  return SiLocalPosition(Amg::Vector2D{pos[0],pos[1]});
123 }
124 
125 
126 // Helper method for stereo angle computation
127 HepGeom::Vector3D<double> PixelModuleDesign::phiMeasureSegment(const SiLocalPosition&) const
128 {
129  HepGeom::Vector3D<double> segment;
130  segment[etaAxis()]=1;
131  return segment;
132 }
133 
134 // Special method for SCT (irrelevant here):
135 std::pair<SiLocalPosition,SiLocalPosition> PixelModuleDesign::endsOfStrip(const SiLocalPosition &position) const
136 {
137  return std::pair<SiLocalPosition,SiLocalPosition>(position,position);
138 }
139 
140 
141 // Methods to calculate length of a module
143 {
144  return m_diodeTree.totalWidth()[1]; // eta
145 }
146 
147 // Methods to calculate average width of a module
149 {
150  return m_diodeTree.totalWidth()[0]; // phi
151 }
152 
153 // Methods to calculate minimum width of a module
155 {
156  return width();
157 }
158 
159 // Methods to calculate maximum width of a module
161 {
162  return width();
163 }
164 
165 
166 // Method to calculate eta width from a column range
167 double PixelModuleDesign::widthFromColumnRange(const int colMin, const int colMax) const
168 {
169  SiCellId idMin(0, colMin);
170  SiCellId idMax(0, colMax);
171 
172  double minEta = parameters(idMin).xEtaMin();
173  double maxEta = parameters(idMax).xEtaMax();
174 
175  return fabs(maxEta-minEta);
176 }
177 
178 // Method to calculate phi width from a row range
179 double PixelModuleDesign::widthFromRowRange(const int rowMin, const int rowMax) const
180 {
181 
182  SiCellId idMin(rowMin, 0);
183  SiCellId idMax(rowMax, 0);
184  double minPhi = parameters(idMin).xPhiMin();
185  double maxPhi = parameters(idMax).xPhiMax();
186 
187  return fabs(maxPhi-minPhi);
188 }
189 
190 // Pitch in phi direction
191 double
193 {
194  // Average pitch.
195  return width() / rows();
196 }
197 
198 // Pitch in phi direction
199 double
201 {
202  // Cheat since we know its constant.
203  return phiPitch();
204 }
205 
206 // Pitch in eta direction
207 double
209 {
210  // Average pitch
211  return length() / columns();
212 }
213 
215 {
216  InDetDD::PixelDiodeTree::Vector2D pos{ localPosition.xPhi(),localPosition.xEta() };
218  if (!isInsideMatrix(idx)) {
219  return SiCellId();
220  }
221  return SiCellId(idx[0],idx[1]);
222 }
223 
225 {
226  return m_readoutScheme.numberOfConnectedCells(readoutId);
227 }
228 
229 SiCellId
231 {
232  return m_readoutScheme.connectedCell(readoutId, number);
233 }
234 
235 SiCellId
237 {
238  return m_readoutScheme.gangedCell(cellId);
239 }
240 
243 {
244  return m_readoutScheme.readoutIdOfCell(cellId);
245 }
246 
247 
250 {
251  InDetDD::PixelDiodeTree::Vector2D pos{ localPosition.xPhi(),localPosition.xEta() };
254 }
255 
256 // Given row and column index of diode, returns position of diode center
257 // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
258 // rawLocalPositionOfCell method in SiDetectorElement.
259 // DEPRECATED (but used in numerous places)
261 {
263 }
264 
265 
266 const Trk::SurfaceBounds &
268 {
269  // We create on demand as width and length are 0 when PixeModuleDesign first gets
270  // created.
271  if (not m_bounds) m_bounds.set(std::make_unique<Trk::RectangleBounds>(0.5*width(), 0.5*length()));
272  return *m_bounds;
273 }
274 
275 SiCellId
277 {
278  return (isInsideMatrix(cellId) ? cellId : SiCellId());
279 }
280 
282 {
283  return m_detectorType;
284 }
285 
286 } // namespace InDetDD
InDetDD::PixelDiodeTree
Tree structure to find the position, index or pitch of a pixel on a semi-regular grid The grid is con...
Definition: PixelDiodeTree.h:33
InDetDD::PixelReadoutTechnology
PixelReadoutTechnology
Definition: PixelReadoutDefinitions.h:37
InDetDD::PixelDiodeTree::DiodeProxy::width
const PixelDiodeTree::Vector2D & width() const
get the width stored for this diode.
Definition: PixelDiodeTree.h:195
InDetDD::PixelDiodeTree::DiodeProxyWithPosition::position
const Vector2D & position() const
get the cached position of this diode
Definition: PixelDiodeTree.h:241
InDetDD::PixelModuleDesign::width
virtual double width() const
Method to calculate average width of a module.
Definition: PixelModuleDesign.cxx:148
InDetDD::PixelModuleDesign::widthFromRowRange
double widthFromRowRange(const int rowMin, const int rowMax) const
Method to calculate phi width from a row range.
Definition: PixelModuleDesign.cxx:179
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:45
InDetDD::PixelModuleDesign::columns
int columns() const
Number of cell columns per module:
Definition: PixelModuleDesign.h:331
InDetDD::PixelDiodeTree::totalWidth
const Vector2D & totalWidth() const
Return the total width of the diode matrix.
Definition: PixelDiodeTree.h:297
InDetDD::PixelDiodeTree::findFromPos
std::array< CellIndexType, 2 > findFromPos(const Vector2D &pos) const
Find a diode by the position relative to the center of the full diode matrix and compute its 2D index...
Definition: PixelDiodeTree.h:282
InDetDD::SiDiodesParameters::xPhiMax
double xPhiMax() const
Definition: SiDiodesParameters.h:121
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
InDetDD::PixelReadoutScheme::numberOfConnectedCells
int numberOfConnectedCells(const SiReadoutCellId &readoutId) const
number of cells connected to this readout.
Definition: PixelReadoutScheme.cxx:45
InDetDD::PixelDiodeTree::diodeProxyFromIdxCachePosition
DiodeProxyWithPosition diodeProxyFromIdxCachePosition(const std::array< CellIndexType, 2 > &idx) const
find a diode by its 2D index (row, column) and compute the position of the diode the returned proxy c...
Definition: PixelDiodeTree.h:276
InDetDD::PixelModuleDesign::rows
int rows() const
Number of cell rows per module:
Definition: PixelModuleDesign.h:336
InDetDD::PixelModuleDesign::cellIdInRange
virtual SiCellId cellIdInRange(const SiCellId &cellId) const
Check if cell is in range.
Definition: PixelModuleDesign.cxx:276
InDetDD::PixelModuleDesign::connectedCell
virtual SiCellId connectedCell(const SiReadoutCellId &readoutId, int number) const
readout id -> id of connected diodes.
Definition: PixelModuleDesign.cxx:230
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
keylayer_zslicemap.row
row
Definition: keylayer_zslicemap.py:155
InDetDD::SiCellId::phiIndex
int phiIndex() const
Get phi index. Equivalent to strip().
Definition: SiCellId.h:122
InDetDD::SiDiodesParameters::xEtaMax
double xEtaMax() const
Definition: SiDiodesParameters.h:111
InDetDD::PixelModuleDesign::etaPitch
virtual double etaPitch() const
Pitch in eta direction.
Definition: PixelModuleDesign.cxx:208
InDetDD::PixelModuleDesign::bounds
virtual const Trk::SurfaceBounds & bounds() const
Element boundary.
Definition: PixelModuleDesign.cxx:267
PUfitVar::maxEta
constexpr float maxEta
Definition: GepMETPufitAlg.cxx:13
InDetDD::PixelModuleDesign::length
virtual double length() const
Method to calculate length of a module.
Definition: PixelModuleDesign.cxx:142
InDetDD::SiLocalPosition
Definition: SiLocalPosition.h:31
InDetDD::PixelModuleDesign::positionFromColumnRow
SiLocalPosition positionFromColumnRow(const int column, const int row) const
Given row and column index of a diode, return position of diode center ALTERNATIVE/PREFERED way is to...
Definition: PixelModuleDesign.cxx:260
InDetDD::SiLocalPosition::xPhi
double xPhi() const
position along phi direction:
Definition: SiLocalPosition.h:123
InDetDD::PixelModuleDesign::phiPitch
virtual double phiPitch() const
Pitch in phi direction.
Definition: PixelModuleDesign.cxx:192
InDetDD::PixelReadoutScheme::readoutIdOfCell
SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const
Readout id of this diode.
Definition: PixelReadoutScheme.cxx:76
InDetDD::PixelDiodeTree::DiodeProxyWithPosition
A diode proxy which caches the position of a diode.
Definition: PixelDiodeTree.h:230
SiReadoutCellId.h
InDetDD::PixelModuleDesign::widthFromColumnRange
double widthFromColumnRange(const int colMin, const int colMax) const
Method to calculate eta width from a column range.
Definition: PixelModuleDesign.cxx:167
InDetDD::SiCellId::etaIndex
int etaIndex() const
Get eta index.
Definition: SiCellId.h:114
InDetDD::DetectorType
DetectorType
Definition: DetectorDesign.h:45
InDetDD::PixelReadoutScheme::connectedCell
SiCellId connectedCell(const SiReadoutCellId &readoutId, unsigned int number) const
Cell ids of cell connected to this readout.
Definition: PixelReadoutScheme.cxx:59
InDetDD::SiLocalPosition::xEta
double xEta() const
position along eta direction:
Definition: SiLocalPosition.h:118
InDetDD::PixelModuleDesign::m_detectorType
InDetDD::DetectorType m_detectorType
Definition: PixelModuleDesign.h:286
InDetDD::SiDiodesParameters::xPhiMin
double xPhiMin() const
Definition: SiDiodesParameters.h:116
InDetDD::PixelModuleDesign::distanceToDetectorEdge
virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, double &phiDist) const
Returns distance to nearest detector active edge +ve = inside -ve = outside.
Definition: PixelModuleDesign.cxx:88
InDetDD::PixelModuleDesign::localPositionOfCell
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
readout or diode id -> position.
Definition: PixelModuleDesign.cxx:117
InDetDD::PixelModuleDesign::readoutIdOfPosition
virtual SiReadoutCellId readoutIdOfPosition(const SiLocalPosition &localPos) const
position -> id
Definition: PixelModuleDesign.cxx:249
InDetDD::PixelModuleDesign::m_bounds
CxxUtils::CachedUniquePtr< Trk::RectangleBounds > m_bounds
Definition: PixelModuleDesign.h:285
InDetDD::PixelModuleDesign::isInsideMatrix
bool isInsideMatrix(const SiCellId &cellId) const
Return true if the given index describes a pixel of this matrix.
Definition: PixelModuleDesign.h:400
InDetDD::PixelModuleDesign::phiMeasureSegment
virtual HepGeom::Vector3D< double > phiMeasureSegment(const SiLocalPosition &) const
Helper method for stereo angle computation.
Definition: PixelModuleDesign.cxx:127
InDetDD::PixelModuleDesign::m_diodeTree
PixelDiodeTree m_diodeTree
Definition: PixelModuleDesign.h:283
InDetDD::PixelModuleDesign::numberOfConnectedCells
virtual int numberOfConnectedCells(const SiReadoutCellId &readoutId) const
readout id -> id of connected diodes
Definition: PixelModuleDesign.cxx:224
python.selection.number
number
Definition: selection.py:20
InDetDD::PixelDiodeTree::Vector2D
Amg::Vector2D Vector2D
Definition: PixelDiodeTree.h:35
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
InDetDD::SiCellId
Definition: SiCellId.h:29
InDetDD::PixelModuleDesign::gangedCell
virtual SiCellId gangedCell(const SiCellId &cellId) const
If cell is ganged return the other cell, otherwise return an invalid id.
Definition: PixelModuleDesign.cxx:236
InDetDD::PixelDiodeTree::findFromIdx
Vector2D findFromIdx(const std::array< CellIndexType, 2 > &idx) const
find a diode by its 2D index (row, column) and compute the position relative to the center of the ful...
Definition: PixelDiodeTree.h:264
InDetDD::CarrierType
CarrierType
Definition: InDetDD_Defs.h:17
InDetDD::PixelModuleDesign::m_readoutScheme
PixelReadoutScheme m_readoutScheme
Definition: PixelModuleDesign.h:284
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
PixelModuleDesign.h
InDetDD::PixelModuleDesign::parameters
virtual SiDiodesParameters parameters(const SiCellId &cellId) const
readout or diode id -> position, size
Definition: PixelModuleDesign.cxx:107
InDetDD::SiDiodesParameters::xEtaMin
double xEtaMin() const
boundaries of the diodes:
Definition: SiDiodesParameters.h:106
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
InDetDD::PixelModuleDesign::cellIdOfPosition
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const
position -> id
Definition: PixelModuleDesign.cxx:214
InDetDD::PixelModuleDesign::PixelModuleDesign
PixelModuleDesign()
InDetDD::PixelModuleDesign::readoutIdOfCell
virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const
diode id -> readout id
Definition: PixelModuleDesign.cxx:242
InDetDD::SiReadoutCellId
Definition: SiReadoutCellId.h:42
InDetDD::PixelDiodeTree::makeCellIndex
static constexpr std::array< PixelDiodeTree::CellIndexType, 2 > makeCellIndex(T local_x_idx, T local_y_idx)
Create a 2D cell index from the indices in local-x (phi, row) and local-y (eta, column) direction.
Definition: PixelDiodeTree.h:320
InDetDD::DetectorDesign::etaAxis
Axis etaAxis() const
local axis corresponding to eta direction:
Definition: DetectorDesign.h:259
InDetDD::SiDetectorDesign
Definition: SiDetectorDesign.h:50
InDetDD::PixelModuleDesign::minWidth
virtual double minWidth() const
Method to calculate minimum width of a module.
Definition: PixelModuleDesign.cxx:154
InDetDD::PixelReadoutScheme::gangedCell
SiCellId gangedCell(const SiCellId &cellId) const
If cell is ganged return the other cell, otherwise return an invalid id.
Definition: PixelReadoutScheme.cxx:91
InDetDD::PixelModuleDesign::endsOfStrip
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const
Special method for SCT (irrelevant here):
Definition: PixelModuleDesign.cxx:135
SiCellId.h
InDetDD::PixelModuleDesign::maxWidth
virtual double maxWidth() const
Method to calculate maximum width of a module.
Definition: PixelModuleDesign.cxx:160
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
InDetDD::PixelModuleDesign::type
virtual DetectorType type() const final
Type of element.
Definition: PixelModuleDesign.cxx:281
InDetDD::SiDiodesParameters
Definition: SiDiodesParameters.h:25