11 static const int dPhiNLBMap_4bit_256Max[16] = {0, 1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 25, 31, 46, 68, 136};
14 static const int dPhiNLBMap_5bit_256Max[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
15 16, 17, 19, 20, 21, 23, 25, 28, 31, 34, 39, 46, 55, 68, 91, 136};
19 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
20 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
21 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
22 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 83, 84, 86, 87, 89, 91, 92, 94,
23 96, 98, 100, 102, 105, 107, 110, 112, 115, 118, 121, 124, 127, 131, 135, 138, 143, 147, 152, 157, 162, 168,
24 174, 181, 188, 196, 204, 214, 224, 235, 247, 261, 276, 294, 313, 336, 361, 391, 427, 470};
38 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
47 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
56 else if (
max == 512) {
59 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
69 return (sign_ * dPhi_);
75 int dPhiBin_ = (1 <<
bits) - 1;
83 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
91 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
100 else if (
max == 512) {
102 for (
int edge = 0; edge < (1 <<
bits) - 1; edge++) {
118 int dPhi_ = (1 <<
bits) - 1;
130 else if (
max == 512) {
147 int sign_ = -1 *
endcap * dPhiSign;
163 clct_ = (sign_ > 0 ? 1 : 2);
166 clct_ = (sign_ > 0 ? 2 : 1);
169 clct_ = (sign_ > 0 ? 0 : 3);
172 clct_ = (sign_ > 0 ? 3 : 0);
175 clct_ = (sign_ > 0 ? 0 : 3);
178 clct_ = (sign_ > 0 ? 3 : 0);
181 clct_ = (sign_ > 0 ? 0 : 3);
184 clct_ = (sign_ > 0 ? 3 : 0);
187 clct_ = (sign_ > 0 ? 0 : 3);
200 else if (
bits == 3) {
206 clct_ = (sign_ > 0 ? 3 : 5);
209 clct_ = (sign_ > 0 ? 5 : 3);
212 clct_ = (sign_ > 0 ? 2 : 6);
215 clct_ = (sign_ > 0 ? 6 : 2);
218 clct_ = (sign_ > 0 ? 1 : 7);
221 clct_ = (sign_ > 0 ? 7 : 1);
224 clct_ = (sign_ > 0 ? 1 : 7);
227 clct_ = (sign_ > 0 ? 7 : 1);
230 clct_ = (sign_ > 0 ? 1 : 7);
257 int sign_ = -1 *
endcap * dPhiSign;
265 clct_ = (sign_ > 0 ? 8 : 9);
268 clct_ = (sign_ > 0 ? 4 : 5);
276 }
else if (
bits == 3) {
282 clct_ = (sign_ > 0 ? 8 : 9);
285 clct_ = (sign_ > 0 ? 9 : 8);
288 clct_ = (sign_ > 0 ? 6 : 7);
291 clct_ = (sign_ > 0 ? 7 : 6);
294 clct_ = (sign_ > 0 ? 4 : 5);
297 clct_ = (sign_ > 0 ? 5 : 4);
320 if (
abs(dTheta) <= 1)
322 else if (
abs(dTheta) <= 2)
324 else if (dTheta <= -3)
331 else if (
bits == 3) {
334 else if (dTheta == -3)
336 else if (dTheta == -2)
338 else if (dTheta == -1)
340 else if (dTheta == 0)
342 else if (dTheta == +1)
344 else if (dTheta == +2)
376 }
else if (
bits == 3) {
418 if (st1_ring2 == 0) {
424 }
else if (st1_ring2 == 1) {
426 if (theta < 46 || theta > 87) {
434 else if (
bits == 5) {
435 if (st1_ring2 == 0) {
437 }
else if (st1_ring2 == 1) {
459 }
else if (
bits == 5) {
517 else if (rpc_2b == 1)
519 else if (rpc_2b == 2)
525 int theta,
int st1_ring2,
int endcap,
int sPhiAB,
int clctA,
int clctB,
int clctC,
int clctD)
const {
538 int nRPC = (clctA == 0) + (clctB == 0) + (clctC == 0) + (clctD == 0);
539 int rpc_word, rpc_clct, mode15_8b;
542 if (nRPC >= 2 && clctA == 0 && clctB == 0)
544 else if (nRPC >= 2 && clctA == 0 && clctC == 0)
546 else if (nRPC >= 2 && clctA == 0 && clctD == 0)
548 else if (nRPC == 1 && clctA == 0)
550 else if (nRPC >= 2 && clctD == 0 && clctB == 0)
552 else if (nRPC >= 2 && clctD == 0 && clctC == 0)
554 else if (nRPC >= 2 && clctB == 0 && clctC == 0)
556 else if (nRPC == 1 && clctD == 0)
558 else if (nRPC == 1 && clctB == 0)
560 else if (nRPC == 1 && clctC == 0)
564 rpc_clct = rpc_word + clctA_2b;
565 mode15_8b = (
theta * 32) + rpc_clct + 64;
567 if (
theta >= 4 && clctD == 0)
569 else if (
theta >= 4 && clctC == 0)
575 rpc_clct = rpc_word * 4 + clctA_2b;
576 mode15_8b = ((
theta % 4) * 16) + rpc_clct;
613 int rpc_clct, rpc_word, clctA_2b, nRPC = -1;
616 rpc_clct = (mode15_8b % 32);
617 theta = (mode15_8b - 64 - rpc_clct) / 32;
623 clctA_2b = (rpc_clct % 4);
624 rpc_word = rpc_clct - clctA_2b;
684 rpc_clct = (mode15_8b % 16);
685 theta = (mode15_8b - rpc_clct) / 16;
686 clctA_2b = (rpc_clct % 4);
687 rpc_word = (rpc_clct - clctA_2b) / 4;
731 const bool BIT_COMP)
const {
734 if ((
mode % 8) / 4 > 0)
736 else if ((
mode % 4) / 2 > 0)
738 else if ((
mode % 2) > 0)
744 int nBits = (
mode == 15 ? 4 : 5);
768 const bool BIT_COMP)
const {
778 if ((
mode % 8) / 4 > 0)
779 dPhSign = (dPh12 >= 0 ? +1 : -1);
780 else if ((
mode % 4) / 2 > 0)
781 dPhSign = (dPh13 >= 0 ? +1 : -1);
782 else if ((
mode % 2) > 0)
783 dPhSign = (dPh14 >= 0 ? +1 : -1);
784 }
else if ((
mode % 8) / 4 > 0) {
785 if ((
mode % 4) / 2 > 0)
786 dPhSign = (dPh23 >= 0 ? +1 : -1);
787 else if ((
mode % 2) > 0)
788 dPhSign = (dPh24 >= 0 ? +1 : -1);
789 }
else if ((
mode % 4) / 2 > 0) {
791 dPhSign = (dPh34 >= 0 ? +1 : -1);
835 dPh13 = dPh12 + dPh23;
836 dPh14 = dPh13 + dPh34;
837 dPh24 = dPh23 + dPh34;
840 dPh13 = dPh12 + dPh23;
843 dPh14 = dPh12 + dPh24;
846 dPh14 = dPh13 + dPh34;
849 dPh24 = dPh23 + dPh34;
859 calcDeltaPhiSums(dPhSum4, dPhSum4A, dPhSum3, dPhSum3A, outStPh, dPh12, dPh13, dPh14, dPh23, dPh24, dPh34);
874 const bool BIT_COMP)
const {
883 int nBits = (
mode == 15 ? 2 : 3);
906 const bool BIT_COMP)
const {
919 if ((
mode % 8) / 4 > 0)
921 if ((
mode % 4) / 2 > 0)
936 const bool BIT_COMP)
const {
940 if (
mode == 15 && !st1_ring2) {
949 int nRPC = (RPC1 == 1) + (RPC2 == 1) + (RPC3 == 1) + (RPC4 == 1);
954 if (RPC1 == 1 && RPC2 == 1) {
957 }
else if (RPC1 == 1 && RPC3 == 1) {
959 }
else if (RPC4 == 1 && RPC2 == 1) {
961 }
else if (RPC3 == 1 && RPC4 == 1 && !st1_ring2) {
964 }
else if (
mode == 14) {
968 }
else if (RPC3 == 1) {
971 }
else if (
mode == 13) {
975 }
else if (RPC4 == 1) {
978 }
else if (
mode == 11) {
982 }
else if (RPC4 == 1) {
985 }
else if (
mode == 7) {
989 }
else if (RPC4 == 1) {
1009 bend = -1 * (11 -
pattern) / 2;
1029 const int dPh34)
const {
1030 dPhSum4 = dPh12 + dPh13 + dPh14 + dPh23 + dPh24 + dPh34;
1031 dPhSum4A =
abs(dPh12) +
abs(dPh13) +
abs(dPh14) +
abs(dPh23) +
abs(dPh24) +
abs(dPh34);
1032 int devSt1 =
abs(dPh12) +
abs(dPh13) +
abs(dPh14);
1033 int devSt2 =
abs(dPh12) +
abs(dPh23) +
abs(dPh24);
1034 int devSt3 =
abs(dPh13) +
abs(dPh23) +
abs(dPh34);
1035 int devSt4 =
abs(dPh14) +
abs(dPh24) +
abs(dPh34);
1037 if (devSt4 > devSt3 && devSt4 > devSt2 && devSt4 > devSt1)
1039 else if (devSt3 > devSt4 && devSt3 > devSt2 && devSt3 > devSt1)
1041 else if (devSt2 > devSt4 && devSt2 > devSt3 && devSt2 > devSt1)
1043 else if (devSt1 > devSt4 && devSt1 > devSt3 && devSt1 > devSt2)
1049 dPhSum3 = dPh12 + dPh13 + dPh23;
1050 dPhSum3A =
abs(dPh12) +
abs(dPh13) +
abs(dPh23);
1051 }
else if (outStPh == 3) {
1052 dPhSum3 = dPh12 + dPh14 + dPh24;
1053 dPhSum3A =
abs(dPh12) +
abs(dPh14) +
abs(dPh24);
1054 }
else if (outStPh == 2) {
1055 dPhSum3 = dPh13 + dPh14 + dPh34;
1056 dPhSum3A =
abs(dPh13) +
abs(dPh14) +
abs(dPh34);
1058 dPhSum3 = dPh23 + dPh24 + dPh34;
1059 dPhSum3A =
abs(dPh23) +
abs(dPh24) +
abs(dPh34);
static const int dPhiNLBMap_7bit_512Max[128]
void calcDeltaThetas(int &dTh12, int &dTh13, int &dTh14, int &dTh23, int &dTh24, int &dTh34, const int th1, const int th2, const int th3, const int th4, const int mode, const bool BIT_COMP=false) const
void calcBends(int &bend1, int &bend2, int &bend3, int &bend4, const int pat1, const int pat2, const int pat3, const int pat4, const int dPhSign, const int endcap, const int mode, const bool BIT_COMP=false) const
int unpackSt1Ring2(int theta, int bits) const
int getNLBdPhi(int dPhi, int bits=7, int max=512) const
int getdPhiFromBin(int dPhiBin, int bits=7, int max=512) const
static const int dPhiNLBMap_5bit_256Max[32]
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
static const int dPhiNLBMap_4bit_256Max[16]
int calcTrackTheta(const int th1, const int th2, const int th3, const int th4, const int ring1, const int mode, const bool BIT_COMP=false) const
int unpackCLCT(int clct, int endcap, int dPhiSign, int bits) const
void calcRPCs(int &RPC1, int &RPC2, int &RPC3, int &RPC4, const int mode, const int st1_ring2, const int theta, const bool BIT_COMP=false) const
int getCLCT(int clct, int endcap, int dPhiSign, int bits=3) const
int calcBendFromPattern(const int pattern, const int endcap) const
void calcDeltaPhiSums(int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int dPh12, const int dPh13, const int dPh14, const int dPh23, const int dPh24, const int dPh34) const
Abs< T >::type abs(const T &t)
int unpackdTheta(int dTheta, int bits) const
int get8bMode15(int theta, int st1_ring2, int endcap, int sPhiAB, int clctA, int clctB, int clctC, int clctD) const
void unpackTheta(int &theta, int &st1_ring2, int bits) const
void calcDeltaPhis(int &dPh12, int &dPh13, int &dPh14, int &dPh23, int &dPh24, int &dPh34, int &dPhSign, int &dPhSum4, int &dPhSum4A, int &dPhSum3, int &dPhSum3A, int &outStPh, const int ph1, const int ph2, const int ph3, const int ph4, const int mode, const bool BIT_COMP=false) const
int getNLBdPhiBin(int dPhi, int bits=7, int max=512) const
void unpack2bRPC(int rpc_2b, int &rpcA, int &rpcB, int &rpcC) const
int get2bRPC(int clctA, int clctB, int clctC) const
Geom::Theta< T > theta() const
int getTheta(int theta, int ring2, int bits=5) const
int getdTheta(int dTheta, int bits=3) const
Power< A, B >::type pow(const A &a, const B &b)