ATLAS Offline Software
PixelDiodeMap.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // PixelDiodeMap.h
8 // (c) ATLAS Pixel Detector software
10 
11 #ifndef READOUTGEOMETRYBASE_PIXELDIODEMAP_H
12 #define READOUTGEOMETRYBASE_PIXELDIODEMAP_H
13 
14 // STL classes
15 #include <list>
16 #include <memory>
17 #include <vector>
18 
19 // Data member classes
21 
22 // Input/output classes
26 
27 namespace InDetDD {
28 
29 class SiCellId;
30 class PixelDiodeMatrix;
31 
44  class PixelDiodeMap {
45 
46  public:
47 
49  PixelDiodeMap(std::shared_ptr<const PixelDiodeMatrix> diodeMatrix);
50 
53 
56 
59 
61  // Const methods:
63 
65  SiDiodesParameters parameters(const SiCellId & diodeId) const;
66 
68  SiCellId cellIdOfPosition(const Amg::Vector2D & localPosition) const;
69 
71  SiCellId cellIdInRange(const SiCellId & cellId) const;
72 
76  void neighboursOfCell(const SiCellId & cellId,
77  std::vector<SiCellId> &neighbours) const;
78 
83  double intersectionLength(const SiCellId &diode1, const SiCellId &diode2) const;
84 
85  // Global sensor size:
86  double leftColumn() const;
87  double rightColumn() const;
88  double leftRow() const;
89  double rightRow() const;
90 
91  double width() const;
92  double length() const;
93 
94  // Number of cells in each direction.
95  int phiDiodes() const;
96  int etaDiodes() const;
97 
98  // Total number of diodes:
99  int diodes() const;
100 
102  // Non-const methods:
104 
108 
110  std::string debugStringRepr() const;
111 
118 
120  // Private methods:
122  private:
123 
128  static double intersectionLength1D(const double x1,const double dx1,
129  const double x2,const double dx2) ;
130 
132  void neighboursOfCellGeneral(const SiCellId & cellId,
133  std::vector<SiCellId> &neighbours) const;
134 
136  double intersectionLengthGeneral(const SiCellId &diode1,
137  const SiCellId &diode2) const;
138 
139 
141  // Private data:
143  private:
144  std::shared_ptr<const PixelDiodeMatrix> m_matrix;
146  };
147 
149  // Inline methods:
151 
152  inline double PixelDiodeMap::length() const
153  {
154  return m_matrix->etaWidth();
155  }
156 
157  inline double PixelDiodeMap::width() const
158  {
159  return m_matrix->phiWidth();
160  }
161 
162  inline double PixelDiodeMap::leftColumn() const
163  {
164  return -0.5*length();
165  }
166 
167  inline double PixelDiodeMap::rightColumn() const
168  {
169  return 0.5*length();
170  }
171 
172  inline double PixelDiodeMap::leftRow() const
173  {
174  return -0.5*width();
175  }
176 
177  inline double PixelDiodeMap::rightRow() const
178  {
179  return 0.5*width();
180  }
181 
182  inline int PixelDiodeMap::diodes() const
183  {
184  return phiDiodes() * etaDiodes();
185  }
186 
187  inline int PixelDiodeMap::phiDiodes() const
188  {
189  return m_matrix->phiCells();
190  }
191 
192  inline int PixelDiodeMap::etaDiodes() const
193  {
194  return m_matrix->etaCells();
195  }
196 
197  inline SiCellId PixelDiodeMap::cellIdInRange(const SiCellId & cellId) const
198  {
199  if (!cellId.isValid() ||
200  cellId.phiIndex() <0 || cellId.phiIndex() >= phiDiodes() ||
201  cellId.etaIndex() <0 || cellId.etaIndex() >= etaDiodes()) return SiCellId(); // Invalid
202  return cellId;
203  }
204 
205  inline std::string PixelDiodeMap::debugStringRepr() const
206  {
207  return m_matrix->createDebugStringRepr();
208  }
209 
212  ret.cell_ptr() = m_matrix->positionOfCell(cellId, ret.position());
213  return ret;
214  }
215 
216 } // namespace InDetDD
217 
218 #endif // READOUTGEOMETRYBASE_PIXELDIODEMAP_H
PixelDiodeParametersProxy.h
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:215
InDetDD::PixelDiodeMap::PixelDiodeMap
PixelDiodeMap(const PixelDiodeMap &map)
Copy constructor:
InDetDD::PixelDiodeMap::parametersProxy
PixelDiodeParametersProxy parametersProxy(const SiCellId &cellId) const
Search diode for the given cell and return proxy to access its parameters.
Definition: PixelDiodeMap.h:210
InDetDD::PixelDiodeMap::diodes
int diodes() const
Definition: PixelDiodeMap.h:182
InDetDD::PixelDiodeMap::intersectionLength
double intersectionLength(const SiCellId &diode1, const SiCellId &diode2) const
Compute the intersection length of two diodes: return: the intersection length when the two diodes ar...
Definition: PixelDiodeMap.cxx:215
InDetDD::PixelDiodeMap::debugStringRepr
std::string debugStringRepr() const
Debug representation.
Definition: PixelDiodeMap.h:205
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
InDetDD::PixelDiodeParametersProxy::position
const Amg::Vector2D & position() const
return the center position of the diode if the proxy is valid.
Definition: PixelDiodeParametersProxy.h:23
InDetDD::PixelDiodeMap::parameters
SiDiodesParameters parameters(const SiCellId &diodeId) const
Get diodes parameters (position and size):
Definition: PixelDiodeMap.cxx:73
InDetDD::PixelDiodeMap::m_matrix
std::shared_ptr< const PixelDiodeMatrix > m_matrix
diode matrix
Definition: PixelDiodeMap.h:144
InDetDD::PixelDiodeMap::width
double width() const
Definition: PixelDiodeMap.h:157
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:217
InDetDD::SiCellId::isValid
bool isValid() const
Test if its in a valid state.
Definition: SiCellId.h:136
InDetDD::PixelDiodeMap::intersectionLength1D
static double intersectionLength1D(const double x1, const double dx1, const double x2, const double dx2)
Compute the intersection length along one direction: return 0 if no intersection x1,...
Definition: PixelDiodeMap.cxx:270
InDetDD::PixelDiodeMap
Definition: PixelDiodeMap.h:44
InDetDD::PixelDiodeMap::m_generalLayout
bool m_generalLayout
Flag set to allow for dealing wth more general layouts.
Definition: PixelDiodeMap.h:145
InDetDD::SiCellId::phiIndex
int phiIndex() const
Get phi index. Equivalent to strip().
Definition: SiCellId.h:122
InDetDD::PixelDiodeMap::~PixelDiodeMap
~PixelDiodeMap()
Destructor.
InDetDD::PixelDiodeMap::etaDiodes
int etaDiodes() const
Definition: PixelDiodeMap.h:192
InDetDD::SiCellId::etaIndex
int etaIndex() const
Get eta index.
Definition: SiCellId.h:114
InDetDD::PixelDiodeMap::rightColumn
double rightColumn() const
Definition: PixelDiodeMap.h:167
InDetDD::PixelDiodeMap::phiDiodes
int phiDiodes() const
Definition: PixelDiodeMap.h:187
InDetDD::PixelDiodeMap::rightRow
double rightRow() const
Definition: PixelDiodeMap.h:177
InDetDD::PixelDiodeMap::neighboursOfCellGeneral
void neighboursOfCellGeneral(const SiCellId &cellId, std::vector< SiCellId > &neighbours) const
Slower method.
Definition: PixelDiodeMap.cxx:149
InDetDD::PixelDiodeMap::PixelDiodeMap
PixelDiodeMap(std::shared_ptr< const PixelDiodeMatrix > diodeMatrix)
Constructor from Diode matrix description.
Definition: PixelDiodeMap.cxx:28
InDetDD::SiCellId
Definition: SiCellId.h:29
InDetDD::PixelDiodeMap::leftColumn
double leftColumn() const
Definition: PixelDiodeMap.h:162
InDetDD::PixelDiodeMap::length
double length() const
Definition: PixelDiodeMap.h:152
SiDiodesParameters.h
PixelDiodeMatrix.h
InDetDD::PixelDiodeParametersProxy
Helper class to cache a pixel diode position, and provide access to diode parameters.
Definition: PixelDiodeParametersProxy.h:12
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::PixelDiodeMap::neighboursOfCell
void neighboursOfCell(const SiCellId &cellId, std::vector< SiCellId > &neighbours) const
Get the neighbouring PixelDiodes of a given PixelDiode: Cell for which the neighbours must be found L...
Definition: PixelDiodeMap.cxx:104
InDetDD::PixelDiodeMap::operator=
PixelDiodeMap & operator=(const PixelDiodeMap &map)
Assignment operator.
InDetDD::PixelDiodeMap::intersectionLengthGeneral
double intersectionLengthGeneral(const SiCellId &diode1, const SiCellId &diode2) const
Slower method.
Definition: PixelDiodeMap.cxx:237
InDetDD::PixelDiodeMap::setGeneralLayout
void setGeneralLayout()
Set general layout flag.
Definition: PixelDiodeMap.h:107
SiCellId.h
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:197
InDetDD::PixelDiodeMap::leftRow
double leftRow() const
Definition: PixelDiodeMap.h:172
InDetDD::PixelDiodeParametersProxy::cell_ptr
PixelDiodeMatrixPtr & cell_ptr()
provide access to internal storage for initializing the proxy.
Definition: PixelDiodeParametersProxy.h:44
InDetDD::SiDiodesParameters
Definition: SiDiodesParameters.h:25