36 #include "L1Trigger/L1TCaloLayer1/src/UCTGeometry.hh" 38 #include "L1Trigger/L1TCaloLayer1/src/UCTLogging.hh" 54 void endJob()
override;
75 uint32_t ngRegion[22];
76 uint32_t nbRegion[22];
77 uint32_t zgRegion[22];
78 uint32_t zbRegion[22];
119 nonZeroTowerCount(0),
120 badNonZeroTowerCount(0),
123 nonZeroRegionCount(0),
124 badNonZeroRegionCount(0),
134 for (uint32_t
r = 0;
r < 22;
r++)
136 for (uint32_t
c = 0;
c < 18;
c++)
147 bool badEvent =
false;
164 for (std::vector<CaloTower>::const_iterator testTower = testTowers->
begin(theBX);
165 testTower != testTowers->
end(theBX);
167 int test_iEta = testTower->hwEta();
168 int test_iPhi = testTower->hwPhi();
169 int test_et = testTower->hwPt();
170 int test_er = testTower->hwEtRatio();
171 int test_fb = testTower->hwQual();
172 for (std::vector<CaloTower>::const_iterator emulTower = emulTowers->
begin(theBX);
173 emulTower != emulTowers->
end(theBX);
175 int emul_iEta = emulTower->hwEta();
176 int emul_iPhi = emulTower->hwPhi();
177 int emul_et = emulTower->hwPt();
178 int emul_er = emulTower->hwEtRatio();
179 int emul_fb = emulTower->hwQual();
181 if (test_iEta == emul_iEta && test_iPhi == emul_iPhi) {
182 if (test_et != emul_et) {
185 if (test_er != emul_er) {
188 if (test_fb != emul_fb) {
192 if (test_et != emul_et) {
196 if (test_er != emul_er) {
200 if (test_fb != emul_fb) {
205 LOG_ERROR <<
"Checks failed for tower (" <<
std::dec << test_iEta <<
", " << test_iPhi <<
") : (" 206 << test_et <<
", " << test_er <<
", " << test_fb <<
") != (" << emul_et <<
", " << emul_er
207 <<
", " << emul_fb <<
")" << std::endl;
217 if (!
success && test_et == emul_et && test_iPhi == emul_iPhi) {
219 LOG_ERROR <<
"Incidental match for tower (" <<
std::dec << test_iEta <<
", " << test_iPhi <<
") : (" 220 << test_et <<
", " << test_er <<
", " << test_fb <<
") != (" << emul_iEta <<
"," << emul_iPhi
221 <<
") :(" << emul_et <<
", " << emul_er <<
", " << emul_fb <<
")" << std::endl;
231 uint32_t testRegionTotET = 0;
232 uint32_t emulRegionTotET = 0;
233 for (std::vector<L1CaloRegion>::const_iterator testRegion = testRegions->begin(); testRegion != testRegions->end();
236 uint32_t test_et = testRegion->et();
237 testRegionTotET += test_et;
238 uint32_t test_rEta = testRegion->id().ieta();
239 uint32_t test_rPhi = testRegion->id().iphi();
242 bool test_negativeEta =
false;
243 int test_cEta = (test_rEta - 11) * 4 + 1;
244 if (test_rEta < 11) {
245 test_negativeEta =
true;
246 test_cEta = -((10 - test_rEta) * 4 + 1);
248 int test_cPhi = test_rPhi * 4 + 1;
249 uint32_t test_crate =
g.getCrate(test_cEta, test_cPhi);
250 uint32_t test_card =
g.getCard(test_cEta, test_cPhi);
251 uint32_t test_region =
g.getRegion(test_cEta, test_cPhi);
252 for (std::vector<L1CaloRegion>::const_iterator emulRegion = emulRegions->begin();
253 emulRegion != emulRegions->end();
256 uint32_t emul_et = emulRegion->et();
257 if (testRegion == testRegions->begin())
258 emulRegionTotET += emul_et;
259 uint32_t emul_rEta = emulRegion->id().ieta();
260 uint32_t emul_rPhi = emulRegion->id().iphi();
263 bool emul_negativeEta =
false;
264 int emul_cEta = (emul_rEta - 11) * 4 + 1;
265 if (emul_rEta < 11) {
266 emul_negativeEta =
true;
267 emul_cEta = -((10 - emul_rEta) * 4 + 1);
269 int emul_cPhi = emul_rPhi * 4 + 1;
270 uint32_t emul_crate =
g.getCrate(emul_cEta, emul_cPhi);
271 uint32_t emul_card =
g.getCard(emul_cEta, emul_cPhi);
272 uint32_t emul_region =
g.getRegion(emul_cEta, emul_cPhi);
274 if (test_rEta == emul_rEta && test_rPhi == emul_rPhi) {
275 if (test_et != emul_et)
281 LOG_ERROR <<
"Checks failed for region (" <<
std::dec << test_rEta <<
", " << test_rPhi <<
") (" 282 << test_negativeEta <<
", " << test_crate <<
", " << test_card <<
", " << test_region
286 << test_et <<
") != (" << emul_negativeEta <<
", " << emul_crate <<
", " << emul_card <<
", " 291 << emul_et <<
")" << std::endl;
307 LOG_ERROR <<
"Checks passed for region (" <<
std::dec << test_rEta <<
", " << test_rPhi <<
") (" 308 << test_negativeEta <<
", " << test_crate <<
", " << test_card <<
", " << test_region
312 << test_et <<
") == (" << emul_negativeEta <<
", " << emul_crate <<
", " << emul_card <<
", " 317 << emul_et <<
")" << std::endl;
327 if (!
success && test_et == emul_et) {
329 LOG_ERROR <<
"Incidental match for region (" <<
std::dec << test_rEta <<
", " << test_rPhi
333 << test_et <<
") != (" << emul_rEta <<
", " << emul_rPhi
337 << emul_et <<
")" << std::endl;
341 uint32_t emulTowerTotET = 0;
342 for (std::vector<CaloTower>::const_iterator emulTower = emulTowers->
begin(theBX);
343 emulTower != emulTowers->
end(theBX);
345 int twr_et = emulTower->hwPt();
346 int twr_cEta = emulTower->hwEta();
347 int twr_cPhi = emulTower->hwPhi();
348 uint32_t twr_region =
g.getRegion(twr_cEta, twr_cPhi);
349 uint32_t twr_gEta = 10 - twr_region;
351 twr_gEta = twr_region + 11;
352 uint32_t twr_gPhi =
g.getUCTRegionPhiIndex(twr_cPhi);
353 if (badEvent && twr_et > 0) {
355 LOG_ERROR <<
"Non-zero tower in region (" << twr_gEta <<
", " << twr_gPhi <<
") " 356 <<
"(cEta, cPhi, et) = (" << twr_cEta <<
", " << twr_cPhi <<
", " << twr_et <<
")" << std::endl;
359 emulTowerTotET += twr_et;
362 if (emulTowerTotET < emulRegionTotET)
364 else if (emulTowerTotET > emulRegionTotET)
369 if (testRegionTotET < emulRegionTotET)
371 else if (testRegionTotET > emulRegionTotET)
387 LOG_ERROR <<
"L1TCaloLayer1Validator: Summary is Non-Zero Bad Tower / Bad Tower / Event Count = (" 391 LOG_ERROR <<
"L1TCaloLayer1Validator: Summary is Non-Zero Bad Region / Bad Region / Event Count = (" 394 LOG_ERROR <<
"L1TCaloLayer1Validator reTa, non-zero-good / non-zero-bad / zero-good / zero-bad region[rEta] = " 396 for (uint32_t
r = 0;
r < 22;
r++)
399 LOG_ERROR <<
"L1TCaloLayer1Validator rPhi, non-zero-good / non-zero-bad / zero-good / zero-bad region[rPhi] = " 401 for (uint32_t
r = 0;
r < 18;
r++)
404 LOG_ERROR <<
"L1TCaloLayer1Validator : Total ET emulator tower vs region; less / equal / greater counts: " 406 LOG_ERROR <<
"L1TCaloLayer1Validator : Total ET region test vs emulator; less / equal / greater counts: "
edm::EDGetTokenT< CaloTowerBxCollection > emulTowerToken
edm::EDGetTokenT< L1CaloRegionCollection > emulRegionToken
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< CaloTowerBxCollection > testTowerToken
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void analyze(const edm::Event &, const edm::EventSetup &) override
const_iterator begin(int bx) const
void addDefault(ParameterSetDescription const &psetDescription)
uint32_t nonZeroRegionCount
uint32_t nonZeroTowerCount
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< L1CaloRegionCollection > testRegionToken
L1TCaloLayer1Validator(const edm::ParameterSet &)
uint32_t badNonZeroRegionCount
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const_iterator end(int bx) const
std::vector< L1CaloRegion > L1CaloRegionCollection
uint32_t badNonZeroTowerCount