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
AngleConverter Class Reference

#include <AngleConverter.h>

Public Member Functions

 AngleConverter ()
 
void checkAndUpdateGeometry (const edm::EventSetup &, unsigned int)
 Update the Geometry with current Event Setup. More...
 
int getGlobalEta (unsigned int rawid, const L1MuDTChambPhDigi &aDigi, const L1MuDTChambThContainer *dtThDigis)
 Convert local eta coordinate to global digital microGMT scale. More...
 
int getGlobalEta (unsigned int rawid, const CSCCorrelatedLCTDigi &aDigi)
 Convert local eta coordinate to global digital microGMT scale. More...
 
int getGlobalEta (unsigned int rawid, const unsigned int &aDigi)
 Convert local eta coordinate to global digital microGMT scale. More...
 
int getProcessorPhi (unsigned int iProcessor, l1t::tftype part, const L1MuDTChambPhDigi &digi) const
 
int getProcessorPhi (unsigned int iProcessor, l1t::tftype part, const CSCDetId &csc, const CSCCorrelatedLCTDigi &digi) const
 
int getProcessorPhi (unsigned int iProcessor, l1t::tftype part, const RPCDetId &rollId, const unsigned int &digi) const
 
int getProcessorPhi (unsigned int iProcessor, l1t::tftype part, const RPCDetId &rollId, const unsigned int &digi1, const unsigned int &digi2) const
 
 ~AngleConverter ()
 

Private Member Functions

const int findBTIgroup (const L1MuDTChambPhDigi &aDigi, const L1MuDTChambThContainer *dtThDigis)
 Find BTI group. More...
 
bool isCSCCounterClockwise (const std::unique_ptr< const CSCLayer > &layer) const
 Check orientation of strips in given CSC chamber. More...
 

Private Attributes

edm::ESHandle< CSCGeometry_geocsc
 
edm::ESHandle< DTGeometry_geodt
 
unsigned long long _geom_cache_id
 
edm::ESHandle< RPCGeometry_georpc
 
unsigned int nPhiBins
 Number of phi bins along 2Pi. More...
 

Detailed Description

Definition at line 27 of file AngleConverter.h.

Constructor & Destructor Documentation

AngleConverter::AngleConverter ( )

Definition at line 152 of file AngleConverter.cc.

152 : _geom_cache_id(0ULL) {}
unsigned long long _geom_cache_id
AngleConverter::~AngleConverter ( )

Definition at line 155 of file AngleConverter.cc.

155 {}

Member Function Documentation

void AngleConverter::checkAndUpdateGeometry ( const edm::EventSetup es,
unsigned int  phiBins 
)

Update the Geometry with current Event Setup.

Definition at line 158 of file AngleConverter.cc.

References _geocsc, _geodt, _geom_cache_id, _georpc, edm::eventsetup::EventSetupRecord::cacheIdentifier(), relativeConstraints::geom, edm::EventSetup::get(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::get(), and nPhiBins.

Referenced by OMTFinputMaker::initialize().

158  {
160  unsigned long long geomid = geom.cacheIdentifier();
161  if (_geom_cache_id != geomid) {
162  geom.get(_georpc);
163  geom.get(_geocsc);
164  geom.get(_geodt);
165  _geom_cache_id = geomid;
166  }
167 
168  nPhiBins = phiBins;
169 }
unsigned long long cacheIdentifier() const
unsigned long long _geom_cache_id
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
unsigned int nPhiBins
Number of phi bins along 2Pi.
T get() const
Definition: EventSetup.h:73
edm::ESHandle< CSCGeometry > _geocsc
edm::ESHandle< RPCGeometry > _georpc
edm::ESHandle< DTGeometry > _geodt
const int AngleConverter::findBTIgroup ( const L1MuDTChambPhDigi aDigi,
const L1MuDTChambThContainer dtThDigis 
)
private

Find BTI group.

If there are more than one theta digi we do not take is due to unresolvet ambiguity. In this case we take eta of the middle of the chamber.

Definition at line 509 of file AngleConverter.cc.

References L1MuDTChambPhDigi::bxNum(), L1MuDTChambThContainer::chThetaSegm(), mps_fire::i, L1MuDTChambThDigi::position(), L1MuDTChambPhDigi::scNum(), L1MuDTChambPhDigi::stNum(), and L1MuDTChambPhDigi::whNum().

509  {
510  int bti_group = -1;
511 
512  const L1MuDTChambThDigi *theta_segm =
513  dtThDigis->chThetaSegm(aDigi.whNum(), aDigi.stNum(), aDigi.scNum(), aDigi.bxNum());
514  if (!theta_segm)
515  return bti_group;
516 
517  for (unsigned int i = 0; i < 7; ++i) {
518  if (theta_segm->position(i) && bti_group < 0)
519  bti_group = i;
523  else if (theta_segm->position(i) && bti_group > -1)
524  return -1;
525  }
526 
527  return bti_group;
528 }
int position(const int i) const
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
int AngleConverter::getGlobalEta ( unsigned int  rawid,
const L1MuDTChambPhDigi aDigi,
const L1MuDTChambThContainer dtThDigis 
)

Convert local eta coordinate to global digital microGMT scale.

Definition at line 355 of file AngleConverter.cc.

References _geodt, L1MuDTChambPhDigi::bxNum(), DTGeometry::chamber(), L1MuDTChambThContainer::chThetaSegm(), PV3DBase< T, PVType, FrameType >::eta(), mps_fire::i, L1MuDTChambThDigi::position(), L1MuDTChambPhDigi::scNum(), FWPFMaths::sgn(), L1MuDTChambPhDigi::stNum(), and L1MuDTChambPhDigi::whNum().

Referenced by OMTFinputMaker::processCSC(), OMTFinputMaker::processDT(), and OMTFinputMaker::processRPC().

357  {
358  const DTChamberId baseid(aDigi.whNum(), aDigi.stNum(), aDigi.scNum() + 1);
359 
360  // do not use this pointer for anything other than creating a trig geom
361  std::unique_ptr<DTChamber> chamb(const_cast<DTChamber *>(_geodt->chamber(baseid)));
362 
363  std::unique_ptr<DTTrigGeom> trig_geom(new DTTrigGeom(chamb.get(), false));
364  chamb.release(); // release it here so no one gets funny ideas
365  // super layer one is the theta superlayer in a DT chamber
366  // station 4 does not have a theta super layer
367  // the BTI index from the theta trigger is an OR of some BTI outputs
368  // so, we choose the BTI that's in the middle of the group
369  // as the BTI that we get theta from
370  // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign
371  const int NBTI_theta = ((baseid.station() != 4) ? trig_geom->nCell(2) : trig_geom->nCell(3));
372 
373  // const int bti_group = findBTIgroup(aDigi,dtThDigis);
374  // const unsigned bti_actual = bti_group*NBTI_theta/7 + NBTI_theta/14 + 1;
375  // DTBtiId thetaBTI;
376  // if ( baseid.station() != 4 && bti_group != -1) {
377  // thetaBTI = DTBtiId(baseid,2,bti_actual);
378  // } else {
379  // // since this is phi oriented it'll give us theta in the middle
380  // // of the chamber
381  // thetaBTI = DTBtiId(baseid,3,1);
382  // }
383  // const GlobalPoint theta_gp = trig_geom->CMSPosition(thetaBTI);
384  // int iEta = theta_gp.eta()/2.61*240;
385  // return iEta;
386 
387  const L1MuDTChambThDigi *theta_segm =
388  dtThDigis->chThetaSegm(aDigi.whNum(), aDigi.stNum(), aDigi.scNum(), aDigi.bxNum());
389  int bti_group = -1;
390  if (theta_segm) {
391  for (unsigned int i = 0; i < 7; ++i)
392  if (theta_segm->position(i) && bti_group < 0)
393  bti_group = i;
394  else if (theta_segm->position(i) && bti_group > -1)
395  bti_group = 511;
396  }
397 
398  int iEta = 0;
399  if (bti_group == 511)
400  iEta = 95;
401  else if (bti_group == -1 && aDigi.stNum() == 1)
402  iEta = 92;
403  else if (bti_group == -1 && aDigi.stNum() == 2)
404  iEta = 79;
405  else if (bti_group == -1 && aDigi.stNum() == 3)
406  iEta = 75;
407  else if (baseid.station() != 4 && bti_group >= 0) {
408  // bti_group = 6-bti_group;
409  unsigned bti_actual = bti_group * NBTI_theta / 7 + NBTI_theta / 14 + 1;
410  DTBtiId thetaBTI = DTBtiId(baseid, 2, bti_actual);
411  GlobalPoint theta_gp = trig_geom->CMSPosition(thetaBTI);
412  iEta = etaVal2Code(fabs(theta_gp.eta()));
413  }
414  int signEta = sgn(aDigi.whNum());
415  iEta *= signEta;
416  return iEta;
417 }
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
float sgn(float val)
Definition: FWPFMaths.cc:9
int position(const int i) const
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
T eta() const
Definition: PV3DBase.h:73
edm::ESHandle< DTGeometry > _geodt
int AngleConverter::getGlobalEta ( unsigned int  rawid,
const CSCCorrelatedLCTDigi aDigi 
)

Convert local eta coordinate to global digital microGMT scale.

Code taken from GeometryTranslator. Will be replaced by direct CSC phi local to global scale transformation as used in FPGA implementation

Definition at line 421 of file AngleConverter.cc.

References _geocsc, CSCGeometry::chamber(), CSCPatternLUT::get2007Position(), CSCCorrelatedLCTDigi::getKeyWG(), CSCCorrelatedLCTDigi::getPattern(), CSCCorrelatedLCTDigi::getStrip(), triggerObjects_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(), digitizers_cfi::strip, PV3DBase< T, PVType, FrameType >::theta(), and Geom::Phi< T1, Range >::value().

421  {
425 
426  // alot of this is transcription and consolidation of the CSC
427  // global phi calculation code
428  // this works directly with the geometry
429  // rather than using the old phi luts
430  const CSCDetId id(rawid);
431  // we should change this to weak_ptrs at some point
432  // requires introducing std::shared_ptrs to geometry
433  std::unique_ptr<const CSCChamber> chamb(_geocsc->chamber(id));
434  std::unique_ptr<const CSCLayerGeometry> layer_geom(chamb->layer(CSCConstants::KEY_ALCT_LAYER)->geometry());
435  std::unique_ptr<const CSCLayer> layer(chamb->layer(CSCConstants::KEY_ALCT_LAYER));
436 
437  const uint16_t halfstrip = aDigi.getStrip();
438  const uint16_t pattern = aDigi.getPattern();
439  const uint16_t keyWG = aDigi.getKeyWG();
440  //const unsigned maxStrips = layer_geom->numberOfStrips();
441 
442  // so we can extend this later
443  // assume TMB2007 half-strips only as baseline
444  double offset = 0.0;
445  switch (1) {
446  case 1:
447  offset = CSCPatternLUT::get2007Position(pattern);
448  }
449  const unsigned halfstrip_offs = unsigned(0.5 + halfstrip + offset);
450  const unsigned strip = halfstrip_offs / 2 + 1; // geom starts from 1
451 
452  // the rough location of the hit at the ALCT key layer
453  // we will refine this using the half strip information
454  const LocalPoint coarse_lp = layer_geom->stripWireGroupIntersection(strip, keyWG);
455  const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp);
456 
457  // the strip width/4.0 gives the offset of the half-strip
458  // center with respect to the strip center
459  const double hs_offset = layer_geom->stripPhiPitch() / 4.0;
460 
461  // determine handedness of the chamber
462  const bool ccw = isCSCCounterClockwise(layer);
463  // we need to subtract the offset of even half strips and add the odd ones
464  const double phi_offset = ((halfstrip_offs % 2 ? 1 : -1) * (ccw ? -hs_offset : hs_offset));
465 
466  // the global eta calculation uses the middle of the strip
467  // so no need to increment it
468  const GlobalPoint final_gp(
469  GlobalPoint::Polar(coarse_gp.theta(), (coarse_gp.phi().value() + phi_offset), coarse_gp.mag()));
470  // release ownership of the pointers
471  chamb.release();
472  layer_geom.release();
473  layer.release();
474 
475  // std::cout <<id<<" st: " << id.station()<< "ri: "<<id.ring()<<" eta: " << final_gp.eta()
476  // <<" etaCode_simple: " << etaVal2Code( final_gp.eta() )<< " KW: "<<keyWG <<" etaKeyWG2Code: "<<etaKeyWG2Code(id,keyWG)<< std::endl;
477  // int station = (id.endcap()==1) ? id.station() : -id.station();
478  // std::cout <<"ETA_CSC: " << station <<" "<<id.ring()<<" "<< final_gp.eta()<<" "<<keyWG <<" "<< etaKeyWG2Code(id,keyWG) << std::endl;
479 
480  return etaKeyWG2Code(id, keyWG);
481 
482  // return etaVal2Code( final_gp.eta() );
483  // int iEta = final_gp.eta()/2.61*240;
484  // return iEta;
485 }
int getStrip() const
return the key halfstrip from 0,159
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T1 value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:75
Geom::Theta< T > theta() const
Definition: PV3DBase.h:72
T mag() const
Definition: PV3DBase.h:64
bool isCSCCounterClockwise(const std::unique_ptr< const CSCLayer > &layer) const
Check orientation of strips in given CSC chamber.
static double get2007Position(int pattern)
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
int getPattern() const
return pattern
edm::ESHandle< CSCGeometry > _geocsc
int getKeyWG() const
return the key wire group. counts from 0.
int AngleConverter::getGlobalEta ( unsigned int  rawid,
const unsigned int &  aDigi 
)

Convert local eta coordinate to global digital microGMT scale.

Definition at line 488 of file AngleConverter.cc.

References _georpc, PV3DBase< T, PVType, FrameType >::eta(), runTauDisplay::gp, triggerObjects_cff::id, and RPCGeometry::roll().

488  {
489  const RPCDetId id(rawid);
490  std::unique_ptr<const RPCRoll> roll(_georpc->roll(id));
491  const LocalPoint lp = roll->centreOfStrip((int)strip);
492  const GlobalPoint gp = roll->toGlobal(lp);
493  roll.release();
494 
495  return etaVal2Code(gp.eta());
496  // float iEta = gp.eta()/2.61*240;
497  // return iEta;
498 }
T eta() const
Definition: PV3DBase.h:73
edm::ESHandle< RPCGeometry > _georpc
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
int AngleConverter::getProcessorPhi ( unsigned int  iProcessor,
l1t::tftype  part,
const L1MuDTChambPhDigi digi 
) const

get phi of DT,CSC and RPC azimutal angle digi in processor scale, used by OMTF algorithm. in case of wrong phi returns OMTFConfiguration::instance()->nPhiBins

Definition at line 172 of file AngleConverter.cc.

References M_PI, nPhiBins, l1t::omtf_pos, phi, L1MuDTChambPhDigi::phi(), funct::pow(), Scenarios_cff::scale, L1MuDTChambPhDigi::scNum(), relativeConstraints::station, L1MuDTChambPhDigi::stNum(), makeMuonMisalignmentScenario::wheel, and L1MuDTChambPhDigi::whNum().

Referenced by OMTFinputMaker::processCSC(), OMTFinputMaker::processDT(), and OMTFinputMaker::processRPC().

172  {
173  double hsPhiPitch = 2 * M_PI / nPhiBins; // width of phi Pitch, related to halfStrip at CSC station 2
174  const int dummy = nPhiBins;
175  int processor = iProcessor + 1; // FIXME: get from OMTF name when available
176  int posneg = (part == l1t::tftype::omtf_pos) ? 1 : -1; // FIXME: get from OMTF name
177 
178  int sector =
179  digi.scNum() + 1; //NOTE: there is a inconsistency in DT sector numb. Thus +1 needed to get detector numb.
180  int wheel = digi.whNum();
181  int station = digi.stNum();
182  int phiDT = digi.phi();
183 
184  if (posneg * 2 != wheel)
185  return dummy;
186  if (station > 3)
187  return dummy;
188 
189  //FIXME: update the following two lines with proper method when Connections introduced
190  if (processor != 6 && !(sector >= processor * 2 - 1 && sector <= processor * 2 + 1))
191  return dummy;
192  if (processor == 6 && !(sector >= 11 || sector == 1))
193  return dummy;
194 
195  // ichamber is consecutive chamber connected to processor, starting from 0 (overlaping one)
196  int ichamber = sector - 1 - 2 * (processor - 1);
197  if (ichamber < 0)
198  ichamber += 12;
199 
200  int offsetLoc = lround(((ichamber - 1) * M_PI / 6 + M_PI / 12.) / hsPhiPitch);
201  double scale = 1. / 4096 / hsPhiPitch;
202  int scale_coeff = lround(scale * pow(2, 11));
203  // int phi = static_cast<int>(phiDT*scale) + offsetLoc;
204  int phi = floor(phiDT * scale_coeff / pow(2, 11)) + offsetLoc;
205 
206  return phi;
207 }
#define M_PI
unsigned int nPhiBins
Number of phi bins along 2Pi.
part
Definition: HCALResponse.h:20
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
int AngleConverter::getProcessorPhi ( unsigned int  iProcessor,
l1t::tftype  part,
const CSCDetId csc,
const CSCCorrelatedLCTDigi digi 
) const

Definition at line 210 of file AngleConverter.cc.

References _geocsc, CSCLayer::centerOfStrip(), relativeConstraints::chamber, CSCDetId::chamber(), CSCGeometry::chamber(), CSCCorrelatedLCTDigi::getStrip(), CSCChamber::layer(), M_PI, nPhiBins, l1t::omtf_pos, eventshapeDQM_cfi::order, phi, PV3DBase< T, PVType, FrameType >::phi(), CSCDetId::ring(), Scenarios_cff::scale, CSCChamber::specs(), CSCDetId::station(), CSCChamberSpecs::stripPhiPitch(), and CSCDetId::zendcap().

213  {
214  const double hsPhiPitch = 2 * M_PI / nPhiBins;
215  const int dummy = nPhiBins;
216  int processor = iProcessor + 1; // FIXME: get from OMTF name when available
217  int posneg = (part == l1t::tftype::omtf_pos) ? 1 : -1; // FIXME: get from OMTF name
218 
219  // filter out chambers not connected to OMTF board
220  // FIXME: temporary - use Connections or relay that filtering done before.
221  if (posneg != csc.zendcap())
222  return dummy;
223  if (csc.ring() != 3 && !(csc.ring() == 2 && (csc.station() == 2 || csc.station() == 3 || csc.station() == 1)))
224  return dummy;
225  if (processor != 6) {
226  if (csc.chamber() < (processor - 1) * 6 + 2)
227  return dummy;
228  if (csc.chamber() > (processor - 1) * 6 + 8)
229  return dummy;
230  } else {
231  if (csc.chamber() > 2 && csc.chamber() < 32)
232  return dummy;
233  }
234 
235  //
236  // assign number 0..6, consecutive processor for a processor
237  //
238  //int ichamber = (csc.chamber()-2-6*(processor-1));
239  //if (ichamber < 0) ichamber += 36;
240 
241  //
242  // get offset for each chamber.
243  // FIXME: These parameters depends on processor and chamber only so may be precomputed and put in map
244  //
245  const CSCChamber *chamber = _geocsc->chamber(csc);
246  const CSCChamberSpecs *cspec = chamber->specs();
247  const CSCLayer *layer = chamber->layer(3);
248  int order = (layer->centerOfStrip(2).phi() - layer->centerOfStrip(1).phi() > 0) ? 1 : -1;
249  double stripPhiPitch = cspec->stripPhiPitch();
250  double scale = fabs(stripPhiPitch / hsPhiPitch / 2.);
251  if (fabs(scale - 1.) < 0.0002)
252  scale = 1.;
253  double phi15deg = M_PI / 3. * (processor - 1) + M_PI / 12.;
254  double phiHalfStrip0 = layer->centerOfStrip(10).phi() - order * 9 * stripPhiPitch - order * stripPhiPitch / 4.;
255  if (processor == 6 || phiHalfStrip0 < 0)
256  phiHalfStrip0 += 2 * M_PI;
257  int offsetLoc = lround((phiHalfStrip0 - phi15deg) / hsPhiPitch);
258 
259  int halfStrip = digi.getStrip(); // returns halfStrip 0..159
260  //FIXME: to be checked (only important for ME1/3) keep more bits for offset, truncate at the end
261 
262  // a quick fix for towards geometry changes due to global tag.
263  // in case of MC tag fixOff shold be identical to offsetLoc
264  int fixOff = fixCscOffsetGeom(offsetLoc);
265 
266  int phi = fixOff + order * scale * halfStrip;
267 
268  // std::cout <<" hs: "<< halfStrip <<" offset: " << offsetLoc <<" oder*scale: "<< order*scale
269  // <<" phi: " <<phi<<" ("<<offsetLoc + order*scale*halfStrip<<")"<< std::endl;
270 
271  return phi;
272 }
int chamber() const
Definition: CSCDetId.h:62
int getStrip() const
return the key halfstrip from 0,159
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
float stripPhiPitch() const
const CSCChamberSpecs * specs() const
Definition: CSCChamber.h:39
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:30
#define M_PI
unsigned int nPhiBins
Number of phi bins along 2Pi.
int ring() const
Definition: CSCDetId.h:68
short int zendcap() const
Definition: CSCDetId.h:91
GlobalPoint centerOfStrip(int strip) const
Definition: CSCLayer.cc:4
part
Definition: HCALResponse.h:20
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
edm::ESHandle< CSCGeometry > _geocsc
int station() const
Definition: CSCDetId.h:79
int AngleConverter::getProcessorPhi ( unsigned int  iProcessor,
l1t::tftype  part,
const RPCDetId rollId,
const unsigned int &  digi 
) const

Definition at line 318 of file AngleConverter.cc.

References _georpc, RPCRoll::centreOfStrip(), M_PI, nPhiBins, RPCGeometry::roll(), and GeomDet::toGlobal().

321  {
322  const double hsPhiPitch = 2 * M_PI / nPhiBins;
323  const int dummy = nPhiBins;
324  int processor = iProcessor + 1;
325  const RPCRoll *roll = _georpc->roll(rollId);
326  if (!roll)
327  return dummy;
328 
329  double phi15deg =
330  M_PI / 3. * (processor - 1) + M_PI / 12.; // "0" is 15degree moved cyclicaly to each processor, note [0,2pi]
331  double stripPhi = (roll->toGlobal(roll->centreOfStrip((int)digi))).phi(); // note [-pi,pi]
332 
333  // adjust [0,2pi] and [-pi,pi] to get deltaPhi difference properly
334  switch (processor) {
335  case 1:
336  break;
337  case 6: {
338  phi15deg -= 2 * M_PI;
339  break;
340  }
341  default: {
342  if (stripPhi < 0)
343  stripPhi += 2 * M_PI;
344  break;
345  }
346  }
347 
348  // local angle in CSC halfStrip usnits
349  int halfStrip = lround((stripPhi - phi15deg) / hsPhiPitch);
350 
351  return halfStrip;
352 }
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
#define M_PI
unsigned int nPhiBins
Number of phi bins along 2Pi.
edm::ESHandle< RPCGeometry > _georpc
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
int AngleConverter::getProcessorPhi ( unsigned int  iProcessor,
l1t::tftype  part,
const RPCDetId rollId,
const unsigned int &  digi1,
const unsigned int &  digi2 
) const

Definition at line 276 of file AngleConverter.cc.

References _georpc, RPCRoll::centreOfStrip(), M_PI, nPhiBins, RPCGeometry::roll(), and GeomDet::toGlobal().

280  {
281  const double hsPhiPitch = 2 * M_PI / nPhiBins;
282  const int dummy = nPhiBins;
283  int processor = iProcessor + 1;
284  const RPCRoll *roll = _georpc->roll(rollId);
285  if (!roll)
286  return dummy;
287 
288  double phi15deg =
289  M_PI / 3. * (processor - 1) + M_PI / 12.; // "0" is 15degree moved cyclicaly to each processor, note [0,2pi]
290  double stripPhi1 = (roll->toGlobal(roll->centreOfStrip((int)digi1))).phi(); // note [-pi,pi]
291  double stripPhi2 = (roll->toGlobal(roll->centreOfStrip((int)digi2))).phi(); // note [-pi,pi]
292 
293  // stripPhi from geometry is given in [-pi,pi] range.
294  // Keep like that for OMTFp1 [15-10deg,75deg] and OMTFp6 [-45-10deg,15deg].
295  // For OMTFp2..OMTFp5 move to [0,2pi] range
296  switch (processor) {
297  case 1:
298  break;
299  case 6: {
300  phi15deg -= 2 * M_PI;
301  break;
302  }
303  default: {
304  if (stripPhi1 < 0)
305  stripPhi1 += 2 * M_PI;
306  if (stripPhi2 < 0)
307  stripPhi2 += 2 * M_PI;
308  break;
309  }
310  }
311 
312  // local angle in CSC halfStrip usnits
313  int halfStrip = lround(((stripPhi1 + stripPhi2) / 2. - phi15deg) / hsPhiPitch);
314 
315  return halfStrip;
316 }
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
#define M_PI
unsigned int nPhiBins
Number of phi bins along 2Pi.
edm::ESHandle< RPCGeometry > _georpc
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
bool AngleConverter::isCSCCounterClockwise ( const std::unique_ptr< const CSCLayer > &  layer) const
private

Check orientation of strips in given CSC chamber.

Definition at line 501 of file AngleConverter.cc.

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

Referenced by getGlobalEta().

501  {
502  const int nStrips = layer->geometry()->numberOfStrips();
503  const double phi1 = layer->centerOfStrip(1).phi();
504  const double phiN = layer->centerOfStrip(nStrips).phi();
505  return ((std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) || (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN));
506 }
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

edm::ESHandle<CSCGeometry> AngleConverter::_geocsc
private

Definition at line 68 of file AngleConverter.h.

Referenced by checkAndUpdateGeometry(), getGlobalEta(), and getProcessorPhi().

edm::ESHandle<DTGeometry> AngleConverter::_geodt
private

Definition at line 69 of file AngleConverter.h.

Referenced by checkAndUpdateGeometry(), and getGlobalEta().

unsigned long long AngleConverter::_geom_cache_id
private

Definition at line 66 of file AngleConverter.h.

Referenced by checkAndUpdateGeometry().

edm::ESHandle<RPCGeometry> AngleConverter::_georpc
private

Definition at line 67 of file AngleConverter.h.

Referenced by checkAndUpdateGeometry(), getGlobalEta(), and getProcessorPhi().

unsigned int AngleConverter::nPhiBins
private

Number of phi bins along 2Pi.

Definition at line 72 of file AngleConverter.h.

Referenced by checkAndUpdateGeometry(), and getProcessorPhi().