CMS 3D CMS Logo

TTGeometryTranslator.cc
Go to the documentation of this file.
3 
4 // event setup stuff / geometries
9 
13 
16 
19 
20 using namespace L1TMuon;
21 
22 
24  _geom_cache_id(0ULL), _topo_cache_id(0ULL), _magfield_cache_id(0ULL) {
25 }
26 
28 }
29 
31  const DetId detId = tp.detId();
32  bool isBarrel = (detId.subdetId() == StripSubdetector::TOB);
33  //bool isEndcap = (detId.subdetId() == StripSubdetector::TID);
34  return isBarrel;
35 }
36 
38  const DetId detId = tp.detId();
39  const TrackerGeometry::ModuleType moduleType = _geom->getDetectorType(detId);
41  //bool isSSModule = (moduleType == TrackerGeometry::ModuleType::Ph2SS);
42  return isPSModule;
43 }
44 
46  int region = 0;
47 
48  const DetId detId = tp.detId();
49  if (detId.subdetId() == StripSubdetector::TOB) { // barrel
50  region = 0;
51  } else if (detId.subdetId() == StripSubdetector::TID) { // endcap
52  int type = _topo->tidSide(detId); // 1=-ve 2=+ve
53  if (type == 1) {
54  region = -1;
55  } else if (type == 2) {
56  region = +1;
57  }
58  }
59  return region;
60 }
61 
63  int layer = 0;
64 
65  const DetId detId = tp.detId();
66  if (detId.subdetId() == StripSubdetector::TOB) { // barrel
67  layer = static_cast<int>(_topo->layer(detId));
68  } else if (detId.subdetId() == StripSubdetector::TID) { // endcap
69  layer = static_cast<int>(_topo->layer(detId));
70  }
71  return layer;
72 }
73 
75  int ring = 0;
76 
77  const DetId detId = tp.detId();
78  if (detId.subdetId() == StripSubdetector::TOB) { // barrel
79  ring = static_cast<int>(_topo->tobRod(detId));
80  } else if (detId.subdetId() == StripSubdetector::TID) { // endcap
81  ring = static_cast<int>(_topo->tidRing(detId));
82  }
83  return ring;
84 }
85 
87  int module = 0;
88 
89  const DetId detId = tp.detId();
90  if (detId.subdetId() == StripSubdetector::TOB) { // barrel
91  module = static_cast<int>(_topo->module(detId));
92  } else if (detId.subdetId() == StripSubdetector::TID) { // endcap
93  module = static_cast<int>(_topo->module(detId));
94  }
95  return module;
96 }
97 
98 double
100  switch(tp.subsystem()) {
102  return calcTTSpecificEta(tp);
103  break;
104  default:
105  return std::nan("Invalid TP type!");
106  break;
107  }
108 }
109 
110 double
112  switch(tp.subsystem()) {
114  return calcTTSpecificPhi(tp);
115  break;
116  default:
117  return std::nan("Invalid TP type!");
118  break;
119  }
120 }
121 
122 double
124  switch(tp.subsystem()) {
126  return calcTTSpecificBend(tp);
127  break;
128  default:
129  return std::nan("Invalid TP type!");
130  break;
131  }
132 }
133 
136  switch(tp.subsystem()) {
138  return getTTSpecificPoint(tp);
139  break;
140  default:
141  GlobalPoint ret(GlobalPoint::Polar(std::nan("Invalid TP type!"), std::nan("Invalid TP type!"), std::nan("Invalid TP type!")));
142  return ret;
143  break;
144  }
145 }
146 
149  unsigned long long geomid = geom.cacheIdentifier();
150  if( _geom_cache_id != geomid ) {
151  geom.get(_geom);
152  _geom_cache_id = geomid;
153  }
154 
155  const TrackerTopologyRcd& topo = es.get<TrackerTopologyRcd>();
156  unsigned long long topoid = topo.cacheIdentifier();
157  if( _topo_cache_id != topoid ) {
158  topo.get(_topo);
159  _topo_cache_id = topoid;
160  }
161 
162  const IdealMagneticFieldRecord& magfield = es.get<IdealMagneticFieldRecord>();
163  unsigned long long magfieldid = magfield.cacheIdentifier();
164  if( _magfield_cache_id != magfieldid ) {
165  magfield.get(_magfield);
166  _magfield_cache_id = magfieldid;
167  }
168 }
169 
172  // Check L1Trigger/TrackTrigger/src/TTStubAlgorithm_official.cc
173  const DetId detId = tp.detId();
174  const GeomDetUnit* geoUnit = _geom->idToDetUnit(detId+1); // det0
175  //const GeomDetUnit* geoUnit = _geom->idToDetUnit(detId+2); // det1
176  const Phase2TrackerGeomDetUnit* ph2TkGeoUnit = dynamic_cast<const Phase2TrackerGeomDetUnit*>(geoUnit);
177  const MeasurementPoint mp(tp.getTTData().row_f, tp.getTTData().col_f);
178  const GlobalPoint gp = ph2TkGeoUnit->surface().toGlobal(ph2TkGeoUnit->specificTopology().localPosition(mp));
179  return gp;
180 }
181 
182 double
184  return getTTSpecificPoint(tp).eta();
185 }
186 
187 double
189  return getTTSpecificPoint(tp).phi();
190 }
191 
192 double
194  return tp.getTTData().bend;
195 }
type
Definition: HCALResponse.h:21
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:106
unsigned long long cacheIdentifier() const
int module(const TTTriggerPrimitive &) const
double calcTTSpecificPhi(const TTTriggerPrimitive &) const
unsigned int tidRing(const DetId &id) const
GlobalPoint getGlobalPoint(const TTTriggerPrimitive &) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
void checkAndUpdateGeometry(const edm::EventSetup &)
int region(const TTTriggerPrimitive &) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
double calcTTSpecificEta(const TTTriggerPrimitive &) const
double calculateGlobalEta(const TTTriggerPrimitive &) const
edm::ESHandle< TrackerGeometry > _geom
double calculateBendAngle(const TTTriggerPrimitive &) const
unsigned int module(const DetId &id) const
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::ESHandle< MagneticField > _magfield
unsigned int tidSide(const DetId &id) const
const subsystem_type subsystem() const
bool isBarrel(const TTTriggerPrimitive &) const
double calculateGlobalPhi(const TTTriggerPrimitive &) const
void get(HolderT &iHolder) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
double calcTTSpecificBend(const TTTriggerPrimitive &) const
edm::ESHandle< TrackerTopology > _topo
GlobalPoint getTTSpecificPoint(const TTTriggerPrimitive &) const
ModuleType getDetectorType(DetId) const
Definition: DetId.h:18
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
int ring(const TTTriggerPrimitive &) const
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
unsigned int layer(const DetId &id) const
T eta() const
Definition: PV3DBase.h:76
int layer(const TTTriggerPrimitive &) const
T get() const
Definition: EventSetup.h:63
bool isPSModule(const TTTriggerPrimitive &) const
unsigned int tobRod(const DetId &id) const
Definition: vlib.h:208