CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1TMuon::GeometryTranslator Class Reference

#include <GeometryTranslator.h>

Public Member Functions

double calculateBendAngle (const TriggerPrimitive &) const
 
double calculateGlobalEta (const TriggerPrimitive &) const
 
double calculateGlobalPhi (const TriggerPrimitive &) const
 
void checkAndUpdateGeometry (const edm::EventSetup &)
 
 GeometryTranslator (edm::ConsumesCollector)
 
const CSCGeometrygetCSCGeometry () const
 
const DTGeometrygetDTGeometry () const
 
const GEMGeometrygetGEMGeometry () const
 
GlobalPoint getGlobalPoint (const TriggerPrimitive &) const
 
const MagneticFieldgetMagneticField () const
 
const ME0GeometrygetME0Geometry () const
 
const RPCGeometrygetRPCGeometry () const
 
 ~GeometryTranslator ()
 

Private Member Functions

double calcCSCSpecificBend (const TriggerPrimitive &) const
 
double calcCSCSpecificEta (const TriggerPrimitive &) const
 
double calcCSCSpecificPhi (const TriggerPrimitive &) const
 
double calcDTSpecificBend (const TriggerPrimitive &) const
 
double calcDTSpecificEta (const TriggerPrimitive &) const
 
double calcDTSpecificPhi (const TriggerPrimitive &) const
 
GlobalPoint calcDTSpecificPoint (const TriggerPrimitive &) const
 
double calcGEMSpecificBend (const TriggerPrimitive &) const
 
double calcGEMSpecificEta (const TriggerPrimitive &) const
 
double calcGEMSpecificPhi (const TriggerPrimitive &) const
 
double calcME0SpecificBend (const TriggerPrimitive &) const
 
double calcME0SpecificEta (const TriggerPrimitive &) const
 
double calcME0SpecificPhi (const TriggerPrimitive &) const
 
double calcRPCSpecificBend (const TriggerPrimitive &) const
 
double calcRPCSpecificEta (const TriggerPrimitive &) const
 
double calcRPCSpecificPhi (const TriggerPrimitive &) const
 
GlobalPoint getCSCSpecificPoint (const TriggerPrimitive &) const
 
GlobalPoint getGEMSpecificPoint (const TriggerPrimitive &) const
 
GlobalPoint getME0SpecificPoint (const TriggerPrimitive &) const
 
GlobalPoint getRPCSpecificPoint (const TriggerPrimitive &) const
 
bool isCSCCounterClockwise (const std::unique_ptr< const CSCLayer > &) const
 

Private Attributes

edm::ESHandle< CSCGeometry_geocsc
 
edm::ESHandle< DTGeometry_geodt
 
edm::ESHandle< GEMGeometry_geogem
 
unsigned long long _geom_cache_id
 
edm::ESHandle< ME0Geometry_geome0
 
edm::ESHandle< RPCGeometry_georpc
 
edm::ESHandle< MagneticField_magfield
 
unsigned long long _magfield_cache_id
 
edm::ESGetToken< CSCGeometry, MuonGeometryRecordgeocscToken_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecordgeodtToken_
 
edm::ESGetToken< GEMGeometry, MuonGeometryRecordgeogemToken_
 
edm::ESGetToken< ME0Geometry, MuonGeometryRecordgeome0Token_
 
edm::ESGetToken< RPCGeometry, MuonGeometryRecordgeorpcToken_
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagfieldToken_
 

Detailed Description

Definition at line 44 of file GeometryTranslator.h.

Constructor & Destructor Documentation

◆ GeometryTranslator()

GeometryTranslator::GeometryTranslator ( edm::ConsumesCollector  iC)

Definition at line 25 of file GeometryTranslator.cc.

26  : _geom_cache_id(0ULL),
27  geodtToken_(iC.esConsumes()),
32  _magfield_cache_id(0ULL),
33  magfieldToken_(iC.esConsumes()) {}
unsigned long long _geom_cache_id
edm::ESGetToken< DTGeometry, MuonGeometryRecord > geodtToken_
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geome0Token_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > georpcToken_
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geocscToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geogemToken_
unsigned long long _magfield_cache_id

◆ ~GeometryTranslator()

GeometryTranslator::~GeometryTranslator ( )

Definition at line 35 of file GeometryTranslator.cc.

35 {}

Member Function Documentation

◆ calcCSCSpecificBend()

double GeometryTranslator::calcCSCSpecificBend ( const TriggerPrimitive tp) const
private

Definition at line 331 of file GeometryTranslator.cc.

References cmsswSequenceInfo::tp.

Referenced by calculateBendAngle().

331 { return tp.getCSCData().bend; }

◆ calcCSCSpecificEta()

double GeometryTranslator::calcCSCSpecificEta ( const TriggerPrimitive tp) const
private

Definition at line 323 of file GeometryTranslator.cc.

References PV3DBase< T, PVType, FrameType >::eta(), getCSCSpecificPoint(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalEta().

323  {
324  return getCSCSpecificPoint(tp).eta();
325 }
GlobalPoint getCSCSpecificPoint(const TriggerPrimitive &) const
T eta() const
Definition: PV3DBase.h:73

◆ calcCSCSpecificPhi()

double GeometryTranslator::calcCSCSpecificPhi ( const TriggerPrimitive tp) const
private

Definition at line 327 of file GeometryTranslator.cc.

References getCSCSpecificPoint(), PV3DBase< T, PVType, FrameType >::phi(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalPhi().

327  {
328  return getCSCSpecificPoint(tp).phi();
329 }
GlobalPoint getCSCSpecificPoint(const TriggerPrimitive &) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66

◆ calcDTSpecificBend()

double GeometryTranslator::calcDTSpecificBend ( const TriggerPrimitive tp) const
private

Definition at line 379 of file GeometryTranslator.cc.

References cmsswSequenceInfo::tp.

Referenced by calculateBendAngle().

379  {
380  int bend = tp.getDTData().bendingAngle;
381  double bendf = bend / 512.0;
382  return bendf;
383 }

◆ calcDTSpecificEta()

double GeometryTranslator::calcDTSpecificEta ( const TriggerPrimitive tp) const
private

Definition at line 374 of file GeometryTranslator.cc.

References calcDTSpecificPoint(), PV3DBase< T, PVType, FrameType >::eta(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalEta().

374 { return calcDTSpecificPoint(tp).eta(); }
T eta() const
Definition: PV3DBase.h:73
GlobalPoint calcDTSpecificPoint(const TriggerPrimitive &) const

◆ calcDTSpecificPhi()

double GeometryTranslator::calcDTSpecificPhi ( const TriggerPrimitive tp) const
private

Definition at line 376 of file GeometryTranslator.cc.

References calcDTSpecificPoint(), PV3DBase< T, PVType, FrameType >::phi(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalPhi().

376 { return calcDTSpecificPoint(tp).phi(); }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GlobalPoint calcDTSpecificPoint(const TriggerPrimitive &) const

◆ calcDTSpecificPoint()

GlobalPoint GeometryTranslator::calcDTSpecificPoint ( const TriggerPrimitive tp) const
private

Definition at line 342 of file GeometryTranslator.cc.

References _geodt, DTGeometry::chamber(), M_PI, PV3DBase< T, PVType, FrameType >::mag(), DTChamberId::station(), PV3DBase< T, PVType, FrameType >::theta(), and cmsswSequenceInfo::tp.

Referenced by calcDTSpecificEta(), calcDTSpecificPhi(), and getGlobalPoint().

342  {
343  const DTChamberId baseid(tp.detId<DTChamberId>());
344  // do not use this pointer for anything other than creating a trig geom
345  std::unique_ptr<DTChamber> chamb(const_cast<DTChamber*>(_geodt->chamber(baseid)));
346  std::unique_ptr<DTTrigGeom> trig_geom(new DTTrigGeom(chamb.get(), false));
347  chamb.release(); // release it here so no one gets funny ideas
348  // super layer one is the theta superlayer in a DT chamber
349  // station 4 does not have a theta super layer
350  // the BTI index from the theta trigger is an OR of some BTI outputs
351  // so, we choose the BTI that's in the middle of the group
352  // as the BTI that we get theta from
353  // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign
354  const int NBTI_theta = ((baseid.station() != 4) ? trig_geom->nCell(2) : trig_geom->nCell(3));
355  const int bti_group = tp.getDTData().theta_bti_group;
356  const unsigned bti_actual = bti_group * NBTI_theta / 7 + NBTI_theta / 14 + 1;
357  DTBtiId thetaBTI;
358  if (baseid.station() != 4 && bti_group != -1) {
359  thetaBTI = DTBtiId(baseid, 2, bti_actual);
360  } else {
361  // since this is phi oriented it'll give us theta in the middle
362  // of the chamber
363  thetaBTI = DTBtiId(baseid, 3, 1);
364  }
365  const GlobalPoint& theta_gp = trig_geom->CMSPosition(thetaBTI);
366 
367  // local phi in sector -> global phi
368  double phi = static_cast<double>(tp.getDTData().radialAngle) / 4096.0; // 12 bits for 1 radian
369  phi += tp.getDTData().sector * M_PI / 6.0; // add sector offset, sector is [0,11]
370 
371  return GlobalPoint(GlobalPoint::Polar(theta_gp.theta(), phi, theta_gp.mag()));
372 }
edm::ESHandle< DTGeometry > _geodt
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T mag() const
Definition: PV3DBase.h:64
#define M_PI
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72

◆ calcGEMSpecificBend()

double GeometryTranslator::calcGEMSpecificBend ( const TriggerPrimitive tp) const
private

Definition at line 233 of file GeometryTranslator.cc.

Referenced by calculateBendAngle().

233 { return 0.0; }

◆ calcGEMSpecificEta()

double GeometryTranslator::calcGEMSpecificEta ( const TriggerPrimitive tp) const
private

Definition at line 225 of file GeometryTranslator.cc.

References PV3DBase< T, PVType, FrameType >::eta(), getGEMSpecificPoint(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalEta().

225  {
226  return getGEMSpecificPoint(tp).eta();
227 }
T eta() const
Definition: PV3DBase.h:73
GlobalPoint getGEMSpecificPoint(const TriggerPrimitive &) const

◆ calcGEMSpecificPhi()

double GeometryTranslator::calcGEMSpecificPhi ( const TriggerPrimitive tp) const
private

Definition at line 229 of file GeometryTranslator.cc.

References getGEMSpecificPoint(), PV3DBase< T, PVType, FrameType >::phi(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalPhi().

229  {
230  return getGEMSpecificPoint(tp).phi();
231 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GlobalPoint getGEMSpecificPoint(const TriggerPrimitive &) const

◆ calcME0SpecificBend()

double GeometryTranslator::calcME0SpecificBend ( const TriggerPrimitive tp) const
private

Definition at line 207 of file GeometryTranslator.cc.

References cmsswSequenceInfo::tp.

Referenced by calculateBendAngle().

207  {
208  return tp.getME0Data().deltaphi * (tp.getME0Data().bend == 0 ? 1 : -1);
209 }

◆ calcME0SpecificEta()

double GeometryTranslator::calcME0SpecificEta ( const TriggerPrimitive tp) const
private

Definition at line 199 of file GeometryTranslator.cc.

References PV3DBase< T, PVType, FrameType >::eta(), getME0SpecificPoint(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalEta().

199  {
200  return getME0SpecificPoint(tp).eta();
201 }
T eta() const
Definition: PV3DBase.h:73
GlobalPoint getME0SpecificPoint(const TriggerPrimitive &) const

◆ calcME0SpecificPhi()

double GeometryTranslator::calcME0SpecificPhi ( const TriggerPrimitive tp) const
private

Definition at line 203 of file GeometryTranslator.cc.

References getME0SpecificPoint(), PV3DBase< T, PVType, FrameType >::phi(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalPhi().

203  {
204  return getME0SpecificPoint(tp).phi();
205 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GlobalPoint getME0SpecificPoint(const TriggerPrimitive &) const

◆ calcRPCSpecificBend()

double GeometryTranslator::calcRPCSpecificBend ( const TriggerPrimitive tp) const
private

Definition at line 259 of file GeometryTranslator.cc.

Referenced by calculateBendAngle().

259 { return 0.0; }

◆ calcRPCSpecificEta()

double GeometryTranslator::calcRPCSpecificEta ( const TriggerPrimitive tp) const
private

Definition at line 249 of file GeometryTranslator.cc.

References PV3DBase< T, PVType, FrameType >::eta(), getRPCSpecificPoint(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalEta().

249  {
250  return getRPCSpecificPoint(tp).eta();
251 }
T eta() const
Definition: PV3DBase.h:73
GlobalPoint getRPCSpecificPoint(const TriggerPrimitive &) const

◆ calcRPCSpecificPhi()

double GeometryTranslator::calcRPCSpecificPhi ( const TriggerPrimitive tp) const
private

Definition at line 253 of file GeometryTranslator.cc.

References getRPCSpecificPoint(), PV3DBase< T, PVType, FrameType >::phi(), and cmsswSequenceInfo::tp.

Referenced by calculateGlobalPhi().

253  {
254  return getRPCSpecificPoint(tp).phi();
255 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
GlobalPoint getRPCSpecificPoint(const TriggerPrimitive &) const

◆ calculateBendAngle()

double GeometryTranslator::calculateBendAngle ( const TriggerPrimitive tp) const

Definition at line 83 of file GeometryTranslator.cc.

References calcCSCSpecificBend(), calcDTSpecificBend(), calcGEMSpecificBend(), calcME0SpecificBend(), calcRPCSpecificBend(), L1TMuon::kCSC, L1TMuon::kDT, L1TMuon::kGEM, L1TMuon::kME0, L1TMuon::kRPC, dqmiodatasetharvest::nan, and cmsswSequenceInfo::tp.

83  {
84  switch (tp.subsystem()) {
85  case L1TMuon::kDT:
86  return calcDTSpecificBend(tp);
87  break;
88  case L1TMuon::kCSC:
89  return calcCSCSpecificBend(tp);
90  break;
91  case L1TMuon::kRPC:
92  return calcRPCSpecificBend(tp);
93  break;
94  case L1TMuon::kGEM:
95  return calcGEMSpecificBend(tp);
96  break;
97  case L1TMuon::kME0:
98  return calcME0SpecificBend(tp);
99  break;
100  default:
101  return std::nan("Invalid TP type!");
102  break;
103  }
104 }
double calcDTSpecificBend(const TriggerPrimitive &) const
double calcME0SpecificBend(const TriggerPrimitive &) const
double calcGEMSpecificBend(const TriggerPrimitive &) const
double calcCSCSpecificBend(const TriggerPrimitive &) const
double calcRPCSpecificBend(const TriggerPrimitive &) const

◆ calculateGlobalEta()

double GeometryTranslator::calculateGlobalEta ( const TriggerPrimitive tp) const

Definition at line 37 of file GeometryTranslator.cc.

References calcCSCSpecificEta(), calcDTSpecificEta(), calcGEMSpecificEta(), calcME0SpecificEta(), calcRPCSpecificEta(), L1TMuon::kCSC, L1TMuon::kDT, L1TMuon::kGEM, L1TMuon::kME0, L1TMuon::kRPC, dqmiodatasetharvest::nan, and cmsswSequenceInfo::tp.

37  {
38  switch (tp.subsystem()) {
39  case L1TMuon::kDT:
40  return calcDTSpecificEta(tp);
41  break;
42  case L1TMuon::kCSC:
43  return calcCSCSpecificEta(tp);
44  break;
45  case L1TMuon::kRPC:
46  return calcRPCSpecificEta(tp);
47  break;
48  case L1TMuon::kGEM:
49  return calcGEMSpecificEta(tp);
50  break;
51  case L1TMuon::kME0:
52  return calcME0SpecificEta(tp);
53  break;
54  default:
55  return std::nan("Invalid TP type!");
56  break;
57  }
58 }
double calcGEMSpecificEta(const TriggerPrimitive &) const
double calcRPCSpecificEta(const TriggerPrimitive &) const
double calcCSCSpecificEta(const TriggerPrimitive &) const
double calcME0SpecificEta(const TriggerPrimitive &) const
double calcDTSpecificEta(const TriggerPrimitive &) const

◆ calculateGlobalPhi()

double GeometryTranslator::calculateGlobalPhi ( const TriggerPrimitive tp) const

Definition at line 60 of file GeometryTranslator.cc.

References calcCSCSpecificPhi(), calcDTSpecificPhi(), calcGEMSpecificPhi(), calcME0SpecificPhi(), calcRPCSpecificPhi(), L1TMuon::kCSC, L1TMuon::kDT, L1TMuon::kGEM, L1TMuon::kME0, L1TMuon::kRPC, dqmiodatasetharvest::nan, and cmsswSequenceInfo::tp.

60  {
61  switch (tp.subsystem()) {
62  case L1TMuon::kDT:
63  return calcDTSpecificPhi(tp);
64  break;
65  case L1TMuon::kCSC:
66  return calcCSCSpecificPhi(tp);
67  break;
68  case L1TMuon::kRPC:
69  return calcRPCSpecificPhi(tp);
70  break;
71  case L1TMuon::kGEM:
72  return calcGEMSpecificPhi(tp);
73  break;
74  case L1TMuon::kME0:
75  return calcME0SpecificPhi(tp);
76  break;
77  default:
78  return std::nan("Invalid TP type!");
79  break;
80  }
81 }
double calcGEMSpecificPhi(const TriggerPrimitive &) const
double calcCSCSpecificPhi(const TriggerPrimitive &) const
double calcRPCSpecificPhi(const TriggerPrimitive &) const
double calcDTSpecificPhi(const TriggerPrimitive &) const
double calcME0SpecificPhi(const TriggerPrimitive &) const

◆ checkAndUpdateGeometry()

void GeometryTranslator::checkAndUpdateGeometry ( const edm::EventSetup es)

Definition at line 131 of file GeometryTranslator.cc.

References _geocsc, _geodt, _geogem, _geom_cache_id, _geome0, _georpc, _magfield, _magfield_cache_id, geocscToken_, geodtToken_, geogemToken_, relativeConstraints::geom, geome0Token_, georpcToken_, edm::EventSetup::get(), volumeBasedMagneticField_160812_cfi::magfield, and magfieldToken_.

Referenced by Phase2L1TGMTStubProducer::produce(), EMTFSetup::reload(), and emtf::phase2::EMTFContext::update().

131  {
133  unsigned long long geomid = geom.cacheIdentifier();
134  if (_geom_cache_id != geomid) {
135  _geodt = geom.getHandle(geodtToken_);
136  _geocsc = geom.getHandle(geocscToken_);
137  _georpc = geom.getHandle(georpcToken_);
138  _geogem = geom.getHandle(geogemToken_);
139  _geome0 = geom.getHandle(geome0Token_);
140  _geom_cache_id = geomid;
141  }
142 
144  unsigned long long magfieldid = magfield.cacheIdentifier();
145  if (_magfield_cache_id != magfieldid) {
146  _magfield = magfield.getHandle(magfieldToken_);
147  _magfield_cache_id = magfieldid;
148  }
149 }
edm::ESHandle< DTGeometry > _geodt
unsigned long long _geom_cache_id
edm::ESHandle< RPCGeometry > _georpc
edm::ESHandle< GEMGeometry > _geogem
edm::ESHandle< ME0Geometry > _geome0
edm::ESHandle< MagneticField > _magfield
edm::ESGetToken< DTGeometry, MuonGeometryRecord > geodtToken_
edm::ESHandle< CSCGeometry > _geocsc
T get() const
Definition: EventSetup.h:79
edm::ESGetToken< ME0Geometry, MuonGeometryRecord > geome0Token_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magfieldToken_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > georpcToken_
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > geocscToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geogemToken_
unsigned long long _magfield_cache_id

◆ getCSCGeometry()

const CSCGeometry& L1TMuon::GeometryTranslator::getCSCGeometry ( ) const
inline

Definition at line 58 of file GeometryTranslator.h.

References _geocsc.

58 { return *_geocsc; }
edm::ESHandle< CSCGeometry > _geocsc

◆ getCSCSpecificPoint()

GlobalPoint GeometryTranslator::getCSCSpecificPoint ( const TriggerPrimitive tp) const
private

Definition at line 268 of file GeometryTranslator.cc.

References _geocsc, cms::cuda::assert(), CSCGeometry::chamber(), CSCPatternBank::getLegacyPosition(), l1ctLayer2EG_cff::id, isCSCCounterClockwise(), CSCConstants::KEY_ALCT_LAYER, PV3DBase< T, PVType, FrameType >::mag(), hltrates_dqm_sourceclient-live_cfg::offset, topSingleLeptonDQM_PU_cfi::pattern, PV3DBase< T, PVType, FrameType >::phi(), nano_mu_digi_cff::strip, PV3DBase< T, PVType, FrameType >::theta(), cmsswSequenceInfo::tp, and Geom::Phi< T1, Range >::value().

Referenced by calcCSCSpecificEta(), calcCSCSpecificPhi(), and getGlobalPoint().

268  {
269  const CSCDetId id(tp.detId<CSCDetId>());
270  // we should change this to weak_ptrs at some point
271  // requires introducing std::shared_ptrs to geometry
272  std::unique_ptr<const CSCChamber> chamb(_geocsc->chamber(id));
273  assert(chamb != nullptr); // failed to get CSC chamber
274  std::unique_ptr<const CSCLayerGeometry> layer_geom(chamb->layer(CSCConstants::KEY_ALCT_LAYER)->geometry());
275  std::unique_ptr<const CSCLayer> layer(chamb->layer(CSCConstants::KEY_ALCT_LAYER));
276 
277  const uint16_t halfstrip = tp.getCSCData().strip;
278  const uint16_t pattern = tp.getCSCData().pattern;
279  const uint16_t keyWG = tp.getCSCData().keywire;
280  //const unsigned maxStrips = layer_geom->numberOfStrips();
281 
282  // so we can extend this later
283  // assume TMB2007 half-strips only as baseline
284  double offset = 0.0;
285  switch (1) {
286  case 1:
288  }
289  const unsigned halfstrip_offs = static_cast<unsigned>(0.5 + halfstrip + offset);
290  const unsigned strip = halfstrip_offs / 2 + 1; // geom starts from 1
291 
292  // the rough location of the hit at the ALCT key layer
293  // we will refine this using the half strip information
294  const LocalPoint& coarse_lp = layer_geom->stripWireGroupIntersection(strip, keyWG);
295  const GlobalPoint& coarse_gp = layer->surface().toGlobal(coarse_lp);
296 
297  // the strip width/4.0 gives the offset of the half-strip
298  // center with respect to the strip center
299  const double hs_offset = layer_geom->stripPhiPitch() / 4.0;
300 
301  // determine handedness of the chamber
302  const bool ccw = isCSCCounterClockwise(layer);
303  // we need to subtract the offset of even half strips and add the odd ones
304  const double phi_offset = ((halfstrip_offs % 2 ? 1 : -1) * (ccw ? -hs_offset : hs_offset));
305 
306  // the global eta calculation uses the middle of the strip
307  // so no need to increment it
308  const GlobalPoint final_gp(
309  GlobalPoint::Polar(coarse_gp.theta(), (coarse_gp.phi().value() + phi_offset), coarse_gp.mag()));
310 
311  // We need to add in some notion of the 'error' on trigger primitives
312  // like the width of the wire group by the width of the strip
313  // or something similar
314 
315  // release ownership of the pointers
316  chamb.release();
317  layer_geom.release();
318  layer.release();
319 
320  return final_gp;
321 }
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
assert(be >=bs)
edm::ESHandle< CSCGeometry > _geocsc
T mag() const
Definition: PV3DBase.h:64
static double getLegacyPosition(int pattern)
T1 value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:75
bool isCSCCounterClockwise(const std::unique_ptr< const CSCLayer > &) const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72

◆ getDTGeometry()

const DTGeometry& L1TMuon::GeometryTranslator::getDTGeometry ( ) const
inline

Definition at line 57 of file GeometryTranslator.h.

References _geodt.

57 { return *_geodt; }
edm::ESHandle< DTGeometry > _geodt

◆ getGEMGeometry()

const GEMGeometry& L1TMuon::GeometryTranslator::getGEMGeometry ( ) const
inline

Definition at line 60 of file GeometryTranslator.h.

References _geogem.

60 { return *_geogem; }
edm::ESHandle< GEMGeometry > _geogem

◆ getGEMSpecificPoint()

GlobalPoint GeometryTranslator::getGEMSpecificPoint ( const TriggerPrimitive tp) const
private

Definition at line 213 of file GeometryTranslator.cc.

References _geogem, cms::cuda::assert(), GEMGeometry::etaPartition(), l1ctLayer2EG_cff::id, nano_mu_digi_cff::roll, and cmsswSequenceInfo::tp.

Referenced by calcGEMSpecificEta(), calcGEMSpecificPhi(), and getGlobalPoint().

213  {
214  const GEMDetId id(tp.detId<GEMDetId>());
216  assert(roll != nullptr); // failed to get GEM roll
217  //const uint16_t pad = tp.getGEMData().pad;
218  // Use half-pad precision, + 0.5 at the end to get the center of the pad (pad starts from 0)
219  const float pad = (0.5 * static_cast<float>(tp.getGEMData().pad_low + tp.getGEMData().pad_hi)) + 0.5f;
220  const LocalPoint& lp = roll->centreOfPad(pad);
221  const GlobalPoint& gp = roll->surface().toGlobal(lp);
222  return gp;
223 }
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:77
edm::ESHandle< GEMGeometry > _geogem
assert(be >=bs)

◆ getGlobalPoint()

GlobalPoint GeometryTranslator::getGlobalPoint ( const TriggerPrimitive tp) const

Definition at line 106 of file GeometryTranslator.cc.

References calcDTSpecificPoint(), getCSCSpecificPoint(), getGEMSpecificPoint(), getME0SpecificPoint(), getRPCSpecificPoint(), L1TMuon::kCSC, L1TMuon::kDT, L1TMuon::kGEM, L1TMuon::kME0, L1TMuon::kRPC, dqmiodatasetharvest::nan, runTheMatrix::ret, and cmsswSequenceInfo::tp.

Referenced by L1TPhase2GMTEndcapStubProcessor::buildCSCOnlyStub(), L1TPhase2GMTEndcapStubProcessor::buildRPCOnlyStub(), emtf::phase2::RPCTPConverter::convert(), emtf::phase2::GE0TPConverter::convert(), emtf::phase2::ME0TPConverter::convert(), emtf::phase2::GEMTPConverter::convert(), emtf::phase2::CSCTPConverter::convert(), PrimitiveConversion::convert_csc(), PrimitiveConversion::convert_dt(), PrimitiveConversion::convert_gem(), PrimitiveConversion::convert_me0(), and PrimitiveConversion::convert_rpc().

106  {
107  switch (tp.subsystem()) {
108  case L1TMuon::kDT:
109  return calcDTSpecificPoint(tp);
110  break;
111  case L1TMuon::kCSC:
112  return getCSCSpecificPoint(tp);
113  break;
114  case L1TMuon::kRPC:
115  return getRPCSpecificPoint(tp);
116  break;
117  case L1TMuon::kGEM:
118  return getGEMSpecificPoint(tp);
119  break;
120  case L1TMuon::kME0:
121  return getME0SpecificPoint(tp);
122  break;
123  default:
125  GlobalPoint::Polar(std::nan("Invalid TP type!"), std::nan("Invalid TP type!"), std::nan("Invalid TP type!")));
126  return ret;
127  break;
128  }
129 }
GlobalPoint getCSCSpecificPoint(const TriggerPrimitive &) const
ret
prodAgent to be discontinued
GlobalPoint getRPCSpecificPoint(const TriggerPrimitive &) const
GlobalPoint getGEMSpecificPoint(const TriggerPrimitive &) const
GlobalPoint getME0SpecificPoint(const TriggerPrimitive &) const
GlobalPoint calcDTSpecificPoint(const TriggerPrimitive &) const

◆ getMagneticField()

const MagneticField& L1TMuon::GeometryTranslator::getMagneticField ( ) const
inline

Definition at line 63 of file GeometryTranslator.h.

References _magfield.

63 { return *_magfield; }
edm::ESHandle< MagneticField > _magfield

◆ getME0Geometry()

const ME0Geometry& L1TMuon::GeometryTranslator::getME0Geometry ( ) const
inline

Definition at line 61 of file GeometryTranslator.h.

References _geome0.

61 { return *_geome0; }
edm::ESHandle< ME0Geometry > _geome0

◆ getME0SpecificPoint()

GlobalPoint GeometryTranslator::getME0SpecificPoint ( const TriggerPrimitive tp) const
private

Definition at line 153 of file GeometryTranslator.cc.

References _geogem, _geome0, ME0Geometry::chamber(), relativeConstraints::chamber, ME0Layer::etaPartition(), GEMChamber::etaPartition(), Exception, MuonSubdetId::GEM, l1ctLayer2EG_cff::id, l1ctLayer1_patternWriters_cff::partition, nano_mu_digi_cff::roll, DetId::subdetId(), GEMGeometry::superChamber(), and cmsswSequenceInfo::tp.

Referenced by calcME0SpecificEta(), calcME0SpecificPhi(), and getGlobalPoint().

153  {
154  if (tp.detId<DetId>().subdetId() == MuonSubdetId::GEM) { // GE0
155  const GEMDetId id(tp.detId<GEMDetId>());
157  const GEMChamber* keylayer = chamber->chamber(3); // GEM key layer is layer 3
158  int partition = tp.getME0Data().partition; // 'partition' is in half-roll unit
159  int iroll = (partition >> 1) + 1;
160  const GEMEtaPartition* roll = keylayer->etaPartition(iroll);
161 
162  // failed to get ME0 roll
163  if (roll == nullptr) {
164  throw cms::Exception("Invalid GE0 Roll") << "Failed to get GEM roll for GE0" << std::endl;
165  }
166 
167  // See L1Trigger/ME0Trigger/src/ME0TriggerPseudoBuilder.cc
168  int phiposition = tp.getME0Data().phiposition; // 'phiposition' is in half-strip unit
169  int istrip = (phiposition >> 1);
170  int phiposition2 = (phiposition & 0x1);
171  float centreOfStrip = istrip + 0.25 + phiposition2 * 0.5;
172  const LocalPoint& lp = roll->centreOfStrip(centreOfStrip);
173  const GlobalPoint& gp = roll->surface().toGlobal(lp);
174  return gp;
175  } else { // ME0
176  const ME0DetId id(tp.detId<ME0DetId>());
177  const ME0Chamber* chamber = _geome0->chamber(id);
178  const ME0Layer* keylayer = chamber->layer(3); // ME0 key layer is layer 3
179  int partition = tp.getME0Data().partition; // 'partition' is in half-roll unit
180  int iroll = (partition >> 1) + 1;
181  const ME0EtaPartition* roll = keylayer->etaPartition(iroll);
182 
183  // failed to get ME0 roll
184  if (roll == nullptr) {
185  throw cms::Exception("Invalid ME0 Roll") << "Failed to get ME0 roll" << std::endl;
186  }
187 
188  // See L1Trigger/ME0Trigger/src/ME0TriggerPseudoBuilder.cc
189  int phiposition = tp.getME0Data().phiposition; // 'phiposition' is in half-strip unit
190  int istrip = (phiposition >> 1);
191  int phiposition2 = (phiposition & 0x1);
192  float centreOfStrip = istrip + 0.25 + phiposition2 * 0.5;
193  const LocalPoint& lp = roll->centreOfStrip(centreOfStrip);
194  const GlobalPoint& gp = roll->surface().toGlobal(lp);
195  return gp;
196  }
197 }
static constexpr int GEM
Definition: MuonSubdetId.h:14
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return the eta partition corresponding to the given id.
Definition: GEMChamber.cc:33
edm::ESHandle< GEMGeometry > _geogem
edm::ESHandle< ME0Geometry > _geome0
const ME0Chamber * chamber(ME0DetId id) const
Return a chamber given its id.
Definition: ME0Geometry.cc:43
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
const GEMSuperChamber * superChamber(GEMDetId id) const
Definition: GEMGeometry.cc:69
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return the eta partition corresponding to the given id.
Definition: ME0Layer.cc:27

◆ getRPCGeometry()

const RPCGeometry& L1TMuon::GeometryTranslator::getRPCGeometry ( ) const
inline

◆ getRPCSpecificPoint()

GlobalPoint GeometryTranslator::getRPCSpecificPoint ( const TriggerPrimitive tp) const
private

Definition at line 237 of file GeometryTranslator.cc.

References _georpc, cms::cuda::assert(), l1ctLayer2EG_cff::id, nano_mu_digi_cff::roll, RPCGeometry::roll(), nano_mu_digi_cff::strip, and cmsswSequenceInfo::tp.

Referenced by calcRPCSpecificEta(), calcRPCSpecificPhi(), and getGlobalPoint().

237  {
238  const RPCDetId id(tp.detId<RPCDetId>());
239  const RPCRoll* roll = _georpc->roll(id);
240  assert(roll != nullptr); // failed to get RPC roll
241  //const int strip = static_cast<int>(tp.getRPCData().strip);
242  // Use half-strip precision, - 0.5 at the end to get the center of the strip (strip starts from 1)
243  const float strip = (0.5 * static_cast<float>(tp.getRPCData().strip_low + tp.getRPCData().strip_hi)) - 0.5f;
244  const LocalPoint& lp = roll->centreOfStrip(strip);
245  const GlobalPoint& gp = roll->surface().toGlobal(lp);
246  return gp;
247 }
edm::ESHandle< RPCGeometry > _georpc
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
assert(be >=bs)

◆ isCSCCounterClockwise()

bool GeometryTranslator::isCSCCounterClockwise ( const std::unique_ptr< const CSCLayer > &  layer) const
private

Definition at line 333 of file GeometryTranslator.cc.

References funct::abs(), M_PI, and me0TriggerPseudoDigis_cff::nStrips.

Referenced by getCSCSpecificPoint().

333  {
334  const int nStrips = layer->geometry()->numberOfStrips();
335  const double phi1 = layer->centerOfStrip(1).phi();
336  const double phiN = layer->centerOfStrip(nStrips).phi();
337  return ((std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) || (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN));
338 }
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI

Member Data Documentation

◆ _geocsc

edm::ESHandle<CSCGeometry> L1TMuon::GeometryTranslator::_geocsc
private

◆ _geodt

edm::ESHandle<DTGeometry> L1TMuon::GeometryTranslator::_geodt
private

Definition at line 67 of file GeometryTranslator.h.

Referenced by calcDTSpecificPoint(), checkAndUpdateGeometry(), and getDTGeometry().

◆ _geogem

edm::ESHandle<GEMGeometry> L1TMuon::GeometryTranslator::_geogem
private

◆ _geom_cache_id

unsigned long long L1TMuon::GeometryTranslator::_geom_cache_id
private

Definition at line 66 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

◆ _geome0

edm::ESHandle<ME0Geometry> L1TMuon::GeometryTranslator::_geome0
private

◆ _georpc

edm::ESHandle<RPCGeometry> L1TMuon::GeometryTranslator::_georpc
private

◆ _magfield

edm::ESHandle<MagneticField> L1TMuon::GeometryTranslator::_magfield
private

Definition at line 80 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry(), and getMagneticField().

◆ _magfield_cache_id

unsigned long long L1TMuon::GeometryTranslator::_magfield_cache_id
private

Definition at line 79 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

◆ geocscToken_

edm::ESGetToken<CSCGeometry, MuonGeometryRecord> L1TMuon::GeometryTranslator::geocscToken_
private

Definition at line 74 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

◆ geodtToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> L1TMuon::GeometryTranslator::geodtToken_
private

Definition at line 73 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

◆ geogemToken_

edm::ESGetToken<GEMGeometry, MuonGeometryRecord> L1TMuon::GeometryTranslator::geogemToken_
private

Definition at line 76 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

◆ geome0Token_

edm::ESGetToken<ME0Geometry, MuonGeometryRecord> L1TMuon::GeometryTranslator::geome0Token_
private

Definition at line 77 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

◆ georpcToken_

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> L1TMuon::GeometryTranslator::georpcToken_
private

Definition at line 75 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

◆ magfieldToken_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> L1TMuon::GeometryTranslator::magfieldToken_
private

Definition at line 81 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().