CMS 3D CMS Logo

List of all members | Public Member Functions
OmtfAngleConverter Class Reference

#include <OmtfAngleConverter.h>

Inheritance diagram for OmtfAngleConverter:
AngleConverterBase

Public Member Functions

virtual int getGlobalEta (const DTChamberId dTChamberId, const L1MuDTChambThContainer *dtThDigis, int bxNum) const
 
virtual int getGlobalEta (unsigned int rawid, const CSCCorrelatedLCTDigi &aDigi, float &r) const
 Convert local eta coordinate to global digital microGMT scale. More...
 
virtual EtaValue getGlobalEta (unsigned int rawid, const unsigned int &aDigi) 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 void getGlobalEta (const L1MuDTChambThDigi &thetaDigi, std::vector< EtaValue > &etaSegments) const
 
virtual int getGlobalEtaRpc (unsigned int rawid, const unsigned int &aDigi, float &r) const
 Convert local eta coordinate to global digital microGMT scale. More...
 
 OmtfAngleConverter ()
 
 ~OmtfAngleConverter () override
 
- Public Member Functions inherited from AngleConverterBase
 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, unsigned int iInput) 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 ()
 

Additional Inherited Members

- Protected Member Functions inherited from AngleConverterBase
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 inherited from AngleConverterBase
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 13 of file OmtfAngleConverter.h.

Constructor & Destructor Documentation

◆ OmtfAngleConverter()

OmtfAngleConverter::OmtfAngleConverter ( )
inline

Definition at line 15 of file OmtfAngleConverter.h.

◆ ~OmtfAngleConverter()

OmtfAngleConverter::~OmtfAngleConverter ( )
override

Definition at line 101 of file OmtfAngleConverter.cc.

101 {}

Member Function Documentation

◆ getGlobalEta() [1/6]

int OmtfAngleConverter::getGlobalEta ( const DTChamberId  dTChamberId,
const L1MuDTChambThContainer dtThDigis,
int  bxNum 
) const
virtual

Convert local eta coordinate to global digital microGMT scale. theta is returned only if in the dtThDigis is only one hit, otherwise eta = 95 or middle of the chamber

Definition at line 105 of file OmtfAngleConverter.cc.

References AngleConverterBase::_geodt, funct::abs(), ProcConfigurationBase::bits, DTGeometry::chamber(), L1MuDTChambThContainer::chThetaSegm(), PV3DBase< T, PVType, FrameType >::eta(), OMTFConfiguration::eta2Bits(), mps_fire::i, l1tPhase2CaloJetEmulator_cfi::iEta, L1MuDTChambThDigi::position(), DTChamberId::sector(), FWPFMaths::sgn(), DTChamberId::station(), ProcConfigurationBase::valueP1Scale, and DTChamberId::wheel().

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

107  {
108  //const DTChamberId dTChamberId(aDigi.whNum(),aDigi.stNum(),aDigi.scNum()+1);
109  DTTrigGeom trig_geom(_geodt->chamber(dTChamberId), false);
110 
111  // super layer one is the theta superlayer in a DT chamber
112  // station 4 does not have a theta super layer
113  // the BTI index from the theta trigger is an OR of some BTI outputs
114  // so, we choose the BTI that's in the middle of the group
115  // as the BTI that we get theta from
116  // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign
117  const int NBTI_theta = ((dTChamberId.station() != 4) ? trig_geom.nCell(2) : trig_geom.nCell(3));
118 
119  const L1MuDTChambThDigi *theta_segm =
120  dtThDigis->chThetaSegm(dTChamberId.wheel(), dTChamberId.station(), dTChamberId.sector() - 1, bxNum);
121 
122  int bti_group = -1;
123  if (theta_segm) {
124  for (unsigned int i = 0; i < 7; ++i)
125  if (theta_segm->position(i) && bti_group < 0)
126  bti_group = i;
127  else if (theta_segm->position(i) && bti_group > -1)
128  bti_group = 511;
129  }
130 
131  //TODO why bti_group == 511 (meaning there is more then one bit fired) is converted into 95, but not into middle of the chamber?
132  int iEta = 0;
133  if (bti_group == 511)
134  iEta = 95;
135  else if (bti_group == -1 && dTChamberId.station() == 1)
136  iEta = 92;
137  else if (bti_group == -1 && dTChamberId.station() == 2)
138  iEta = 79;
139  else if (bti_group == -1 && dTChamberId.station() == 3)
140  iEta = 75;
141  else if (dTChamberId.station() != 4 && bti_group >= 0) {
142  unsigned bti_actual = bti_group * NBTI_theta / 7 + NBTI_theta / 14 + 1;
143  DTBtiId thetaBTI = DTBtiId(dTChamberId, 2, bti_actual);
144  GlobalPoint theta_gp = trig_geom.CMSPosition(thetaBTI);
145  iEta = etaVal2Code(fabs(theta_gp.eta()));
146  }
147  int signEta = sgn(dTChamberId.wheel());
148  iEta *= signEta;
149 
150  if (config->getStubEtaEncoding() == ProcConfigurationBase::StubEtaEncoding::bits)
152  else if (config->getStubEtaEncoding() == ProcConfigurationBase::StubEtaEncoding::valueP1Scale)
153  return abs(iEta);
154 
155  return 0;
156 }
int station() const
Return the station number.
Definition: DTChamberId.h:45
edm::ESHandle< DTGeometry > _geodt
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
Definition: config.py:1
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static unsigned int eta2Bits(unsigned int eta)
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:42
int sector() const
Definition: DTChamberId.h:52
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:90

◆ getGlobalEta() [2/6]

int OmtfAngleConverter::getGlobalEta ( unsigned int  rawid,
const CSCCorrelatedLCTDigi aDigi,
float &  r 
) 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 160 of file OmtfAngleConverter.cc.

References AngleConverterBase::_geocsc, funct::abs(), ProcConfigurationBase::bits, CSCGeometry::chamber(), PV3DBase< T, PVType, FrameType >::eta(), OMTFConfiguration::eta2Bits(), CSCLayer::geometry(), CSCCorrelatedLCTDigi::getKeyWG(), CSCCorrelatedLCTDigi::getStrip(), l1ctLayer2EG_cff::id, AngleConverterBase::isCSCCounterClockwise(), CSCConstants::KEY_ALCT_LAYER, nano_mu_digi_cff::layer, CSCChamber::layer(), PV3DBase< T, PVType, FrameType >::mag(), hltrates_dqm_sourceclient-live_cfg::offset, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), alignCSCRings::r, nano_mu_digi_cff::strip, PV3DBase< T, PVType, FrameType >::theta(), Geom::Phi< T1, Range >::value(), and ProcConfigurationBase::valueP1Scale.

160  {
164 
165  // a lot of this is transcription and consolidation of the CSC
166  // global phi calculation code
167  // this works directly with the geometry
168  // rather than using the old phi luts
169  const CSCDetId id(rawid);
170  // we should change this to weak_ptrs at some point
171  // requires introducing std::shared_ptrs to geometry
172  auto chamb = _geocsc->chamber(id);
173  auto layer_geom = chamb->layer(CSCConstants::KEY_ALCT_LAYER)->geometry();
174  auto layer = chamb->layer(CSCConstants::KEY_ALCT_LAYER);
175 
176  const uint16_t halfstrip = aDigi.getStrip();
177  //const uint16_t pattern = aDigi.getPattern();
178  const uint16_t keyWG = aDigi.getKeyWG();
179  //const unsigned maxStrips = layer_geom->numberOfStrips();
180 
181  // so we can extend this later
182  // assume TMB2007 half-strips only as baseline
183  double offset = 0.0;
184  //K.B. CSCPatternLUT is removed since CMSSW_11_2_1, but it looks that this offset is effectively not needed here
185  //offset = CSCPatternLUT::get2007Position(pattern);
186 
187  const unsigned halfstrip_offs = unsigned(0.5 + halfstrip + offset);
188  const unsigned strip = halfstrip_offs / 2 + 1; // geom starts from 1
189 
190  // the rough location of the hit at the ALCT key layer
191  // we will refine this using the half strip information
192  const LocalPoint coarse_lp = layer_geom->stripWireGroupIntersection(strip, keyWG);
193  const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp);
194 
195  // the strip width/4.0 gives the offset of the half-strip
196  // center with respect to the strip center
197  const double hs_offset = layer_geom->stripPhiPitch() / 4.0;
198 
199  // determine handedness of the chamber
200  const bool ccw = isCSCCounterClockwise(layer);
201  // we need to subtract the offset of even half strips and add the odd ones
202  const double phi_offset = ((halfstrip_offs % 2 ? 1 : -1) * (ccw ? -hs_offset : hs_offset));
203 
204  // the global eta calculation uses the middle of the strip
205  // so no need to increment it
206  const GlobalPoint final_gp(
207  GlobalPoint::Polar(coarse_gp.theta(), (coarse_gp.phi().value() + phi_offset), coarse_gp.mag()));
208 
209  //TODO for phase 2, add firmware like, fixed point conversion from keyWG to eta and r
210  const LocalPoint lpWg = layer_geom->localCenterOfWireGroup(keyWG);
211  const GlobalPoint gpWg = layer->surface().toGlobal(lpWg);
212  r = round(gpWg.perp());
213 
214  if (config->getStubEtaEncoding() == ProcConfigurationBase::StubEtaEncoding::bits)
215  return OMTFConfiguration::eta2Bits(abs(etaKeyWG2Code(id, keyWG)));
216  else if (config->getStubEtaEncoding() == ProcConfigurationBase::StubEtaEncoding::valueP1Scale) {
217  return config->etaToHwEta(abs(gpWg.eta()));
218  } else {
219  return 0;
220  }
221 }
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:30
T perp() const
Definition: PV3DBase.h:69
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:100
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
Definition: config.py:1
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
T mag() const
Definition: PV3DBase.h:64
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
uint16_t getStrip(uint16_t n=2) const
return the key halfstrip from 0,159
static unsigned int eta2Bits(unsigned int eta)
edm::ESHandle< CSCGeometry > _geocsc
uint16_t getKeyWG() const
return the key wire group. counts from 0.
virtual bool isCSCCounterClockwise(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/6]

EtaValue AngleConverterBase::getGlobalEta

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

Definition at line 386 of file AngleConverterBase.cc.

386  {
387  const RPCDetId id(rawid);
388 
389  auto roll = _georpc->roll(id);
390  const LocalPoint lp = roll->centreOfStrip((int)strip);
391  const GlobalPoint gp = roll->toGlobal(lp);
392 
393  int neighbRoll = 1; //neighbor roll in eta
394  //roll->chamber()->nrolls() does not work
395  if (id.region() == 0) { //barel
396  if (id.station() == 2 && ((std::abs(id.ring()) == 2 && id.layer() == 2) ||
397  (std::abs(id.ring()) != 2 && id.layer() == 1))) { //three-roll chamber
398  if (id.roll() == 2)
399  neighbRoll = 1;
400  else {
401  neighbRoll = 2;
402  }
403  } else //two-roll chamber
404  neighbRoll = (id.roll() == 1 ? 3 : 1);
405  } else { //endcap
406  neighbRoll = id.roll() + (id.roll() == 1 ? +1 : -1);
407  }
408 
409  const RPCDetId idNeigh =
410  RPCDetId(id.region(), id.ring(), id.station(), id.sector(), id.layer(), id.subsector(), neighbRoll);
411  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" rpc "<<id<<std::endl;
412  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" rpc "<<idNeigh<<std::endl;
413 
414  auto rollNeigh = _georpc->roll(idNeigh);
415  const LocalPoint lpNeigh = rollNeigh->centreOfStrip((int)strip);
416  const GlobalPoint gpNeigh = rollNeigh->toGlobal(lpNeigh);
417 
418  EtaValue etaValue = {config->etaToHwEta(gp.eta()),
419  config->etaToHwEta(std::abs(gp.eta() - gpNeigh.eta())) /
420  2, //half of the size of the strip in eta - not precise, but OK
421  0};
422 
423  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" rpc "<<id<<" eta "<<gp.eta()<<" etaHw "<<etaValue.eta<<" etaSigma "<<etaValue.etaSigma<<std::endl;
424  return etaValue;
425 }
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
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ getGlobalEta() [4/6]

std::vector< EtaValue > AngleConverterBase::getGlobalEta

Definition at line 287 of file AngleConverterBase.cc.

289  {
290  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" dtThDigis size "<<dtThDigis->getContainer()->size()<<std::endl;
291 
292  std::vector<EtaValue> etaSegments;
293 
294  for (auto& thetaDigi : (*(dtThDigis->getContainer()))) {
295  if (thetaDigi.bxNum() >= bxFrom && thetaDigi.bxNum() <= bxTo) {
296  getGlobalEta(thetaDigi, etaSegments);
297  }
298  }
299  return etaSegments;
300 }
virtual int getGlobalEta(const DTChamberId dTChamberId, const L1MuDTChambThContainer *dtThDigis, int bxNum) const

◆ getGlobalEta() [5/6]

void AngleConverterBase::getGlobalEta

Definition at line 256 of file AngleConverterBase.cc.

256  {
257  const DTChamberId baseid(thetaDigi.whNum(), thetaDigi.stNum(), thetaDigi.scNum() + 1);
258  DTTrigGeom trig_geom(_geodt->chamber(baseid), false);
259 
260  // super layer 2 is the theta superlayer in a DT chamber
261  // station 4 does not have a theta super layer
262  // the BTI index from the theta trigger is an OR of some BTI outputs
263  // so, we choose the BTI that's in the middle of the group
264  // as the BTI that we get theta from
265  // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign
266  const int NBTI_theta = trig_geom.nCell(2);
267  for (unsigned int btiGroup = 0; btiGroup < 7; ++btiGroup) {
268  if (thetaDigi.position(btiGroup)) {
269  unsigned btiActual = btiGroup * NBTI_theta / 7 + NBTI_theta / 14 + 1;
270  DTBtiId thetaBTI = DTBtiId(baseid, 2, btiActual);
271  GlobalPoint theta_gp = trig_geom.CMSPosition(thetaBTI);
272 
273  EtaValue etaValue = {
274  config->etaToHwEta(theta_gp.eta()),
275  0,
276  thetaDigi.quality(btiGroup),
277  thetaDigi.bxNum(),
278  0 //TODO what about sub-bx timing???
279  };
280  etaSegments.emplace_back(etaValue);
281 
282  //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;
283  }
284  }
285 }
edm::ESHandle< DTGeometry > _geodt
T eta() const
Definition: PV3DBase.h:73
Definition: config.py:1
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() [6/6]

EtaValue AngleConverterBase::getGlobalEta

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

333  {
337 
338  // alot of this is transcription and consolidation of the CSC
339  // global phi calculation code
340  // this works directly with the geometry
341  // rather than using the old phi luts
342 
343  auto chamb = _geocsc->chamber(detId);
344  auto layer_geom = chamb->layer(CSCConstants::KEY_ALCT_LAYER)->geometry();
345  auto layer = chamb->layer(CSCConstants::KEY_ALCT_LAYER);
346 
347  const uint16_t keyWG = aDigi.getKeyWG();
348 
349  const LocalPoint lpWg = layer_geom->localCenterOfWireGroup(keyWG);
350  const GlobalPoint gpWg = layer->surface().toGlobal(lpWg);
351 
352  EtaValue etaSegment = {
353  config->etaToHwEta(gpWg.eta()),
354  0, //config->etaToHwEta(cscChamberEtaSize(id) ),
355  0,
356  aDigi.getBX(),
357  0 //tming???
358  };
359 
360  //LogTrace("l1tOmtfEventPrint")<<__FUNCTION__<<":"<<__LINE__<<" csc "<<detId<<" eta "<<gpWg.eta()<<" etaHw "<<etaSegment.eta<<" etaSigma "<<etaSegment.etaSigma<<std::endl;
361  return etaSegment;
362 }
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
edm::ESHandle< CSCGeometry > _geocsc

◆ getGlobalEtaRpc()

int OmtfAngleConverter::getGlobalEtaRpc ( unsigned int  rawid,
const unsigned int &  aDigi,
float &  r 
) const
virtual

Convert local eta coordinate to global digital microGMT scale.

Definition at line 224 of file OmtfAngleConverter.cc.

References AngleConverterBase::_georpc, funct::abs(), ProcConfigurationBase::bits, OMTFConfiguration::eta2Bits(), runTauDisplay::gp, l1ctLayer2EG_cff::id, alignCSCRings::r, nano_mu_digi_cff::region, nano_mu_digi_cff::roll, RPCGeometry::roll(), nano_mu_digi_cff::strip, and ProcConfigurationBase::valueP1Scale.

Referenced by RpcDigiToStubsConverterOmtf::addRPCstub().

224  {
225  const RPCDetId id(rawid);
226  auto roll = _georpc->roll(id);
227  const LocalPoint lp = roll->centreOfStrip((int)strip);
228  const GlobalPoint gp = roll->toGlobal(lp);
229 
230  if (id.region() != 0) { //outside barrel
231  r = gp.perp();
232  }
233 
234  if (config->getStubEtaEncoding() == ProcConfigurationBase::StubEtaEncoding::bits)
235  return OMTFConfiguration::eta2Bits(abs(etaVal2Code(gp.eta())));
236  else if (config->getStubEtaEncoding() == ProcConfigurationBase::StubEtaEncoding::valueP1Scale)
237  return abs(config->etaToHwEta((gp.eta())));
238 
239  return 0;
240 }
edm::ESHandle< RPCGeometry > _georpc
Definition: config.py:1
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static unsigned int eta2Bits(unsigned int eta)