ATLAS Offline Software
Loading...
Searching...
No Matches
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
23namespace InDetDD {
24
25using std::abs;
26
27// Constructor with parameters:
28
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,
41 int readoutSide,
42 bool is3D,
43 InDetDD::DetectorType detectorType,
44 PixelReadoutTechnology readoutTechnology
45 ) :
46
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),
59{
60}
61
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,
71 int readoutSide,
72 bool is3D,
73 InDetDD::DetectorType detectorType,
74 PixelReadoutTechnology readoutTechnology
75 ) :
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
87void
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
111 InDetDD::PixelDiodeTree::DiodeProxyWithPosition si_param ( m_diodeTree.diodeProxyFromIdxCachePosition(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
127HepGeom::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):
135std::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
167double 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
179double 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
191double
193{
194 // Average pitch.
195 return width() / rows();
196}
197
198// Pitch in phi direction
199double
201{
202 // Cheat since we know its constant.
203 return phiPitch();
204}
205
206// Pitch in eta direction
207double
209{
210 // Average pitch
211 return length() / columns();
212}
213
215{
216 InDetDD::PixelDiodeTree::Vector2D pos{ localPosition.xPhi(),localPosition.xEta() };
217 auto idx=m_diodeTree.findFromPos(pos);
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
231{
232 return m_readoutScheme.connectedCell(readoutId, number);
233}
234
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() };
252 auto idx=m_diodeTree.findFromPos(pos);
253 return m_readoutScheme.readoutIdOfCell(SiCellId(idx[0],idx[1]));
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)
260SiLocalPosition PixelModuleDesign::positionFromColumnRow(const int column, const int row) const
261{
262 return localPositionOfCell(SiCellId(row,column));
263}
264
265
266const 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
277{
278 return (isInsideMatrix(cellId) ? cellId : SiCellId());
279}
280
285
286} // 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.
Tree structure to find the position, index or pitch of a pixel on a semi-regular grid The grid is con...
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.
CxxUtils::CachedUniquePtr< Trk::RectangleBounds > m_bounds
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
readout or diode id -> position.
virtual SiDiodesParameters parameters(const SiCellId &cellId) const
readout or diode id -> position, size
virtual int numberOfConnectedCells(const SiReadoutCellId &readoutId) const
readout id -> id of connected diodes
PixelReadoutTechnology m_readoutTechnology
bool isInsideMatrix(const SiCellId &cellId) const
Return true if the given index describes a pixel of this matrix.
InDetDD::DetectorType m_detectorType
virtual DetectorType type() const final
Type of element.
int columns() const
Number of cell columns per module:
virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, double &phiDist) const
Returns distance to nearest detector active edge +ve = inside -ve = outside.
virtual double length() const
Method to calculate length of a module.
PixelReadoutScheme m_readoutScheme
int rows() const
Number of cell rows per module:
virtual double maxWidth() const
Method to calculate maximum width of a module.
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...
double widthFromRowRange(const int rowMin, const int rowMax) const
Method to calculate phi width from a row range.
virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const
diode id -> readout id
virtual HepGeom::Vector3D< double > phiMeasureSegment(const SiLocalPosition &) const
Helper method for stereo angle computation.
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const
position -> id
virtual SiCellId gangedCell(const SiCellId &cellId) const
If cell is ganged return the other cell, otherwise return an invalid id.
virtual SiCellId cellIdInRange(const SiCellId &cellId) const
Check if cell is in range.
double widthFromColumnRange(const int colMin, const int colMax) const
Method to calculate eta width from a column range.
virtual double minWidth() const
Method to calculate minimum width of a module.
virtual SiReadoutCellId readoutIdOfPosition(const SiLocalPosition &localPos) const
position -> id
virtual double width() const
Method to calculate average width of a module.
virtual SiCellId connectedCell(const SiReadoutCellId &readoutId, int number) const
readout id -> id of connected diodes.
virtual const Trk::SurfaceBounds & bounds() const
Element boundary.
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const
Special method for SCT (irrelevant here):
virtual double etaPitch() const
Pitch in eta direction.
PixelModuleDesign(const double thickness, const int circuitsPerColumn, const int circuitsPerRow, const int cellColumnsPerCircuit, const int cellRowsPerCircuit, const int diodeColumnsPerCircuit, const int diodeRowsPerCircuit, PixelDiodeTree &&diode_tree, InDetDD::CarrierType carrierType, int readoutSide, bool is3D, InDetDD::DetectorType detectorType, PixelReadoutTechnology readoutTechnology)
Constructor with parameters: local axis corresponding to eta direction local axis corresponding to ph...
virtual double phiPitch() const
Pitch in phi direction.
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
SiDetectorDesign(double thickness, bool phiSymmetric, bool etaSymmetric, bool depthSymmetric, InDetDD::CarrierType carrierType, int readoutSide)
Constructor.
Class to handle the position of the centre and the width of a diode or a cluster of diodes Version 1....
double xEtaMin() const
boundaries of the diodes:
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:
Identifier for the strip or pixel readout cell.
Abstract base class for surface bounds to be specified.
Eigen::Matrix< double, 2, 1 > Vector2D
Message Stream Member.
STL namespace.
A diode proxy which caches the position of a diode.
const Vector2D & position() const
get the cached position of this diode
const PixelDiodeTree::Vector2D & width() const
get the width stored for this diode.
std::string number(const double &d, const std::string &s)
Definition utils.cxx:186