CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
AngleConverter Class Reference

#include <AngleConverter.h>

Public Member Functions

 AngleConverter (edm::ConsumesCollector &, bool getDuringEvent=true)
 
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

CSCGeometry const * _geocsc
 
DTGeometry const * _geodt
 
unsigned long long _geom_cache_id
 
RPCGeometry const * _georpc
 
edm::ESGetToken< CSCGeometry, MuonGeometryRecordcscGeometryToken_
 
edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeometryToken_
 
unsigned int nPhiBins
 Number of phi bins along 2Pi. More...
 
edm::ESGetToken< RPCGeometry, MuonGeometryRecordrpcGeometryToken_
 

Detailed Description

Definition at line 26 of file AngleConverter.h.

Constructor & Destructor Documentation

◆ AngleConverter()

AngleConverter::AngleConverter ( edm::ConsumesCollector iC,
bool  getDuringEvent = true 
)

Definition at line 151 of file AngleConverter.cc.

References edm::BeginRun, cscGeometryToken_, dtGeometryToken_, edm::ConsumesCollector::esConsumes(), and rpcGeometryToken_.

151  : _geom_cache_id(0ULL) {
152  if (getDuringEvent) {
156  } else {
160  }
161 }
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeometryToken_
unsigned long long _geom_cache_id
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeometryToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeometryToken_

◆ ~AngleConverter()

AngleConverter::~AngleConverter ( )

Definition at line 164 of file AngleConverter.cc.

164 {}

Member Function Documentation

◆ checkAndUpdateGeometry()

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

Update the Geometry with current Event Setup.

Definition at line 167 of file AngleConverter.cc.

References _geocsc, _geodt, _geom_cache_id, _georpc, cscGeometryToken_, dtGeometryToken_, relativeConstraints::geom, edm::EventSetup::get(), nPhiBins, L1TrackJetEmulationProducer_cfi::phiBins, and rpcGeometryToken_.

167  {
169  unsigned long long geomid = geom.cacheIdentifier();
170  if (_geom_cache_id != geomid) {
173  _geodt = &geom.get(dtGeometryToken_);
174  _geom_cache_id = geomid;
175  }
176 
177  nPhiBins = phiBins;
178 }
CSCGeometry const * _geocsc
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeometryToken_
unsigned long long _geom_cache_id
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeometryToken_
DTGeometry const * _geodt
T get() const
Definition: EventSetup.h:82
RPCGeometry const * _georpc
unsigned int nPhiBins
Number of phi bins along 2Pi.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeometryToken_

◆ findBTIgroup()

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 518 of file AngleConverter.cc.

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

518  {
519  int bti_group = -1;
520 
521  const L1MuDTChambThDigi *theta_segm =
522  dtThDigis->chThetaSegm(aDigi.whNum(), aDigi.stNum(), aDigi.scNum(), aDigi.bxNum());
523  if (!theta_segm)
524  return bti_group;
525 
526  for (unsigned int i = 0; i < 7; ++i) {
527  if (theta_segm->position(i) && bti_group < 0)
528  bti_group = i;
532  else if (theta_segm->position(i) && bti_group > -1)
533  return -1;
534  }
535 
536  return bti_group;
537 }
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
int position(const int i) const

◆ getGlobalEta() [1/3]

int AngleConverter::getGlobalEta ( unsigned int  rawid,
const L1MuDTChambPhDigi aDigi,
const L1MuDTChambThContainer dtThDigis 
)

Convert local eta coordinate to global digital microGMT scale.

Definition at line 364 of file AngleConverter.cc.

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

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

◆ getGlobalEta() [2/3]

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 430 of file AngleConverter.cc.

References _geocsc, CSCGeometry::chamber(), CSCCorrelatedLCTDigi::getKeyWG(), CSCPatternBank::getLegacyPosition(), CSCCorrelatedLCTDigi::getPattern(), CSCCorrelatedLCTDigi::getStrip(), triggerObjects_cff::id, isCSCCounterClockwise(), CSCConstants::KEY_ALCT_LAYER, phase1PixelTopology::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().

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

◆ getGlobalEta() [3/3]

int AngleConverter::getGlobalEta ( unsigned int  rawid,
const unsigned int &  aDigi 
)

Convert local eta coordinate to global digital microGMT scale.

Definition at line 497 of file AngleConverter.cc.

References _georpc, runTauDisplay::gp, triggerObjects_cff::id, RPCGeometry::roll(), and digitizers_cfi::strip.

497  {
498  const RPCDetId id(rawid);
499  std::unique_ptr<const RPCRoll> roll(_georpc->roll(id));
500  const LocalPoint lp = roll->centreOfStrip((int)strip);
501  const GlobalPoint gp = roll->toGlobal(lp);
502  roll.release();
503 
504  return etaVal2Code(gp.eta());
505  // float iEta = gp.eta()/2.61*240;
506  // return iEta;
507 }
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
RPCGeometry const * _georpc

◆ getProcessorPhi() [1/4]

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 181 of file AngleConverter.cc.

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

181  {
182  double hsPhiPitch = 2 * M_PI / nPhiBins; // width of phi Pitch, related to halfStrip at CSC station 2
183  const int dummy = nPhiBins;
184  int processor = iProcessor + 1; // FIXME: get from OMTF name when available
185  int posneg = (part == l1t::tftype::omtf_pos) ? 1 : -1; // FIXME: get from OMTF name
186 
187  int sector =
188  digi.scNum() + 1; //NOTE: there is a inconsistency in DT sector numb. Thus +1 needed to get detector numb.
189  int wheel = digi.whNum();
190  int station = digi.stNum();
191  int phiDT = digi.phi();
192 
193  if (posneg * 2 != wheel)
194  return dummy;
195  if (station > 3)
196  return dummy;
197 
198  //FIXME: update the following two lines with proper method when Connections introduced
199  if (processor != 6 && !(sector >= processor * 2 - 1 && sector <= processor * 2 + 1))
200  return dummy;
201  if (processor == 6 && !(sector >= 11 || sector == 1))
202  return dummy;
203 
204  // ichamber is consecutive chamber connected to processor, starting from 0 (overlaping one)
205  int ichamber = sector - 1 - 2 * (processor - 1);
206  if (ichamber < 0)
207  ichamber += 12;
208 
209  int offsetLoc = lround(((ichamber - 1) * M_PI / 6 + M_PI / 12.) / hsPhiPitch);
210  double scale = 1. / 4096 / hsPhiPitch;
211  int scale_coeff = lround(scale * pow(2, 11));
212  // int phi = static_cast<int>(phiDT*scale) + offsetLoc;
213  int phi = floor(phiDT * scale_coeff / pow(2, 11)) + offsetLoc;
214 
215  return phi;
216 }
#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:29

◆ getProcessorPhi() [2/4]

int AngleConverter::getProcessorPhi ( unsigned int  iProcessor,
l1t::tftype  part,
const CSCDetId csc,
const CSCCorrelatedLCTDigi digi 
) const

Definition at line 219 of file AngleConverter.cc.

References _geocsc, relativeConstraints::chamber, CSCGeometry::chamber(), CSCCorrelatedLCTDigi::getStrip(), phase1PixelTopology::layer, M_PI, nPhiBins, l1t::omtf_pos, eventshapeDQM_cfi::order, phi, L1EGammaClusterEmuProducer_cfi::scale, and CSCChamberSpecs::stripPhiPitch().

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

◆ getProcessorPhi() [3/4]

int AngleConverter::getProcessorPhi ( unsigned int  iProcessor,
l1t::tftype  part,
const RPCDetId rollId,
const unsigned int &  digi 
) const

Definition at line 327 of file AngleConverter.cc.

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

330  {
331  const double hsPhiPitch = 2 * M_PI / nPhiBins;
332  const int dummy = nPhiBins;
333  int processor = iProcessor + 1;
334  const RPCRoll *roll = _georpc->roll(rollId);
335  if (!roll)
336  return dummy;
337 
338  double phi15deg =
339  M_PI / 3. * (processor - 1) + M_PI / 12.; // "0" is 15degree moved cyclicaly to each processor, note [0,2pi]
340  double stripPhi = (roll->toGlobal(roll->centreOfStrip((int)digi))).phi(); // note [-pi,pi]
341 
342  // adjust [0,2pi] and [-pi,pi] to get deltaPhi difference properly
343  switch (processor) {
344  case 1:
345  break;
346  case 6: {
347  phi15deg -= 2 * M_PI;
348  break;
349  }
350  default: {
351  if (stripPhi < 0)
352  stripPhi += 2 * M_PI;
353  break;
354  }
355  }
356 
357  // local angle in CSC halfStrip usnits
358  int halfStrip = lround((stripPhi - phi15deg) / hsPhiPitch);
359 
360  return halfStrip;
361 }
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
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
RPCGeometry const * _georpc
unsigned int nPhiBins
Number of phi bins along 2Pi.
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26

◆ getProcessorPhi() [4/4]

int AngleConverter::getProcessorPhi ( unsigned int  iProcessor,
l1t::tftype  part,
const RPCDetId rollId,
const unsigned int &  digi1,
const unsigned int &  digi2 
) const

Definition at line 285 of file AngleConverter.cc.

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

289  {
290  const double hsPhiPitch = 2 * M_PI / nPhiBins;
291  const int dummy = nPhiBins;
292  int processor = iProcessor + 1;
293  const RPCRoll *roll = _georpc->roll(rollId);
294  if (!roll)
295  return dummy;
296 
297  double phi15deg =
298  M_PI / 3. * (processor - 1) + M_PI / 12.; // "0" is 15degree moved cyclicaly to each processor, note [0,2pi]
299  double stripPhi1 = (roll->toGlobal(roll->centreOfStrip((int)digi1))).phi(); // note [-pi,pi]
300  double stripPhi2 = (roll->toGlobal(roll->centreOfStrip((int)digi2))).phi(); // note [-pi,pi]
301 
302  // stripPhi from geometry is given in [-pi,pi] range.
303  // Keep like that for OMTFp1 [15-10deg,75deg] and OMTFp6 [-45-10deg,15deg].
304  // For OMTFp2..OMTFp5 move to [0,2pi] range
305  switch (processor) {
306  case 1:
307  break;
308  case 6: {
309  phi15deg -= 2 * M_PI;
310  break;
311  }
312  default: {
313  if (stripPhi1 < 0)
314  stripPhi1 += 2 * M_PI;
315  if (stripPhi2 < 0)
316  stripPhi2 += 2 * M_PI;
317  break;
318  }
319  }
320 
321  // local angle in CSC halfStrip usnits
322  int halfStrip = lround(((stripPhi1 + stripPhi2) / 2. - phi15deg) / hsPhiPitch);
323 
324  return halfStrip;
325 }
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
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
RPCGeometry const * _georpc
unsigned int nPhiBins
Number of phi bins along 2Pi.
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26

◆ isCSCCounterClockwise()

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

Check orientation of strips in given CSC chamber.

Definition at line 510 of file AngleConverter.cc.

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

Referenced by getGlobalEta().

510  {
511  const int nStrips = layer->geometry()->numberOfStrips();
512  const double phi1 = layer->centerOfStrip(1).phi();
513  const double phiN = layer->centerOfStrip(nStrips).phi();
514  return ((std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) || (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN));
515 }
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
constexpr std::array< uint8_t, layerIndexSize > layer
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI

Member Data Documentation

◆ _geocsc

CSCGeometry const* AngleConverter::_geocsc
private

Definition at line 71 of file AngleConverter.h.

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

◆ _geodt

DTGeometry const* AngleConverter::_geodt
private

Definition at line 72 of file AngleConverter.h.

Referenced by checkAndUpdateGeometry(), and getGlobalEta().

◆ _geom_cache_id

unsigned long long AngleConverter::_geom_cache_id
private

Definition at line 69 of file AngleConverter.h.

Referenced by checkAndUpdateGeometry().

◆ _georpc

RPCGeometry const* AngleConverter::_georpc
private

Definition at line 70 of file AngleConverter.h.

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

◆ cscGeometryToken_

edm::ESGetToken<CSCGeometry, MuonGeometryRecord> AngleConverter::cscGeometryToken_
private

Definition at line 65 of file AngleConverter.h.

Referenced by AngleConverter(), and checkAndUpdateGeometry().

◆ dtGeometryToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> AngleConverter::dtGeometryToken_
private

Definition at line 66 of file AngleConverter.h.

Referenced by AngleConverter(), and checkAndUpdateGeometry().

◆ nPhiBins

unsigned int AngleConverter::nPhiBins
private

Number of phi bins along 2Pi.

Definition at line 75 of file AngleConverter.h.

Referenced by checkAndUpdateGeometry(), and getProcessorPhi().

◆ rpcGeometryToken_

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> AngleConverter::rpcGeometryToken_
private

Definition at line 64 of file AngleConverter.h.

Referenced by AngleConverter(), and checkAndUpdateGeometry().