ATLAS Offline Software
StripAnnulusDesign.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <stdexcept>
6 #include <algorithm> // For upper_bound
7 #include <iterator> // for std::distance()
8 #include <cmath>
10 #include "Identifier/Identifier.h"
13 
14 namespace InDetDD {
16  const SiDetectorDesign::Axis &thicknessDirection,
17  const double &thickness,
18  const int &readoutSide,
19  const InDetDD::CarrierType &carrier,
20  const int &nStrips,
21  const double &pitch,
22  const double &stripStartRadius,
23  const double &stripEndRadius) :
24  SCT_ModuleSideDesign(thickness, true, true, true, 1, 0, 0, 0, false, carrier, readoutSide, stripDirection, thicknessDirection) {
25 
27  m_pitch = pitch;
28  m_stripStartRadius = stripStartRadius;
29  m_stripEndRadius = stripEndRadius;
30 
33 
34  double width = m_nStrips * m_pitch;
36  std::unique_ptr<Trk::SurfaceBounds> m_bounds = std::make_unique<Trk::RectangleBounds>(width / 2.0, length / 2.0); // Awaiting new boundclass for Annulus shape
37 }
38 
40  double centerR = (m_stripStartRadius + m_stripEndRadius) * 0.5;
41  return Amg::Vector3D(centerR, 0., 0.);
42 }
43 
44 void StripAnnulusDesign::neighboursOfCell(const SiCellId &cellId, std::vector<SiCellId> &neighbours) const {
45 
46  neighbours.clear();
47 
48  if (!cellId.isValid()) {
49  return;
50  }
51 
52  int strip = cellId.strip();
53  int stripM = strip - 1;
54  int stripP = strip + 1;
55 
56  if (stripM > 0) {
57  neighbours.emplace_back(stripM);
58  }
59  if (stripP < m_nStrips) {
60  neighbours.emplace_back(stripP);
61  }
62 
63 }
64 
66 
67  return *m_bounds;
68 }
69 
71  double phi = pos.phi();
72 //
73 // Find the strip
74 //
75  int strip = std::floor(phi / m_pitch) + m_nStrips * 0.5;
76  return {strip};
77 }
78 
80 
81  int strip = cellId.strip();
82  double r = (m_stripEndRadius - m_stripStartRadius) *0.5;
83  double phi = (strip - m_nStrips*0.5 + 0.5) * m_pitch;
84  double xEta = r * std::cos(phi);
85  double xPhi = r * std::sin(phi);
86  return SiLocalPosition(xEta, xPhi, 0.0);
87 }
88 
90 
92 
93  if (clusterSize <= 1) {
94  return pos;
95  }
96 
97  double clusterWidth = clusterSize * m_pitch;
98  double phi = pos.phi() + clusterWidth *0.5;
99  double r = pos.r();
100 
101  pos.xPhi(r * std::sin(phi));
102  pos.xEta(r * std::cos(phi));
103 
104  return pos;
105 }
106 
108 std::pair<SiLocalPosition, SiLocalPosition> StripAnnulusDesign::endsOfStrip(SiLocalPosition const &pos) const {
109 
110  SiCellId cellId = cellIdOfPosition(pos);
111 
112  int strip = cellId.strip();
113 
114  double rStart = m_stripStartRadius;
115  double rEnd = m_stripEndRadius;
116  double phi = (strip - m_nStrips*0.5 + 0.5) * m_pitch;
117 
118  SiLocalPosition end1(rStart * std::cos(phi), rStart * std::sin(phi), 0.0);
119  SiLocalPosition end2(rEnd * std::cos(phi), rEnd * std::sin(phi), 0.0);
120 
121  return std::pair<SiLocalPosition, SiLocalPosition>(end1, end2);
122 }
123 
124 bool StripAnnulusDesign::inActiveArea(SiLocalPosition const &pos, bool /*checkBondGap*/) const {
125 
126 
128 
129  return id.isValid();
130 }
131 
132 // Used in surfaceChargesGenerator
134 
135  SiCellId cellId = cellIdOfPosition(pos);
136  SiLocalPosition posStrip = localPositionOfCell(cellId);
137 
138  return std::abs(pos.xPhi() - posStrip.xPhi()) / m_pitch;
139 }
140 
143  throw std::runtime_error("Call to StripAnnulusDesign::parameters; not yet implemented");
144 }
145 
146 // Used in VP1 graphics. DEPRECATED.
148 // throw std::runtime_error("Deprecated positionFromStrip called.");
149  return localPositionOfCell(cellId);
150 }
151 
154 }
155 //
156 // DEPRECATED: only used in a stupid example (2014). Make cellId's by correct methods and
157 // they are either invalid or in range.
158 // Check if cell is in range. Returns the original cellId if it is in range, otherwise it
159 // returns an invalid id.
160 //
162 
163  if (!cellId.isValid()) {
164  return {}; // Invalid
165  }
166  int strip = cellId.strip();
167  if (strip < 0 || strip >= m_nStrips) {
168  return {}; // Invalid
169  }
170  return cellId;
171 }
172 
173 double StripAnnulusDesign::length() const { // DEPRECATED:
175 }
176 
177 double StripAnnulusDesign::width() const { // DEPRECATED
178  return m_pitch * m_nStrips;
179 }
180 
181 double StripAnnulusDesign::minWidth() const { // DEPRECATED
182  return width();
183 }
184 
185 double StripAnnulusDesign::maxWidth() const { // DEPRECATED
186  return width();
187 }
188 
189 double StripAnnulusDesign::etaPitch() const { // DEPRECATED
190  return length();
191 }
192 
194  return Amg::getRotateY3D(90.*CLHEP::deg);
195 }
196 
197 } // namespace InDetDD
beamspotman.r
def r
Definition: beamspotman.py:676
InDetDD::StripAnnulusDesign::inActiveArea
bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap=false) const
check if the position is in active area
Definition: StripAnnulusDesign.cxx:124
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
RectangleBounds.h
InDetDD::StripAnnulusDesign::m_bounds
std::unique_ptr< Trk::RectangleBounds > m_bounds
Definition: StripAnnulusDesign.h:161
InDetDD::SCT_ModuleSideDesign
Definition: SCT_ModuleSideDesign.h:40
InDetDD::StripAnnulusDesign::StripAnnulusDesign
StripAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, const SiDetectorDesign::Axis &thicknessDirection, const double &thickness, const int &readoutSide, const InDetDD::CarrierType &carrier, const int &nStrips, const double &pitch, const double &stripStart, const double &stripEnd)
Definition: StripAnnulusDesign.cxx:15
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
InDetDD::StripAnnulusDesign::length
double length() const
Method to calculate length of a module.
Definition: StripAnnulusDesign.cxx:173
InDetDD::SCT_ModuleSideDesign::strip
virtual int strip(int stripId1Dim) const
Definition: SCT_ModuleSideDesign.h:275
InDetDD::SiCellId::isValid
bool isValid() const
Test if its in a valid state.
Definition: SiCellId.h:136
InDetDD::StripAnnulusDesign::m_pitch
double m_pitch
Definition: StripAnnulusDesign.h:158
deg
#define deg
Definition: SbPolyhedron.cxx:17
InDetDD::StripAnnulusDesign::cellIdOfPosition
SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const
position -> id
Definition: StripAnnulusDesign.cxx:70
InDetDD::DetectorDesign::Axis
Axis
Definition: DetectorDesign.h:59
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
InDetDD::SiCellId::strip
int strip() const
Get strip number. Equivalent to phiIndex().
Definition: SiCellId.h:131
InDetDD::StripAnnulusDesign::cellIdInRange
SiCellId cellIdInRange(const SiCellId &) const
Check if cell is in range.
Definition: StripAnnulusDesign.cxx:161
InDetDD::SiLocalPosition
Definition: SiLocalPosition.h:31
InDetDD::SiLocalPosition::xPhi
double xPhi() const
position along phi direction:
Definition: SiLocalPosition.h:123
InDetDD::StripAnnulusDesign::sensorCenter
Amg::Vector3D sensorCenter() const
Return the centre of a sensor in the local reference frame.
Definition: StripAnnulusDesign.cxx:39
InDetDD::StripAnnulusDesign::localPositionOfCluster
SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const
Definition: StripAnnulusDesign.cxx:89
InDetDD::StripAnnulusDesign::m_stripStartRadius
double m_stripStartRadius
Definition: StripAnnulusDesign.h:159
InDetDD::StripAnnulusDesign::scaledDistanceToNearestDiode
double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const
give distance to the nearest diode in units of pitch, from 0.0 to 0.5, this method should be fast as ...
Definition: StripAnnulusDesign.cxx:133
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
InDetDD::SCT_ModuleSideDesign::m_scheme
SCT_ReadoutScheme m_scheme
Definition: SCT_ModuleSideDesign.h:196
InDetDD::StripAnnulusDesign::minWidth
double minWidth() const
Method to calculate minimum width of a module.
Definition: StripAnnulusDesign.cxx:181
InDetDD::StripAnnulusDesign::parameters
SiDiodesParameters parameters(const SiCellId &cellId) const
Return strip width, centre, length etc. Hard to find if this is used or not.
Definition: StripAnnulusDesign.cxx:142
InDetDD::StripAnnulusDesign::width
double width() const
Method to calculate average width of a module.
Definition: StripAnnulusDesign.cxx:177
InDetDD::StripAnnulusDesign::neighboursOfCell
void neighboursOfCell(const SiCellId &cellId, std::vector< SiCellId > &neighbours) const
Get the neighbouring diodes of a given diode: Cell for which the neighbours must be found List of cel...
Definition: StripAnnulusDesign.cxx:44
InDetDD::StripAnnulusDesign::etaPitch
double etaPitch() const
Definition: StripAnnulusDesign.cxx:189
MuonGM::nStrips
int nStrips(const MuonGM::TgcReadoutElement &readoutEle, int layer)
Definition: MuonDetDescr/MuonGeoModelTest/src/GeoModelTgcTest.cxx:46
StripAnnulusDesign.h
Amg::getRotateY3D
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
Definition: GeoPrimitivesHelpers.h:261
InDetDD::StripAnnulusDesign::positionFromStrip
SiLocalPosition positionFromStrip(const SiCellId &cellId) const
Definition: StripAnnulusDesign.cxx:147
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
InDetDD::SCT_ReadoutScheme::setCells
void setCells(int numReadoutCells)
Definition: SCT_ReadoutScheme.h:109
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
InDetDD::StripAnnulusDesign::m_nStrips
int m_nStrips
Definition: StripAnnulusDesign.h:157
InDetDD::SiCellId
Definition: SiCellId.h:29
InDetDD::CarrierType
CarrierType
Definition: InDetDD_Defs.h:17
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
GeoPrimitivesHelpers.h
InDetDD::StripAnnulusDesign::pitch
double pitch(const SiCellId &cellId) const
InDetDD::StripAnnulusDesign::endsOfStrip
std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const
Give end points of the strip that covers the given position.
Definition: StripAnnulusDesign.cxx:108
InDetDD::StripAnnulusDesign::SiHitToGeoModel
static const Amg::Transform3D SiHitToGeoModel()
Definition: StripAnnulusDesign.cxx:193
InDetDD::StripAnnulusDesign::m_stripEndRadius
double m_stripEndRadius
Definition: StripAnnulusDesign.h:160
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
InDetDD::StripAnnulusDesign::bounds
const Trk::SurfaceBounds & bounds() const
Element boundary.
Definition: StripAnnulusDesign.cxx:65
InDetDD::SCT_ReadoutScheme::setDiodes
void setDiodes(int numDiodes)
Definition: SCT_ReadoutScheme.h:105
InDetDD::StripAnnulusDesign::maxWidth
double maxWidth() const
Method to calculate maximum width of a module.
Definition: StripAnnulusDesign.cxx:185
InDetDD::StripAnnulusDesign::localPositionOfCell
SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
id -> position
Definition: StripAnnulusDesign.cxx:79
InDetDD::SiDiodesParameters
Definition: SiDiodesParameters.h:25