156 bool badEvent =
false;
173 for (std::vector<CaloTower>::const_iterator testTower = testTowers->
begin(theBX);
174 testTower != testTowers->
end(theBX);
176 int test_iEta = testTower->hwEta();
177 int test_iPhi = testTower->hwPhi();
178 int test_et = testTower->hwPt();
179 int test_er = testTower->hwEtRatio();
180 int test_fb = testTower->hwQual();
181 for (std::vector<CaloTower>::const_iterator emulTower = emulTowers->
begin(theBX);
182 emulTower != emulTowers->
end(theBX);
184 int emul_iEta = emulTower->hwEta();
185 int emul_iPhi = emulTower->hwPhi();
186 int emul_et = emulTower->hwPt();
187 int emul_er = emulTower->hwEtRatio();
188 int emul_fb = emulTower->hwQual();
190 if (test_iEta == emul_iEta && test_iPhi == emul_iPhi) {
191 if (test_et != emul_et) {
194 if (test_er != emul_er) {
197 if (test_fb != emul_fb) {
201 if (test_et != emul_et) {
205 if (test_er != emul_er) {
209 if (test_fb != emul_fb) {
214 LOG_ERROR <<
"Checks failed for tower (" <<
std::dec << test_iEta <<
", " << test_iPhi <<
") : ("
215 << test_et <<
", " << test_er <<
", " << test_fb <<
") != (" << emul_et <<
", " << emul_er
216 <<
", " << emul_fb <<
")" << std::endl;
226 if (!
success && test_et == emul_et && test_iPhi == emul_iPhi) {
228 LOG_ERROR <<
"Incidental match for tower (" <<
std::dec << test_iEta <<
", " << test_iPhi <<
") : ("
229 << test_et <<
", " << test_er <<
", " << test_fb <<
") != (" << emul_iEta <<
"," << emul_iPhi
230 <<
") :(" << emul_et <<
", " << emul_er <<
", " << emul_fb <<
")" << std::endl;
240 uint32_t testRegionTotET = 0;
241 uint32_t emulRegionTotET = 0;
242 for (std::vector<L1CaloRegion>::const_iterator testRegion = testRegions->begin(); testRegion != testRegions->end();
245 uint32_t test_et = testRegion->et();
246 testRegionTotET += test_et;
247 uint32_t test_rEta = testRegion->id().ieta();
248 uint32_t test_rPhi = testRegion->id().iphi();
251 bool test_negativeEta =
false;
252 int test_cEta = (test_rEta - 11) * 4 + 1;
253 if (test_rEta < 11) {
254 test_negativeEta =
true;
255 test_cEta = -((10 - test_rEta) * 4 + 1);
257 int test_cPhi = test_rPhi * 4 + 1;
258 uint32_t test_crate =
g.getCrate(test_cEta, test_cPhi);
259 uint32_t test_card =
g.getCard(test_cEta, test_cPhi);
260 uint32_t test_region =
g.getRegion(test_cEta, test_cPhi);
261 for (std::vector<L1CaloRegion>::const_iterator emulRegion = emulRegions->begin();
262 emulRegion != emulRegions->end();
265 uint32_t emul_et = emulRegion->et();
266 if (testRegion == testRegions->begin())
267 emulRegionTotET += emul_et;
268 uint32_t emul_rEta = emulRegion->id().ieta();
269 uint32_t emul_rPhi = emulRegion->id().iphi();
272 bool emul_negativeEta =
false;
273 int emul_cEta = (emul_rEta - 11) * 4 + 1;
274 if (emul_rEta < 11) {
275 emul_negativeEta =
true;
276 emul_cEta = -((10 - emul_rEta) * 4 + 1);
278 int emul_cPhi = emul_rPhi * 4 + 1;
279 uint32_t emul_crate =
g.getCrate(emul_cEta, emul_cPhi);
280 uint32_t emul_card =
g.getCard(emul_cEta, emul_cPhi);
281 uint32_t emul_region =
g.getRegion(emul_cEta, emul_cPhi);
283 if (test_rEta == emul_rEta && test_rPhi == emul_rPhi) {
284 if (test_et != emul_et)
290 LOG_ERROR <<
"Checks failed for region (" <<
std::dec << test_rEta <<
", " << test_rPhi <<
") ("
291 << test_negativeEta <<
", " << test_crate <<
", " << test_card <<
", " << test_region
295 << test_et <<
") != (" << emul_negativeEta <<
", " << emul_crate <<
", " << emul_card <<
", "
300 << emul_et <<
")" << std::endl;
316 LOG_ERROR <<
"Checks passed for region (" <<
std::dec << test_rEta <<
", " << test_rPhi <<
") ("
317 << test_negativeEta <<
", " << test_crate <<
", " << test_card <<
", " << test_region
321 << test_et <<
") == (" << emul_negativeEta <<
", " << emul_crate <<
", " << emul_card <<
", "
326 << emul_et <<
")" << std::endl;
336 if (!
success && test_et == emul_et) {
338 LOG_ERROR <<
"Incidental match for region (" <<
std::dec << test_rEta <<
", " << test_rPhi
342 << test_et <<
") != (" << emul_rEta <<
", " << emul_rPhi
346 << emul_et <<
")" << std::endl;
350 uint32_t emulTowerTotET = 0;
351 for (std::vector<CaloTower>::const_iterator emulTower = emulTowers->
begin(theBX);
352 emulTower != emulTowers->
end(theBX);
354 int twr_et = emulTower->hwPt();
355 int twr_cEta = emulTower->hwEta();
356 int twr_cPhi = emulTower->hwPhi();
357 uint32_t twr_region =
g.getRegion(twr_cEta, twr_cPhi);
358 uint32_t twr_gEta = 10 - twr_region;
360 twr_gEta = twr_region + 11;
361 uint32_t twr_gPhi =
g.getUCTRegionPhiIndex(twr_cPhi);
362 if (badEvent && twr_et > 0) {
364 LOG_ERROR <<
"Non-zero tower in region (" << twr_gEta <<
", " << twr_gPhi <<
") "
365 <<
"(cEta, cPhi, et) = (" << twr_cEta <<
", " << twr_cPhi <<
", " << twr_et <<
")" << std::endl;
368 emulTowerTotET += twr_et;
371 if (emulTowerTotET < emulRegionTotET)
373 else if (emulTowerTotET > emulRegionTotET)
378 if (testRegionTotET < emulRegionTotET)
380 else if (testRegionTotET > emulRegionTotET)