37 #include "L1Trigger/L1TCaloLayer1/src/UCTGeometry.hh"
39 #include "L1Trigger/L1TCaloLayer1/src/UCTLogging.hh"
58 virtual void endJob()
override;
84 uint32_t ngRegion[22];
85 uint32_t nbRegion[22];
86 uint32_t zgRegion[22];
87 uint32_t zbRegion[22];
129 nonZeroTowerCount(0),
130 badNonZeroTowerCount(0),
133 nonZeroRegionCount(0),
134 badNonZeroRegionCount(0),
141 validateTowers(iConfig.getParameter<bool>(
"validateTowers")),
142 validateRegions(iConfig.getParameter<bool>(
"validateRegions")),
143 verbose(iConfig.getParameter<bool>(
"verbose")) {
160 bool badEvent =
false;
177 for(std::vector<CaloTower>::const_iterator testTower = testTowers->begin(theBX);
178 testTower != testTowers->end(theBX);
180 int test_iEta = testTower->hwEta();
181 int test_iPhi = testTower->hwPhi();
182 int test_et = testTower->hwPt();
183 int test_er = testTower->hwEtRatio();
184 int test_fb = testTower->hwQual();
185 for(std::vector<CaloTower>::const_iterator emulTower = emulTowers->begin(theBX);
186 emulTower != emulTowers->end(theBX);
188 int emul_iEta = emulTower->hwEta();
189 int emul_iPhi = emulTower->hwPhi();
190 int emul_et = emulTower->hwPt();
191 int emul_er = emulTower->hwEtRatio();
192 int emul_fb = emulTower->hwQual();
194 if(test_iEta == emul_iEta && test_iPhi == emul_iPhi) {
195 if(test_et != emul_et) {success =
false;}
196 if(test_er != emul_er) {success =
false;}
197 if(test_fb != emul_fb) {success =
false;}
205 << test_iPhi <<
") : ("
208 << test_fb <<
") != ("
211 << emul_fb <<
")" << std::endl;
219 if(!success && test_et == emul_et && test_iPhi == emul_iPhi) {
223 << test_iPhi <<
") : ("
226 << test_fb <<
") != ("
231 << emul_fb <<
")" << std::endl;
241 uint32_t testRegionTotET = 0;
242 uint32_t emulRegionTotET = 0;
243 for(std::vector<L1CaloRegion>::const_iterator testRegion = testRegions->begin();
244 testRegion != testRegions->end();
247 uint32_t test_et = testRegion->et();
248 testRegionTotET += test_et;
249 uint32_t test_rEta = testRegion->id().ieta();
250 uint32_t test_rPhi = testRegion->id().iphi();
253 bool test_negativeEta =
false;
254 int test_cEta = (test_rEta - 11) * 4 + 1;
256 test_negativeEta =
true;
257 test_cEta = -((10 - test_rEta) * 4 + 1);
259 int test_cPhi = test_rPhi * 4 + 1;
260 uint32_t test_crate = g.getCrate(test_cEta, test_cPhi);
261 uint32_t test_card = g.getCard(test_cEta, test_cPhi);
262 uint32_t test_region = g.getRegion(test_cEta, test_cPhi);
263 for(std::vector<L1CaloRegion>::const_iterator emulRegion = emulRegions->begin();
264 emulRegion != emulRegions->end();
267 uint32_t emul_et = emulRegion->et();
268 if(testRegion == testRegions->begin()) emulRegionTotET += emul_et;
269 uint32_t emul_rEta = emulRegion->id().ieta();
270 uint32_t emul_rPhi = emulRegion->id().iphi();
273 bool emul_negativeEta =
false;
274 int emul_cEta = (emul_rEta - 11) * 4 + 1;
276 emul_negativeEta =
true;
277 emul_cEta = -((10 - emul_rEta) * 4 + 1);
279 int emul_cPhi = emul_rPhi * 4 + 1;
280 uint32_t emul_crate = g.getCrate(emul_cEta, emul_cPhi);
281 uint32_t emul_card = g.getCard(emul_cEta, emul_cPhi);
282 uint32_t emul_region = g.getRegion(emul_cEta, emul_cPhi);
284 if(test_rEta == emul_rEta && test_rPhi == emul_rPhi) {
285 if(test_et != emul_et) success =
false;
292 << test_rPhi <<
") ("
293 << test_negativeEta <<
", "
294 << test_crate <<
", "
296 << test_region <<
", "
299 << test_et <<
") != ("
300 << emul_negativeEta <<
", "
301 << emul_crate <<
", "
303 << emul_region <<
", "
306 << emul_et <<
")"<< std::endl;
326 << test_rPhi <<
") ("
327 << test_negativeEta <<
", "
328 << test_crate <<
", "
330 << test_region <<
", "
333 << test_et <<
") == ("
334 << emul_negativeEta <<
", "
335 << emul_crate <<
", "
337 << emul_region <<
", "
340 << emul_et <<
")"<< std::endl;
350 if(!success && test_et == emul_et) {
357 << test_et <<
") != ("
362 << emul_et <<
")"<< std::endl;
366 uint32_t emulTowerTotET = 0;
367 for(std::vector<CaloTower>::const_iterator emulTower = emulTowers->begin(theBX);
368 emulTower != emulTowers->end(theBX);
370 int twr_et = emulTower->hwPt();
371 int twr_cEta = emulTower->hwEta();
372 int twr_cPhi = emulTower->hwPhi();
373 uint32_t twr_region = g.getRegion(twr_cEta, twr_cPhi);
374 uint32_t twr_gEta = 10 - twr_region;
375 if(twr_cEta > 0) twr_gEta = twr_region + 11;
376 uint32_t twr_gPhi = g.getUCTRegionPhiIndex(twr_cPhi);
377 if(badEvent && twr_et > 0) {
381 <<
"(cEta, cPhi, et) = ("
387 if(
std::abs(twr_cEta) <= 28) emulTowerTotET += twr_et;
391 else if(emulTowerTotET > emulRegionTotET)
tGrEmulTotET++;
394 if(testRegionTotET < emulRegionTotET)
tLeTotET++;
395 else if(testRegionTotET > emulRegionTotET)
tGeTotET++;
417 LOG_ERROR <<
"L1TCaloLayer1Validator: Summary is Non-Zero Bad Tower / Bad Tower / Event Count = ("
422 LOG_ERROR <<
"L1TCaloLayer1Validator: Summary is Non-Zero Bad Region / Bad Region / Event Count = ("
426 LOG_ERROR <<
"L1TCaloLayer1Validator reTa, non-zero-good / non-zero-bad / zero-good / zero-bad region[rEta] = " << std::endl;
427 for(uint32_t
r = 0;
r < 22;
r++)
429 LOG_ERROR <<
"L1TCaloLayer1Validator rPhi, non-zero-good / non-zero-bad / zero-good / zero-bad region[rPhi] = " << std::endl;
430 for(uint32_t
r = 0;
r < 18;
r++)
432 LOG_ERROR <<
"L1TCaloLayer1Validator : Total ET emulator tower vs region; less / equal / greater counts: "
434 LOG_ERROR <<
"L1TCaloLayer1Validator : Total ET region test vs emulator; less / equal / greater counts: "
virtual void beginJob() override
~L1TCaloLayer1Validator()
edm::EDGetTokenT< CaloTowerBxCollection > emulTowerToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
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
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
void addDefault(ParameterSetDescription const &psetDescription)
uint32_t nonZeroRegionCount
uint32_t nonZeroTowerCount
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< L1CaloRegionCollection > testRegionToken
L1TCaloLayer1Validator(const edm::ParameterSet &)
uint32_t badNonZeroRegionCount
virtual void endJob() override
std::vector< L1CaloRegion > L1CaloRegionCollection
uint32_t badNonZeroTowerCount