14 std::cout <<
"L1TdeGCT::L1TdeGCT()...\n" << std::flush;
23 if (!histFile_.empty()) {
24 edm::LogInfo(
"OutputRootFile") <<
"L1TEmulator GCT specific histograms will be saved to " << histFile_.c_str()
31 std::cout <<
"L1TdeGCT::L1TdeGCT()...done.\n" << std::flush;
32 m_stage1_layer2_ = iConfig.
getParameter<
bool>(
"stage1_layer2_");
39 double rnkMinim = 0.5;
40 double rnkMaxim = 63.5;
43 std::cout <<
"L1TdeGCT::beginRun() start\n" << std::flush;
47 if (m_stage1_layer2_ ==
false) {
48 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES", nGctColl_, 0, nGctColl_);
50 for (
int j = 0;
j < 2;
j++) {
52 lbl += (
j == 0 ?
"Data" :
"Emul");
54 title += (
j == 0 ?
"(DATA)" :
"(EMULATOR)");
55 sysncand[
j] = ibooker.
book1D(lbl.data(),
title.data(), nGctColl_, 0, nGctColl_);
58 for (
int j = 0;
j < nGctColl_;
j++) {
68 title +=
" ErrorFlag";
69 errortype[
j] = ibooker.
book1D(lbl.data(),
title.data(), nerr, 0, nerr);
76 title +=
" ETA OF COMPARISON FAILURES";
83 title +=
" PHI OF COMPARISON FAILURES";
91 title +=
" ETA PHI OF COMPARISON FAILURES";
98 title +=
" RANK OF COMPARISON FAILURES";
99 rnk[
j] = ibooker.
book1D(lbl.data(),
title.data(), rnkNBins, rnkMinim, rnkMaxim);
107 title +=
" ETA (DATA)";
115 title +=
" PHI (DATA)";
124 title +=
" RANK (DATA)";
125 rnkData[
j] = ibooker.
book1D(lbl.data(),
title.data(), rnkNBins, rnkMinim, rnkMaxim);
129 dword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
133 eword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
137 deword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
143 for (
int i = 0;
i < nGctColl_;
i++) {
145 sysncand[0]->setBinLabel(
i + 1, cLabel[
i]);
146 sysncand[1]->setBinLabel(
i + 1, cLabel[
i]);
149 for (
int i = 0;
i < nGctColl_;
i++) {
150 for (
int j = 0;
j < nerr;
j++) {
151 errortype[
i]->setBinLabel(
j + 1, errLabel[
j]);
155 for (
int i = 0;
i < nGctColl_;
i++) {
156 etaphi[
i]->setAxisTitle(
"GCT #eta", 1);
157 etaphi[
i]->setAxisTitle(
"GCT #phi", 2);
158 eta[
i]->setAxisTitle(
"GCT #eta");
159 phi[
i]->setAxisTitle(
"GCT #phi");
160 rnk[
i]->setAxisTitle(
"Rank");
161 etaData[
i]->setAxisTitle(
"GCT #eta");
162 phiData[
i]->setAxisTitle(
"GCT #phi");
163 rnkData[
i]->setAxisTitle(
"Rank");
164 dword[
i]->setAxisTitle(
"trigger data word bit");
165 eword[
i]->setAxisTitle(
"trigger data word bit");
166 deword[
i]->setAxisTitle(
"trigger data word bit");
169 for (
int i = 0;
i < nGctColl_;
i++) {
177 if (m_stage1_layer2_ ==
true) {
178 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES", nStage1Layer2Coll_, 0, nStage1Layer2Coll_);
180 for (
int j = 0;
j < 2;
j++) {
182 lbl += (
j == 0 ?
"Data" :
"Emul");
184 title += (
j == 0 ?
"(DATA)" :
"(EMULATOR)");
185 sysncand[
j] = ibooker.
book1D(lbl.data(),
title.data(), nStage1Layer2Coll_, 0, nStage1Layer2Coll_);
188 for (
int j = 0;
j < nStage1Layer2Coll_;
j++) {
191 if (sLabel[
j] ==
"MHT") {
197 if ((sLabel[
j] ==
"HT") || (sLabel[
j] ==
"ET") || (sLabel[
j] ==
"MET")) {
203 if (sLabel[
j] ==
"Stage1HFSums") {
209 if (sLabel[
j] ==
"IsoTauJet") {
222 title +=
" ErrorFlag";
223 errortype_stage1layer2[
j] = ibooker.
book1D(lbl.data(),
title.data(), nerr, 0, nerr);
230 title +=
" ETA OF COMPARISON FAILURES";
237 title +=
" PHI OF COMPARISON FAILURES";
245 title +=
" ETA PHI OF COMPARISON FAILURES";
246 etaphi_stage1layer2[
j] =
253 title +=
" RANK OF COMPARISON FAILURES";
254 rnk_stage1layer2[
j] = ibooker.
book1D(lbl.data(),
title.data(), rnkNBins, rnkMinim, rnkMaxim);
262 title +=
" ETA (DATA)";
263 etaData_stage1layer2[
j] = ibooker.
book1D(lbl.data(),
title.data(),
etaNBins, etaMinim, etaMaxim);
270 title +=
" PHI (DATA)";
271 phiData_stage1layer2[
j] = ibooker.
book1D(lbl.data(),
title.data(),
phiNBins, phiMinim, phiMaxim);
279 title +=
" RANK (DATA)";
280 rnkData_stage1layer2[
j] = ibooker.
book1D(lbl.data(),
title.data(), rnkNBins, rnkMinim, rnkMaxim);
284 dword_stage1layer2[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
288 eword_stage1layer2[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
292 deword_stage1layer2[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
298 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
300 sysncand[0]->setBinLabel(
i + 1, sLabel[
i]);
301 sysncand[1]->setBinLabel(
i + 1, sLabel[
i]);
304 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
305 for (
int j = 0;
j < nerr;
j++) {
306 errortype_stage1layer2[
i]->setBinLabel(
j + 1, errLabel[
j]);
310 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
311 etaphi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta", 1);
312 etaphi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi", 2);
313 eta_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta");
314 phi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi");
315 rnk_stage1layer2[
i]->setAxisTitle(
"Rank");
316 etaData_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta");
317 phiData_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi");
318 rnkData_stage1layer2[
i]->setAxisTitle(
"Rank");
319 dword_stage1layer2[
i]->setAxisTitle(
"trigger data word bit");
320 eword_stage1layer2[
i]->setAxisTitle(
"trigger data word bit");
321 deword_stage1layer2[
i]->setAxisTitle(
"trigger data word bit");
324 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
325 colCount_stage1Layer2[
i] = 0;
326 nWithCol_stage1Layer2[
i] = 0;
331 std::cout <<
"L1TdeGCT::beginJob() end.\n" << std::flush;
341 std::cout <<
"L1TdeGCT::analyze() start\n" << std::flush;
345 iEvent.getByToken(DEsource_, deRecord);
348 edm::LogInfo(
"DataNotFound") <<
"Cannot find L1DataEmulRecord"
349 <<
" Please verify that comparator was successfully executed."
350 <<
" Emulator DQM for GCT will be skipped!" << std::endl;
355 if (m_stage1_layer2_ ==
false) {
359 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record."
360 <<
" Skiping event!\n"
365 int DEncand[2] = {0};
366 for (
int j = 0;
j < 2;
j++)
371 <<
" data: " << DEncand[0] <<
" emul: " << DEncand[1] << std::endl;
383 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
385 if (it->sid() ==
GCT)
386 gctColl.push_back(*it);
389 std::cout <<
"[L1TdeGCT] record has " << gctColl.size() <<
" gct de digis\n" << std::flush;
390 for (L1DEDigiCollection::const_iterator it = gctColl.begin(); it != gctColl.end(); it++)
399 for (L1DEDigiCollection::const_iterator it = gctColl.begin(); it != gctColl.end(); it++) {
407 std::cout <<
"[L1TdeGCT] processing digi "
408 <<
" sys:" << sid <<
" type:" << cid <<
" \n\t" << *it <<
"\n"
412 if (sid !=
GCT || it->empty()) {
413 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-gct digis!";
417 int type = it->type();
418 double phiv = it->x1();
419 double etav = it->x2();
422 float rnkv = rankarr[0];
426 unsigned int mask = (~0x0);
430 if (ccid < 0 || ccid >= nGctColl_) {
431 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" << ccid <<
"\n";
437 sysncand[0]->
Fill(ccid);
438 if (it->type() < 5 && it->type() != 3)
439 sysncand[1]->
Fill(ccid);
441 errortype[ccid]->Fill(
type);
446 if (etav != nullVal && phiv != nullVal)
447 etaphi[ccid]->Fill(etav, phiv, wei);
449 eta[ccid]->Fill(etav, wei);
451 phi[ccid]->Fill(phiv, wei);
452 rnk[ccid]->Fill(rnkv, wei);
459 etaData[ccid]->Fill(etav, wei);
461 phiData[ccid]->Fill(phiv, wei);
462 rnkData[ccid]->Fill(rnkv, wei);
466 unsigned int word[2];
468 std::bitset<32> dbits(
word[0]);
469 std::bitset<32> ebits(
word[1]);
470 unsigned int dexor = ((
word[0]) ^ (
word[1]));
472 std::bitset<32> debits(dexor);
474 std::bitset<32> dembits(((dexor) & (mask)));
478 <<
" sid:" << sid <<
" cid:" << cid <<
"\n"
479 <<
" data:0x" << std::hex <<
word[0] <<
std::dec <<
" bitset:" << dbits <<
"\n"
480 <<
" emul:0x" << std::hex <<
word[1] <<
std::dec <<
" bitset:" << ebits <<
"\n"
481 <<
" xor:0x" << std::hex << dexor <<
std::dec <<
" bitset:" << debits
482 <<
" bitset:" << ((dbits) ^ (ebits)) <<
"\n"
486 for (
int ibit = 0; ibit < 32; ibit++) {
492 dword[ccid]->Fill(ibit, wei);
494 eword[ccid]->Fill(ibit, wei);
496 deword[ccid]->Fill(ibit, wei);
503 int hasCol[nGctColl_] = {0};
504 int nagree[nGctColl_] = {0};
505 for (L1DEDigiCollection::const_iterator it = gctColl.begin(); it != gctColl.end(); it++) {
507 ccid = (ccid < 0 || ccid >= nGctColl_) ? 0 : ccid;
512 for (
int i = 0;
i < nGctColl_;
i++) {
519 nWithCol[
i] += hasCol[
i];
520 colCount[
i] += nagree[
i];
522 for (
int i = 0;
i < nGctColl_;
i++) {
524 double rate = nWithCol[
i] ? 1. - 1. * colCount[
i] / nWithCol[
i] : 0.;
525 sysrates->setBinContent(ibin,
rate);
527 std::cout <<
"[L1TDEMON] analyze rate computation\t\n"
528 <<
" colid:" <<
i <<
"(so far)"
529 <<
" nWithCol: " << nWithCol[
i] <<
" colCount: " << colCount[
i] <<
"(this event)"
530 <<
"hasCol: " << hasCol[
i] <<
" nagree: " << nagree[
i] <<
" rate:" << sysrates->getBinContent(ibin)
534 std::cout <<
"problem, error rate for " <<
SystLabel[
i] <<
" is " << sysrates->getBinContent(ibin) <<
"\n"
540 if (m_stage1_layer2_ ==
true) {
544 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record."
545 <<
" Skiping event!\n"
550 int DEncand[2] = {0};
551 for (
int j = 0;
j < 2;
j++)
556 <<
" data: " << DEncand[0] <<
" emul: " << DEncand[1] << std::endl;
565 stage1layer2Coll.reserve(21);
566 stage1layer2Coll.clear();
568 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
570 if (it->sid() ==
GCT)
571 stage1layer2Coll.push_back(*it);
574 std::cout <<
"[L1TdeSTAGE1LAYER2] record has " << stage1layer2Coll.size() <<
" stage1layer2 de digis\n"
576 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++)
585 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++) {
593 std::cout <<
"[L1TdeStage1Layer2] processing digi "
594 <<
" sys:" << sid <<
" type:" << cid <<
" \n\t" << *it <<
"\n"
597 if (sid !=
GCT || it->empty()) {
598 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-stage1layer2 digis!";
602 int type = it->type();
603 double phiv = it->x1();
604 double etav = it->x2();
607 float rnkv = rankarr[0];
611 unsigned int mask = (~0x0);
615 if (ccid < 0 || ccid >= nStage1Layer2Coll_) {
616 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" << ccid <<
"\n";
622 sysncand[0]->
Fill(ccid);
623 if (it->type() < 5 && it->type() != 3)
624 sysncand[1]->
Fill(ccid);
625 errortype_stage1layer2[ccid]->Fill(
type);
629 if (etav != nullVal && phiv != nullVal)
630 etaphi_stage1layer2[ccid]->Fill(etav, phiv, wei);
632 eta_stage1layer2[ccid]->Fill(etav, wei);
634 phi_stage1layer2[ccid]->Fill(phiv, wei);
635 rnk_stage1layer2[ccid]->Fill(rnkv, wei);
642 etaData_stage1layer2[ccid]->Fill(etav, wei);
644 phiData_stage1layer2[ccid]->Fill(phiv, wei);
645 rnkData_stage1layer2[ccid]->Fill(rnkv, wei);
649 unsigned int word_stage1layer2[2];
650 it->data(word_stage1layer2);
651 std::bitset<32> dbits(word_stage1layer2[0]);
652 std::bitset<32> ebits(word_stage1layer2[1]);
653 unsigned int dexor = ((word_stage1layer2[0]) ^ (word_stage1layer2[1]));
655 std::bitset<32> debits(dexor);
657 std::bitset<32> dembits(((dexor) & (mask)));
661 <<
" sid:" << sid <<
" cid:" << cid <<
"\n"
662 <<
" data:0x" << std::hex << word_stage1layer2[0] <<
std::dec <<
" bitset:" << dbits <<
"\n"
663 <<
" emul:0x" << std::hex << word_stage1layer2[1] <<
std::dec <<
" bitset:" << ebits <<
"\n"
664 <<
" xor:0x" << std::hex << dexor <<
std::dec <<
" bitset:" << debits
665 <<
" bitset:" << ((dbits) ^ (ebits)) <<
"\n"
669 for (
int ibit = 0; ibit < 32; ibit++) {
675 dword_stage1layer2[ccid]->Fill(ibit, wei);
677 eword_stage1layer2[ccid]->Fill(ibit, wei);
679 deword_stage1layer2[ccid]->Fill(ibit, wei);
685 int hasCol[nStage1Layer2Coll_] = {0};
686 int nagree[nStage1Layer2Coll_] = {0};
687 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++) {
689 ccid = (ccid < 0 || ccid >= nStage1Layer2Coll_) ? 0 : ccid;
694 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
701 nWithCol_stage1Layer2[
i] += hasCol[
i];
702 colCount_stage1Layer2[
i] += nagree[
i];
704 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
706 double rate = nWithCol_stage1Layer2[
i] ? 1. - 1. * colCount_stage1Layer2[
i] / nWithCol_stage1Layer2[
i] : 0.;
707 sysrates->setBinContent(ibin,
rate);
709 std::cout <<
"[L1TDEMON] analyze rate computation\t\n"
710 <<
" colid:" <<
i <<
"(so far)"
711 <<
" nWithCol: " << nWithCol_stage1Layer2[
i] <<
" colCount: " << colCount_stage1Layer2[
i]
713 <<
"hasCol: " << hasCol[
i] <<
" nagree: " << nagree[
i] <<
" rate:" << sysrates->getBinContent(ibin)
717 std::cout <<
"problem, error rate for " <<
SystLabel[
i] <<
" is " << sysrates->getBinContent(ibin) <<
"\n"