6 uint32_t raw_data_spare,
7 uint32_t raw_data_00_31,
8 uint32_t raw_data_32_63,
21 if ((fed == 1402 &&
fw < 0x4010000) || (fed == 1404 &&
fw < 0x10A6)) {
23 }
else if ((fed == 1402 &&
fw < 0x6000000) || (fed == 1404 &&
fw < 0x1120)) {
34 uint32_t raw_data_00_31,
35 uint32_t raw_data_32_63,
38 mu.setHwCharge((raw_data_32_63 >> chargeShift_) & 0
x1);
41 fillMuonCoordinates2016(
mu, raw_data_00_31, raw_data_32_63);
42 }
else if (
fw < 0x6000000) {
43 fillMuonCoordinatesFrom2017(
mu, raw_data_00_31, raw_data_32_63);
45 fillIntermediateMuonQuantitiesRun3(
mu, raw_data_00_31, raw_data_32_63);
49 fillMuonStableQuantities(
mu, raw_data_00_31, raw_data_32_63);
53 mu.setHwPt((raw_data_00_31 >> ptShift_) & ptMask_);
54 mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_);
55 mu.setHwIso((raw_data_32_63 >> isoShift_) & isoMask_);
57 mu.setHwChargeValid((raw_data_32_63 >> chargeValidShift_) & 0
x1);
58 mu.setTfMuonIndex((raw_data_32_63 >> tfMuonIndexShift_) & tfMuonIndexMask_);
59 if (
mu.hwChargeValid()) {
60 mu.setCharge(1 - 2 *
mu.hwCharge());
69 (
mu.hwPt() - 1) * 0.5,
mu.hwEtaAtVtx() * 0.010875,
mu.hwPhiAtVtx() * 0.010908, 0.0};
71 muAtVtx.
setP4(vecAtVtx);
72 mu.setEtaAtVtx(muAtVtx.
eta());
73 mu.setPhiAtVtx(muAtVtx.
phi());
75 int hwPtUnconstrained{
mu.hwPtUnconstrained()};
76 mu.setPtUnconstrained(hwPtUnconstrained == 0 ? 0 : (hwPtUnconstrained - 1) * 0.5);
80 Muon&
mu, uint32_t raw_data_spare,
uint64_t dataword,
int fed,
unsigned int fw,
int muInBx) {
82 mu, raw_data_spare, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), fed,
fw, muInBx);
87 mu.setHwEta(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_));
88 mu.setHwPhi((raw_data_00_31 >> phiAtVtxShift_) & phiMask_);
91 mu.setHwEtaAtVtx(
mu.hwEta());
92 mu.setHwPhiAtVtx(
mu.hwPhi());
99 uint32_t raw_data_00_31,
100 uint32_t raw_data_32_63) {
102 mu.setHwEta(calcHwEta(raw_data_32_63, absEtaShift_, etaSignShift_));
103 mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_);
106 mu.setHwEtaAtVtx(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_));
107 mu.setHwPhiAtVtx((raw_data_00_31 >> phiAtVtxShift_) & phiMask_);
109 mu.setHwDEtaExtra(
mu.hwEtaAtVtx() -
mu.hwEta());
110 int dPhi =
mu.hwPhiAtVtx() -
mu.hwPhi();
111 if (
mu.hwCharge() == 1 &&
dPhi > 0) {
113 }
else if (
mu.hwCharge() == 0 &&
dPhi < 0) {
120 Muon&
mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63,
int muInBx) {
124 mu.setHwEta(calcHwEta(raw_data_spare, absEtaMu1Shift_, etaMu1SignShift_));
125 }
else if (muInBx == 2) {
126 mu.setHwEta(calcHwEta(raw_data_spare, absEtaMu2Shift_, etaMu2SignShift_));
128 edm::LogWarning(
"L1T") <<
"Received invalid muon id " << muInBx <<
". Cannot fill eta value in the muon system.";
130 mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_);
133 mu.setHwEtaAtVtx(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_));
134 mu.setHwPhiAtVtx((raw_data_00_31 >> phiAtVtxShift_) & phiMask_);
136 mu.setHwDEtaExtra(
mu.hwEtaAtVtx() -
mu.hwEta());
137 int dPhi =
mu.hwPhiAtVtx() -
mu.hwPhi();
138 if (
mu.hwCharge() == 1 &&
dPhi > 0) {
140 }
else if (
mu.hwCharge() == 0 &&
dPhi < 0) {
146 mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_);
147 mu.setHwPtUnconstrained((raw_data_32_63 >> ptUnconstrainedShift_) & ptUnconstrainedMask_);
151 uint32_t raw_data_00_31,
152 uint32_t raw_data_32_63) {
153 fillMuonCoordinatesFrom2017(
mu, raw_data_00_31, raw_data_32_63);
156 mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_);
157 mu.setHwPtUnconstrained((raw_data_00_31 >> ptUnconstrainedIntermedidateShift_) & ptUnconstrainedMask_);
161 uint32_t& raw_data_spare,
162 uint32_t& raw_data_00_31,
163 uint32_t& raw_data_32_63,
167 int abs_eta =
mu.hwEta();
169 abs_eta += (1 << (etaSignShift_ - absEtaShift_));
171 int abs_eta_at_vtx =
mu.hwEtaAtVtx();
172 if (abs_eta_at_vtx < 0) {
173 abs_eta_at_vtx += (1 << (etaAtVtxSignShift_ - absEtaAtVtxShift_));
175 if ((fedID == 1402 && fwID < 0x4010000) || (fedID == 1404 && fwID < 0x10A6)) {
178 raw_data_00_31 = (
mu.hwPt() & ptMask_) << ptShift_ | (
mu.hwQual() & qualMask_) << qualShift_ |
179 (abs_eta & absEtaMask_) << absEtaAtVtxShift_ | (
mu.hwEta() < 0) << etaAtVtxSignShift_ |
180 (
mu.hwPhi() & phiMask_) << phiAtVtxShift_;
181 raw_data_32_63 =
mu.hwCharge() << chargeShift_ |
mu.hwChargeValid() << chargeValidShift_ |
182 (
mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (
mu.hwIso() & isoMask_) << isoShift_;
183 }
else if ((fedID == 1402 && fwID < 0x6000000) || (fedID == 1404 && fwID < 0x1120)) {
185 raw_data_00_31 = (
mu.hwPt() & ptMask_) << ptShift_ | (
mu.hwQual() & qualMask_) << qualShift_ |
186 (abs_eta_at_vtx & absEtaMask_) << absEtaAtVtxShift_ | (
mu.hwEtaAtVtx() < 0) << etaAtVtxSignShift_ |
187 (
mu.hwPhiAtVtx() & phiMask_) << phiAtVtxShift_;
189 raw_data_32_63 =
mu.hwCharge() << chargeShift_ |
mu.hwChargeValid() << chargeValidShift_ |
190 (
mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (
mu.hwIso() & isoMask_) << isoShift_ |
191 (abs_eta & absEtaMask_) << absEtaShift_ | (
mu.hwEta() < 0) << etaSignShift_ |
192 (
mu.hwPhi() & phiMask_) << phiShift_;
194 int absEtaShiftRun3{0}, etaSignShiftRun3{0};
196 absEtaShiftRun3 = absEtaMu1Shift_;
197 etaSignShiftRun3 = etaMu1SignShift_;
198 }
else if (muInBx == 2) {
199 absEtaShiftRun3 = absEtaMu2Shift_;
200 etaSignShiftRun3 = etaMu2SignShift_;
202 raw_data_spare = (abs_eta & absEtaMask_) << absEtaShiftRun3 | (
mu.hwEta() < 0) << etaSignShiftRun3;
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 raw_data_32_63 =
mu.hwCharge() << chargeShift_ |
mu.hwChargeValid() << chargeValidShift_ |
207 (
mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (
mu.hwIso() & isoMask_) << isoShift_ |
208 (
mu.hwPhi() & phiMask_) << phiShift_ |
209 (
mu.hwPtUnconstrained() & ptUnconstrainedMask_) << ptUnconstrainedShift_ |
210 (
mu.hwDXY() & dxyMask_) << dxyShift_;
215 const Muon&
mu, uint32_t& raw_data_spare,
uint64_t& dataword,
int fedId,
int fwId,
int muInBx) {
219 generatePackedDataWords(
mu, raw_data_spare, lsw, msw,
fedId, fwId, muInBx);
220 dataword = (((
uint64_t)msw) << 32) + lsw;
224 const unsigned absEtaShift,
225 const unsigned etaSignShift) {
227 int abs_eta = (raw >> absEtaShift) & absEtaMask_;
228 if ((raw >> etaSignShift) & 0x1) {
229 return abs_eta - (1 << (etaSignShift - absEtaShift));