6#include "Identifier/Identifier.h"
21 const std::vector<int> &nStrips,
22 const std::vector<double> &
pitch,
23 const std::vector<double> &stripStartRadius,
24 const std::vector<double> &stripEndRadius,
25 const double &stereoAngle,
30 SCT_ModuleSideDesign(
thickness, false, false, true, 1, 0, 0, 0, false, carrier,
51 throw std::runtime_error(
52 "ERROR: StripStereoAnnulusDesign called with negative number of rows");
55 if (
pitch.size() != (
unsigned) nRows) {
56 throw std::runtime_error(
57 "ERROR: StripStereoAnnulusDesign called with insufficiant pitch values for no. of rows");
60 if (stripStartRadius.size() != (
unsigned) nRows) {
61 throw std::runtime_error(
62 "ERROR: StripStereoAnnulusDesign called with insufficiant strip start-positions for no. of rows");
65 if (stripEndRadius.size() != (
unsigned) nRows) {
66 throw std::runtime_error(
67 "ERROR: StripStereoAnnulusDesign called with insufficiant strip end-positions for no. of rows");
71 for (
int r = 0;
r < nRows; ++
r) {
75 int totalStrips = startStrip;
92 m_bounds = std::make_unique<Trk::AnnulusBoundsPC>(
100 m_bounds = std::make_unique<Trk::AnnulusBounds>(
115 const std::vector<int> &nStrips,
116 const std::vector<double> &
pitch,
117 const std::vector<double> &stripStartRadius,
118 const std::vector<double> &stripEndRadius,
119 const double &stereoAngle,
131 const double x_beam = pos.xEta();
132 const double y_beam = pos.xPhi();
142 return {x_strip, y_strip};
146 const double phi_beam = pos.xPhi();
147 const double rad_beam = pos.xEta();
150 const double x_beam = rad_beam * std::cos(phi_beam);
151 const double y_beam = rad_beam * std::sin(phi_beam);
161 const double phi_strip = std::atan2(y_strip, x_strip);
162 const double rad_strip = std::hypot(x_strip, y_strip);
164 return {rad_strip, phi_strip};
176 const double phi_beam = pos.xPhi();
177 const double rad_beam = pos.xEta();
181 const double stereo_2 =
m_stereo*0.5;
182 const double cosStereo_2 = std::cos(stereo_2);
183 const double sin_plus_stereo_2 = std::sin(stereo_2);
186 const double rad_conv = 2.0*
m_waferCentreR*std::abs(sin_plus_stereo_2);
187 const double rad_strip = std::sqrt( std::pow(rad_beam,2.0) + std::pow(rad_conv,2.0) + 2.0*rad_beam*rad_conv*cosStereo_2);
190 const double phi_strip = M_PI_2 - stereo_2 - std::asin((rad_beam*std::sin(
M_PI + phi_beam - stereo_2))/rad_strip);
192 return {rad_strip, phi_strip};
198 const double x_strip = pos.xEta();
199 const double y_strip = pos.xPhi();
209 return {x_beam, y_beam};
213 const double phi_strip = pos.xPhi();
214 const double rad_strip = pos.xEta();
217 const double x_strip = rad_strip * std::cos(phi_strip);
218 const double y_strip = rad_strip * std::sin(phi_strip);
228 const double phi_beam = std::atan2(y_beam, x_beam);
229 const double rad_beam = std::hypot(x_beam, y_beam);
231 return {rad_beam, phi_beam};
243 const double phi_strip = pos.xPhi();
244 const double rad_strip = pos.xEta();
248 const double stereo_2 =
m_stereo*0.5;
249 const double sin_plus_stereo_2 = std::sin(stereo_2);
252 const double rad_conv = 2.0*
m_waferCentreR*std::abs(sin_plus_stereo_2);
253 const double rad_beam = std::sqrt( std::pow(rad_strip,2.0) + std::pow(rad_conv,2.0) + 2.0*rad_strip*rad_conv*std::cos(M_PI_2 - stereo_2 - phi_strip));
256 const double phi_beam = stereo_2 - M_PI_2 + std::asin((rad_strip*std::sin(M_PI_2 - stereo_2 - phi_strip))/rad_beam);
258 return {rad_beam, phi_beam};
272 double phi_strip = (
m_usePC) ? pos_strip.
xPhi() : std::atan2(pos_strip.
xPhi(), pos_strip.
xEta());
276 return -std::sin(phi_strip +
m_stereo);
289 int rowNum =
row(strip1D);
291 return {strip2D,rowNum};
309 int stripM =
strip - 1;
310 int stripP =
strip + 1;
313 neighbours.emplace_back(stripM);
316 neighbours.emplace_back(stripP);
335 double rad_beam = (
m_usePC) ? pos.xEta() : pos.r();
349 double phi_strip = (
m_usePC) ? pos_strip.
xPhi() : std::atan2(pos_strip.
xPhi(), pos_strip.
xEta());
373 double rad_strip = (-b + std::sqrt(b * b - 4. * c))/2.;
378 double x_strip = rad_strip * std::cos(phi_strip);
379 double y_strip = rad_strip * std::sin(phi_strip);
391 double rad_strip = (-b + std::sqrt(b * b - 4. * c))*0.5;
395 double x_strip = rad_strip * std::cos(phi_strip);
396 double y_strip = rad_strip * std::sin(phi_strip);
408 if (clusterSize <= 1) {
413 int stripEnd =
strip + clusterSize - 1;
417 return (startPos + endPos)*0.5;
440 double rPrime = (-b + std::sqrt(b * b - 4. * c))*0.5;
443 double phi = -1*phiPrime;
461 if (clusterSize <= 1) {
466 int stripEnd =
strip + clusterSize - 1;
470 return (startPos + endPos)*0.5;
484 return std::pair<SiLocalPosition, SiLocalPosition>(innerEnd, outerEnd);
490 bool inside =
id.isValid();
501 double pos_phi_stripframe = (
m_usePC) ? pos_stripframe.
xPhi() : std::atan2(pos_stripframe.
xPhi(),pos_stripframe.
xEta());
507 double strip_phi_stripframe = (
m_usePC) ? stripPos_stripframe.
xPhi() : std::atan2(stripPos_stripframe.
xPhi(),stripPos_stripframe.
xEta());
510 return std::abs(pos_phi_stripframe - strip_phi_stripframe) /
m_pitch[
row];
515 throw std::runtime_error(
"Call to StripStereoAnnulusDesign::parameters; not yet implemented");
576 throw std::runtime_error(
"Call to phiMeasureSegment, DEPRECATED, not implemented.");
585 double rad_beam = (
m_usePC) ? pos.xEta() : std::hypot(pos.xEta(), pos.xPhi());
587 if (rad_beam < rInner)
588 etaDist = rad_beam - rInner;
589 else if (rad_beam > rOuter)
590 etaDist = rOuter - rad_beam;
592 etaDist = std::min(rOuter - rad_beam, rad_beam - rInner);
598 double rad_strip = (
m_usePC) ? pos_strip.
xEta() : std::hypot(pos_strip.
xEta(), pos_strip.
xPhi());
599 double phi_strip = (
m_usePC) ? pos_strip.
xPhi() : std::atan2(pos_strip.
xPhi(), pos_strip.
xEta());
602 double phiAngleMin = -phiAngleMax;
604 if (phi_strip < phiAngleMin)
605 phiDist = rad_strip * (phi_strip - phiAngleMin);
606 else if (phi_strip > phiAngleMax)
607 phiDist = rad_strip * (phiAngleMax - phi_strip);
609 phiDist = rad_strip * std::min(phiAngleMax - phi_strip, phi_strip - phiAngleMin);
621 std::pair<SiLocalPosition, SiLocalPosition> end =
endsOfStrip(lpoc);
622 double dx = end.second.xEta() - end.first.xEta();
623 double dy = end.second.xPhi() - end.first.xPhi();
624 return std::sqrt(dx * dx + dy * dy);
Scalar phi() const
phi method
double thickness() const
Method which returns thickness of the silicon wafer.
int readoutSide() const
ReadoutSide.
SCT_ModuleSideDesign(const double thickness, const bool phiSymmetric, const bool etaSymmetric, const bool depthSymmetric, const int crystals, const int diodes, const int cells, const int shift, const bool swapStripReadout, InDetDD::CarrierType carrierType, int readoutSide)
Constructor with parameters: local axis corresponding to eta direction local axis corresponding to ph...
SCT_ReadoutScheme m_scheme
InDetDD::DetectorType m_detectorType
Identifier for the strip or pixel cell.
int phiIndex() const
Get phi index. Equivalent to strip().
bool isValid() const
Test if its in a valid state.
int etaIndex() const
Get eta index.
Class to handle the position of the centre and the width of a diode or a cluster of diodes Version 1....
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:
std::unique_ptr< Trk::SurfaceBounds > m_bounds
SiLocalPosition beamToStripPC(const SiLocalPosition &pos) const
virtual int strip1Dim(int strip, int row) const override
only relevant for SCT.
virtual void neighboursOfCell(const SiCellId &cellId, std::vector< SiCellId > &neighbours) const override
Get the neighbouring diodes of a given diode: Cell for which the neighbours must be found List of cel...
virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap=true) const override
check if the position is in active area
SiLocalPosition stripToBeamPC(const SiLocalPosition &pos) const
virtual double maxWidth() const override
Method to calculate maximum width of a module.
const std::vector< double > m_stripStartRadius
StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, const SiDetectorDesign::Axis &thicknessDirection, const double &thickness, const int &readoutSide, const InDetDD::CarrierType &carrier, const int &nRows, const std::vector< int > &nStrips, const std::vector< double > &pitch, const std::vector< double > &stripStart, const std::vector< double > &stripEnd, const double &stereoAngle, const double ¢reR, const bool &usePC, InDetDD::DetectorType detectorType=InDetDD::Undefined)
SiLocalPosition stripPosAtR(int strip, int row, double r) const
virtual int row(int stripId1Dim) const override
virtual double width() const override
Method to calculate average width of a module.
virtual DetectorShape shape() const override
Shape of element.
virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const override
virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const override
give distance to the nearest diode in units of pitch, from 0.0 to 0.5, this method should be fast as ...
virtual double sinStripAngleReco(double phiCoord, double etaCoord) const override
Give strip angle in the reco frame.
SiLocalPosition beamToStripPCpolar(const SiLocalPosition &pos) const
Version of StripStereoAnnulusDesign::beamToStripPC transform based exclusively in a polar system.
virtual SiCellId cellIdInRange(const SiCellId &) const override
DEPRECATED: only used in a stupid example (2014) Check if cell is in range.
const std::vector< int > m_nStrips
SiLocalPosition stripToBeamPCpolar(const SiLocalPosition &pos) const
Version of StripStereoAnnulusDesign::stripToBeamPC transform based exclusively in a polar system.
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const override
id -> position
const double m_waferCentreR
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const override
Give end points of the strip that covers the given position.
double waferCentreR() const
SiLocalPosition beamToStrip(const SiLocalPosition &pos) const
virtual HepGeom::Vector3D< double > phiMeasureSegment(const SiLocalPosition &position) const override
Helper method for stereo angle computation, DEPRECATED.
double pitch(const SiCellId &cellId) const
SiLocalPosition localPositionOfCellPC(const SiCellId &cellId) const
This is for debugging only.
double stripLength(const SiCellId &cellId) const
std::pair< int, int > getStripRow(SiCellId cellId) const final
Get the strip and row number of the cell.
virtual const Trk::SurfaceBounds & bounds() const override
Get a reference to the module bounds object.
virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, double &phiDist) const override
Returns distance to nearest detector active edge +ve = inside -ve = outside.
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const override
position -> id
SiLocalPosition stripToBeam(const SiLocalPosition &pos) const
virtual Amg::Vector3D sensorCenter() const override
Return the centre of a sensor in the local reference frame.
const std::vector< double > m_stripEndRadius
SiLocalPosition localPositionOfClusterPC(const SiCellId &cellId, int clusterSize) const
This is for debugging only.
virtual double etaPitch() const override
SiLocalPosition positionFromStrip(const SiCellId &cellId) const
virtual double length() const override
Method to calculate length of a module.
virtual SiDiodesParameters parameters(const SiCellId &cellId) const override
Return strip width, centre, length etc. Hard to find if this is used or not.
const double m_cosNegStereo
const std::vector< double > m_pitch
std::vector< int > m_firstStrip
virtual int strip(int stripId1Dim) const override
virtual double minWidth() const override
Method to calculate minimum width of a module.
const double m_sinNegStereo
Class that implements the asymmetric shape of the ITk strip endcap modules.
Bounds for a annulus-like, planar Surface.
Abstract base class for surface bounds to be specified.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D