14 static const int dPhiNLBMap_4bit_256Max[16] = {0, 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 25, 31, 46, 68, 136};
17 static const int dPhiNLBMap_5bit_256Max[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
18 16, 17, 19, 20, 21, 23, 25, 28, 31, 34, 39, 46, 55, 68, 91, 136};
21 static const int dPhiNLBMap_7bit_512Max[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
22 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
23 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
24 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
25 64, 65, 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81,
26 83, 84, 86, 87, 89, 91, 92, 94, 96, 98, 100, 102, 105, 107, 110, 112,
27 115, 118, 121, 124, 127, 131, 135, 138, 143, 147, 152, 157, 162, 168, 174, 181,
28 188, 196, 204, 214, 224, 235, 247, 261, 276, 294, 313, 336, 361, 391, 427, 470};
32 if (not( (bits == 4 && max == 256) ||
33 (bits == 5 && max == 256) ||
34 (bits == 7 && max == 512) ))
35 {
edm::LogError(
"L1T") <<
"bits = " << bits <<
", max = " <<
max;
return 0; }
46 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
56 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
66 else if (max == 512) {
69 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
79 if (not(
abs(sign_) == 1 && dPhi_ >= 0 && dPhi_ <
max))
80 {
edm::LogError(
"L1T") <<
"sign_ = " << sign_ <<
", dPhi_ = " << dPhi_ <<
", max = " <<
max;
return 0; }
81 return (sign_ * dPhi_);
86 if (not( (bits == 4 && max == 256) ||
87 (bits == 5 && max == 256) ||
88 (bits == 7 && max == 512) ))
89 {
edm::LogError(
"L1T") <<
"bits = " << bits <<
", max = " <<
max;
return 0; }
91 int dPhiBin_ = (1 <<
bits) - 1;
99 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
108 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
118 else if (max == 512) {
120 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
130 if (not(dPhiBin_ >= 0 && dPhiBin_ <
pow(2, bits)))
131 {
edm::LogError(
"L1T") <<
"dPhiBin_ = " << dPhiBin_ <<
", bits = " <<
bits;
return 0; }
137 if (not( (bits == 4 && max == 256) ||
138 (bits == 5 && max == 256) ||
139 (bits == 7 && max == 512) ))
140 {
edm::LogError(
"L1T") <<
"bits = " << bits <<
", max = " <<
max;
return 0; }
142 int dPhi_ = (1 <<
bits) - 1;
144 if (dPhiBin > (1 << bits) - 1)
145 dPhiBin = (1 << bits) - 1;
154 else if (max == 512) {
159 if (not(dPhi_ >= 0 && dPhi_ < max))
160 {
edm::LogError(
"L1T") <<
"dPhi_ = " << dPhi_ <<
", max = " <<
max;
return 0; }
170 if (not( clct >= 0 && clct <= 10 &&
abs(endcap) == 1 &&
171 abs(dPhiSign) == 1 && (bits == 2 || bits == 3) ))
172 {
edm::LogError(
"L1T") <<
"clct = " << clct <<
", endcap = " << endcap
173 <<
", dPhiSign = " << dPhiSign <<
", bits = " <<
bits;
return 0; }
177 int sign_ = -1 * endcap * dPhiSign;
189 case 10: clct_ = 1;
break;
190 case 9: clct_ = (sign_ > 0 ? 1 : 2);
break;
191 case 8: clct_ = (sign_ > 0 ? 2 : 1);
break;
192 case 7: clct_ = (sign_ > 0 ? 0 : 3);
break;
193 case 6: clct_ = (sign_ > 0 ? 3 : 0);
break;
194 case 5: clct_ = (sign_ > 0 ? 0 : 3);
break;
195 case 4: clct_ = (sign_ > 0 ? 3 : 0);
break;
196 case 3: clct_ = (sign_ > 0 ? 0 : 3);
break;
197 case 2: clct_ = (sign_ > 0 ? 3 : 0);
break;
198 case 1: clct_ = (sign_ > 0 ? 0 : 3);
break;
199 case 0: clct_ = 0;
break;
200 default: clct_ = 1;
break;
206 else if (bits == 3) {
208 case 10: clct_ = 4;
break;
209 case 9: clct_ = (sign_ > 0 ? 3 : 5);
break;
210 case 8: clct_ = (sign_ > 0 ? 5 : 3);
break;
211 case 7: clct_ = (sign_ > 0 ? 2 : 6);
break;
212 case 6: clct_ = (sign_ > 0 ? 6 : 2);
break;
213 case 5: clct_ = (sign_ > 0 ? 1 : 7);
break;
214 case 4: clct_ = (sign_ > 0 ? 7 : 1);
break;
215 case 3: clct_ = (sign_ > 0 ? 1 : 7);
break;
216 case 2: clct_ = (sign_ > 0 ? 7 : 1);
break;
217 case 1: clct_ = (sign_ > 0 ? 1 : 7);
break;
218 case 0: clct_ = 0;
break;
219 default: clct_ = 4;
break;
225 if (not(clct_ >= 0 && clct_ <
pow(2, bits)))
226 {
edm::LogError(
"L1T") <<
"clct_ = " << clct_ <<
", bits = " <<
bits;
return 0; }
236 if (not(bits == 2 || bits == 3))
238 if (not(clct >= 0 && clct <
pow(2, bits)))
239 {
edm::LogError(
"L1T") <<
"bits = " << bits <<
", clct = " << clct;
return 0; }
240 if (not(
abs(dPhiSign) == 1))
241 {
edm::LogError(
"L1T") <<
"dPhiSign = " << dPhiSign;
return 0; }
245 int sign_ = -1 * endcap * dPhiSign;
249 case 1: clct_ = 10;
break;
250 case 2: clct_ = (sign_ > 0 ? 8 : 9);
break;
251 case 3: clct_ = (sign_ > 0 ? 4 : 5);
break;
252 case 0: clct_ = 0;
break;
255 }
else if (bits == 3) {
257 case 4: clct_ = 10;
break;
258 case 5: clct_ = (sign_ > 0 ? 8 : 9);
break;
259 case 3: clct_ = (sign_ > 0 ? 9 : 8);
break;
260 case 6: clct_ = (sign_ > 0 ? 6 : 7);
break;
261 case 2: clct_ = (sign_ > 0 ? 7 : 6);
break;
262 case 7: clct_ = (sign_ > 0 ? 4 : 5);
break;
263 case 1: clct_ = (sign_ > 0 ? 5 : 4);
break;
264 case 0: clct_ = 0;
break;
271 if (not(clct_ >= 0 && clct_ <= 10))
278 if (not( bits == 2 || bits == 3 ))
285 if (
abs(dTheta) <= 1)
287 else if (
abs(dTheta) <= 2)
289 else if (dTheta <= -3)
296 else if (bits == 3) {
299 else if (dTheta == -3)
301 else if (dTheta == -2)
303 else if (dTheta == -1)
305 else if (dTheta == 0)
307 else if (dTheta == +1)
309 else if (dTheta == +2)
315 if (not(dTheta_ >= 0 && dTheta_ <
pow(2, bits)))
316 {
edm::LogError(
"L1T") <<
"dTheta_ = " << dTheta_ <<
", bits = " <<
bits;
return 0; }
322 if (not( bits == 2 || bits == 3 ))
328 case 2: dTheta_ = 0;
break;
329 case 1: dTheta_ = -2;
break;
330 case 0: dTheta_ = -3;
break;
331 case 3: dTheta_ = 3;
break;
334 }
else if (bits == 3) {
336 case 0: dTheta_ = -4;
break;
337 case 1: dTheta_ = -3;
break;
338 case 2: dTheta_ = -2;
break;
339 case 3: dTheta_ = -1;
break;
340 case 4: dTheta_ = 0;
break;
341 case 5: dTheta_ = 1;
break;
342 case 6: dTheta_ = 2;
break;
343 case 7: dTheta_ = 3;
break;
348 if (not(dTheta_ >= -4 && dTheta_ <= 3))
349 {
edm::LogError(
"L1T") <<
"dTheta_ = " << dTheta_;
return 0; }
355 if (not( theta >= 5 && theta < 128 &&
356 (st1_ring2 == 0 || st1_ring2 == 1) &&
357 (bits == 4 || bits == 5) ))
358 {
edm::LogError(
"L1T") <<
"theta = " << theta <<
", st1_ring2 = " << st1_ring2
359 <<
", bits = " <<
bits;
return 0; }
365 if (st1_ring2 == 0) {
372 else if (st1_ring2 == 1) {
374 if (theta < 46 || theta > 87) {
382 else if (bits == 5) {
383 if (st1_ring2 == 0) {
384 theta_ = (
std::max(theta, 1) - 1) / 4;
386 else if (st1_ring2 == 1) {
387 theta_ = ((
std::min(theta, 104) - 1) / 4) + 6;
391 if (not(theta_ >= 0 && ((bits == 4 && theta_ <= 13) || (bits == 5 && theta_ <
pow(2, bits))) ))
392 {
edm::LogError(
"L1T") <<
"theta_ = " << theta_ <<
", bits = " <<
bits;
return 0; }
398 if (not(bits == 4 || bits == 5))
400 if (not(theta >= 0 && theta <
pow(2, bits)))
407 theta = (theta * 6) + 5;
410 theta = ((theta - 8) * 7) + 46;
412 }
else if (bits == 5) {
415 theta = (theta * 4) + 1;
418 theta = ((theta - 6) * 4) + 1;
422 if (not(theta >= 5 && theta <= 104))
429 if (not(bits == 4 || bits == 5))
431 if (not(theta >= 0 && theta <
pow(2, bits)))
432 {
edm::LogError(
"L1T") <<
"theta = " << theta <<
", bits = " <<
bits;
return 0; }
436 if (theta < 6)
return 0;
439 if (theta < 15)
return 0;
450 if (clctA == 0) rpc_2b = 0;
451 else if (clctC == 0) rpc_2b = 1;
452 else if (clctB == 0) rpc_2b = 2;
455 if (not(rpc_2b >= 0 && rpc_2b < 4))
463 if (not(rpc_2b >= 0 && rpc_2b < 4))
466 rpcA = 0; rpcB = 0; rpcC = 0;
468 if (rpc_2b == 0) rpcA = 1;
469 else if (rpc_2b == 1) rpcC = 1;
470 else if (rpc_2b == 2) rpcB = 1;
476 int clctA,
int clctB,
int clctC,
int clctD)
const {
483 if (not(theta >= 0 && theta < 10))
486 int clctA_2b =
getCLCT(clctA, endcap, sPhiAB, 2);
488 int nRPC = (clctA == 0) + (clctB == 0) + (clctC == 0) + (clctD == 0);
489 int rpc_word, rpc_clct, mode15_8b;
492 if (nRPC >= 2 && clctA == 0 && clctB == 0) rpc_word = 0;
493 else if (nRPC >= 2 && clctA == 0 && clctC == 0) rpc_word = 1;
494 else if (nRPC >= 2 && clctA == 0 && clctD == 0) rpc_word = 2;
495 else if (nRPC == 1 && clctA == 0 ) rpc_word = 3;
496 else if (nRPC >= 2 && clctD == 0 && clctB == 0) rpc_word = 4;
497 else if (nRPC >= 2 && clctD == 0 && clctC == 0) rpc_word = 8;
498 else if (nRPC >= 2 && clctB == 0 && clctC == 0) rpc_word = 12;
499 else if (nRPC == 1 && clctD == 0 ) rpc_word = 16;
500 else if (nRPC == 1 && clctB == 0 ) rpc_word = 20;
501 else if (nRPC == 1 && clctC == 0 ) rpc_word = 24;
503 rpc_clct = rpc_word + clctA_2b;
504 mode15_8b = (theta*32) + rpc_clct + 64;
506 if (theta >= 4 && clctD == 0) rpc_word = 0;
507 else if (theta >= 4 && clctC == 0) rpc_word = 1;
508 else if (theta >= 4 ) rpc_word = 2;
510 rpc_clct = rpc_word*4 + clctA_2b;
511 mode15_8b = ((theta % 4)*16) + rpc_clct;
516 if (not(mode15_8b >= 0 && mode15_8b <
pow(2, 8)))
517 {
edm::LogError(
"L1T") <<
"mode15_8b = " << mode15_8b;
return 0; }
524 int& clctA,
int& rpcA,
int& rpcB,
int& rpcC,
int& rpcD)
const {
530 if (not(mode15_8b >= 0 && mode15_8b <
pow(2, 8)))
531 {
edm::LogError(
"L1T") <<
"mode15_8b = " << mode15_8b;
return; }
532 if (not(
abs(endcap) == 1 &&
abs(sPhiAB) == 1))
533 {
edm::LogError(
"L1T") <<
"endcap = " << endcap <<
", sPhiAB = " << sPhiAB;
return; }
535 rpcA = 0; rpcB = 0; rpcC = 0; rpcD = 0;
537 if (mode15_8b >= 64) st1_ring2 = 1;
540 int rpc_clct, rpc_word, clctA_2b, nRPC = -1;
544 rpc_clct = (mode15_8b % 32);
545 theta = (mode15_8b - 64 - rpc_clct) / 32;
548 if (rpc_clct < 4) clctA_2b = 0;
549 else clctA_2b = (rpc_clct % 4);
550 rpc_word = rpc_clct - clctA_2b;
556 case 0: nRPC = 2; rpcA = 1; rpcB = 1;
break;
557 case 1: nRPC = 2; rpcA = 1; rpcC = 1;
break;
558 case 2: nRPC = 2; rpcA = 1; rpcD = 1;
break;
559 case 3: nRPC = 1; rpcA = 1;
break;
560 case 4: nRPC = 2; rpcD = 1; rpcB = 1;
break;
561 case 8: nRPC = 2; rpcD = 1; rpcC = 1;
break;
562 case 12: nRPC = 2; rpcB = 1; rpcC = 1;
break;
563 case 16: nRPC = 1; rpcD = 1;
break;
564 case 20: nRPC = 1; rpcB = 1;
break;
565 case 24: nRPC = 1; rpcC = 1;
break;
566 case 28: nRPC = 0;
break;
572 rpc_clct = (mode15_8b % 16);
573 theta = (mode15_8b - rpc_clct) / 16;
574 clctA_2b = (rpc_clct % 4);
575 rpc_word = (rpc_clct - clctA_2b) / 4;
581 case 0: nRPC = 1; theta += 4; rpcD = 1;
break;
582 case 1: nRPC = 1; theta += 4; rpcC = 1;
break;
583 case 2: nRPC = 0; theta += 4;
break;
584 case 3: nRPC = 0;
break;
int getTheta(int theta, int ring2, int bits=5) const
static const int dPhiNLBMap_7bit_512Max[128]
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
static const int dPhiNLBMap_5bit_256Max[32]
Geom::Theta< T > theta() const
static const int dPhiNLBMap_4bit_256Max[16]
void unpack8bMode15(int mode15_8b, int &theta, int &st1_ring2, int endcap, int sPhiAB, int &clctA, int &rpcA, int &rpcB, int &rpcC, int &rpcD) const
int get2bRPC(int clctA, int clctB, int clctC) const
void unpack2bRPC(int rpc_2b, int &rpcA, int &rpcB, int &rpcC) const
int getNLBdPhi(int dPhi, int bits=7, int max=512) const
int unpackdTheta(int dTheta, int bits) const
Abs< T >::type abs(const T &t)
int getCLCT(int clct, int endcap, int dPhiSign, int bits=3) const
void unpackTheta(int &theta, int &st1_ring2, int bits) const
int getdPhiFromBin(int dPhiBin, int bits=7, int max=512) const
int getdTheta(int dTheta, int bits=3) const
int get8bMode15(int theta, int st1_ring2, int endcap, int sPhiAB, int clctA, int clctB, int clctC, int clctD) const
int unpackSt1Ring2(int theta, int bits) const
int unpackCLCT(int clct, int endcap, int dPhiSign, int bits) const
int getNLBdPhiBin(int dPhi, int bits=7, int max=512) const
Power< A, B >::type pow(const A &a, const B &b)