18 auto muonPhToken =
static_cast<const BMTFTokens*
>(toks)->getInputMuonTokenPh();
19 auto muonThToken =
static_cast<const BMTFTokens*
>(toks)->getInputMuonTokenTh();
24 event.getByToken(muonPhToken, phInputs);
26 event.getByToken(muonThToken, thInputs);
28 uint32_t qualEta_32bit = 0;
29 uint32_t posEta_0_32bit = 0;
30 uint32_t posEta_n2_32bit = 0, posEta_n1_32bit = 0;
31 uint32_t posEta_p2_32bit = 0, posEta_p1_32bit = 0;
33 bool moreBXeta =
false;
34 for (
int link = 0; link <= 35; link++) {
37 if ( (link >= 6 && link < 8) ||
38 (link >= 14 && link < 16) ||
39 (link >= 30 && link < 32) )
43 std::vector<uint32_t> payload_0 (6,0);
44 std::vector<uint32_t> payload_p1(6,0);
45 std::vector<uint32_t> payload_n1(6,0);
46 std::vector<uint32_t> payload_p2(6,0);
47 std::vector<uint32_t> payload_n2(6,0);
49 unsigned int block_id = 2*link;
51 std::vector<bool> bxPresent(5,
false);
52 bool moreBXphi =
false;
61 if (
std::abs(iphi.bxNum()) > 2)
continue;
63 if (iphi.bxNum() != 0)
71 if ( iphi.scNum()+1 != board_id )
75 if (link !=
ownLinks_[4+2*(iphi.whNum())+iphi.Ts2Tag()])
79 bxPresent[2+iphi.bxNum()] =
true;
84 payload_n2[iphi.stNum()-1] = word_32bit;
86 else if (bxPresent[1]){
87 payload_n1[iphi.stNum()-1] = word_32bit;
89 else if (bxPresent[2])
90 payload_0[iphi.stNum()-1] = word_32bit;
91 else if (bxPresent[3]){
92 payload_p1[iphi.stNum()-1] = word_32bit;
94 else if (bxPresent[4]){
95 payload_p2[iphi.stNum()-1] = word_32bit;
98 bxPresent.assign(5,
false);
108 uint32_t phiNull_32bit = 0 | (BC & 0x3) << 30;
110 uint32_t etaNull_32bit = 0 | (BC & 0x3) << 30;
124 posEta_0_32bit = etaNull_32bit;
125 posEta_n2_32bit = etaNull_32bit;
126 posEta_n1_32bit = etaNull_32bit;
127 posEta_p2_32bit = etaNull_32bit;
128 posEta_p1_32bit = etaNull_32bit;
130 qualEta_32bit = etaNull_32bit;
133 int theta_iterators = 0;
137 if (
std::abs(ithe.bxNum()) > 2)
continue;
139 if (ithe.bxNum() != 0)
149 if ( ithe.scNum()+1 != board_id )
152 if ( link !=
ownLinks_[4+2*(ithe.whNum())] )
155 bxPresent[2+ithe.bxNum()] =
true;
163 qualEta_32bit = qualEta_32bit | ( (qualEta_7bit & 0x7F) << 7*(ithe.stNum()-1) );
168 payload_n2[4] = qualEta_32bit;
169 payload_n2[5] = etaNull_32bit | (2 & 0x2);
170 posEta_n2_32bit = posEta_n2_32bit | ( (posEta_7bit & 0x7F) << 7*(ithe.stNum()-1) );
172 else if (bxPresent[1]){
173 payload_n1[4] = qualEta_32bit;
174 payload_n1[5] = etaNull_32bit | (2 & 0x2);
175 posEta_n1_32bit = posEta_n1_32bit | ( (posEta_7bit & 0x7F) << 7*(ithe.stNum()-1) );
177 else if (bxPresent[2]){
178 payload_0[4] = qualEta_32bit;
179 payload_0[5] = etaNull_32bit | (2 & 0x2);
180 posEta_0_32bit = posEta_0_32bit | ( (posEta_7bit & 0x7F) << 7*(ithe.stNum()-1) );
182 else if (bxPresent[3]){
183 payload_p1[4] = qualEta_32bit;
184 payload_p1[5] = etaNull_32bit | (2 & 0x2);
185 posEta_p1_32bit = posEta_p1_32bit | ( (posEta_7bit & 0x7F) << 7*(ithe.stNum()-1) );
187 else if (bxPresent[4]){
188 payload_p2[4] = qualEta_32bit;
189 payload_p2[5] = etaNull_32bit | (2 & 0x2);
190 posEta_p2_32bit = posEta_p2_32bit | ( (posEta_7bit & 0x7F) << 7*(ithe.stNum()-1) );
193 bxPresent.assign(5,
false);
202 payload_n2[4] = posEta_n2_32bit;
203 payload_n2[5] = etaNull_32bit;
205 payload_n1[4] = posEta_n1_32bit;
206 payload_n1[5] = etaNull_32bit;
209 payload_0[4] = posEta_0_32bit;
210 payload_0[5] = etaNull_32bit;
213 payload_p1[4] = posEta_p1_32bit;
214 payload_p1[5] = etaNull_32bit;
216 payload_p2[4] = posEta_p2_32bit;
217 payload_p2[5] = etaNull_32bit;
227 bool moreBX = moreBXphi || moreBXeta;
231 for (
int iSt = 0; iSt <= 3; iSt++){
233 if (moreBX && payload_n2[iSt]==0)
234 payload_n2[iSt] = phiNull_32bit;
236 if (moreBX && payload_n1[iSt]==0)
237 payload_n1[iSt] = phiNull_32bit;
239 if (payload_0[iSt]==0)
240 payload_0[iSt] = phiNull_32bit;
242 if (moreBX && payload_p1[iSt]==0)
243 payload_p1[iSt] = phiNull_32bit;
245 if (moreBX && payload_p2[iSt]==0)
246 payload_p2[iSt] = phiNull_32bit;
251 for (
int word = 4; word <= 5; word++){
253 if (moreBX && payload_n2[word]==0)
254 payload_n2[word] = etaNull_32bit;
256 if (moreBX && payload_n1[word]==0)
257 payload_n1[word] = etaNull_32bit;
259 if (payload_0[word]==0)
260 payload_0[word] = etaNull_32bit;
262 if (moreBX && payload_p1[word]==0)
263 payload_p1[word] = etaNull_32bit;
265 if (moreBX && payload_p2[word]==0)
266 payload_p2[word] = etaNull_32bit;
301 for (
int i=0;
i<6;
i++)
302 payload.push_back(payload_n2[
i]);
303 for (
int i=0; i<6; i++)
304 payload.push_back(payload_n1[i]);
307 for (
int i=0;
i<6;
i++)
308 payload.push_back(payload_0[
i]);
311 for (
int i=0; i<6; i++)
312 payload.push_back(payload_p1[i]);
313 for (
int i=0; i<6; i++)
314 payload.push_back(payload_p2[i]);
318 blocks.push_back(
Block(block_id, payload));
355 for (
int i=6;
i>=0;
i--) {
357 temp = temp | (thInput.
position(
i) & 0x1);
362 for (
int i=6;
i>=0;
i--) {
364 temp = temp | (thInput.
quality(
i) & 0x1);
The_Container const * getContainer() const
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)
Phi_Container const * getContainer() const