ATLAS Offline Software
SCT_ModuleSideDesign.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // SCT_ModuleSideDesign.cxx
7 // Implementation file for class SCT_ModuleSideDesign
9 // (c) ATLAS Detector software
11 // Version 1.2 03/7/2001 Alessandro Fornaini
12 // Modified: Grant Gorfine
14 
16 #include "Identifier/Identifier.h"
18 #include <string>
19 #include <stdexcept>
20 
21 namespace InDetDD {
22 // Constructor with parameters:
23 // local axis corresponding to eta direction
24 // local axis corresponding to phi direction
25 // local axis corresponding to depth direction
26 // thickness of silicon sensor
27 // number of crystals within module side
28 // number of diodes within crystal
29 // number of cells within module side
30 // index of diode connected to cell with index 0
31 
32 
34  const bool phiSymmetric,
35  const bool etaSymmetric,
36  const bool depthSymmetric,
37  const int crystals,
38  const int diodes,
39  const int cells,
40  const int shift,
41  const bool swapStripReadout,
42  InDetDD::CarrierType carrierType,
43  int readoutSide):
44  SiDetectorDesign(thickness, phiSymmetric, etaSymmetric, depthSymmetric, carrierType, readoutSide),
45  m_scheme(crystals, diodes, cells, shift),
46  m_swapStripReadout(swapStripReadout) {
47 }
48 
50  const bool phiSymmetric,
51  const bool etaSymmetric,
52  const bool depthSymmetric,
53  const int crystals,
54  const int diodes,
55  const int cells,
56  const int shift,
57  const bool swapStripReadout,
58  InDetDD::CarrierType carrierType,
59  int readoutSide,
60  const InDetDD::SiDetectorDesign::Axis stripDirection,
61  const InDetDD::SiDetectorDesign::Axis thicknessDirection)
62  :
63  SiDetectorDesign(thickness, phiSymmetric, etaSymmetric, depthSymmetric, carrierType, readoutSide,
64  stripDirection, thicknessDirection),
65  m_scheme(crystals, diodes, cells, shift),
66  m_swapStripReadout(swapStripReadout) {
67 }
68 
69 
71  std::vector<SiCellId> &neighbours) const {
72  neighbours.clear();
73  neighbours.reserve(2);
74 
75  if (!cellId.isValid()) {
76  return;
77  }
78 
79  int strip = cellId.strip();
80  int stripM = strip - 1;
81  int stripP = strip + 1;
82 
83  if (stripM >= m_scheme.shift()) {
84  neighbours.emplace_back(stripM);
85  }
86  if (stripP < m_scheme.diodes() + m_scheme.shift()) {
87  neighbours.emplace_back(stripP);
88  }
89 }
90 
91 // This method returns the position of the centre of a strip
92 // ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or
93 // rawLocalPositionOfCell method in SiDetectorElement.
94 // DEPRECATED (but used in numerous places)
96  return localPositionOfCell(SiCellId(stripNumber));
97 }
98 
100 // returns an invalid id.
102  if (!cellId.isValid() ||
103  cellId.strip() < 0 || cellId.strip() >= cells()) {
104  return {}; // Invalid
105  }
106  return cellId;
107 }
108 
110  if(m_motherDesign){
111  const std::string errMsg=std::string("SCT_ModuleSideDesign already has a mother set!");
112  throw std::runtime_error(errMsg);
113  }
114  m_motherDesign = mother;
115 
116  }
117 
127 std::pair<int,int> SCT_ModuleSideDesign::getStripRow(SiCellId /*id*/) const {
128  return {0,0};
129  }
130 
131  SiIntersect SCT_ModuleSideDesign::inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol) const {
132 
133  double etaDist = 0;
134  double phiDist = 0;
135 
136  distanceToDetectorEdge(localPosition, etaDist, phiDist);
137 
138  SiIntersect state;
139 
140  if (phiDist < -phiTol || etaDist < -etaTol) {
141  state.setOut();
142  return state;
143  }
144 
145  if (phiDist > phiTol && etaDist > etaTol) {
146  state.setIn();
147  return state;
148  }
149 
150  // Near boundary.
151  state.setNearBoundary();
152  return state;
153 }
154 
155 } // namespace InDetDD
InDetDD::SCT_ReadoutScheme::diodes
int diodes() const
Definition: SCT_ReadoutScheme.h:118
InDetDD::SiIntersect::setOut
void setOut()
Definition: SiIntersect.h:81
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
InDetDD::SCT_ModuleSideDesign::setMother
void setMother(SCT_ModuleSideDesign *mother)
Definition: SCT_ModuleSideDesign.cxx:109
SCT_ModuleSideDesign.h
InDetDD::SCT_ModuleSideDesign
Definition: SCT_ModuleSideDesign.h:40
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::SCT_ReadoutScheme::shift
int shift() const
Definition: SCT_ReadoutScheme.h:128
InDetDD::DetectorDesign::Axis
Axis
Definition: DetectorDesign.h:59
InDetDD::SiCellId::strip
int strip() const
Get strip number. Equivalent to phiIndex().
Definition: SiCellId.h:131
InDetDD::SCT_ModuleSideDesign::cells
int cells() const
number of readout stips within module side:
Definition: SCT_ModuleSideDesign.h:228
SiIntersect.h
InDetDD::SiLocalPosition
Definition: SiLocalPosition.h:31
InDetDD::SiIntersect::setIn
void setIn()
Definition: SiIntersect.h:76
InDetDD::SCT_ModuleSideDesign::cellIdInRange
virtual SiCellId cellIdInRange(const SiCellId &cellId) const override
Check if cell is in range.
Definition: SCT_ModuleSideDesign.cxx:101
InDetDD::SCT_ModuleSideDesign::m_motherDesign
const SCT_ModuleSideDesign * m_motherDesign
Definition: SCT_ModuleSideDesign.h:208
InDetDD::SCT_ModuleSideDesign::localPositionOfCell
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const override=0
id -> position
InDetDD::SCT_ModuleSideDesign::positionFromStrip
virtual SiLocalPosition positionFromStrip(const int stripNumber) const
gives position of strip center ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId ...
Definition: SCT_ModuleSideDesign.cxx:95
InDetDD::SCT_ModuleSideDesign::m_scheme
SCT_ReadoutScheme m_scheme
Definition: SCT_ModuleSideDesign.h:196
InDetDD::DetectorDesign::distanceToDetectorEdge
virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, double &phiDist) const =0
Returns distance to nearest detector active edge +ve = inside -ve = outside.
InDetDD::SiIntersect
Definition: SiIntersect.h:23
InDetDD::SiCellId
Definition: SiCellId.h:29
InDetDD::CarrierType
CarrierType
Definition: InDetDD_Defs.h:17
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::SCT_ModuleSideDesign::neighboursOfCell
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...
Definition: SCT_ModuleSideDesign.cxx:70
InDetDD::SiDetectorDesign
Definition: SiDetectorDesign.h:50
InDetDD::SCT_ModuleSideDesign::getStripRow
virtual std::pair< int, int > getStripRow(SiCellId id) const
Get the strip and row number of the cell.
Definition: SCT_ModuleSideDesign.cxx:127
InDetDD::SiIntersect::setNearBoundary
void setNearBoundary()
Definition: SiIntersect.h:86
InDetDD::SCT_ModuleSideDesign::SCT_ModuleSideDesign
SCT_ModuleSideDesign()
InDetDD::SCT_ModuleSideDesign::inDetector
virtual SiIntersect inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol) const override
Test if point is in the active part of the detector with specified tolerances.
Definition: SCT_ModuleSideDesign.cxx:131