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 trackerDTC {
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);
20  const PixelTopology* pixelTopology =
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 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
56  sin_ = std::sin(tilt_);
57  // cosinus of module tilt measured w.r.t. beam axis (+-1=endcap), tk layout measures w.r.t. radial axis
58  cos_ = std::cos(tilt_);
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  // getting bend window size
95  double windowSize(-1.);
96  if (barrel_) {
97  enum TypeBarrel { nonBarrel = 0, tiltedMinus = 1, tiltedPlus = 2, flat = 3 };
98  const TypeBarrel type = static_cast<TypeBarrel>(trackerTopology->tobSide(detId));
99  if (type == flat)
100  windowSize = setup.windowSizeBarrelLayer(layerId_);
101  else {
102  int ladder = trackerTopology->tobRod(detId);
103  if (type == tiltedMinus)
104  // Corrected ring number, bet 0 and barrelNTilt.at(layer), in ascending |z|
105  ladder = 1 + setup.numTiltedLayerRing(layerId_) - ladder;
106  windowSize = setup.windowSizeTiltedLayerRing(layerId_, ladder);
107  }
108  } else {
109  const int ring = trackerTopology->tidRing(detId);
110  const int lay = layer + setup.offsetLayerId();
111  windowSize = setup.windowSizeEndcapDisksRing(lay, ring);
112  }
113  windowSize_ = windowSize / setup.baseWindowSize();
114  // getting encoded layer id
115  const vector<int>& encodingLayerId = setup.encodingLayerId(dtcId_);
116  const auto pos = find(encodingLayerId.begin(), encodingLayerId.end(), layerId_);
117  encodedLayerId_ = distance(encodingLayerId.begin(), pos);
118  }
119 
120 } // namespace trackerDTC
GeomDet::position
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:43
trackerDTC::SensorModule::numRows_
int numRows_
Definition: SensorModule.h:97
trackerDTC::SensorModule::BarrelPS
Definition: SensorModule.h:16
trackerDTC::SensorModule::windowSize
int windowSize() const
Definition: SensorModule.h:71
trackerDTC::SensorModule::pitchCol_
double pitchCol_
Definition: SensorModule.h:111
GeomDet
Definition: GeomDet.h:27
trackerDTC::SensorModule::barrel_
bool barrel_
Definition: SensorModule.h:83
trackerDTC::SensorModule::flipped_
bool flipped_
Definition: SensorModule.h:87
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
pos
Definition: PixelAliasList.h:18
PixelTopology::pitch
virtual std::pair< float, float > pitch() const =0
trackerDTC::SensorModule::offsetZ_
double offsetZ_
Definition: SensorModule.h:127
trackerDTC::SensorModule::z_
double z_
Definition: SensorModule.h:105
trackerDTC::SensorModule::layerId_
int layerId_
Definition: SensorModule.h:99
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
trackerDTC::SensorModule::tilt_
double tilt_
Definition: SensorModule.h:113
trackerDTC::SensorModule::phi_
double phi_
Definition: SensorModule.h:103
trackerDTC::SensorModule::offsetR_
double offsetR_
Definition: SensorModule.h:125
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
trackerDTC::Setup
Class to process and provide run-time constants used by Track Trigger emulators.
Definition: Setup.h:41
TrackerGeometry::getDetectorType
ModuleType getDetectorType(DetId) const
Definition: TrackerGeometry.cc:247
trackerDTC::SensorModule::encodedR_
int encodedR_
Definition: SensorModule.h:121
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
TrackerTopology::tidRing
unsigned int tidRing(const DetId &id) const
Definition: TrackerTopology.h:218
TrackerTopology::tobRod
unsigned int tobRod(const DetId &id) const
Definition: TrackerTopology.h:195
TrackerTopology::tidWheel
unsigned int tidWheel(const DetId &id) const
Definition: TrackerTopology.h:201
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
TrackerGeometry::idToDetUnit
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: TrackerGeometry.cc:183
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
trackerDTC::SensorModule::pitchRow_
double pitchRow_
Definition: SensorModule.h:109
SensorModule.h
trackerDTC::SensorModule::side_
bool side_
Definition: SensorModule.h:81
DetId
Definition: DetId.h:17
Plane.h
trackerDTC::SensorModule::windowSize_
int windowSize_
Definition: SensorModule.h:129
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
TrackerTopology::partnerDetId
DetId partnerDetId(const DetId &id) const
Definition: TrackerTopology.cc:233
PixelTopology::ncolumns
virtual int ncolumns() const =0
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
trackerDTC::SensorModule::DiskPS
Definition: SensorModule.h:16
Point3DBase< float, GlobalTag >
PixelTopology
Definition: PixelTopology.h:10
trackerDTC::SensorModule::dtcId_
int dtcId_
Definition: SensorModule.h:77
trackerDTC::SensorModule::Disk2S
Definition: SensorModule.h:16
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
trackerDTC::SensorModule::encodedLayerId_
int encodedLayerId_
Definition: SensorModule.h:123
trackerDTC::SensorModule::type_
Type type_
Definition: SensorModule.h:119
trackerDTC::SensorModule::signRow_
bool signRow_
Definition: SensorModule.h:89
trackerDTC::SensorModule::cos_
double cos_
Definition: SensorModule.h:117
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88271
trackerDTC::SensorModule::numColumns_
int numColumns_
Definition: SensorModule.h:95
trackerDTC
Definition: DTC.h:10
Setup.h
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
std
Definition: JetResolutionObject.h:76
trackerDTC::SensorModule::signBend_
bool signBend_
Definition: SensorModule.h:93
trackerDTC::deltaPhi
double deltaPhi(double lhs, double rhs=0.)
Definition: Setup.h:34
trackerDTC::SensorModule::sin_
double sin_
Definition: SensorModule.h:115
Plane
Definition: Plane.h:16
PVValHelper::ladder
Definition: PVValidationHelpers.h:73
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
trackerDTC::SensorModule::psModule_
bool psModule_
Definition: SensorModule.h:85
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
TkRotation::x
Basic3DVector< T > x() const
Definition: extTkRotation.h:247
trackerDTC::SensorModule::r_
double r_
Definition: SensorModule.h:101
GloballyPositioned::rotation
const RotationType & rotation() const
Definition: GloballyPositioned.h:38
trackerDTC::SensorModule::sep_
double sep_
Definition: SensorModule.h:107
trackerDTC::SensorModule::signCol_
bool signCol_
Definition: SensorModule.h:91
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
PixelTopology::nrows
virtual int nrows() const =0
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
Basic3DVector::phi
Geom::Phi< T > phi() const
Definition: extBasic3DVector.h:132
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
TrackerTopology::tobSide
unsigned int tobSide(const DetId &id) const
Definition: TrackerTopology.h:180
TrackerGeometry::ModuleType::Ph2PSP
TrackerGeometry
Definition: TrackerGeometry.h:14
trackerDTC::SensorModule::Barrel2S
Definition: SensorModule.h:16