CMS 3D CMS Logo

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

#include <MuonRawDigiTranslator.h>

Static Public Member Functions

static int calcHwEta (const uint32_t &raw, unsigned absEtaShift, unsigned etaSignShift)
 
static void fillIntermediateMuon (Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int fw)
 
static void fillMuon (Muon &mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int fed, int fw, int muInBx)
 
static void fillMuon (Muon &mu, uint32_t raw_data_spare, uint64_t dataword, int fed, int fw, int muInBx)
 
static void generate64bitDataWord (const Muon &mu, uint32_t &raw_data_spare, uint64_t &dataword, int fedId, int fwId, int muInBx)
 
static void generatePackedMuonDataWords (const Muon &mu, uint32_t &raw_data_spare, uint32_t &raw_data_00_31, uint32_t &raw_data_32_63, int fedId, int fwId, int muInBx)
 
static std::array< std::array< uint32_t, 4 >, 2 > getPackedShowerDataWords (const MuonShower &shower, int fedId, int fwId)
 
static bool showerFired (uint32_t shower_word, int fedId, int fwId)
 

Static Public Attributes

static constexpr unsigned absEtaAtVtxShift_ = 23
 
static constexpr unsigned absEtaMask_ = 0xFF
 
static constexpr unsigned absEtaMu1Shift_ = 13
 
static constexpr unsigned absEtaMu2Shift_ = 22
 
static constexpr unsigned absEtaShift_ = 21
 
static constexpr unsigned chargeShift_ = 2
 
static constexpr unsigned chargeValidShift_ = 3
 
static constexpr unsigned dxyMask_ = 0x3
 
static constexpr unsigned dxyShift_ = 30
 
static constexpr unsigned etaAtVtxSignShift_ = 31
 
static constexpr unsigned etaMu1SignShift_ = 21
 
static constexpr unsigned etaMu2SignShift_ = 30
 
static constexpr unsigned etaSignShift_ = 29
 
static constexpr unsigned isoMask_ = 0x3
 
static constexpr unsigned isoShift_ = 0
 
static constexpr int kUgmtFedId = 1402
 
static constexpr int kUgmtFwVersionFirstWithShowers = 0x7000000
 
static constexpr int kUgmtFwVersionRun3Start = 0x6000001
 
static constexpr int kUgmtFwVersionShowersFrom2023 = 0x8000000
 
static constexpr int kUgmtFwVersionUntil2016 = 0x4010000
 
static constexpr int kUgmtFwVersionUntil2017 = 0x6000000
 
static constexpr int kUgtFedId = 1404
 
static constexpr int kUgtFwVersionFirstWithShowers = 0x113B
 
static constexpr int kUgtFwVersionShowersFrom2023 = 0x1150
 
static constexpr int kUgtFwVersionUntil2016 = 0x10A6
 
static constexpr int kUgtFwVersionUntil2017 = 0x1120
 
static constexpr int kUgtFwVersionUntilRun3Start = 0x1130
 
static constexpr unsigned phiAtVtxShift_ = 0
 
static constexpr unsigned phiMask_ = 0x3FF
 
static constexpr unsigned phiShift_ = 11
 
static constexpr unsigned ptMask_ = 0x1FF
 
static constexpr unsigned ptShift_ = 10
 
static constexpr unsigned ptUnconstrainedIntermedidateShift_ = 0
 
static constexpr unsigned ptUnconstrainedMask_ = 0xFF
 
static constexpr unsigned ptUnconstrainedShift_ = 21
 
static constexpr unsigned qualMask_ = 0xF
 
static constexpr unsigned qualShift_ = 19
 
static constexpr unsigned showerShift_ = 29
 
static constexpr unsigned tfMuonIndexMask_ = 0x7F
 
static constexpr unsigned tfMuonIndexShift_ = 4
 

Static Private Member Functions

static void fillIntermediateMuonQuantitiesRun3 (Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
 
static void fillMuonCoordinates2016 (Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
 
static void fillMuonCoordinatesFrom2017 (Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
 
static void fillMuonQuantitiesRun3 (Muon &mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx, bool wasSpecialMWGR=false)
 
static void fillMuonStableQuantities (Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
 
static void generatePackedMuonDataWordsRun3 (const Muon &mu, int abs_eta, int abs_eta_at_vtx, uint32_t &raw_data_spare, uint32_t &raw_data_00_31, uint32_t &raw_data_32_63, int muInBx, bool wasSpecialMWGR=false)
 

Detailed Description

Definition at line 10 of file MuonRawDigiTranslator.h.

Member Function Documentation

◆ calcHwEta()

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

Definition at line 289 of file MuonRawDigiTranslator.cc.

291  {
292  // eta is coded as two's complement
293  int abs_eta = (raw >> absEtaShift) & absEtaMask_;
294  if ((raw >> etaSignShift) & 0x1) {
295  return abs_eta - (1 << (etaSignShift - absEtaShift));
296  } else {
297  return abs_eta;
298  }
299 }
static constexpr unsigned absEtaMask_

◆ fillIntermediateMuon()

void l1t::MuonRawDigiTranslator::fillIntermediateMuon ( Muon mu,
uint32_t  raw_data_00_31,
uint32_t  raw_data_32_63,
int  fw 
)
static

Definition at line 32 of file MuonRawDigiTranslator.cc.

References amptDefaultParameters_cff::mu.

Referenced by l1t::stage2::IntermediateMuonUnpacker::unpackBx().

35  {
36  // Need the hw charge to properly compute dPhi
37  mu.setHwCharge((raw_data_32_63 >> chargeShift_) & 0x1);
38 
40  fillMuonCoordinates2016(mu, raw_data_00_31, raw_data_32_63);
41  } else if (fw < kUgmtFwVersionUntil2017) {
42  fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63);
43  } else {
44  fillIntermediateMuonQuantitiesRun3(mu, raw_data_00_31, raw_data_32_63);
45  }
46 
47  // Fill pT, qual, iso, charge, index bits, phys. coordinates at vtx & unconstrained pT
48  fillMuonStableQuantities(mu, raw_data_00_31, raw_data_32_63);
49 }
static void fillIntermediateMuonQuantitiesRun3(Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
static constexpr int kUgmtFwVersionUntil2016
static constexpr unsigned chargeShift_
static void fillMuonStableQuantities(Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
static void fillMuonCoordinatesFrom2017(Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
static void fillMuonCoordinates2016(Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
static constexpr int kUgmtFwVersionUntil2017

◆ fillIntermediateMuonQuantitiesRun3()

void l1t::MuonRawDigiTranslator::fillIntermediateMuonQuantitiesRun3 ( Muon mu,
uint32_t  raw_data_00_31,
uint32_t  raw_data_32_63 
)
staticprivate

Definition at line 166 of file MuonRawDigiTranslator.cc.

References amptDefaultParameters_cff::mu.

168  {
169  fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63);
170 
171  // displacement information
172  mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_);
173  mu.setHwPtUnconstrained((raw_data_00_31 >> ptUnconstrainedIntermedidateShift_) & ptUnconstrainedMask_);
174 }
static constexpr unsigned dxyMask_
static constexpr unsigned ptUnconstrainedMask_
static constexpr unsigned ptUnconstrainedIntermedidateShift_
static constexpr unsigned dxyShift_
static void fillMuonCoordinatesFrom2017(Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)

◆ fillMuon() [1/2]

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

Definition at line 5 of file MuonRawDigiTranslator.cc.

References chargeShift_, fillMuonCoordinates2016(), fillMuonCoordinatesFrom2017(), fillMuonQuantitiesRun3(), fillMuonStableQuantities(), kUgmtFedId, kUgmtFwVersionRun3Start, kUgmtFwVersionUntil2016, kUgmtFwVersionUntil2017, kUgtFedId, kUgtFwVersionUntil2016, kUgtFwVersionUntil2017, kUgtFwVersionUntilRun3Start, and amptDefaultParameters_cff::mu.

Referenced by l1t::stage2::MuonUnpacker::unpackBx().

6  {
7  // Need the hw charge to properly compute dPhi
8  mu.setHwCharge((raw_data_32_63 >> chargeShift_) & 0x1);
9 
10  // The position of the eta and phi coordinates in the RAW data changed between the 2016 run and the 2017 run.
11  // Eta and phi at the muon system are replaced by eta and phi at the vertex
12  // Eta and phi at the muon system are moved to spare bits
13  // In Run-3 we have displacement information.
14  // To make room for these data the raw eta value was moved to the second "spare" word which we will have to treat separately
15  // The uGMT (FED 1402) or uGT (FED 1404) FW versions are used to determine the era.
16  if ((fed == kUgmtFedId && fw < kUgmtFwVersionUntil2016) || (fed == kUgtFedId && fw < kUgtFwVersionUntil2016)) {
17  fillMuonCoordinates2016(mu, raw_data_00_31, raw_data_32_63);
18  } else if ((fed == kUgmtFedId && fw < kUgmtFwVersionUntil2017) || (fed == kUgtFedId && fw < kUgtFwVersionUntil2017)) {
19  fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63);
20  } else if ((fed == kUgmtFedId && fw == kUgmtFwVersionRun3Start) ||
22  // We're unpacking data from the November MWGR where the raw eta values were shifted by one bit.
23  fillMuonQuantitiesRun3(mu, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx, true);
24  } else {
25  fillMuonQuantitiesRun3(mu, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx, false);
26  }
27 
28  // Fill pT, qual, iso, charge, index bits, coordinates at vtx
29  fillMuonStableQuantities(mu, raw_data_00_31, raw_data_32_63);
30 }
static constexpr int kUgtFwVersionUntil2016
static void fillMuonQuantitiesRun3(Muon &mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx, bool wasSpecialMWGR=false)
static constexpr int kUgtFwVersionUntil2017
static constexpr int kUgmtFedId
static constexpr int kUgmtFwVersionRun3Start
static constexpr int kUgmtFwVersionUntil2016
static constexpr int kUgtFedId
static constexpr unsigned chargeShift_
static void fillMuonStableQuantities(Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
static void fillMuonCoordinatesFrom2017(Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
static void fillMuonCoordinates2016(Muon &mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63)
static constexpr int kUgtFwVersionUntilRun3Start
static constexpr int kUgmtFwVersionUntil2017

◆ fillMuon() [2/2]

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

Definition at line 79 of file MuonRawDigiTranslator.cc.

References amptDefaultParameters_cff::mu.

80  {
81  fillMuon(
82  mu, raw_data_spare, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), fed, fw, muInBx);
83 }
static void fillMuon(Muon &mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int fed, int fw, int muInBx)

◆ fillMuonCoordinates2016()

void l1t::MuonRawDigiTranslator::fillMuonCoordinates2016 ( Muon mu,
uint32_t  raw_data_00_31,
uint32_t  raw_data_32_63 
)
staticprivate

Definition at line 85 of file MuonRawDigiTranslator.cc.

References amptDefaultParameters_cff::mu.

Referenced by fillMuon().

85  {
86  // coordinates at the muon system are in 2016 where in 2017 eta and phi at the vertex are
87  mu.setHwEta(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_));
88  mu.setHwPhi((raw_data_00_31 >> phiAtVtxShift_) & phiMask_);
89 
90  // set the coordiantes at vertex to be the same as the coordinates at the muon system
91  mu.setHwEtaAtVtx(mu.hwEta());
92  mu.setHwPhiAtVtx(mu.hwPhi());
93  // deltas are 0
94  mu.setHwDEtaExtra(0);
95  mu.setHwDPhiExtra(0);
96 }
static constexpr unsigned absEtaAtVtxShift_
static int calcHwEta(const uint32_t &raw, unsigned absEtaShift, unsigned etaSignShift)
static constexpr unsigned etaAtVtxSignShift_
static constexpr unsigned phiAtVtxShift_
static constexpr unsigned phiMask_

◆ fillMuonCoordinatesFrom2017()

void l1t::MuonRawDigiTranslator::fillMuonCoordinatesFrom2017 ( Muon mu,
uint32_t  raw_data_00_31,
uint32_t  raw_data_32_63 
)
staticprivate

Definition at line 98 of file MuonRawDigiTranslator.cc.

References amptDefaultParameters_cff::mu.

Referenced by fillMuon().

100  {
101  // coordinates at the muon system
102  mu.setHwEta(calcHwEta(raw_data_32_63, absEtaShift_, etaSignShift_));
103  mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_);
104 
105  // coordinates at the vertex
106  mu.setHwEtaAtVtx(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_));
107  mu.setHwPhiAtVtx((raw_data_00_31 >> phiAtVtxShift_) & phiMask_);
108  // deltas
109  mu.setHwDEtaExtra(mu.hwEtaAtVtx() - mu.hwEta());
110  int dPhi = mu.hwPhiAtVtx() - mu.hwPhi();
111  if (mu.hwCharge() == 1 && dPhi > 0) {
112  dPhi -= 576;
113  } else if (mu.hwCharge() == 0 && dPhi < 0) {
114  dPhi += 576;
115  }
116  mu.setHwDPhiExtra(dPhi);
117 }
static constexpr unsigned absEtaAtVtxShift_
static int calcHwEta(const uint32_t &raw, unsigned absEtaShift, unsigned etaSignShift)
static constexpr unsigned etaAtVtxSignShift_
static constexpr unsigned phiAtVtxShift_
static constexpr unsigned etaSignShift_
static constexpr unsigned phiShift_
static constexpr unsigned phiMask_
static constexpr unsigned absEtaShift_

◆ fillMuonQuantitiesRun3()

void l1t::MuonRawDigiTranslator::fillMuonQuantitiesRun3 ( Muon mu,
uint32_t  raw_data_spare,
uint32_t  raw_data_00_31,
uint32_t  raw_data_32_63,
int  muInBx,
bool  wasSpecialMWGR = false 
)
staticprivate

Definition at line 119 of file MuonRawDigiTranslator.cc.

References amptDefaultParameters_cff::mu.

Referenced by fillMuon().

124  {
125  unsigned absEtaMu1Shift{absEtaMu1Shift_};
126  unsigned etaMu1SignShift{etaMu1SignShift_};
127  unsigned absEtaMu2Shift{absEtaMu2Shift_};
128  unsigned etaMu2SignShift{etaMu2SignShift_};
129 
130  // Adjust if we're unpacking data from the November 2020 MWGR.
131  if (wasSpecialMWGR) {
132  --absEtaMu1Shift;
133  --etaMu1SignShift;
134  --absEtaMu2Shift;
135  --etaMu2SignShift;
136  }
137  // coordinates at the muon system
138  // Where to find the raw eta depends on which muon we're looking at
139  if (muInBx == 1) {
140  mu.setHwEta(calcHwEta(raw_data_spare, absEtaMu1Shift, etaMu1SignShift));
141  } else if (muInBx == 2) {
142  mu.setHwEta(calcHwEta(raw_data_spare, absEtaMu2Shift, etaMu2SignShift));
143  } else {
144  edm::LogWarning("L1T") << "Received invalid muon id " << muInBx << ". Cannot fill eta value in the muon system.";
145  }
146  mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_);
147 
148  // coordinates at the vertex
149  mu.setHwEtaAtVtx(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_));
150  mu.setHwPhiAtVtx((raw_data_00_31 >> phiAtVtxShift_) & phiMask_);
151  // deltas
152  mu.setHwDEtaExtra(mu.hwEtaAtVtx() - mu.hwEta());
153  int dPhi = mu.hwPhiAtVtx() - mu.hwPhi();
154  if (mu.hwCharge() == 1 && dPhi > 0) {
155  dPhi -= 576;
156  } else if (mu.hwCharge() == 0 && dPhi < 0) {
157  dPhi += 576;
158  }
159  mu.setHwDPhiExtra(dPhi);
160 
161  // displacement information
162  mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_);
163  mu.setHwPtUnconstrained((raw_data_32_63 >> ptUnconstrainedShift_) & ptUnconstrainedMask_);
164 }
static constexpr unsigned dxyMask_
static constexpr unsigned absEtaAtVtxShift_
static int calcHwEta(const uint32_t &raw, unsigned absEtaShift, unsigned etaSignShift)
static constexpr unsigned etaMu2SignShift_
static constexpr unsigned ptUnconstrainedMask_
static constexpr unsigned etaMu1SignShift_
static constexpr unsigned absEtaMu1Shift_
static constexpr unsigned etaAtVtxSignShift_
static constexpr unsigned phiAtVtxShift_
static constexpr unsigned dxyShift_
static constexpr unsigned phiShift_
static constexpr unsigned phiMask_
static constexpr unsigned absEtaMu2Shift_
Log< level::Warning, false > LogWarning
static constexpr unsigned ptUnconstrainedShift_

◆ fillMuonStableQuantities()

void l1t::MuonRawDigiTranslator::fillMuonStableQuantities ( Muon mu,
uint32_t  raw_data_00_31,
uint32_t  raw_data_32_63 
)
staticprivate

Definition at line 51 of file MuonRawDigiTranslator.cc.

References reco::LeafCandidate::eta(), l1trig_cff::hwPtUnconstrained, amptDefaultParameters_cff::mu, reco::LeafCandidate::phi(), and reco::LeafCandidate::setP4().

Referenced by fillMuon().

51  {
52  mu.setHwPt((raw_data_00_31 >> ptShift_) & ptMask_);
53  mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_);
54  mu.setHwIso((raw_data_32_63 >> isoShift_) & isoMask_);
55  // charge is coded as -1^chargeBit
56  mu.setHwChargeValid((raw_data_32_63 >> chargeValidShift_) & 0x1);
57  mu.setTfMuonIndex((raw_data_32_63 >> tfMuonIndexShift_) & tfMuonIndexMask_);
58  if (mu.hwChargeValid()) {
59  mu.setCharge(1 - 2 * mu.hwCharge());
60  } else {
61  mu.setCharge(0);
62  }
63 
64  math::PtEtaPhiMLorentzVector vec{(mu.hwPt() - 1) * 0.5, mu.hwEta() * 0.010875, mu.hwPhi() * 0.010908, 0.0};
65  mu.setP4(vec);
66  // generate a muon at the vertex to extract the physical eta and phi coordinates
68  (mu.hwPt() - 1) * 0.5, mu.hwEtaAtVtx() * 0.010875, mu.hwPhiAtVtx() * 0.010908, 0.0};
69  Muon muAtVtx;
70  muAtVtx.setP4(vecAtVtx);
71  mu.setEtaAtVtx(muAtVtx.eta());
72  mu.setPhiAtVtx(muAtVtx.phi());
73 
74  int hwPtUnconstrained{mu.hwPtUnconstrained()};
75  mu.setPtUnconstrained(
76  hwPtUnconstrained == 0 ? 0 : (hwPtUnconstrained - 1)); // Don't want negative pT, unconstr. pT has LSB of 1 GeV.
77 }
static constexpr unsigned tfMuonIndexShift_
static constexpr unsigned isoShift_
static constexpr unsigned qualMask_
static constexpr unsigned isoMask_
static constexpr unsigned qualShift_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
Definition: Muon.py:1
static constexpr unsigned chargeValidShift_
static constexpr unsigned ptShift_
static constexpr unsigned ptMask_
static constexpr unsigned tfMuonIndexMask_

◆ generate64bitDataWord()

void l1t::MuonRawDigiTranslator::generate64bitDataWord ( const Muon mu,
uint32_t &  raw_data_spare,
uint64_t &  dataword,
int  fedId,
int  fwId,
int  muInBx 
)
static

Definition at line 256 of file MuonRawDigiTranslator.cc.

References l1tstage2_dqm_sourceclient-live_cfg::fedId, and amptDefaultParameters_cff::mu.

257  {
258  uint32_t lsw;
259  uint32_t msw;
260 
261  generatePackedMuonDataWords(mu, raw_data_spare, lsw, msw, fedId, fwId, muInBx);
262  dataword = (((uint64_t)msw) << 32) + lsw;
263 }
static void generatePackedMuonDataWords(const Muon &mu, uint32_t &raw_data_spare, uint32_t &raw_data_00_31, uint32_t &raw_data_32_63, int fedId, int fwId, int muInBx)
unsigned long long uint64_t
Definition: Time.h:13

◆ generatePackedMuonDataWords()

void l1t::MuonRawDigiTranslator::generatePackedMuonDataWords ( const Muon mu,
uint32_t &  raw_data_spare,
uint32_t &  raw_data_00_31,
uint32_t &  raw_data_32_63,
int  fedId,
int  fwId,
int  muInBx 
)
static

Definition at line 176 of file MuonRawDigiTranslator.cc.

References amptDefaultParameters_cff::mu.

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

182  {
183  int abs_eta = mu.hwEta();
184  if (abs_eta < 0) {
185  abs_eta += (1 << (etaSignShift_ - absEtaShift_));
186  }
187  int abs_eta_at_vtx = mu.hwEtaAtVtx();
188  if (abs_eta_at_vtx < 0) {
189  abs_eta_at_vtx += (1 << (etaAtVtxSignShift_ - absEtaAtVtxShift_));
190  }
191  if ((fedID == kUgmtFedId && fwID < kUgmtFwVersionUntil2016) ||
192  (fedID == kUgtFedId && fwID < kUgtFwVersionUntil2016)) {
193  // For 2016 the non-extrapolated coordiantes were in the place that are now occupied by the extrapolated quantities.
194  raw_data_spare = 0;
195  raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_ | (mu.hwQual() & qualMask_) << qualShift_ |
196  (abs_eta & absEtaMask_) << absEtaAtVtxShift_ | (mu.hwEta() < 0) << etaAtVtxSignShift_ |
197  (mu.hwPhi() & phiMask_) << phiAtVtxShift_;
198  raw_data_32_63 = mu.hwCharge() << chargeShift_ | mu.hwChargeValid() << chargeValidShift_ |
199  (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (mu.hwIso() & isoMask_) << isoShift_;
200  } else if ((fedID == kUgmtFedId && fwID < kUgmtFwVersionUntil2017) ||
201  (fedID == kUgtFedId && fwID < kUgtFwVersionUntil2017)) {
202  raw_data_spare = 0;
203  raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_ | (mu.hwQual() & qualMask_) << qualShift_ |
204  (abs_eta_at_vtx & absEtaMask_) << absEtaAtVtxShift_ | (mu.hwEtaAtVtx() < 0) << etaAtVtxSignShift_ |
205  (mu.hwPhiAtVtx() & phiMask_) << phiAtVtxShift_;
206 
207  raw_data_32_63 = mu.hwCharge() << chargeShift_ | mu.hwChargeValid() << chargeValidShift_ |
208  (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (mu.hwIso() & isoMask_) << isoShift_ |
209  (abs_eta & absEtaMask_) << absEtaShift_ | (mu.hwEta() < 0) << etaSignShift_ |
210  (mu.hwPhi() & phiMask_) << phiShift_;
211  } else if ((fedID == kUgmtFedId && fwID == kUgmtFwVersionRun3Start) ||
212  (fedID == kUgtFedId &&
213  fwID < kUgtFwVersionUntilRun3Start)) { // This allows us to unpack data taken in the November 2020 MWGR.
215  mu, abs_eta, abs_eta_at_vtx, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx, true);
216  } else {
218  mu, abs_eta, abs_eta_at_vtx, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx, false);
219  }
220 }
static constexpr int kUgtFwVersionUntil2016
static constexpr int kUgtFwVersionUntil2017
static constexpr unsigned tfMuonIndexShift_
static constexpr unsigned isoShift_
static constexpr unsigned absEtaAtVtxShift_
static constexpr int kUgmtFedId
static constexpr unsigned qualMask_
static constexpr unsigned isoMask_
static constexpr unsigned qualShift_
static constexpr int kUgmtFwVersionRun3Start
static constexpr int kUgmtFwVersionUntil2016
static constexpr int kUgtFedId
static constexpr unsigned etaAtVtxSignShift_
static constexpr unsigned chargeValidShift_
static constexpr unsigned phiAtVtxShift_
static constexpr unsigned ptShift_
static constexpr unsigned chargeShift_
static constexpr unsigned etaSignShift_
static constexpr unsigned phiShift_
static constexpr unsigned phiMask_
static constexpr unsigned absEtaShift_
static constexpr unsigned absEtaMask_
static void generatePackedMuonDataWordsRun3(const Muon &mu, int abs_eta, int abs_eta_at_vtx, uint32_t &raw_data_spare, uint32_t &raw_data_00_31, uint32_t &raw_data_32_63, int muInBx, bool wasSpecialMWGR=false)
static constexpr int kUgtFwVersionUntilRun3Start
static constexpr unsigned ptMask_
static constexpr int kUgmtFwVersionUntil2017
static constexpr unsigned tfMuonIndexMask_

◆ generatePackedMuonDataWordsRun3()

void l1t::MuonRawDigiTranslator::generatePackedMuonDataWordsRun3 ( const Muon mu,
int  abs_eta,
int  abs_eta_at_vtx,
uint32_t &  raw_data_spare,
uint32_t &  raw_data_00_31,
uint32_t &  raw_data_32_63,
int  muInBx,
bool  wasSpecialMWGR = false 
)
staticprivate

Definition at line 222 of file MuonRawDigiTranslator.cc.

References amptDefaultParameters_cff::mu.

229  {
230  int absEtaShiftRun3{0}, etaSignShiftRun3{0};
231  if (muInBx == 1) {
232  absEtaShiftRun3 = absEtaMu1Shift_;
233  etaSignShiftRun3 = etaMu1SignShift_;
234  } else if (muInBx == 2) {
235  absEtaShiftRun3 = absEtaMu2Shift_;
236  etaSignShiftRun3 = etaMu2SignShift_;
237  }
238 
239  // Adjust if we're packing the November 2020 MWGR
240  if (wasSpecialMWGR && (muInBx == 1 || muInBx == 2)) {
241  --absEtaShiftRun3;
242  --etaSignShiftRun3;
243  }
244 
245  raw_data_spare = (abs_eta & absEtaMask_) << absEtaShiftRun3 | (mu.hwEta() < 0) << etaSignShiftRun3;
246  raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_ | (mu.hwQual() & qualMask_) << qualShift_ |
247  (abs_eta_at_vtx & absEtaMask_) << absEtaAtVtxShift_ | (mu.hwEtaAtVtx() < 0) << etaAtVtxSignShift_ |
248  (mu.hwPhiAtVtx() & phiMask_) << phiAtVtxShift_;
249  raw_data_32_63 = mu.hwCharge() << chargeShift_ | mu.hwChargeValid() << chargeValidShift_ |
250  (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (mu.hwIso() & isoMask_) << isoShift_ |
251  (mu.hwPhi() & phiMask_) << phiShift_ |
252  (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << ptUnconstrainedShift_ |
253  (mu.hwDXY() & dxyMask_) << dxyShift_;
254 }
static constexpr unsigned dxyMask_
static constexpr unsigned tfMuonIndexShift_
static constexpr unsigned isoShift_
static constexpr unsigned absEtaAtVtxShift_
static constexpr unsigned qualMask_
static constexpr unsigned isoMask_
static constexpr unsigned qualShift_
static constexpr unsigned etaMu2SignShift_
static constexpr unsigned ptUnconstrainedMask_
static constexpr unsigned etaMu1SignShift_
static constexpr unsigned absEtaMu1Shift_
static constexpr unsigned etaAtVtxSignShift_
static constexpr unsigned chargeValidShift_
static constexpr unsigned phiAtVtxShift_
static constexpr unsigned ptShift_
static constexpr unsigned chargeShift_
static constexpr unsigned dxyShift_
static constexpr unsigned phiShift_
static constexpr unsigned phiMask_
static constexpr unsigned absEtaMu2Shift_
static constexpr unsigned absEtaMask_
static constexpr unsigned ptUnconstrainedShift_
static constexpr unsigned ptMask_
static constexpr unsigned tfMuonIndexMask_

◆ getPackedShowerDataWords()

std::array< std::array< uint32_t, 4 >, 2 > l1t::MuonRawDigiTranslator::getPackedShowerDataWords ( const MuonShower shower,
int  fedId,
int  fwId 
)
static

Definition at line 273 of file MuonRawDigiTranslator.cc.

References l1tstage2_dqm_sourceclient-live_cfg::fedId, l1t::MuonShower::isOneNominalInTime(), l1t::MuonShower::isOneTightInTime(), and l1t::MuonShower::isTwoLooseDiffSectorsInTime().

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

275  {
276  std::array<std::array<uint32_t, 4>, 2> res{};
277  if ((fedId == kUgmtFedId && fwId >= kUgmtFwVersionFirstWithShowers) ||
279  res.at(0).at(0) = shower.isOneNominalInTime() ? (1 << showerShift_) : 0;
280  res.at(0).at(1) = shower.isOneTightInTime() ? (1 << showerShift_) : 0;
281  }
282  if ((fedId == kUgmtFedId && fwId >= kUgmtFwVersionShowersFrom2023) ||
283  (fedId == kUgtFedId && fwId >= kUgtFwVersionShowersFrom2023)) {
284  res.at(1).at(0) = shower.isTwoLooseDiffSectorsInTime() ? (1 << showerShift_) : 0;
285  }
286  return res;
287 }
static constexpr int kUgmtFedId
static constexpr int kUgmtFwVersionFirstWithShowers
Definition: Electron.h:6
static constexpr int kUgmtFwVersionShowersFrom2023
static constexpr int kUgtFedId
static constexpr int kUgtFwVersionFirstWithShowers
static constexpr int kUgtFwVersionShowersFrom2023
static constexpr unsigned showerShift_

◆ showerFired()

bool l1t::MuonRawDigiTranslator::showerFired ( uint32_t  shower_word,
int  fedId,
int  fwId 
)
static

Definition at line 265 of file MuonRawDigiTranslator.cc.

References l1tstage2_dqm_sourceclient-live_cfg::fedId.

Referenced by l1t::stage2::MuonUnpacker::unpackBx().

265  {
266  if ((fedId == kUgmtFedId && fwId >= kUgmtFwVersionFirstWithShowers) ||
268  return ((shower_word >> showerShift_) & 1) == 1;
269  }
270  return false;
271 }
static constexpr int kUgmtFedId
static constexpr int kUgmtFwVersionFirstWithShowers
static constexpr int kUgtFedId
static constexpr int kUgtFwVersionFirstWithShowers
static constexpr unsigned showerShift_

Member Data Documentation

◆ absEtaAtVtxShift_

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

Definition at line 42 of file MuonRawDigiTranslator.h.

◆ absEtaMask_

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

Definition at line 40 of file MuonRawDigiTranslator.h.

◆ absEtaMu1Shift_

constexpr unsigned l1t::MuonRawDigiTranslator::absEtaMu1Shift_ = 13
static

Definition at line 60 of file MuonRawDigiTranslator.h.

◆ absEtaMu2Shift_

constexpr unsigned l1t::MuonRawDigiTranslator::absEtaMu2Shift_ = 22
static

Definition at line 62 of file MuonRawDigiTranslator.h.

◆ absEtaShift_

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

Definition at line 41 of file MuonRawDigiTranslator.h.

◆ chargeShift_

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

Definition at line 48 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ chargeValidShift_

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

Definition at line 49 of file MuonRawDigiTranslator.h.

◆ dxyMask_

constexpr unsigned l1t::MuonRawDigiTranslator::dxyMask_ = 0x3
static

Definition at line 54 of file MuonRawDigiTranslator.h.

◆ dxyShift_

constexpr unsigned l1t::MuonRawDigiTranslator::dxyShift_ = 30
static

Definition at line 55 of file MuonRawDigiTranslator.h.

◆ etaAtVtxSignShift_

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

Definition at line 44 of file MuonRawDigiTranslator.h.

◆ etaMu1SignShift_

constexpr unsigned l1t::MuonRawDigiTranslator::etaMu1SignShift_ = 21
static

Definition at line 61 of file MuonRawDigiTranslator.h.

◆ etaMu2SignShift_

constexpr unsigned l1t::MuonRawDigiTranslator::etaMu2SignShift_ = 30
static

Definition at line 63 of file MuonRawDigiTranslator.h.

◆ etaSignShift_

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

Definition at line 43 of file MuonRawDigiTranslator.h.

◆ isoMask_

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

Definition at line 52 of file MuonRawDigiTranslator.h.

◆ isoShift_

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

Definition at line 53 of file MuonRawDigiTranslator.h.

◆ kUgmtFedId

constexpr int l1t::MuonRawDigiTranslator::kUgmtFedId = 1402
static

Definition at line 64 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ kUgmtFwVersionFirstWithShowers

constexpr int l1t::MuonRawDigiTranslator::kUgmtFwVersionFirstWithShowers = 0x7000000
static

Definition at line 72 of file MuonRawDigiTranslator.h.

◆ kUgmtFwVersionRun3Start

constexpr int l1t::MuonRawDigiTranslator::kUgmtFwVersionRun3Start = 0x6000001
static

Definition at line 70 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ kUgmtFwVersionShowersFrom2023

constexpr int l1t::MuonRawDigiTranslator::kUgmtFwVersionShowersFrom2023 = 0x8000000
static

Definition at line 74 of file MuonRawDigiTranslator.h.

◆ kUgmtFwVersionUntil2016

constexpr int l1t::MuonRawDigiTranslator::kUgmtFwVersionUntil2016 = 0x4010000
static

Definition at line 66 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ kUgmtFwVersionUntil2017

constexpr int l1t::MuonRawDigiTranslator::kUgmtFwVersionUntil2017 = 0x6000000
static

Definition at line 68 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ kUgtFedId

constexpr int l1t::MuonRawDigiTranslator::kUgtFedId = 1404
static

Definition at line 65 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ kUgtFwVersionFirstWithShowers

constexpr int l1t::MuonRawDigiTranslator::kUgtFwVersionFirstWithShowers = 0x113B
static

Definition at line 73 of file MuonRawDigiTranslator.h.

◆ kUgtFwVersionShowersFrom2023

constexpr int l1t::MuonRawDigiTranslator::kUgtFwVersionShowersFrom2023 = 0x1150
static

Definition at line 75 of file MuonRawDigiTranslator.h.

◆ kUgtFwVersionUntil2016

constexpr int l1t::MuonRawDigiTranslator::kUgtFwVersionUntil2016 = 0x10A6
static

Definition at line 67 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ kUgtFwVersionUntil2017

constexpr int l1t::MuonRawDigiTranslator::kUgtFwVersionUntil2017 = 0x1120
static

Definition at line 69 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ kUgtFwVersionUntilRun3Start

constexpr int l1t::MuonRawDigiTranslator::kUgtFwVersionUntilRun3Start = 0x1130
static

Definition at line 71 of file MuonRawDigiTranslator.h.

Referenced by fillMuon().

◆ phiAtVtxShift_

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

Definition at line 47 of file MuonRawDigiTranslator.h.

◆ phiMask_

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

Definition at line 45 of file MuonRawDigiTranslator.h.

◆ phiShift_

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

Definition at line 46 of file MuonRawDigiTranslator.h.

◆ ptMask_

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

◆ ptShift_

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

◆ ptUnconstrainedIntermedidateShift_

constexpr unsigned l1t::MuonRawDigiTranslator::ptUnconstrainedIntermedidateShift_ = 0
static

Definition at line 58 of file MuonRawDigiTranslator.h.

◆ ptUnconstrainedMask_

constexpr unsigned l1t::MuonRawDigiTranslator::ptUnconstrainedMask_ = 0xFF
static

Definition at line 56 of file MuonRawDigiTranslator.h.

◆ ptUnconstrainedShift_

constexpr unsigned l1t::MuonRawDigiTranslator::ptUnconstrainedShift_ = 21
static

Definition at line 57 of file MuonRawDigiTranslator.h.

◆ qualMask_

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

Definition at line 38 of file MuonRawDigiTranslator.h.

◆ qualShift_

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

Definition at line 39 of file MuonRawDigiTranslator.h.

◆ showerShift_

constexpr unsigned l1t::MuonRawDigiTranslator::showerShift_ = 29
static

Definition at line 59 of file MuonRawDigiTranslator.h.

◆ tfMuonIndexMask_

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

Definition at line 50 of file MuonRawDigiTranslator.h.

◆ tfMuonIndexShift_

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

Definition at line 51 of file MuonRawDigiTranslator.h.