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