CMS 3D CMS Logo

SensorModule.cc
Go to the documentation of this file.
4 
5 #include <cmath>
6 #include <algorithm>
7 #include <iterator>
8 #include <vector>
9 
10 using namespace std;
11 using namespace edm;
12 
13 namespace tt {
14 
15  SensorModule::SensorModule(const Setup* setup, const DetId& detId, int dtcId, int modId)
16  : detId_(detId), dtcId_(dtcId), modId_(modId) {
17  const TrackerGeometry* trackerGeometry = setup->trackerGeometry();
18  const TrackerTopology* trackerTopology = setup->trackerTopology();
19  const GeomDetUnit* geomDetUnit = trackerGeometry->idToDetUnit(detId);
21  dynamic_cast<const PixelTopology*>(&(dynamic_cast<const PixelGeomDetUnit*>(geomDetUnit)->specificTopology()));
22  const Plane& plane = dynamic_cast<const PixelGeomDetUnit*>(geomDetUnit)->surface();
23  const GlobalPoint pos0 = GlobalPoint(geomDetUnit->position());
24  const GlobalPoint pos1 =
25  GlobalPoint(trackerGeometry->idToDetUnit(trackerTopology->partnerDetId(detId))->position());
26  // detector region [0-8]
27  const int region = dtcId_ / setup->numDTCsPerRegion();
28  // module radius in cm
29  r_ = pos0.perp();
30  // module phi w.r.t. detector region_ centre in rad
31  phi_ = deltaPhi(pos0.phi() - (region + .5) * setup->baseRegion());
32  // module z in cm
33  z_ = pos0.z();
34  // sensor separation in cm
35  sep_ = (pos1 - pos0).mag();
36  // sensor pitch in cm [strip=.009,pixel=.01]
37  pitchRow_ = pixelTopology->pitch().first;
38  // sensor length in cm [strip=5,pixel=.15625]
39  pitchCol_ = pixelTopology->pitch().second;
40  // number of columns [2S=2,PS=8]
41  numColumns_ = pixelTopology->ncolumns();
42  // number of rows [2S=8*127,PS=8*120]
43  numRows_ = pixelTopology->nrows();
44  // +z or -z
45  side_ = pos0.z() >= 0.;
46  // main sensor inside or outside
47  flipped_ = pos0.mag() > pos1.mag();
48  // barrel or endcap
50  // Pixel-Strip or 2Strip module
52  // module tilt angle measured w.r.t. beam axis (0=barrel), tk layout measures w.r.t. radial axis
53  tilt_ = flipped_ ? atan2(pos1.z() - pos0.z(), pos0.perp() - pos1.perp())
54  : atan2(pos0.z() - pos1.z(), pos1.perp() - pos0.perp());
55  // sinus of module tilt measured w.r.t. beam axis (0=barrel), tk layout measures w.r.t. radial axis
57  // cosinus of module tilt measured w.r.t. beam axis (+-1=endcap), tk layout measures w.r.t. radial axis
59  // layer id [barrel: 0-5, endcap: 0-4]
60  const int layer =
61  (barrel_ ? trackerTopology->layer(detId) : trackerTopology->tidWheel(detId)) - setup->offsetLayerId();
62  // layer id [1-6,11-15]
63  layerId_ = layer + setup->offsetLayerId() + (barrel_ ? 0 : setup->offsetLayerDisks());
64  // TTStub row needs flip of sign
65  signRow_ = signbit(deltaPhi(plane.rotation().x().phi() - pos0.phi()));
66  // TTStub col needs flip of sign
67  signCol_ = !barrel_ && !side_;
68  // TTStub bend needs flip of sign
69  signBend_ = barrel_ || (!barrel_ && side_);
70  // determing sensor type
71  if (barrel_ && psModule_)
72  type_ = BarrelPS;
73  if (barrel_ && !psModule_)
74  type_ = Barrel2S;
75  if (!barrel_ && psModule_)
76  type_ = DiskPS;
77  if (!barrel_ && !psModule_)
78  type_ = Disk2S;
79  // encoding for 2S endcap radii
80  encodedR_ = -1;
81  if (type_ == Disk2S) {
82  const int offset = setup->hybridNumRingsPS(layer);
83  const int ring = trackerTopology->tidRing(detId);
85  }
86  // r and z offsets
87  if (barrel_) {
88  offsetR_ = setup->hybridLayerR(layer);
89  offsetZ_ = 0.;
90  } else {
91  offsetR_ = 0.;
92  offsetZ_ = side_ ? setup->hybridDiskZ(layer) : -setup->hybridDiskZ(layer);
93  }
94  const TypeTilt typeTilt = static_cast<TypeTilt>(trackerTopology->tobSide(detId));
95  // getting bend window size
96  double windowSize(-1.);
97  if (barrel_) {
98  if (typeTilt == flat)
99  windowSize = setup->windowSizeBarrelLayer(layerId_);
100  else {
101  int ladder = trackerTopology->tobRod(detId);
102  if (typeTilt == tiltedMinus)
103  // Corrected ring number, bet 0 and barrelNTilt.at(layer), in ascending |z|
104  ladder = 1 + setup->numTiltedLayerRing(layerId_) - ladder;
105  windowSize = setup->windowSizeTiltedLayerRing(layerId_, ladder);
106  }
107  } else {
108  const int ring = trackerTopology->tidRing(detId);
109  const int lay = layer + setup->offsetLayerId();
110  windowSize = setup->windowSizeEndcapDisksRing(lay, ring);
111  }
112  windowSize_ = windowSize / setup->baseWindowSize();
113  // calculate tilt correction parameter used to project r to z uncertainty
114  tiltCorrectionSlope_ = barrel_ ? 0. : 1.;
115  tiltCorrectionIntercept_ = barrel_ ? 1. : 0.;
116  if (typeTilt == tiltedMinus || typeTilt == tiltedPlus) {
117  tiltCorrectionSlope_ = setup->tiltApproxSlope();
118  tiltCorrectionIntercept_ = setup->tiltApproxIntercept();
119  }
120  }
121 
122 } // namespace tt
double tiltCorrectionIntercept_
Definition: SensorModule.h:132
T perp() const
Definition: PV3DBase.h:69
unsigned int tobSide(const DetId &id) const
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
T z() const
Definition: PV3DBase.h:61
Class to process and provide run-time constants used by Track Trigger emulators.
Definition: Setup.h:44
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
unsigned int tidWheel(const DetId &id) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Definition: Plane.h:16
unsigned int layer(const DetId &id) const
Basic3DVector< T > x() const
double tiltCorrectionSlope_
Definition: SensorModule.h:130
Definition: TTTypes.h:54
ModuleType getDetectorType(DetId) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T mag() const
Definition: PV3DBase.h:64
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId partnerDetId(const DetId &id) const
static constexpr auto TOB
Definition: DetId.h:17
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
unsigned int tobRod(const DetId &id) const
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
int windowSize() const
Definition: SensorModule.h:69
HLT enums.
static int position[264][3]
Definition: ReadPGInfo.cc:289
double deltaPhi(double lhs, double rhs=0.)
Definition: Setup.h:37
unsigned int tidRing(const DetId &id) const
const RotationType & rotation() const
Geom::Phi< T > phi() const