ATLAS Offline Software
PixelModuleDesign.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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 
24 namespace InDetDD {
25 
26 using std::abs;
27 
28 // Constructor with parameters:
29 
30 PixelModuleDesign::PixelModuleDesign(const double thickness,
31  const bool phiSymmetric,
32  const bool etaSymmetric,
33  const bool depthSymmetric,
34  const int circuitsPerColumn,
35  const int circuitsPerRow,
36  const int cellColumnsPerCircuit,
37  const int cellRowsPerCircuit,
38  const int diodeColumnsPerCircuit,
39  const int diodeRowsPerCircuit,
40  std::shared_ptr<const PixelDiodeMatrix> matrix,
41  InDetDD::CarrierType carrierType,
42  int readoutSide,
43  bool is3D,
44  InDetDD::DetectorType detectorType) :
45 
46  SiDetectorDesign(thickness,
47  phiSymmetric, etaSymmetric, depthSymmetric,
48  carrierType,
49  readoutSide),
50  m_diodeMap(std::move(matrix)),
51  m_readoutScheme(circuitsPerColumn,circuitsPerRow,
52  cellColumnsPerCircuit,cellRowsPerCircuit,
53  diodeColumnsPerCircuit,diodeRowsPerCircuit),
54  m_bounds(),
55  m_is3D(is3D),
56  m_detectorType(detectorType)
57 {
58 }
59 
60 PixelModuleDesign::PixelModuleDesign(const double thickness,
61  const int circuitsPerColumn,
62  const int circuitsPerRow,
63  const int cellColumnsPerCircuit,
64  const int cellRowsPerCircuit,
65  const int diodeColumnsPerCircuit,
66  const int diodeRowsPerCircuit,
67  std::shared_ptr<const PixelDiodeMatrix> matrix,
68  InDetDD::CarrierType carrierType,
69  int readoutSide,
70  bool is3D,
71  InDetDD::DetectorType detectorType) :
72  PixelModuleDesign(thickness,
73  true,true,true, //if symmetry not explicitly set, assume fully symmetric
74  circuitsPerColumn,circuitsPerRow,cellColumnsPerCircuit,cellRowsPerCircuit,
75  diodeColumnsPerCircuit,diodeRowsPerCircuit,matrix,carrierType,readoutSide,
76  is3D,detectorType)
77 {
78 }
79 
80 // Returns distance to nearest detector edge
81 // +ve = inside
82 // -ve = outside
83 void
85  double & etaDist, double & phiDist) const
86 {
87  // This assume element is centered at 0,0
88  // As the calculation is symmetric around 0,0 we only have to test it for one side.
89  double xEta = abs(localPosition.xEta());
90  double xPhi = abs(localPosition.xPhi());
91 
92  double xEtaEdge = 0.5*length();
93  double xPhiEdge = 0.5*width();
94 
95  // Distance to top/bottom
96  etaDist = xEtaEdge - xEta;
97 
98  // Distance to right/left edge
99  phiDist = xPhiEdge - xPhi;
100 
101 }
102 
104 {
105  return m_diodeMap.parameters(cellId);
106 }
107 
109 {
110  return m_diodeMap.parameters(cellId).centre();
111 }
112 
113 
114 // Helper method for stereo angle computation
115 HepGeom::Vector3D<double> PixelModuleDesign::phiMeasureSegment(const SiLocalPosition&) const
116 {
117  HepGeom::Vector3D<double> segment;
118  segment[etaAxis()]=1;
119  return segment;
120 }
121 
122 // Special method for SCT (irrelevant here):
123 std::pair<SiLocalPosition,SiLocalPosition> PixelModuleDesign::endsOfStrip(const SiLocalPosition &position) const
124 {
125  return std::pair<SiLocalPosition,SiLocalPosition>(position,position);
126 }
127 
128 
129 // Methods to calculate length of a module
131 {
132  return m_diodeMap.length();
133 }
134 
135 // Methods to calculate average width of a module
137 {
138  return m_diodeMap.width();
139 }
140 
141 // Methods to calculate minimum width of a module
143 {
144  return width();
145 }
146 
147 // Methods to calculate maximum width of a module
149 {
150  return width();
151 }
152 
153 
154 // Method to calculate eta width from a column range
155 double PixelModuleDesign::widthFromColumnRange(const int colMin, const int colMax) const
156 {
157  SiCellId idMin(0, colMin);
158  SiCellId idMax(0, colMax);
159 
160  double minEta = parameters(idMin).xEtaMin();
161  double maxEta = parameters(idMax).xEtaMax();
162 
163  return fabs(maxEta-minEta);
164 }
165 
166 // Method to calculate phi width from a row range
167 double PixelModuleDesign::widthFromRowRange(const int rowMin, const int rowMax) const
168 {
169 
170  SiCellId idMin(rowMin, 0);
171  SiCellId idMax(rowMax, 0);
172  double minPhi = parameters(idMin).xPhiMin();
173  double maxPhi = parameters(idMax).xPhiMax();
174 
175  return fabs(maxPhi-minPhi);
176 }
177 
178 // Pitch in phi direction
179 double
181 {
182  // Average pitch.
183  return width() / rows();
184 }
185 
186 // Pitch in phi direction
187 double
189 {
190  // Cheat since we know its constant.
191  return phiPitch();
192 }
193 
194 // Pitch in eta direction
195 double
197 {
198  // Average pitch
199  return length() / columns();
200 }
201 
203 {
204  return m_diodeMap.cellIdOfPosition(localPosition);
205 }
206 
207 
209 {
210  return m_readoutScheme.numberOfConnectedCells(readoutId);
211 }
212 
213 SiCellId
215 {
216  return m_readoutScheme.connectedCell(readoutId, number);
217 }
218 
219 SiCellId
221 {
222  return m_readoutScheme.gangedCell(cellId);
223 }
224 
227 {
228  return m_readoutScheme.readoutIdOfCell(cellId);
229 }
230 
231 
234 {
236 }
237 
238 // Given row and column index of diode, returns position of diode center
239 // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
240 // rawLocalPositionOfCell method in SiDetectorElement.
241 // DEPRECATED (but used in numerous places)
243 {
245 }
246 
247 
248 const Trk::SurfaceBounds &
250 {
251  // We create on demand as width and length are 0 when PixeModuleDesign first gets
252  // created.
253  if (not m_bounds) m_bounds.set(std::make_unique<Trk::RectangleBounds>(0.5*width(), 0.5*length()));
254  return *m_bounds;
255 }
256 
257 
258 
260 {
262 }
263 
264 SiCellId
266 {
267  return m_diodeMap.cellIdInRange(cellId);
268 }
269 
271 {
272  return m_detectorType;
273 }
274 
275 } // namespace InDetDD
InDetDD::PixelModuleDesign::m_diodeMap
PixelDiodeMap m_diodeMap
Definition: PixelModuleDesign.h:272
query_example.row
row
Definition: query_example.py:24
InDetDD::PixelModuleDesign::width
virtual double width() const
Method to calculate average width of a module.
Definition: PixelModuleDesign.cxx:136
InDetDD::PixelModuleDesign::widthFromRowRange
double widthFromRowRange(const int rowMin, const int rowMax) const
Method to calculate phi width from a row range.
Definition: PixelModuleDesign.cxx:167
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:48
InDetDD::PixelModuleDesign::columns
int columns() const
Number of cell columns per module:
Definition: PixelModuleDesign.h:340
InDetDD::SiDiodesParameters::xPhiMax
double xPhiMax() const
Definition: SiDiodesParameters.h:121
InDetDD::PixelDiodeMap::parameters
SiDiodesParameters parameters(const SiCellId &diodeId) const
Get diodes parameters (position and size):
Definition: PixelDiodeMap.cxx:73
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::PixelDiodeMap::width
double width() const
Definition: PixelDiodeMap.h:149
InDetDD::PixelModuleDesign::rows
int rows() const
Number of cell rows per module:
Definition: PixelModuleDesign.h:345
InDetDD::PixelModuleDesign::cellIdInRange
virtual SiCellId cellIdInRange(const SiCellId &cellId) const
Check if cell is in range.
Definition: PixelModuleDesign.cxx:265
InDetDD::PixelModuleDesign::connectedCell
virtual SiCellId connectedCell(const SiReadoutCellId &readoutId, int number) const
readout id -> id of connected diodes.
Definition: PixelModuleDesign.cxx:214
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
InDetDD::SiDiodesParameters::centre
const SiLocalPosition & centre() const
position of the diodes centre:
Definition: SiDiodesParameters.h:91
InDetDD::SiDiodesParameters::xEtaMax
double xEtaMax() const
Definition: SiDiodesParameters.h:111
InDetDD::PixelModuleDesign::etaPitch
virtual double etaPitch() const
Pitch in eta direction.
Definition: PixelModuleDesign.cxx:196
InDetDD::PixelModuleDesign::bounds
virtual const Trk::SurfaceBounds & bounds() const
Element boundary.
Definition: PixelModuleDesign.cxx:249
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:130
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:242
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:180
InDetDD::PixelReadoutScheme::readoutIdOfCell
SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const
Readout id of this diode.
Definition: PixelReadoutScheme.cxx:76
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:155
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:276
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:84
InDetDD::PixelModuleDesign::localPositionOfCell
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
readout or diode id -> position.
Definition: PixelModuleDesign.cxx:108
InDetDD::PixelModuleDesign::readoutIdOfPosition
virtual SiReadoutCellId readoutIdOfPosition(const SiLocalPosition &localPos) const
position -> id
Definition: PixelModuleDesign.cxx:233
InDetDD::PixelModuleDesign::m_bounds
CxxUtils::CachedUniquePtr< Trk::RectangleBounds > m_bounds
Definition: PixelModuleDesign.h:274
InDetDD::PixelModuleDesign::phiMeasureSegment
virtual HepGeom::Vector3D< double > phiMeasureSegment(const SiLocalPosition &) const
Helper method for stereo angle computation.
Definition: PixelModuleDesign.cxx:115
InDetDD::PixelModuleDesign::numberOfConnectedCells
virtual int numberOfConnectedCells(const SiReadoutCellId &readoutId) const
readout id -> id of connected diodes
Definition: PixelModuleDesign.cxx:208
python.selection.number
number
Definition: selection.py:20
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:220
InDetDD::PixelDiodeMap::length
double length() const
Definition: PixelDiodeMap.h:144
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
InDetDD::CarrierType
CarrierType
Definition: InDetDD_Defs.h:17
InDetDD::PixelModuleDesign::m_readoutScheme
PixelReadoutScheme m_readoutScheme
Definition: PixelModuleDesign.h:273
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:103
InDetDD::SiDiodesParameters::xEtaMin
double xEtaMin() const
boundaries of the diodes:
Definition: SiDiodesParameters.h:106
InDetDD::PixelModuleDesign::setGeneralLayout
void setGeneralLayout()
Indicate that it is a more complex layout where cells are not lined up with each other.
Definition: PixelModuleDesign.cxx:259
InDetDD::PixelModuleDesign::cellIdOfPosition
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const
position -> id
Definition: PixelModuleDesign.cxx:202
InDetDD::PixelModuleDesign::PixelModuleDesign
PixelModuleDesign()
InDetDD::PixelModuleDesign::readoutIdOfCell
virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const
diode id -> readout id
Definition: PixelModuleDesign.cxx:226
InDetDD::SiReadoutCellId
Definition: SiReadoutCellId.h:42
InDetDD::PixelDiodeMap::setGeneralLayout
void setGeneralLayout()
Set general layout flag.
Definition: PixelDiodeMap.h:106
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:142
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:123
SiCellId.h
InDetDD::PixelModuleDesign::maxWidth
virtual double maxWidth() const
Method to calculate maximum width of a module.
Definition: PixelModuleDesign.cxx:148
InDetDD::PixelDiodeMap::cellIdOfPosition
SiCellId cellIdOfPosition(const Amg::Vector2D &localPosition) const
cell id for a given local position
Definition: PixelDiodeMap.cxx:38
InDetDD::PixelDiodeMap::cellIdInRange
SiCellId cellIdInRange(const SiCellId &cellId) const
Check if cellId is within range.
Definition: PixelDiodeMap.h:189
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:270
InDetDD::SiDiodesParameters
Definition: SiDiodesParameters.h:25