CMS 3D CMS Logo

List of all members | Static Public Member Functions | Static Public Attributes
l1t::MuonRawDigiTranslator Class Reference

#include <MuonRawDigiTranslator.h>

Static Public Member Functions

static int calcHwEta (const uint32_t &, const unsigned, const unsigned)
 
static void fillMuon (Muon &, uint32_t, uint32_t, int, unsigned int)
 
static void fillMuon (Muon &, uint64_t, int, unsigned int)
 
static uint64_t generate64bitDataWord (const Muon &)
 
static void generatePackedDataWords (const Muon &, uint32_t &, uint32_t &)
 

Static Public Attributes

static const unsigned absEtaAtVtxShift_ = 23
 
static const unsigned absEtaMask_ = 0xFF
 
static const unsigned absEtaShift_ = 21
 
static const unsigned chargeShift_ = 2
 
static const unsigned chargeValidShift_ = 3
 
static const unsigned etaAtVtxSignShift_ = 31
 
static const unsigned etaSignShift_ = 29
 
static const unsigned isoMask_ = 0x3
 
static const unsigned isoShift_ = 0
 
static const unsigned phiAtVtxShift_ = 0
 
static const unsigned phiMask_ = 0x3FF
 
static const unsigned phiShift_ = 11
 
static const unsigned ptMask_ = 0x1FF
 
static const unsigned ptShift_ = 10
 
static const unsigned qualMask_ = 0xF
 
static const unsigned qualShift_ = 19
 
static const unsigned tfMuonIndexMask_ = 0x7F
 
static const unsigned tfMuonIndexShift_ = 4
 

Detailed Description

Definition at line 7 of file MuonRawDigiTranslator.h.

Member Function Documentation

◆ calcHwEta()

int l1t::MuonRawDigiTranslator::calcHwEta ( const uint32_t &  raw,
const unsigned  absEtaShift,
const unsigned  etaSignShift 
)
static

Definition at line 100 of file MuonRawDigiTranslator.cc.

102  {
103  // eta is coded as two's complement
104  int abs_eta = (raw >> absEtaShift) & absEtaMask_;
105  if ((raw >> etaSignShift) & 0x1) {
106  return abs_eta - (1 << (etaSignShift - absEtaShift));
107  } else {
108  return abs_eta;
109  }
110 }

Referenced by fillMuon().

◆ fillMuon() [1/2]

void l1t::MuonRawDigiTranslator::fillMuon ( Muon mu,
uint32_t  raw_data_00_31,
uint32_t  raw_data_32_63,
int  fed,
unsigned int  fw 
)
static

Definition at line 4 of file MuonRawDigiTranslator.cc.

5  {
6  int hwPt = (raw_data_00_31 >> ptShift_) & ptMask_;
7  if (hwPt > 0) {
8  mu.setHwPt(hwPt);
9  mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_);
10  mu.setHwIso((raw_data_32_63 >> isoShift_) & isoMask_);
11  // charge is coded as -1^chargeBit
12  mu.setHwCharge((raw_data_32_63 >> chargeShift_) & 0x1);
13  mu.setHwChargeValid((raw_data_32_63 >> chargeValidShift_) & 0x1);
14  mu.setTfMuonIndex((raw_data_32_63 >> tfMuonIndexShift_) & tfMuonIndexMask_);
15 
16  // The position of the eta and phi coordinates in the RAW data changed between the 2016 run and the 2017 run.
17  // Eta and phi at the muon system are replaced by eta and phi at the vertex
18  // Eta and phi at the muon system are moved to spare bits
19  // The uGMT (FED 1402) or uGT (FED 1404) FW versions are used to determine the era.
20  if ((fed == 1402 && fw < 0x4010000) || (fed == 1404 && fw < 0x10A6)) {
21  // coordinates at the muon system are in 2016 where in 2017 eta and phi at the vertex are
22  mu.setHwEta(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_));
23  mu.setHwPhi((raw_data_00_31 >> phiAtVtxShift_) & phiMask_);
24 
25  // set the coordiantes at vertex to be the same as the coordinates at the muon system
26  mu.setHwEtaAtVtx(mu.hwEta());
27  mu.setHwPhiAtVtx(mu.hwPhi());
28  // deltas are 0
29  mu.setHwDEtaExtra(0);
30  mu.setHwDPhiExtra(0);
31  } else {
32  // coordinates at the muon system
33  mu.setHwEta(calcHwEta(raw_data_32_63, absEtaShift_, etaSignShift_));
34  mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_);
35 
36  // coordinates at the vertex
37  mu.setHwEtaAtVtx(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_));
38  mu.setHwPhiAtVtx((raw_data_00_31 >> phiAtVtxShift_) & phiMask_);
39  // deltas
40  mu.setHwDEtaExtra(mu.hwEtaAtVtx() - mu.hwEta());
41  int dPhi = mu.hwPhiAtVtx() - mu.hwPhi();
42  if (mu.hwCharge() == 1 && dPhi > 0) {
43  dPhi -= 576;
44  } else if (mu.hwCharge() == 0 && dPhi < 0) {
45  dPhi += 576;
46  }
47  mu.setHwDPhiExtra(dPhi);
48  }
49 
50  math::PtEtaPhiMLorentzVector vec{(mu.hwPt() - 1) * 0.5, mu.hwEta() * 0.010875, mu.hwPhi() * 0.010908, 0.0};
51  mu.setP4(vec);
52  // generate a muon at the vertex to extract the physical eta and phi coordinates
54  (mu.hwPt() - 1) * 0.5, mu.hwEtaAtVtx() * 0.010875, mu.hwPhiAtVtx() * 0.010908, 0.0};
55  Muon muAtVtx;
56  muAtVtx.setP4(vecAtVtx);
57  mu.setEtaAtVtx(muAtVtx.eta());
58  mu.setPhiAtVtx(muAtVtx.phi());
59  if (mu.hwChargeValid()) {
60  mu.setCharge(1 - 2 * mu.hwCharge());
61  } else {
62  mu.setCharge(0);
63  }
64  }
65 }

References absEtaAtVtxShift_, absEtaShift_, calcHwEta(), chargeShift_, chargeValidShift_, HLT_2018_cff::dPhi, reco::LeafCandidate::eta(), etaAtVtxSignShift_, etaSignShift_, isoMask_, isoShift_, amptDefaultParameters_cff::mu, reco::LeafCandidate::phi(), phiAtVtxShift_, phiMask_, phiShift_, ptMask_, ptShift_, qualMask_, qualShift_, reco::LeafCandidate::setP4(), tfMuonIndexMask_, tfMuonIndexShift_, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by l1t::stage2::IntermediateMuonUnpacker::unpackBx(), and l1t::stage2::MuonUnpacker::unpackBx().

◆ fillMuon() [2/2]

void l1t::MuonRawDigiTranslator::fillMuon ( Muon mu,
uint64_t  dataword,
int  fed,
unsigned int  fw 
)
static

Definition at line 67 of file MuonRawDigiTranslator.cc.

67  {
68  fillMuon(mu, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), fed, fw);
69 }

References amptDefaultParameters_cff::mu.

◆ generate64bitDataWord()

uint64_t l1t::MuonRawDigiTranslator::generate64bitDataWord ( const Muon mu)
static

Definition at line 92 of file MuonRawDigiTranslator.cc.

92  {
93  uint32_t lsw;
94  uint32_t msw;
95 
96  generatePackedDataWords(mu, lsw, msw);
97  return (((uint64_t)msw) << 32) + lsw;
98 }

References amptDefaultParameters_cff::mu.

◆ generatePackedDataWords()

void l1t::MuonRawDigiTranslator::generatePackedDataWords ( const Muon mu,
uint32_t &  raw_data_00_31,
uint32_t &  raw_data_32_63 
)
static

Definition at line 71 of file MuonRawDigiTranslator.cc.

73  {
74  int abs_eta = mu.hwEta();
75  if (abs_eta < 0) {
76  abs_eta += (1 << (etaSignShift_ - absEtaShift_));
77  }
78  int abs_eta_at_vtx = mu.hwEtaAtVtx();
79  if (abs_eta_at_vtx < 0) {
80  abs_eta_at_vtx += (1 << (etaAtVtxSignShift_ - absEtaAtVtxShift_));
81  }
82  raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_ | (mu.hwQual() & qualMask_) << qualShift_ |
83  (abs_eta_at_vtx & absEtaMask_) << absEtaAtVtxShift_ | (mu.hwEtaAtVtx() < 0) << etaAtVtxSignShift_ |
84  (mu.hwPhiAtVtx() & phiMask_) << phiAtVtxShift_;
85 
86  raw_data_32_63 = mu.hwCharge() << chargeShift_ | mu.hwChargeValid() << chargeValidShift_ |
87  (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (mu.hwIso() & isoMask_) << isoShift_ |
88  (abs_eta & absEtaMask_) << absEtaShift_ | (mu.hwEta() < 0) << etaSignShift_ |
89  (mu.hwPhi() & phiMask_) << phiShift_;
90 }

References amptDefaultParameters_cff::mu.

Referenced by l1t::stage2::MuonPacker::pack().

Member Data Documentation

◆ absEtaAtVtxShift_

const unsigned l1t::MuonRawDigiTranslator::absEtaAtVtxShift_ = 23
static

Definition at line 21 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ absEtaMask_

const unsigned l1t::MuonRawDigiTranslator::absEtaMask_ = 0xFF
static

Definition at line 19 of file MuonRawDigiTranslator.h.

◆ absEtaShift_

const unsigned l1t::MuonRawDigiTranslator::absEtaShift_ = 21
static

Definition at line 20 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ chargeShift_

const unsigned l1t::MuonRawDigiTranslator::chargeShift_ = 2
static

Definition at line 27 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ chargeValidShift_

const unsigned l1t::MuonRawDigiTranslator::chargeValidShift_ = 3
static

Definition at line 28 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ etaAtVtxSignShift_

const unsigned l1t::MuonRawDigiTranslator::etaAtVtxSignShift_ = 31
static

Definition at line 23 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ etaSignShift_

const unsigned l1t::MuonRawDigiTranslator::etaSignShift_ = 29
static

Definition at line 22 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ isoMask_

const unsigned l1t::MuonRawDigiTranslator::isoMask_ = 0x3
static

Definition at line 31 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ isoShift_

const unsigned l1t::MuonRawDigiTranslator::isoShift_ = 0
static

Definition at line 32 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ phiAtVtxShift_

const unsigned l1t::MuonRawDigiTranslator::phiAtVtxShift_ = 0
static

Definition at line 26 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ phiMask_

const unsigned l1t::MuonRawDigiTranslator::phiMask_ = 0x3FF
static

Definition at line 24 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ phiShift_

const unsigned l1t::MuonRawDigiTranslator::phiShift_ = 11
static

Definition at line 25 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ ptMask_

const unsigned l1t::MuonRawDigiTranslator::ptMask_ = 0x1FF
static

◆ ptShift_

const unsigned l1t::MuonRawDigiTranslator::ptShift_ = 10
static

◆ qualMask_

const unsigned l1t::MuonRawDigiTranslator::qualMask_ = 0xF
static

Definition at line 17 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ qualShift_

const unsigned l1t::MuonRawDigiTranslator::qualShift_ = 19
static

Definition at line 18 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ tfMuonIndexMask_

const unsigned l1t::MuonRawDigiTranslator::tfMuonIndexMask_ = 0x7F
static

Definition at line 29 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ tfMuonIndexShift_

const unsigned l1t::MuonRawDigiTranslator::tfMuonIndexShift_ = 4
static

Definition at line 30 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

l1t::MuonRawDigiTranslator::absEtaShift_
static const unsigned absEtaShift_
Definition: MuonRawDigiTranslator.h:20
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
l1t::MuonRawDigiTranslator::ptShift_
static const unsigned ptShift_
Definition: MuonRawDigiTranslator.h:16
l1t::MuonRawDigiTranslator::chargeShift_
static const unsigned chargeShift_
Definition: MuonRawDigiTranslator.h:27
Muon
Definition: Muon.py:1
l1t::MuonRawDigiTranslator::generatePackedDataWords
static void generatePackedDataWords(const Muon &, uint32_t &, uint32_t &)
Definition: MuonRawDigiTranslator.cc:71
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
l1t::MuonRawDigiTranslator::fillMuon
static void fillMuon(Muon &, uint32_t, uint32_t, int, unsigned int)
Definition: MuonRawDigiTranslator.cc:4
l1t::MuonRawDigiTranslator::phiAtVtxShift_
static const unsigned phiAtVtxShift_
Definition: MuonRawDigiTranslator.h:26
HLT_2018_cff.dPhi
dPhi
Definition: HLT_2018_cff.py:12290
l1t::MuonRawDigiTranslator::qualMask_
static const unsigned qualMask_
Definition: MuonRawDigiTranslator.h:17
l1t::MuonRawDigiTranslator::isoMask_
static const unsigned isoMask_
Definition: MuonRawDigiTranslator.h:31
l1t::MuonRawDigiTranslator::etaAtVtxSignShift_
static const unsigned etaAtVtxSignShift_
Definition: MuonRawDigiTranslator.h:23
fw
Definition: estimate_field.h:12
l1t::MuonRawDigiTranslator::ptMask_
static const unsigned ptMask_
Definition: MuonRawDigiTranslator.h:15
l1t::MuonRawDigiTranslator::phiMask_
static const unsigned phiMask_
Definition: MuonRawDigiTranslator.h:24
l1t::MuonRawDigiTranslator::isoShift_
static const unsigned isoShift_
Definition: MuonRawDigiTranslator.h:32
l1t::MuonRawDigiTranslator::tfMuonIndexShift_
static const unsigned tfMuonIndexShift_
Definition: MuonRawDigiTranslator.h:30
l1t::MuonRawDigiTranslator::absEtaAtVtxShift_
static const unsigned absEtaAtVtxShift_
Definition: MuonRawDigiTranslator.h:21
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
l1t::MuonRawDigiTranslator::etaSignShift_
static const unsigned etaSignShift_
Definition: MuonRawDigiTranslator.h:22
math::PtEtaPhiMLorentzVector
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
l1t::MuonRawDigiTranslator::calcHwEta
static int calcHwEta(const uint32_t &, const unsigned, const unsigned)
Definition: MuonRawDigiTranslator.cc:100
l1t::MuonRawDigiTranslator::qualShift_
static const unsigned qualShift_
Definition: MuonRawDigiTranslator.h:18
l1t::MuonRawDigiTranslator::chargeValidShift_
static const unsigned chargeValidShift_
Definition: MuonRawDigiTranslator.h:28
l1t::MuonRawDigiTranslator::phiShift_
static const unsigned phiShift_
Definition: MuonRawDigiTranslator.h:25
l1t::MuonRawDigiTranslator::tfMuonIndexMask_
static const unsigned tfMuonIndexMask_
Definition: MuonRawDigiTranslator.h:29
l1t::MuonRawDigiTranslator::absEtaMask_
static const unsigned absEtaMask_
Definition: MuonRawDigiTranslator.h:19