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) 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) 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) 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 143 of file OmtfAngleConverter.cc.

143 {}

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 147 of file OmtfAngleConverter.cc.

References AngleConverterBase::_geodt, DTGeometry::chamber(), L1MuDTChambThContainer::chThetaSegm(), PV3DBase< T, PVType, FrameType >::eta(), mps_fire::i, l1tTowerCalibrationProducer_cfi::iEta, L1MuDTChambThDigi::position(), DTChamberId::sector(), FWPFMaths::sgn(), DTChamberId::station(), and DTChamberId::wheel().

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

149  {
150  //const DTChamberId dTChamberId(aDigi.whNum(),aDigi.stNum(),aDigi.scNum()+1);
151  DTTrigGeom trig_geom(_geodt->chamber(dTChamberId), false);
152 
153  // super layer one is the theta superlayer in a DT chamber
154  // station 4 does not have a theta super layer
155  // the BTI index from the theta trigger is an OR of some BTI outputs
156  // so, we choose the BTI that's in the middle of the group
157  // as the BTI that we get theta from
158  // TODO:::::>>> need to make sure this ordering doesn't flip under wheel sign
159  const int NBTI_theta = ((dTChamberId.station() != 4) ? trig_geom.nCell(2) : trig_geom.nCell(3));
160 
161  const L1MuDTChambThDigi *theta_segm =
162  dtThDigis->chThetaSegm(dTChamberId.wheel(), dTChamberId.station(), dTChamberId.sector() - 1, bxNum);
163 
164  int bti_group = -1;
165  if (theta_segm) {
166  for (unsigned int i = 0; i < 7; ++i)
167  if (theta_segm->position(i) && bti_group < 0)
168  bti_group = i;
169  else if (theta_segm->position(i) && bti_group > -1)
170  bti_group = 511;
171  }
172 
173  int iEta = 0;
174  if (bti_group == 511)
175  iEta = 95;
176  else if (bti_group == -1 && dTChamberId.station() == 1)
177  iEta = 92;
178  else if (bti_group == -1 && dTChamberId.station() == 2)
179  iEta = 79;
180  else if (bti_group == -1 && dTChamberId.station() == 3)
181  iEta = 75;
182  else if (dTChamberId.station() != 4 && bti_group >= 0) {
183  unsigned bti_actual = bti_group * NBTI_theta / 7 + NBTI_theta / 14 + 1;
184  DTBtiId thetaBTI = DTBtiId(dTChamberId, 2, bti_actual);
185  GlobalPoint theta_gp = trig_geom.CMSPosition(thetaBTI);
186  iEta = etaVal2Code(fabs(theta_gp.eta()));
187  }
188  int signEta = sgn(dTChamberId.wheel());
189  iEta *= signEta;
190  return iEta;
191 }
int station() const
Return the station number.
Definition: DTChamberId.h:42
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
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

◆ getGlobalEta() [2/6]

int OmtfAngleConverter::getGlobalEta ( unsigned int  rawid,
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 195 of file OmtfAngleConverter.cc.

References AngleConverterBase::_geocsc, CSCGeometry::chamber(), CSCLayer::geometry(), CSCCorrelatedLCTDigi::getKeyWG(), CSCCorrelatedLCTDigi::getStrip(), l1ctLayer2EG_cff::id, AngleConverterBase::isCSCCounterClockwise(), CSCConstants::KEY_ALCT_LAYER, CSCChamber::layer(), phase1PixelTopology::layer, PV3DBase< T, PVType, FrameType >::mag(), hltrates_dqm_sourceclient-live_cfg::offset, PV3DBase< T, PVType, FrameType >::phi(), digitizers_cfi::strip, PV3DBase< T, PVType, FrameType >::theta(), and Geom::Phi< T1, Range >::value().

195  {
199 
200  // a lot of this is transcription and consolidation of the CSC
201  // global phi calculation code
202  // this works directly with the geometry
203  // rather than using the old phi luts
204  const CSCDetId id(rawid);
205  // we should change this to weak_ptrs at some point
206  // requires introducing std::shared_ptrs to geometry
207  auto chamb = _geocsc->chamber(id);
208  auto layer_geom = chamb->layer(CSCConstants::KEY_ALCT_LAYER)->geometry();
209  auto layer = chamb->layer(CSCConstants::KEY_ALCT_LAYER);
210 
211  const uint16_t halfstrip = aDigi.getStrip();
212  //const uint16_t pattern = aDigi.getPattern();
213  const uint16_t keyWG = aDigi.getKeyWG();
214  //const unsigned maxStrips = layer_geom->numberOfStrips();
215 
216  // so we can extend this later
217  // assume TMB2007 half-strips only as baseline
218  double offset = 0.0;
219  //K.B. CSCPatternLUT is removed since CMSSW_11_2_1, but it looks that this offset is effectively not needed here
220  //offset = CSCPatternLUT::get2007Position(pattern);
221 
222  const unsigned halfstrip_offs = unsigned(0.5 + halfstrip + offset);
223  const unsigned strip = halfstrip_offs / 2 + 1; // geom starts from 1
224 
225  // the rough location of the hit at the ALCT key layer
226  // we will refine this using the half strip information
227  const LocalPoint coarse_lp = layer_geom->stripWireGroupIntersection(strip, keyWG);
228  const GlobalPoint coarse_gp = layer->surface().toGlobal(coarse_lp);
229 
230  // the strip width/4.0 gives the offset of the half-strip
231  // center with respect to the strip center
232  const double hs_offset = layer_geom->stripPhiPitch() / 4.0;
233 
234  // determine handedness of the chamber
235  const bool ccw = isCSCCounterClockwise(layer);
236  // we need to subtract the offset of even half strips and add the odd ones
237  const double phi_offset = ((halfstrip_offs % 2 ? 1 : -1) * (ccw ? -hs_offset : hs_offset));
238 
239  // the global eta calculation uses the middle of the strip
240  // so no need to increment it
241  const GlobalPoint final_gp(
242  GlobalPoint::Polar(coarse_gp.theta(), (coarse_gp.phi().value() + phi_offset), coarse_gp.mag()));
243 
244  // LogTrace("l1tOmtfEventPrint")<<id<<" st: " << id.station()<< "ri: "<<id.ring()<<" eta: " << final_gp.eta()
245  // <<" etaCode_simple: " << etaVal2Code( final_gp.eta() )<< " KW: "<<keyWG <<" etaKeyWG2Code: "<<etaKeyWG2Code(id,keyWG)<< std::endl;
246  // int station = (id.endcap()==1) ? id.station() : -id.station();
247  // LogTrace("l1tOmtfEventPrint")<<"ETA_CSC: " << station <<" "<<id.ring()<<" "<< final_gp.eta()<<" "<<keyWG <<" "<< etaKeyWG2Code(id,keyWG) << std::endl;
248 
249  return etaKeyWG2Code(id, keyWG);
250 }
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
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
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
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 380 of file AngleConverterBase.cc.

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

◆ getGlobalEta() [4/6]

std::vector< EtaValue > AngleConverterBase::getGlobalEta

Definition at line 281 of file AngleConverterBase.cc.

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 }
virtual int getGlobalEta(const DTChamberId dTChamberId, const L1MuDTChambThContainer *dtThDigis, int bxNum) const

◆ getGlobalEta() [5/6]

void AngleConverterBase::getGlobalEta

Definition at line 250 of file AngleConverterBase.cc.

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

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
edm::ESHandle< CSCGeometry > _geocsc

◆ getGlobalEtaRpc()

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

Convert local eta coordinate to global digital microGMT scale.

Definition at line 253 of file OmtfAngleConverter.cc.

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

Referenced by RpcDigiToStubsConverterOmtf::addRPCstub().

253  {
254  const RPCDetId id(rawid);
255  auto roll = _georpc->roll(id);
256  const LocalPoint lp = roll->centreOfStrip((int)strip);
257  const GlobalPoint gp = roll->toGlobal(lp);
258 
259  return etaVal2Code(gp.eta());
260 }
edm::ESHandle< RPCGeometry > _georpc
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50