20 :
regions(2), crtNo(crateNumber), cardNo(cardNumber),
21 rctLookupTables_(rctLookupTables), etIn10Bits(2), overFlowBits(2),
22 muonBits(2), tauBits(2) {}
27 std::vector<unsigned short>
input(64);
28 for (
int i = 0;
i < 64;
i++)
29 input.at(
i) =
rand() & 511;
34 std::vector<unsigned short>
input(64);
36 std::ifstream instream(filename);
38 for (
int i = 0;
i < 64;
i++) {
69 std::vector<unsigned short> ecalInput(32);
70 std::vector<unsigned short> ecalFG(32);
71 std::vector<unsigned short> hcalInput(32);
72 std::vector<unsigned short> hcalMuon(32);
74 for (
int i = 0;
i < 32;
i++) {
75 ecalInput.at(
i) = input.at(
i) / 2;
76 ecalFG.at(
i) = input.at(
i) & 1;
77 hcalInput.at(
i) = input.at(
i + 32) / 2;
78 hcalMuon.at(
i) = input.at(
i + 32) & 1;
79 unsigned long lookup =
82 unsigned short etIn7Bits = lookup & 127;
83 unsigned short etIn9Bits = (lookup >> 8) & 511;
84 unsigned short HE_FGBit = (lookup >> 7) & 1;
85 unsigned short activityBit = (lookup >> 17) & 1;
87 unsigned short r = indices.at(0);
88 unsigned short row = indices.at(1);
89 unsigned short col = indices.at(2);
90 regions.at(r).setEtIn7Bits(row, col, etIn7Bits);
91 regions.at(r).setEtIn9Bits(row, col, etIn9Bits);
92 regions.at(r).setHE_FGBit(row, col, HE_FGBit);
93 regions.at(r).setMuonBit(row, col, hcalMuon.at(
i));
94 regions.at(r).setActivityBit(row, col, activityBit);
99 std::vector<unsigned short> returnVec(3);
100 unsigned short region;
101 unsigned short towerrow;
102 unsigned short towercol;
107 towerrow = towernum % 4;
108 towercol = 3 - (towernum / 4);
111 towerrow = towernum % 4;
112 towercol = 7 - (towernum / 4);
117 towerrow = towernum % 4;
118 towercol = 3 - (towernum / 4);
121 towerrow = towernum % 4;
122 towercol = (towernum / 4) - 4;
129 towerrow = towernum % 4;
130 towercol = towernum / 4;
133 towerrow = towernum % 4;
134 towercol = (towernum / 4) - 4;
139 towerrow = towernum % 4;
140 towercol = towernum / 4;
143 towerrow = towernum % 4;
144 towercol = 7 - (towernum / 4);
148 returnVec.at(0) = region;
149 returnVec.at(1) = towerrow;
150 returnVec.at(2) = towercol;
155 for (
int i = 0;
i < 2;
i++)
160 bitset<4> etaPattern;
161 bitset<4> phiPattern;
163 bitset<4> badPattern5(
string(
"0101"));
164 bitset<4> badPattern7(
string(
"0111"));
165 bitset<4> badPattern9(
string(
"1001"));
166 bitset<4> badPattern10(
string(
"1010"));
167 bitset<4> badPattern11(
string(
"1011"));
168 bitset<4> badPattern13(
string(
"1101"));
169 bitset<4> badPattern14(
string(
"1110"));
170 bitset<4> badPattern15(
string(
"1111"));
172 for (
int i = 0;
i < 4;
i++) {
183 if (etaPattern != badPattern5 && etaPattern != badPattern7 &&
184 etaPattern != badPattern10 && etaPattern != badPattern11 &&
185 etaPattern != badPattern13 && etaPattern != badPattern14 &&
186 etaPattern != badPattern15 && phiPattern != badPattern5 &&
187 phiPattern != badPattern7 && phiPattern != badPattern10 &&
188 phiPattern != badPattern11 && phiPattern != badPattern13 &&
189 phiPattern != badPattern14 && phiPattern != badPattern15 &&
190 etaPattern != badPattern9 && phiPattern != badPattern9) {
203 for (
int i = 0;
i < 2;
i++) {
210 unsigned short sum = 0;
211 unsigned short overflow = 0;
212 for (
int i = 0;
i < 4;
i++) {
213 for (
int j = 0; j < 4; j++) {
225 unsigned short sumFullInfo = sum * 2 + overflow;
230 for (
int i = 0;
i < 2;
i++)
235 unsigned short muonBit = 0;
236 for (
int i = 0;
i < 4;
i++) {
237 for (
int j = 0; j < 4; j++) {
247 for (
int i = 0;
i < 2;
i++) {
248 std::cout <<
"Region " <<
i <<
" information" << std::endl;
L1RCTReceiverCard()=delete
unsigned short getEtIn9Bits(int i, int j) const
unsigned short getMuonBit(int i, int j) const
void fillInput(const std::vector< unsigned short > &input)
static std::string const input
const L1RCTLookupTables * rctLookupTables_
std::vector< unsigned short > overFlowBits
unsigned short getActivityBit(int i, int j) const
unsigned short calcTauBit(L1RCTRegion region)
std::vector< unsigned short > etIn10Bits
void fileInput(char *filename)
unsigned short calcMuonBit(L1RCTRegion region)
std::vector< unsigned short > muonBits
std::vector< unsigned short > tauBits
unsigned short calcRegionSum(L1RCTRegion region)
std::vector< unsigned short > towerToRegionMap(int towernum)
std::vector< L1RCTRegion > regions
unsigned int lookup(unsigned short ecalInput, unsigned short hcalInput, unsigned short fgbit, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const