CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
AngleConverterBase Class Reference

#include <AngleConverterBase.h>

Inheritance diagram for AngleConverterBase:
OmtfAngleConverter

Public Member Functions

 AngleConverterBase ()
 
virtual void checkAndUpdateGeometry (const edm::EventSetup &, const ProcConfigurationBase *config, const MuonGeometryTokens &muonGeometryTokens)
 Update the Geometry with current Event Setup. More...
 
float cscChamberEtaSize (const CSCDetId &id) const
 
virtual void getGlobalEta (const L1MuDTChambThDigi &thetaDigi, std::vector< EtaValue > &etaSegments) const
 
virtual std::vector< EtaValuegetGlobalEta (const L1MuDTChambThContainer *dtThDigis, int bxFrom, int bxTo) const
 
virtual EtaValue getGlobalEta (const CSCDetId &detId, const CSCCorrelatedLCTDigi &aDigi) const
 Convert local eta coordinate to global digital microGMT scale. More...
 
virtual EtaValue getGlobalEta (unsigned int rawid, const unsigned int &aDigi) const
 
virtual EtaValue getGlobalEtaCsc (const CSCDetId &detId) const
 returns the eta position of the CSC chamber More...
 
virtual EtaValue getGlobalEtaDt (const DTChamberId &detId) const
 
virtual int getProcessorPhi (int phiZero, l1t::tftype part, int dtScNum, int dtPhi) const
 
virtual int getProcessorPhi (int phiZero, l1t::tftype part, const CSCDetId &csc, const CSCCorrelatedLCTDigi &digi) const
 
virtual int getProcessorPhi (unsigned int iProcessor, l1t::tftype part, const RPCDetId &rollId, const unsigned int &digi) const
 
virtual int getProcessorPhi (int phiZero, l1t::tftype part, const RPCDetId &rollId, const unsigned int &digi1, const unsigned int &digi2) const
 
virtual ~AngleConverterBase ()
 

Protected Member Functions

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

Protected Attributes

edm::ESHandle< CSCGeometry_geocsc
 
edm::ESHandle< DTGeometry_geodt
 
unsigned long long _geom_cache_id = 0
 
edm::ESHandle< RPCGeometry_georpc
 
const ProcConfigurationBaseconfig = nullptr
 
edm::ESWatcher< MuonGeometryRecordmuonGeometryRecordWatcher
 
unsigned int nPhiBins = 0
 Number of phi bins along 2Pi. More...
 

Detailed Description

Definition at line 49 of file AngleConverterBase.h.

Constructor & Destructor Documentation

◆ AngleConverterBase()

AngleConverterBase::AngleConverterBase ( )

Definition at line 41 of file AngleConverterBase.cc.

41 : _geom_cache_id(0ULL) {}
unsigned long long _geom_cache_id

◆ ~AngleConverterBase()

AngleConverterBase::~AngleConverterBase ( )
virtual

Definition at line 44 of file AngleConverterBase.cc.

44 {}

Member Function Documentation

◆ checkAndUpdateGeometry()

void AngleConverterBase::checkAndUpdateGeometry ( const edm::EventSetup es,
const ProcConfigurationBase config,
const MuonGeometryTokens muonGeometryTokens 
)
virtual

Update the Geometry with current Event Setup.

Definition at line 47 of file AngleConverterBase.cc.

References _geocsc, _geodt, _georpc, edm::ESWatcher< T >::check(), config, MuonGeometryTokens::cscGeometryEsToken, MuonGeometryTokens::dtGeometryEsToken, edm::EventSetup::getHandle(), muonGeometryRecordWatcher, nPhiBins, and MuonGeometryTokens::rpcGeometryEsToken.

49  {
51  _georpc = es.getHandle(muonGeometryTokens.rpcGeometryEsToken);
52  _geocsc = es.getHandle(muonGeometryTokens.cscGeometryEsToken);
53  _geodt = es.getHandle(muonGeometryTokens.dtGeometryEsToken);
54  }
55  this->config = config;
56  nPhiBins = config->nPhiBins();
57 }
edm::ESHandle< DTGeometry > _geodt
const ProcConfigurationBase * config
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeometryEsToken
edm::ESHandle< RPCGeometry > _georpc
Definition: config.py:1
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeometryEsToken
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
unsigned int nPhiBins
Number of phi bins along 2Pi.
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeometryEsToken
edm::ESHandle< CSCGeometry > _geocsc
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::ESWatcher< MuonGeometryRecord > muonGeometryRecordWatcher

◆ cscChamberEtaSize()

float AngleConverterBase::cscChamberEtaSize ( const CSCDetId id) const

ME1/1 lower eta (b?, eta < ~2.1), L1TkMuonBayes eta bins 6-11 - but getGlobalEtaCsc(const CSCDetId& detId) gives the midle of the full chamber, so here we put the size of the full chamber

ME1/1 higher eta (a?, eta > ~2.1), L1TkMuonBayes eta bins 10-15

Definition at line 297 of file AngleConverterBase.cc.

References CSCDetId::ring(), and CSCDetId::station().

Referenced by getGlobalEtaCsc().

297  {
298  if (detId.station() == 1) {
299  if (detId.ring() == 1)
300  return (2.5 - 1.6) / 2.;
302  if (detId.ring() == 2)
303  return (1.7 - 1.2) / 2.;
304  if (detId.ring() == 3)
305  return (1.12 - 0.9) / 2.;
306  if (detId.ring() == 4)
307  return (2.5 - 1.6) / 2.;
308  } else if (detId.station() == 2) {
309  if (detId.ring() == 1)
310  return (2.5 - 1.6) / 2.;
311  if (detId.ring() == 2)
312  return (1.6 - 1.0) / 2.;
313  } else if (detId.station() == 3) {
314  if (detId.ring() == 1)
315  return (2.5 - 1.7) / 2.;
316  if (detId.ring() == 2)
317  return (1.7 - 1.1) / 2.;
318  } else if (detId.station() == 4) {
319  if (detId.ring() == 1)
320  return (2.45 - 1.8) / 2.;
321  if (detId.ring() == 2)
322  return (1.8 - 1.2) / 2.;
323  }
324  return 0;
325 }

◆ findBTIgroup()

const int AngleConverterBase::findBTIgroup ( const L1MuDTChambPhDigi aDigi,
const L1MuDTChambThContainer dtThDigis 
)
protectedvirtual

Find BTI group.

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

Definition at line 430 of file AngleConverterBase.cc.

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

430  {
431  int bti_group = -1;
432 
433  const L1MuDTChambThDigi* theta_segm =
434  dtThDigis->chThetaSegm(aDigi.whNum(), aDigi.stNum(), aDigi.scNum(), aDigi.bxNum());
435  if (!theta_segm)
436  return bti_group;
437 
438  for (unsigned int i = 0; i < 7; ++i) {
439  if (theta_segm->position(i) && bti_group < 0)
440  bti_group = i;
444  else if (theta_segm->position(i) && bti_group > -1)
445  return -1;
446  }
447 
448  return bti_group;
449 }
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
int position(const int i) const

◆ getGlobalEta() [1/4]

void AngleConverterBase::getGlobalEta ( const L1MuDTChambThDigi thetaDigi,
std::vector< EtaValue > &  etaSegments 
) const
virtual

Definition at line 250 of file AngleConverterBase.cc.

References _geodt, L1MuDTChambThDigi::bxNum(), DTGeometry::chamber(), PV3DBase< T, PVType, FrameType >::eta(), DTTrigGeom::nCell(), L1MuDTChambThDigi::position(), L1MuDTChambThDigi::quality(), L1MuDTChambThDigi::scNum(), L1MuDTChambThDigi::stNum(), and L1MuDTChambThDigi::whNum().

Referenced by getGlobalEta().

250  {
251  const DTChamberId baseid(thetaDigi.whNum(), thetaDigi.stNum(), thetaDigi.scNum() + 1);
252  DTTrigGeom trig_geom(_geodt->chamber(baseid), false);
253 
254  // super layer 2 is the theta superlayer in a DT chamber
255  // station 4 does not have a theta super layer
256  // the BTI index from the theta trigger is an OR of some BTI outputs
257  // so, we choose the BTI that's in the middle of the group
258  // as the BTI that we get theta from
259  // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign
260  const int NBTI_theta = trig_geom.nCell(2);
261  for (unsigned int btiGroup = 0; btiGroup < 7; ++btiGroup) {
262  if (thetaDigi.position(btiGroup)) {
263  unsigned btiActual = btiGroup * NBTI_theta / 7 + NBTI_theta / 14 + 1;
264  DTBtiId thetaBTI = DTBtiId(baseid, 2, btiActual);
265  GlobalPoint theta_gp = trig_geom.CMSPosition(thetaBTI);
266 
267  EtaValue etaValue = {
268  config->etaToHwEta(theta_gp.eta()),
269  0,
270  thetaDigi.quality(btiGroup),
271  thetaDigi.bxNum(),
272  0 //TODO what about sub-bx timing???
273  };
274  etaSegments.emplace_back(etaValue);
275 
276  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" bx "<<thetaDigi.bxNum()<<" baseid "<<baseid<<" btiGroup "<<btiGroup<<" quality "<<thetaDigi.quality(btiGroup)<<" theta_gp.eta() "<<theta_gp.eta()<<" eta "<<etaValue.eta<<" etaSigma "<<etaValue.etaSigma<<std::endl;
277  }
278  }
279 }
edm::ESHandle< DTGeometry > _geodt
T eta() const
Definition: PV3DBase.h:73
int position(const int i) const
Definition: config.py:1
int quality(const int i) const
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90
int nCell(int sl) const
Number of BTIs in a required superlayer (i.e. nCells in lay 1)
Definition: DTTrigGeom.h:88

◆ getGlobalEta() [2/4]

std::vector< EtaValue > AngleConverterBase::getGlobalEta ( const L1MuDTChambThContainer dtThDigis,
int  bxFrom,
int  bxTo 
) const
virtual

Definition at line 281 of file AngleConverterBase.cc.

References L1MuDTChambThContainer::getContainer(), and getGlobalEta().

283  {
284  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" dtThDigis size "<<dtThDigis->getContainer()->size()<<std::endl;
285 
286  std::vector<EtaValue> etaSegments;
287 
288  for (auto& thetaDigi : (*(dtThDigis->getContainer()))) {
289  if (thetaDigi.bxNum() >= bxFrom && thetaDigi.bxNum() <= bxTo) {
290  getGlobalEta(thetaDigi, etaSegments);
291  }
292  }
293  return etaSegments;
294 }
The_Container const * getContainer() const
virtual void getGlobalEta(const L1MuDTChambThDigi &thetaDigi, std::vector< EtaValue > &etaSegments) const

◆ getGlobalEta() [3/4]

EtaValue AngleConverterBase::getGlobalEta ( const CSCDetId detId,
const CSCCorrelatedLCTDigi aDigi 
) const
virtual

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 327 of file AngleConverterBase.cc.

References _geocsc, CSCGeometry::chamber(), PV3DBase< T, PVType, FrameType >::eta(), CSCLayer::geometry(), CSCCorrelatedLCTDigi::getBX(), CSCCorrelatedLCTDigi::getKeyWG(), CSCConstants::KEY_ALCT_LAYER, CSCChamber::layer(), and phase1PixelTopology::layer.

327  {
331 
332  // alot of this is transcription and consolidation of the CSC
333  // global phi calculation code
334  // this works directly with the geometry
335  // rather than using the old phi luts
336 
337  auto chamb = _geocsc->chamber(detId);
338  auto layer_geom = chamb->layer(CSCConstants::KEY_ALCT_LAYER)->geometry();
339  auto layer = chamb->layer(CSCConstants::KEY_ALCT_LAYER);
340 
341  const uint16_t keyWG = aDigi.getKeyWG();
342 
343  const LocalPoint lpWg = layer_geom->localCenterOfWireGroup(keyWG);
344  const GlobalPoint gpWg = layer->surface().toGlobal(lpWg);
345 
346  EtaValue etaSegment = {
347  config->etaToHwEta(gpWg.eta()),
348  0, //config->etaToHwEta(cscChamberEtaSize(id) ),
349  0,
350  aDigi.getBX(),
351  0 //tming???
352  };
353 
354  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" csc "<<detId<<" eta "<<gpWg.eta()<<" etaHw "<<etaSegment.eta<<" etaSigma "<<etaSegment.etaSigma<<std::endl;
355  return etaSegment;
356 }
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:30
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
T eta() const
Definition: PV3DBase.h:73
Definition: config.py:1
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
constexpr std::array< uint8_t, layerIndexSize > layer
uint16_t getBX() const
return BX
edm::ESHandle< CSCGeometry > _geocsc
uint16_t getKeyWG() const
return the key wire group. counts from 0.

◆ getGlobalEta() [4/4]

EtaValue AngleConverterBase::getGlobalEta ( unsigned int  rawid,
const unsigned int &  aDigi 
) const
virtual

Convert local eta coordinate to global digital microGMT scale. EtaValue::etaSigma is half of the strip

Definition at line 380 of file AngleConverterBase.cc.

References _georpc, funct::abs(), PV3DBase< T, PVType, FrameType >::eta(), runTauDisplay::gp, l1ctLayer2EG_cff::id, phase1PixelTopology::layer, HLT_2022v15_cff::region, relativeConstraints::ring, RPCGeometry::roll(), relativeConstraints::station, and digitizers_cfi::strip.

380  {
381  const RPCDetId id(rawid);
382 
383  auto roll = _georpc->roll(id);
384  const LocalPoint lp = roll->centreOfStrip((int)strip);
385  const GlobalPoint gp = roll->toGlobal(lp);
386 
387  int neighbRoll = 1; //neighbor roll in eta
388  //roll->chamber()->nrolls() does not work
389  if (id.region() == 0) { //barel
390  if (id.station() == 2 &&
391  ((abs(id.ring()) == 2 && id.layer() == 2) || (abs(id.ring()) != 2 && id.layer() == 1))) { //three-roll chamber
392  if (id.roll() == 2)
393  neighbRoll = 1;
394  else {
395  neighbRoll = 2;
396  }
397  } else //two-roll chamber
398  neighbRoll = (id.roll() == 1 ? 3 : 1);
399  } else { //endcap
400  neighbRoll = id.roll() + (id.roll() == 1 ? +1 : -1);
401  }
402 
403  const RPCDetId idNeigh =
404  RPCDetId(id.region(), id.ring(), id.station(), id.sector(), id.layer(), id.subsector(), neighbRoll);
405  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" rpc "<<id<<std::endl;
406  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" rpc "<<idNeigh<<std::endl;
407 
408  auto rollNeigh = _georpc->roll(idNeigh);
409  const LocalPoint lpNeigh = rollNeigh->centreOfStrip((int)strip);
410  const GlobalPoint gpNeigh = rollNeigh->toGlobal(lpNeigh);
411 
412  EtaValue etaValue = {config->etaToHwEta(gp.eta()),
413  config->etaToHwEta(abs(gp.eta() - gpNeigh.eta())) /
414  2, //half of the size of the strip in eta - not precise, but OK
415  0};
416 
417  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" rpc "<<id<<" eta "<<gp.eta()<<" etaHw "<<etaValue.eta<<" etaSigma "<<etaValue.etaSigma<<std::endl;
418  return etaValue;
419 }
edm::ESHandle< RPCGeometry > _georpc
T eta() const
Definition: PV3DBase.h:73
Definition: config.py:1
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
constexpr std::array< uint8_t, layerIndexSize > layer
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ getGlobalEtaCsc()

EtaValue AngleConverterBase::getGlobalEtaCsc ( const CSCDetId detId) const
virtual

returns the eta position of the CSC chamber

Definition at line 360 of file AngleConverterBase.cc.

References _geocsc, CSCGeometry::chamber(), cscChamberEtaSize(), and PV3DBase< T, PVType, FrameType >::eta().

360  {
361  auto chamb = _geocsc->chamber(detId);
362 
363  Local2DPoint chamberMiddleLP(0, 0);
364  GlobalPoint chamberMiddleGP = chamb->toGlobal(chamberMiddleLP);
365 
366  EtaValue etaValue = {
367  config->etaToHwEta(chamberMiddleGP.eta()),
368  config->etaToHwEta(cscChamberEtaSize(detId)),
369  0,
370  0, //bx
371  0 //timnig
372  };
373 
374  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" rawid "<<detId.rawId()<<" detId "<<detId<<" chamberMiddleGP.eta() "<<chamberMiddleGP.eta()<<" eta "<<etaValue.eta<<" etaSigma "<<etaValue.etaSigma<<std::endl;
375  return etaValue;
376 }
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
T eta() const
Definition: PV3DBase.h:73
Definition: config.py:1
float cscChamberEtaSize(const CSCDetId &id) const
edm::ESHandle< CSCGeometry > _geocsc

◆ getGlobalEtaDt()

EtaValue AngleConverterBase::getGlobalEtaDt ( const DTChamberId detId) const
virtual

returns the eta position of the DT chamber (n.b. in the DT phi and eta segments are independent)

Definition at line 229 of file AngleConverterBase.cc.

References _geodt, DTGeometry::chamber(), PV3DBase< T, PVType, FrameType >::eta(), DTChamberId::sector(), DTChamberId::station(), GeomDet::toGlobal(), and DTChamberId::wheel().

229  {
230  Local2DPoint chamberMiddleLP(0, 0);
231  GlobalPoint chamberMiddleGP = _geodt->chamber(detId)->toGlobal(chamberMiddleLP);
232 
233  const DTChamberId baseidNeigh(detId.wheel() + (detId.wheel() >= 0 ? -1 : +1), detId.station(), detId.sector());
234  GlobalPoint chambNeighMiddleGP = _geodt->chamber(baseidNeigh)->toGlobal(chamberMiddleLP);
235 
236  EtaValue etaValue = {
237  config->etaToHwEta(chamberMiddleGP.eta()),
238  config->etaToHwEta(fabs(chamberMiddleGP.eta() - chambNeighMiddleGP.eta())) / 2,
239  0, //quality
240  0, //bx
241  0 //timin
242  };
243 
244  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" rawid "<<detId.rawId()<<" baseid "<<detId<<" chamberMiddleGP.eta() "<<chamberMiddleGP.eta()<<" eta "<<etaValue.eta<<" etaSigma "<<etaValue.etaSigma<<std::endl;
245  return etaValue;
246 }
int station() const
Return the station number.
Definition: DTChamberId.h:42
edm::ESHandle< DTGeometry > _geodt
T eta() const
Definition: PV3DBase.h:73
Definition: config.py:1
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
int sector() const
Definition: DTChamberId.h:49
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90

◆ getProcessorPhi() [1/4]

int AngleConverterBase::getProcessorPhi ( int  phiZero,
l1t::tftype  part,
int  dtScNum,
int  dtPhi 
) const
virtual

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 phiZero - desired phi where the scale should start, should be in the desired scale, use getProcessorPhiZero to obtain it

Definition at line 60 of file AngleConverterBase.cc.

References createfilelist::int, M_PI, nPhiBins, l1ctLayer1_cff::phiZero, funct::pow(), and L1EGammaClusterEmuProducer_cfi::scale.

Referenced by CscDigiToStubsConverterOmtf::addCSCstubs(), DtDigiToStubsConverterOmtf::addDTphiDigi(), and RpcDigiToStubsConverterOmtf::addRPCstub().

60  {
61  int dtPhiBins = 4096;
62 
63  double hsPhiPitch = 2 * M_PI / nPhiBins; // width of phi Pitch, related to halfStrip at CSC station 2
64 
65  int sector = dtScNum + 1; //NOTE: there is a inconsistency in DT sector numb. Thus +1 needed to get detector numb.
66 
67  double scale = 1. / dtPhiBins / hsPhiPitch;
68  int scale_coeff = lround(scale * pow(2, 11));
69 
70  int ichamber = sector - 1;
71  if (ichamber > 6)
72  ichamber = ichamber - 12;
73 
74  int offsetGlobal = (int)nPhiBins * ichamber / 12;
75 
76  int phiConverted = floor(dtPhi * scale_coeff / pow(2, 11)) + offsetGlobal - phiZero;
77 
78  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" phiZero "<<phiZero<<" phiDT "<<phiDT<<" sector "<<sector<<" ichamber "<<ichamber<<" offsetGlobal "<<offsetGlobal<<" phi "<<phi<<" foldPhi(phi) "<<omtfConfig->foldPhi(phi)<<std::endl;
79  return config->foldPhi(phiConverted);
80 }
Definition: config.py:1
unsigned int nPhiBins
Number of phi bins along 2Pi.
#define M_PI
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ getProcessorPhi() [2/4]

int AngleConverterBase::getProcessorPhi ( int  phiZero,
l1t::tftype  part,
const CSCDetId csc,
const CSCCorrelatedLCTDigi digi 
) const
virtual

Definition at line 83 of file AngleConverterBase.cc.

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

86  {
87  const double hsPhiPitch = 2 * M_PI / nPhiBins;
88  //
89  // get offset for each chamber.
90  // FIXME: These parameters depends on processor and chamber only so may be precomputed and put in map
91  //
92 
93  int halfStrip = digi.getStrip(); // returns halfStrip 0..159
94 
96 
97  //in the PhaseIITDRSpring19DR dataset (generated with CMSSW_10_6_1_patch2?), in case of the ME1/1 ring 4 (higher eta) the detId in the CSCCorrelatedLCTDigiCollection is ME1/1 ring 1 (instead ME1/1/4 as it was before),
98  //and the digi.getStrip() is increased by 2*64 (i.e. number of half strips in the chamber roll)
99  if (csc.station() == 1 && csc.ring() == 1 && halfStrip > 128) {
100  CSCDetId cscME11 = CSCDetId(csc.endcap(), csc.station(), 4, csc.chamber()); //changing ring to 4
101  chamber = _geocsc->chamber(cscME11);
102  }
103 
104  const CSCChamberSpecs* cspec = chamber->specs();
105  const CSCLayer* layer = chamber->layer(3);
106  int order = (layer->centerOfStrip(2).phi() - layer->centerOfStrip(1).phi() > 0) ? 1 : -1;
107  double stripPhiPitch = cspec->stripPhiPitch();
108  double scale = fabs(stripPhiPitch / hsPhiPitch / 2.);
109  if (fabs(scale - 1.) < 0.0002)
110  scale = 1.;
111 
112  double phiHalfStrip0 = layer->centerOfStrip(1).phi() - order * stripPhiPitch / 4.;
113 
114  int offsetLoc = lround((phiHalfStrip0) / hsPhiPitch - phiZero);
115  offsetLoc = config->foldPhi(offsetLoc);
116 
117  if (csc.station() == 1 && csc.ring() == 1 && halfStrip > 128) { //ME1/1/
118  /* if(cspec->nStrips() != 64)
119  edm::LogImportant("l1tOmtfEventPrint") <<__FUNCTION__<<":"<<__LINE__<<" cspec->nStrips() != 64 in case of the ME1/1, phi of the muon stub will be not correct. chamber "
120  <<csc<<" cspec->nStrips() "<<cspec->nStrips()<<std::endl;
121  this checks has no sense - the ME1/1/ ring 4 has cspec->nStrips() = 48. but the offset of 128 half strips in the digi.getStrip() looks to be good*/
122  halfStrip -= 128;
123  }
124 
125  //FIXME: to be checked (only important for ME1/3) keep more bits for offset, truncate at the end
126 
127  int fixOff = offsetLoc;
128  // a quick fix for towards geometry changes due to global tag.
129  // in case of MC tag fixOff should be identical to offsetLoc
130 
131  if (config->getFixCscGeometryOffset())
132  fixOff = fixCscOffsetGeom(offsetLoc); //TODO does not work in when phiZero is always 0. Fix this
133 
134  int phi = fixOff + order * scale * halfStrip;
135  //the phi conversion is done like above - and not simply converting the layer->centerOfStrip(halfStrip/2 +1).phi() - to mimic this what is done by the firmware,
136  //where phi of the stub is calculated with use of the offset and scale provided by an register
137 
138  /*//debug
139  auto localPoint = layer->toLocal(layer->centerOfStrip(halfStrip));
140  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << 147 << " csc: " <<csc.rawId()<<" "<< csc<<" layer "<<layer->id()<<" "<<layer->id().rawId()
141  << " halfStrip "<<halfStrip<<" phiGlobal " << layer->centerOfStrip(halfStrip).phi()<<" local phi "<<localPoint.phi()<<" x "<<localPoint.x()<<" y "<<localPoint.y() <<std::endl;
142  */
143 
144  /*//debug
145  auto radToDeg = [](double rad) { return (180. / M_PI * rad); };
146  LogTrace("l1tOmtfEventPrint") <<__FUNCTION__<<":"<<__LINE__<<" "<<std::setw(16)<<csc<<" phiZero "<<phiZero<<" hs: "<<std::setw(3)<< halfStrip <<" phiHalfStrip0 "<<std::setw(10)<<radToDeg(phiHalfStrip0)<<" offset: " << offsetLoc
147  <<" oder*scale: "<<std::setw(10)<< order*scale
148  <<" phi: " <<phi<<" foldPhi(phi) "<<config->foldPhi(phi)<<" ("<<offsetLoc + order*scale*halfStrip<<")"<<" centerOfStrip "<<std::setw(10)<< radToDeg( layer->centerOfStrip(halfStrip/2 +1).phi() )
149  <<" centerOfStrip/hsPhiPitch "<< ( (layer->centerOfStrip(halfStrip/2 + 1).phi() )/hsPhiPitch)<<" hsPhiPitch "<<hsPhiPitch
150  //<<" phiSpan.f "<<layer->geometry()->phiSpan().first<<" phiSpan.s "<<layer->geometry()->phiSpan().second
151  <<" nStrips "<<cspec->nStrips()
152  //<<" strip 1 "<<radToDeg( layer->centerOfStrip(1).phi() )<<" strip last "<<radToDeg( layer->centerOfStrip(cspec->nStrips()).phi() )
153  << std::endl;*/
154 
155  return config->foldPhi(phi);
156 }
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
Definition: config.py:1
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned int nPhiBins
Number of phi bins along 2Pi.
Definition: L1Track.h:19
#define M_PI
float stripPhiPitch() const
uint16_t getStrip(uint16_t n=2) const
return the key halfstrip from 0,159
edm::ESHandle< CSCGeometry > _geocsc

◆ getProcessorPhi() [3/4]

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

Definition at line 191 of file AngleConverterBase.cc.

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

194  {
195  const double hsPhiPitch = 2 * M_PI / nPhiBins;
196  const int dummy = nPhiBins;
197  int processor = iProcessor + 1;
198  const RPCRoll* roll = _georpc->roll(rollId);
199  if (!roll)
200  return dummy;
201 
202  double phi15deg = M_PI / 3. * (processor - 1) + M_PI / 12.;
203  // "0" is 15degree moved cyclically to each processor, note [0,2pi]
204 
205  double stripPhi = (roll->toGlobal(roll->centreOfStrip((int)digi))).phi(); // note [-pi,pi]
206 
207  // adjust [0,2pi] and [-pi,pi] to get deltaPhi difference properly
208  switch (processor) {
209  case 1:
210  break;
211  case 6: {
212  phi15deg -= 2 * M_PI;
213  break;
214  }
215  default: {
216  if (stripPhi < 0)
217  stripPhi += 2 * M_PI;
218  break;
219  }
220  }
221 
222  // local angle in CSC halfStrip usnits
223  int halfStrip = lround((stripPhi - phi15deg) / hsPhiPitch);
224 
225  return halfStrip;
226 }
edm::ESHandle< RPCGeometry > _georpc
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
unsigned int nPhiBins
Number of phi bins along 2Pi.
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
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26

◆ getProcessorPhi() [4/4]

int AngleConverterBase::getProcessorPhi ( int  phiZero,
l1t::tftype  part,
const RPCDetId rollId,
const unsigned int &  digi1,
const unsigned int &  digi2 
) const
virtual

Definition at line 160 of file AngleConverterBase.cc.

References _georpc, funct::abs(), RPCRoll::centreOfStrip(), LogTrace, M_PI, nPhiBins, l1ctLayer1_cff::phiZero, DetId::rawId(), RPCGeometry::roll(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

161  {
162  const double hsPhiPitch = 2 * M_PI / nPhiBins;
163  const int dummy = nPhiBins;
164  const RPCRoll* roll = _georpc->roll(rollId);
165  if (!roll)
166  return dummy;
167 
168  double stripPhi1 = (roll->toGlobal(roll->centreOfStrip((int)digi1))).phi(); // note [-pi,pi]
169  double stripPhi2 = (roll->toGlobal(roll->centreOfStrip((int)digi2))).phi(); // note [-pi,pi]
170 
171  // the case when the two strips are on different sides of phi = pi
172  if (std::signbit(stripPhi1) != std::signbit(stripPhi2) && abs(stripPhi1) > M_PI / 2.) {
173  if (std::signbit(stripPhi1)) { //stripPhi1 is negative
174  stripPhi1 += 2 * M_PI;
175  } else //stripPhi2 is negative
176  stripPhi2 += 2 * M_PI;
177  }
178  int halfStrip = lround(((stripPhi1 + stripPhi2) / 2.) / hsPhiPitch);
179  halfStrip = config->foldPhi(halfStrip); //only for the case when the two strips are on different sides of phi = pi
180 
181  LogTrace("l1tOmtfEventPrint") << __FUNCTION__ << ":" << 185 << " roll " << rollId.rawId() << " " << rollId
182  << " cluster: firstStrip " << digi1 << " stripPhi1Global " << stripPhi1
183  << " stripPhi1LocalPhi " << roll->centreOfStrip((int)digi1).x() << " y "
184  << roll->centreOfStrip((int)digi1).y() << " lastStrip " << digi2 << " stripPhi2Global "
185  << stripPhi2 << " stripPhi2LocalPhi x " << roll->centreOfStrip((int)digi2).x() << " y "
186  << roll->centreOfStrip((int)digi2).y() << " halfStrip " << halfStrip << std::endl;
187 
188  return config->foldPhi(halfStrip - phiZero);
189 }
edm::ESHandle< RPCGeometry > _georpc
Definition: config.py:1
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
#define LogTrace(id)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int nPhiBins
Number of phi bins along 2Pi.
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
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26

◆ isCSCCounterClockwise()

bool AngleConverterBase::isCSCCounterClockwise ( const CSCLayer layer) const
protectedvirtual

Check orientation of strips in given CSC chamber.

Definition at line 422 of file AngleConverterBase.cc.

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

Referenced by OmtfAngleConverter::getGlobalEta().

422  {
423  const int nStrips = layer->geometry()->numberOfStrips();
424  const double phi1 = layer->centerOfStrip(1).phi();
425  const double phiN = layer->centerOfStrip(nStrips).phi();
426  return ((std::abs(phi1 - phiN) < M_PI && phi1 >= phiN) || (std::abs(phi1 - phiN) >= M_PI && phi1 < phiN));
427 }
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

edm::ESHandle<CSCGeometry> AngleConverterBase::_geocsc
protected

◆ _geodt

edm::ESHandle<DTGeometry> AngleConverterBase::_geodt
protected

◆ _geom_cache_id

unsigned long long AngleConverterBase::_geom_cache_id = 0
protected

Definition at line 107 of file AngleConverterBase.h.

◆ _georpc

edm::ESHandle<RPCGeometry> AngleConverterBase::_georpc
protected

◆ config

const ProcConfigurationBase* AngleConverterBase::config = nullptr
protected

Definition at line 114 of file AngleConverterBase.h.

Referenced by checkAndUpdateGeometry().

◆ muonGeometryRecordWatcher

edm::ESWatcher<MuonGeometryRecord> AngleConverterBase::muonGeometryRecordWatcher
protected

Definition at line 112 of file AngleConverterBase.h.

Referenced by checkAndUpdateGeometry().

◆ nPhiBins

unsigned int AngleConverterBase::nPhiBins = 0
protected

Number of phi bins along 2Pi.

Definition at line 116 of file AngleConverterBase.h.

Referenced by checkAndUpdateGeometry(), and getProcessorPhi().