test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1t::GeometryTranslator Class Reference

#include <GeometryTranslator.h>

Public Member Functions

double calculateBendAngle (const MuonTriggerPrimitive &) const
 
double calculateGlobalEta (const MuonTriggerPrimitive &) const
 
double calculateGlobalPhi (const MuonTriggerPrimitive &) const
 
void checkAndUpdateGeometry (const edm::EventSetup &)
 
 GeometryTranslator ()
 
 ~GeometryTranslator ()
 

Private Member Functions

double calcCSCSpecificBend (const MuonTriggerPrimitive &) const
 
double calcCSCSpecificEta (const MuonTriggerPrimitive &) const
 
double calcCSCSpecificPhi (const MuonTriggerPrimitive &) const
 
double calcDTSpecificBend (const MuonTriggerPrimitive &) const
 
double calcDTSpecificEta (const MuonTriggerPrimitive &) const
 
double calcDTSpecificPhi (const MuonTriggerPrimitive &) const
 
GlobalPoint calcDTSpecificPoint (const MuonTriggerPrimitive &) const
 
double calcRPCSpecificBend (const MuonTriggerPrimitive &) const
 
double calcRPCSpecificEta (const MuonTriggerPrimitive &) const
 
double calcRPCSpecificPhi (const MuonTriggerPrimitive &) const
 
GlobalPoint getCSCSpecificPoint (const MuonTriggerPrimitive &) const
 
GlobalPoint getRPCSpecificPoint (const MuonTriggerPrimitive &) const
 
bool isCSCCounterClockwise (const std::unique_ptr< const CSCLayer > &) const
 

Private Attributes

edm::ESHandle< CSCGeometry_geocsc
 
edm::ESHandle< DTGeometry_geodt
 
unsigned long long _geom_cache_id
 
edm::ESHandle< RPCGeometry_georpc
 

Detailed Description

Definition at line 36 of file GeometryTranslator.h.

Constructor & Destructor Documentation

GeometryTranslator::GeometryTranslator ( )

Definition at line 20 of file GeometryTranslator.cc.

20  :
21  _geom_cache_id(0ULL) {
22 }
unsigned long long _geom_cache_id
GeometryTranslator::~GeometryTranslator ( )

Definition at line 24 of file GeometryTranslator.cc.

24  {
25 }

Member Function Documentation

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

Definition at line 201 of file GeometryTranslator.cc.

Referenced by calculateBendAngle().

201  {
202  return 0.0;
203 }
double GeometryTranslator::calcCSCSpecificEta ( const MuonTriggerPrimitive tp) const
private

Definition at line 191 of file GeometryTranslator.cc.

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

Referenced by calculateGlobalEta().

191  {
192  return getCSCSpecificPoint(tp).eta();
193 }
GlobalPoint getCSCSpecificPoint(const MuonTriggerPrimitive &) const
T eta() const
Definition: PV3DBase.h:76
double GeometryTranslator::calcCSCSpecificPhi ( const MuonTriggerPrimitive tp) const
private

Definition at line 196 of file GeometryTranslator.cc.

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

Referenced by calculateGlobalPhi().

196  {
197  return getCSCSpecificPoint(tp).phi();
198 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint getCSCSpecificPoint(const MuonTriggerPrimitive &) const
double GeometryTranslator::calcDTSpecificBend ( const MuonTriggerPrimitive tp) const
private

Definition at line 255 of file GeometryTranslator.cc.

References l1t::MuonTriggerPrimitive::DTData::bendingAngle, and l1t::MuonTriggerPrimitive::getDTData().

Referenced by calculateBendAngle().

255  {
256  int bend = tp.getDTData().bendingAngle;
257  double bendf = bend/512.0;
258  return bendf;
259 }
const DTData getDTData() const
double GeometryTranslator::calcDTSpecificEta ( const MuonTriggerPrimitive tp) const
private

Definition at line 244 of file GeometryTranslator.cc.

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

Referenced by calculateGlobalEta().

244  {
245  return calcDTSpecificPoint(tp).eta();
246 }
T eta() const
Definition: PV3DBase.h:76
GlobalPoint calcDTSpecificPoint(const MuonTriggerPrimitive &) const
double GeometryTranslator::calcDTSpecificPhi ( const MuonTriggerPrimitive tp) const
private

Definition at line 249 of file GeometryTranslator.cc.

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

Referenced by calculateGlobalPhi().

249  {
250  return calcDTSpecificPoint(tp).phi();
251 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint calcDTSpecificPoint(const MuonTriggerPrimitive &) const
GlobalPoint GeometryTranslator::calcDTSpecificPoint ( const MuonTriggerPrimitive tp) const
private

Definition at line 206 of file GeometryTranslator.cc.

References _geodt, l1t::MuonTriggerPrimitive::detId(), l1t::MuonTriggerPrimitive::getDTData(), M_PI, PV3DBase< T, PVType, FrameType >::mag(), phi(), l1t::MuonTriggerPrimitive::DTData::radialAngle, l1t::MuonTriggerPrimitive::DTData::sector, DTChamberId::station(), PV3DBase< T, PVType, FrameType >::theta(), and l1t::MuonTriggerPrimitive::DTData::theta_bti_group.

Referenced by calcDTSpecificEta(), and calcDTSpecificPhi().

206  {
207  const DTChamberId baseid(tp.detId<DTChamberId>());
208  // do not use this pointer for anything other than creating a trig geom
209  std::unique_ptr<DTChamber> chamb(
210  const_cast<DTChamber*>(_geodt->chamber(baseid))
211  );
212  std::unique_ptr<DTTrigGeom> trig_geom( new DTTrigGeom(chamb.get(),false) );
213  chamb.release(); // release it here so no one gets funny ideas
214  // super layer one is the theta superlayer in a DT chamber
215  // station 4 does not have a theta super layer
216  // the BTI index from the theta trigger is an OR of some BTI outputs
217  // so, we choose the BTI that's in the middle of the group
218  // as the BTI that we get theta from
219  // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign
220  const int NBTI_theta = ( (baseid.station() != 4) ?
221  trig_geom->nCell(2) : trig_geom->nCell(3) );
222  const int bti_group = tp.getDTData().theta_bti_group;
223  const unsigned bti_actual = bti_group*NBTI_theta/7 + NBTI_theta/14 + 1;
224  DTBtiId thetaBTI;
225  if ( baseid.station() != 4 && bti_group != -1) {
226  thetaBTI = DTBtiId(baseid,2,bti_actual);
227  } else {
228  // since this is phi oriented it'll give us theta in the middle
229  // of the chamber
230  thetaBTI = DTBtiId(baseid,3,1);
231  }
232  const GlobalPoint theta_gp = trig_geom->CMSPosition(thetaBTI);
233 
234  // local phi in sector -> global phi
235  double phi = ((double)tp.getDTData().radialAngle)/4096.0;
236  phi += tp.getDTData().sector*M_PI/6.0; // add sector offset
237 
238  return GlobalPoint( GlobalPoint::Polar( theta_gp.theta(),
239  phi,
240  theta_gp.mag() ) );
241 }
const DTData getDTData() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T mag() const
Definition: PV3DBase.h:67
edm::ESHandle< DTGeometry > _geodt
#define M_PI
double GeometryTranslator::calcRPCSpecificBend ( const MuonTriggerPrimitive tp) const
private

Definition at line 118 of file GeometryTranslator.cc.

Referenced by calculateBendAngle().

118  {
119  return 0.0;
120 }
double GeometryTranslator::calcRPCSpecificEta ( const MuonTriggerPrimitive tp) const
private

Definition at line 106 of file GeometryTranslator.cc.

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

Referenced by calculateGlobalEta().

106  {
107  return getRPCSpecificPoint(tp).eta();
108 }
GlobalPoint getRPCSpecificPoint(const MuonTriggerPrimitive &) const
T eta() const
Definition: PV3DBase.h:76
double GeometryTranslator::calcRPCSpecificPhi ( const MuonTriggerPrimitive tp) const
private

Definition at line 111 of file GeometryTranslator.cc.

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

Referenced by calculateGlobalPhi().

111  {
112  return getRPCSpecificPoint(tp).phi();
113 }
GlobalPoint getRPCSpecificPoint(const MuonTriggerPrimitive &) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
double GeometryTranslator::calculateBendAngle ( const MuonTriggerPrimitive tp) const

Definition at line 64 of file GeometryTranslator.cc.

References calcCSCSpecificBend(), calcDTSpecificBend(), calcRPCSpecificBend(), l1t::MuonTriggerPrimitive::kCSC, l1t::MuonTriggerPrimitive::kDT, l1t::MuonTriggerPrimitive::kRPC, and l1t::MuonTriggerPrimitive::subsystem().

64  {
65  switch(tp.subsystem()) {
67  return calcDTSpecificBend(tp);
68  break;
70  return calcCSCSpecificBend(tp);
71  break;
73  return calcRPCSpecificBend(tp);
74  break;
75  default:
76  return std::nan("Invalid TP type!");
77  break;
78  }
79 }
double calcCSCSpecificBend(const MuonTriggerPrimitive &) const
double calcDTSpecificBend(const MuonTriggerPrimitive &) const
const subsystem_type subsystem() const
double calcRPCSpecificBend(const MuonTriggerPrimitive &) const
double GeometryTranslator::calculateGlobalEta ( const MuonTriggerPrimitive tp) const

Definition at line 28 of file GeometryTranslator.cc.

References calcCSCSpecificEta(), calcDTSpecificEta(), calcRPCSpecificEta(), l1t::MuonTriggerPrimitive::kCSC, l1t::MuonTriggerPrimitive::kDT, l1t::MuonTriggerPrimitive::kRPC, and l1t::MuonTriggerPrimitive::subsystem().

28  {
29  switch(tp.subsystem()) {
31  return calcDTSpecificEta(tp);
32  break;
34  return calcCSCSpecificEta(tp);
35  break;
37  return calcRPCSpecificEta(tp);
38  break;
39  default:
40  return std::nan("Invalid TP type!");
41  break;
42  }
43 }
double calcCSCSpecificEta(const MuonTriggerPrimitive &) const
double calcRPCSpecificEta(const MuonTriggerPrimitive &) const
const subsystem_type subsystem() const
double calcDTSpecificEta(const MuonTriggerPrimitive &) const
double GeometryTranslator::calculateGlobalPhi ( const MuonTriggerPrimitive tp) const

Definition at line 46 of file GeometryTranslator.cc.

References calcCSCSpecificPhi(), calcDTSpecificPhi(), calcRPCSpecificPhi(), l1t::MuonTriggerPrimitive::kCSC, l1t::MuonTriggerPrimitive::kDT, l1t::MuonTriggerPrimitive::kRPC, and l1t::MuonTriggerPrimitive::subsystem().

46  {
47  switch(tp.subsystem()) {
49  return calcDTSpecificPhi(tp);
50  break;
52  return calcCSCSpecificPhi(tp);
53  break;
55  return calcRPCSpecificPhi(tp);
56  break;
57  default:
58  return std::nan("Invalid TP type!");
59  break;
60  }
61 }
double calcDTSpecificPhi(const MuonTriggerPrimitive &) const
double calcCSCSpecificPhi(const MuonTriggerPrimitive &) const
double calcRPCSpecificPhi(const MuonTriggerPrimitive &) const
const subsystem_type subsystem() const
void GeometryTranslator::checkAndUpdateGeometry ( const edm::EventSetup es)

Definition at line 81 of file GeometryTranslator.cc.

References _geocsc, _geodt, _geom_cache_id, _georpc, edm::eventsetup::EventSetupRecord::cacheIdentifier(), relativeConstraints::geom, edm::EventSetup::get(), and edm::eventsetup::EventSetupRecord::get().

81  {
83  unsigned long long geomid = geom.cacheIdentifier();
84  if( _geom_cache_id != geomid ) {
85  geom.get(_georpc);
86  geom.get(_geocsc);
87  geom.get(_geodt);
88  _geom_cache_id = geomid;
89  }
90 }
unsigned long long cacheIdentifier() const
unsigned long long _geom_cache_id
edm::ESHandle< RPCGeometry > _georpc
void get(HolderT &iHolder) const
edm::ESHandle< DTGeometry > _geodt
edm::ESHandle< CSCGeometry > _geocsc
const T & get() const
Definition: EventSetup.h:56
GlobalPoint GeometryTranslator::getCSCSpecificPoint ( const MuonTriggerPrimitive tp) const
private

Definition at line 128 of file GeometryTranslator.cc.

References _geocsc, l1t::MuonTriggerPrimitive::detId(), CSCPatternLUT::get2007Position(), l1t::MuonTriggerPrimitive::getCSCData(), isCSCCounterClockwise(), CSCConstants::KEY_ALCT_LAYER, l1t::MuonTriggerPrimitive::CSCData::keywire, PV3DBase< T, PVType, FrameType >::mag(), hltrates_dqm_sourceclient-live_cfg::offset, listBenchmarks::pattern, l1t::MuonTriggerPrimitive::CSCData::pattern, PV3DBase< T, PVType, FrameType >::phi(), l1t::MuonTriggerPrimitive::CSCData::strip, PV3DBase< T, PVType, FrameType >::theta(), and Geom::Phi< T >::value().

Referenced by calcCSCSpecificEta(), and calcCSCSpecificPhi().

128  {
129  const CSCDetId id(tp.detId<CSCDetId>());
130  // we should change this to weak_ptrs at some point
131  // requires introducing std::shared_ptrs to geometry
132  std::unique_ptr<const CSCChamber> chamb(_geocsc->chamber(id));
133  std::unique_ptr<const CSCLayerGeometry> layer_geom(
134  chamb->layer(CSCConstants::KEY_ALCT_LAYER)->geometry()
135  );
136  std::unique_ptr<const CSCLayer> layer(
137  chamb->layer(CSCConstants::KEY_ALCT_LAYER)
138  );
139 
140  const uint16_t halfstrip = tp.getCSCData().strip;
141  const uint16_t pattern = tp.getCSCData().pattern;
142  const uint16_t keyWG = tp.getCSCData().keywire;
143  //const unsigned maxStrips = layer_geom->numberOfStrips();
144 
145  // so we can extend this later
146  // assume TMB2007 half-strips only as baseline
147  double offset = 0.0;
148  switch(1) {
149  case 1:
150  offset = CSCPatternLUT::get2007Position(pattern);
151  }
152  const unsigned halfstrip_offs = unsigned(0.5 + halfstrip + offset);
153  const unsigned strip = halfstrip_offs/2 + 1; // geom starts from 1
154 
155  // the rough location of the hit at the ALCT key layer
156  // we will refine this using the half strip information
157  const LocalPoint coarse_lp =
158  layer_geom->stripWireGroupIntersection(strip,keyWG);
159  const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp);
160 
161  // the strip width/4.0 gives the offset of the half-strip
162  // center with respect to the strip center
163  const double hs_offset = layer_geom->stripPhiPitch()/4.0;
164 
165  // determine handedness of the chamber
166  const bool ccw = isCSCCounterClockwise(layer);
167  // we need to subtract the offset of even half strips and add the odd ones
168  const double phi_offset = ( ( halfstrip_offs%2 ? 1 : -1)*
169  ( ccw ? -hs_offset : hs_offset ) );
170 
171  // the global eta calculation uses the middle of the strip
172  // so no need to increment it
173  const GlobalPoint final_gp( GlobalPoint::Polar( coarse_gp.theta(),
174  (coarse_gp.phi().value() +
175  phi_offset),
176  coarse_gp.mag() ) );
177 
178  // We need to add in some notion of the 'error' on trigger primitives
179  // like the width of the wire group by the width of the strip
180  // or something similar
181 
182  // release ownership of the pointers
183  chamb.release();
184  layer_geom.release();
185  layer.release();
186 
187  return final_gp;
188 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T mag() const
Definition: PV3DBase.h:67
T value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:38
edm::ESHandle< CSCGeometry > _geocsc
static double get2007Position(int pattern)
const CSCData getCSCData() const
bool isCSCCounterClockwise(const std::unique_ptr< const CSCLayer > &) const
GlobalPoint GeometryTranslator::getRPCSpecificPoint ( const MuonTriggerPrimitive tp) const
private

Definition at line 93 of file GeometryTranslator.cc.

References _georpc, l1t::MuonTriggerPrimitive::detId(), l1t::MuonTriggerPrimitive::getRPCData(), and l1t::MuonTriggerPrimitive::RPCData::strip.

Referenced by calcRPCSpecificEta(), and calcRPCSpecificPhi().

93  {
94  const RPCDetId id(tp.detId<RPCDetId>());
95  std::unique_ptr<const RPCRoll> roll(_georpc->roll(id));
96  const uint16_t strip = tp.getRPCData().strip;
97  const LocalPoint lp = roll->centreOfStrip(strip);
98  const GlobalPoint gp = roll->toGlobal(lp);
99 
100  roll.release();
101 
102  return gp;
103 }
edm::ESHandle< RPCGeometry > _georpc
const RPCData getRPCData() const
bool GeometryTranslator::isCSCCounterClockwise ( const std::unique_ptr< const CSCLayer > &  layer) const
private

Definition at line 262 of file GeometryTranslator.cc.

References funct::abs(), and M_PI.

Referenced by getCSCSpecificPoint().

262  {
263  const int nStrips = layer->geometry()->numberOfStrips();
264  const double phi1 = layer->centerOfStrip(1).phi();
265  const double phiN = layer->centerOfStrip(nStrips).phi();
266  return ( (std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) ||
267  (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN) );
268 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI

Member Data Documentation

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

Definition at line 51 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry(), and getCSCSpecificPoint().

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

Definition at line 52 of file GeometryTranslator.h.

Referenced by calcDTSpecificPoint(), and checkAndUpdateGeometry().

unsigned long long l1t::GeometryTranslator::_geom_cache_id
private

Definition at line 49 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

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

Definition at line 50 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry(), and getRPCSpecificPoint().