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
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 ()
 
 ~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 calcRPCSpecificBend (const TriggerPrimitive &) const
 
double calcRPCSpecificEta (const TriggerPrimitive &) const
 
double calcRPCSpecificPhi (const TriggerPrimitive &) const
 
GlobalPoint getCSCSpecificPoint (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
 
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 TriggerPrimitive tp) const
private

Definition at line 201 of file GeometryTranslator.cc.

Referenced by calculateBendAngle().

201  {
202  return 0.0;
203 }
double GeometryTranslator::calcCSCSpecificEta ( const TriggerPrimitive 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 TriggerPrimitive &) const
T eta() const
Definition: PV3DBase.h:76
double GeometryTranslator::calcCSCSpecificPhi ( const TriggerPrimitive 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 TriggerPrimitive &) const
double GeometryTranslator::calcDTSpecificBend ( const TriggerPrimitive tp) const
private

Definition at line 255 of file GeometryTranslator.cc.

References L1TMuon::TriggerPrimitive::DTData::bendingAngle, and L1TMuon::TriggerPrimitive::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 TriggerPrimitive 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 }
GlobalPoint calcDTSpecificPoint(const TriggerPrimitive &) const
T eta() const
Definition: PV3DBase.h:76
double GeometryTranslator::calcDTSpecificPhi ( const TriggerPrimitive 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 TriggerPrimitive &) const
GlobalPoint GeometryTranslator::calcDTSpecificPoint ( const TriggerPrimitive tp) const
private

Definition at line 206 of file GeometryTranslator.cc.

References _geodt, L1TMuon::TriggerPrimitive::detId(), L1TMuon::TriggerPrimitive::getDTData(), M_PI, PV3DBase< T, PVType, FrameType >::mag(), phi(), L1TMuon::TriggerPrimitive::DTData::radialAngle, L1TMuon::TriggerPrimitive::DTData::sector, DTChamberId::station(), PV3DBase< T, PVType, FrameType >::theta(), and L1TMuon::TriggerPrimitive::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 }
edm::ESHandle< DTGeometry > _geodt
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
#define M_PI
double GeometryTranslator::calcRPCSpecificBend ( const TriggerPrimitive tp) const
private

Definition at line 118 of file GeometryTranslator.cc.

Referenced by calculateBendAngle().

118  {
119  return 0.0;
120 }
double GeometryTranslator::calcRPCSpecificEta ( const TriggerPrimitive 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 TriggerPrimitive &) const
T eta() const
Definition: PV3DBase.h:76
double GeometryTranslator::calcRPCSpecificPhi ( const TriggerPrimitive 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 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
GlobalPoint getRPCSpecificPoint(const TriggerPrimitive &) const
double GeometryTranslator::calculateBendAngle ( const TriggerPrimitive tp) const

Definition at line 64 of file GeometryTranslator.cc.

References calcCSCSpecificBend(), calcDTSpecificBend(), calcRPCSpecificBend(), L1TMuon::TriggerPrimitive::kCSC, L1TMuon::TriggerPrimitive::kDT, L1TMuon::TriggerPrimitive::kRPC, and L1TMuon::TriggerPrimitive::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 }
const subsystem_type subsystem() const
double calcRPCSpecificBend(const TriggerPrimitive &) const
double calcDTSpecificBend(const TriggerPrimitive &) const
double calcCSCSpecificBend(const TriggerPrimitive &) const
double GeometryTranslator::calculateGlobalEta ( const TriggerPrimitive tp) const

Definition at line 28 of file GeometryTranslator.cc.

References calcCSCSpecificEta(), calcDTSpecificEta(), calcRPCSpecificEta(), L1TMuon::TriggerPrimitive::kCSC, L1TMuon::TriggerPrimitive::kDT, L1TMuon::TriggerPrimitive::kRPC, and L1TMuon::TriggerPrimitive::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 }
const subsystem_type subsystem() const
double calcDTSpecificEta(const TriggerPrimitive &) const
double calcCSCSpecificEta(const TriggerPrimitive &) const
double calcRPCSpecificEta(const TriggerPrimitive &) const
double GeometryTranslator::calculateGlobalPhi ( const TriggerPrimitive tp) const

Definition at line 46 of file GeometryTranslator.cc.

References calcCSCSpecificPhi(), calcDTSpecificPhi(), calcRPCSpecificPhi(), L1TMuon::TriggerPrimitive::kCSC, L1TMuon::TriggerPrimitive::kDT, L1TMuon::TriggerPrimitive::kRPC, and L1TMuon::TriggerPrimitive::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 }
const subsystem_type subsystem() const
double calcRPCSpecificPhi(const TriggerPrimitive &) const
double calcCSCSpecificPhi(const TriggerPrimitive &) const
double calcDTSpecificPhi(const TriggerPrimitive &) 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
edm::ESHandle< DTGeometry > _geodt
unsigned long long _geom_cache_id
edm::ESHandle< RPCGeometry > _georpc
edm::ESHandle< CSCGeometry > _geocsc
void get(HolderT &iHolder) const
const T & get() const
Definition: EventSetup.h:56
GlobalPoint GeometryTranslator::getCSCSpecificPoint ( const TriggerPrimitive tp) const
private

Definition at line 128 of file GeometryTranslator.cc.

References _geocsc, L1TMuon::TriggerPrimitive::detId(), CSCPatternLUT::get2007Position(), L1TMuon::TriggerPrimitive::getCSCData(), isCSCCounterClockwise(), CSCConstants::KEY_ALCT_LAYER, L1TMuon::TriggerPrimitive::CSCData::keywire, PV3DBase< T, PVType, FrameType >::mag(), hltrates_dqm_sourceclient-live_cfg::offset, listBenchmarks::pattern, L1TMuon::TriggerPrimitive::CSCData::pattern, PV3DBase< T, PVType, FrameType >::phi(), L1TMuon::TriggerPrimitive::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
const CSCData getCSCData() const
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
T mag() const
Definition: PV3DBase.h:67
edm::ESHandle< CSCGeometry > _geocsc
T value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:38
static double get2007Position(int pattern)
bool isCSCCounterClockwise(const std::unique_ptr< const CSCLayer > &) const
GlobalPoint GeometryTranslator::getRPCSpecificPoint ( const TriggerPrimitive tp) const
private

Definition at line 93 of file GeometryTranslator.cc.

References _georpc, RPCRoll::centreOfStrip(), L1TMuon::TriggerPrimitive::detId(), L1TMuon::TriggerPrimitive::getRPCData(), L1TMuon::TriggerPrimitive::RPCData::strip, and GeomDet::toGlobal().

Referenced by calcRPCSpecificEta(), and calcRPCSpecificPhi().

93  {
94  const RPCDetId id(tp.detId<RPCDetId>());
95  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 }
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
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> L1TMuon::GeometryTranslator::_geocsc
private

Definition at line 51 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry(), and getCSCSpecificPoint().

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

Definition at line 52 of file GeometryTranslator.h.

Referenced by calcDTSpecificPoint(), and checkAndUpdateGeometry().

unsigned long long L1TMuon::GeometryTranslator::_geom_cache_id
private

Definition at line 49 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry().

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

Definition at line 50 of file GeometryTranslator.h.

Referenced by checkAndUpdateGeometry(), and getRPCSpecificPoint().