12 int board_id = (int)
board();
14 auto muonPhToken =
static_cast<const BMTFTokens*
>(toks)->getInputMuonTokenPh();
15 auto muonThToken =
static_cast<const BMTFTokens*
>(toks)->getInputMuonTokenTh();
20 event.getByToken(muonPhToken, phInputs);
22 event.getByToken(muonThToken, thInputs);
24 uint32_t qualEta_32bit = 0;
25 uint32_t posEta_0_32bit = 0;
26 uint32_t posEta_n2_32bit = 0, posEta_n1_32bit = 0;
27 uint32_t posEta_p2_32bit = 0, posEta_p1_32bit = 0;
29 bool moreBXeta =
false;
37 std::vector<uint32_t> payload_0(6, 0);
38 std::vector<uint32_t> payload_p1(6, 0);
39 std::vector<uint32_t> payload_n1(6, 0);
40 std::vector<uint32_t> payload_p2(6, 0);
41 std::vector<uint32_t> payload_n2(6, 0);
43 unsigned int block_id = 2 *
link;
45 std::vector<bool> bxPresent(5,
false);
46 bool moreBXphi =
false;
52 for (
const auto& iphi : *(phInputs->getContainer())) {
57 if (iphi.bxNum() != 0)
65 if (iphi.scNum() + 1 != board_id)
69 if (
link !=
ownLinks_[4 + 2 * (iphi.whNum()) + iphi.Ts2Tag()])
73 bxPresent[2 + iphi.bxNum()] =
true;
78 payload_n2[iphi.stNum() - 1] = word_32bit;
79 }
else if (bxPresent[1]) {
80 payload_n1[iphi.stNum() - 1] = word_32bit;
81 }
else if (bxPresent[2])
82 payload_0[iphi.stNum() - 1] = word_32bit;
83 else if (bxPresent[3]) {
84 payload_p1[iphi.stNum() - 1] = word_32bit;
85 }
else if (bxPresent[4]) {
86 payload_p2[iphi.stNum() - 1] = word_32bit;
89 bxPresent.assign(5,
false);
97 uint32_t phiNull_32bit = 0 | (BC & 0x3) << 30;
99 uint32_t etaNull_32bit = 0 | (BC & 0x3) << 30;
110 posEta_0_32bit = etaNull_32bit;
111 posEta_n2_32bit = etaNull_32bit;
112 posEta_n1_32bit = etaNull_32bit;
113 posEta_p2_32bit = etaNull_32bit;
114 posEta_p1_32bit = etaNull_32bit;
116 qualEta_32bit = etaNull_32bit;
118 int theta_iterators = 0;
119 for (
const auto& ithe : *(thInputs->getContainer())) {
124 if (ithe.bxNum() != 0)
134 if (ithe.scNum() + 1 != board_id)
140 bxPresent[2 + ithe.bxNum()] =
true;
147 qualEta_32bit = qualEta_32bit | ((qualEta_7bit & 0x7F) << 7 * (ithe.stNum() - 1));
151 payload_n2[4] = qualEta_32bit;
152 payload_n2[5] = etaNull_32bit | (2 & 0x2);
153 posEta_n2_32bit = posEta_n2_32bit | ((posEta_7bit & 0x7F) << 7 * (ithe.stNum() - 1));
154 }
else if (bxPresent[1]) {
155 payload_n1[4] = qualEta_32bit;
156 payload_n1[5] = etaNull_32bit | (2 & 0x2);
157 posEta_n1_32bit = posEta_n1_32bit | ((posEta_7bit & 0x7F) << 7 * (ithe.stNum() - 1));
158 }
else if (bxPresent[2]) {
159 payload_0[4] = qualEta_32bit;
160 payload_0[5] = etaNull_32bit | (2 & 0x2);
161 posEta_0_32bit = posEta_0_32bit | ((posEta_7bit & 0x7F) << 7 * (ithe.stNum() - 1));
162 }
else if (bxPresent[3]) {
163 payload_p1[4] = qualEta_32bit;
164 payload_p1[5] = etaNull_32bit | (2 & 0x2);
165 posEta_p1_32bit = posEta_p1_32bit | ((posEta_7bit & 0x7F) << 7 * (ithe.stNum() - 1));
166 }
else if (bxPresent[4]) {
167 payload_p2[4] = qualEta_32bit;
168 payload_p2[5] = etaNull_32bit | (2 & 0x2);
169 posEta_p2_32bit = posEta_p2_32bit | ((posEta_7bit & 0x7F) << 7 * (ithe.stNum() - 1));
172 bxPresent.assign(5,
false);
179 payload_n2[4] = posEta_n2_32bit;
180 payload_n2[5] = etaNull_32bit;
182 payload_n1[4] = posEta_n1_32bit;
183 payload_n1[5] = etaNull_32bit;
186 payload_0[4] = posEta_0_32bit;
187 payload_0[5] = etaNull_32bit;
190 payload_p1[4] = posEta_p1_32bit;
191 payload_p1[5] = etaNull_32bit;
193 payload_p2[4] = posEta_p2_32bit;
194 payload_p2[5] = etaNull_32bit;
201 bool moreBX = moreBXphi || moreBXeta;
205 for (
int iSt = 0; iSt <= 3; iSt++) {
206 if (moreBX && payload_n2[iSt] == 0)
207 payload_n2[iSt] = phiNull_32bit;
209 if (moreBX && payload_n1[iSt] == 0)
210 payload_n1[iSt] = phiNull_32bit;
212 if (payload_0[iSt] == 0)
213 payload_0[iSt] = phiNull_32bit;
215 if (moreBX && payload_p1[iSt] == 0)
216 payload_p1[iSt] = phiNull_32bit;
218 if (moreBX && payload_p2[iSt] == 0)
219 payload_p2[iSt] = phiNull_32bit;
224 if (moreBX && payload_n2[
word] == 0)
225 payload_n2[
word] = etaNull_32bit;
227 if (moreBX && payload_n1[
word] == 0)
228 payload_n1[
word] = etaNull_32bit;
230 if (payload_0[
word] == 0)
231 payload_0[
word] = etaNull_32bit;
233 if (moreBX && payload_p1[
word] == 0)
234 payload_p1[
word] = etaNull_32bit;
236 if (moreBX && payload_p2[
word] == 0)
237 payload_p2[
word] = etaNull_32bit;
270 for (
int i = 0;
i < 6;
i++)
271 payload.push_back(payload_n2[
i]);
272 for (
int i = 0; i < 6; i++)
273 payload.push_back(payload_n1[i]);
276 for (
int i = 0;
i < 6;
i++)
277 payload.push_back(payload_0[
i]);
280 for (
int i = 0; i < 6; i++)
281 payload.push_back(payload_p1[i]);
282 for (
int i = 0; i < 6; i++)
283 payload.push_back(payload_p2[i]);
287 blocks.push_back(
Block(block_id, payload));
313 for (
int i = 6;
i >= 0;
i--) {
315 temp = temp | (thInput.
position(
i) & 0x1);
318 for (
int i = 6;
i >= 0;
i--) {
320 temp = temp | (thInput.
quality(
i) & 0x1);
int quality(const int i) const
int position(const int i) const
std::vector< Block > Blocks
Abs< T >::type abs(const T &t)
#define DEFINE_L1T_PACKER(type)