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);
439 sysncand[1]->Fill(ccid);
441 errortype[ccid]->Fill(
type);
443 wei = (
type == 0) ? 0. : 1.;
444 if (etav != nullVal && phiv != nullVal)
445 etaphi[ccid]->Fill(etav, phiv, wei);
447 eta[ccid]->Fill(etav, wei);
449 phi[ccid]->Fill(phiv, wei);
450 rnk[ccid]->Fill(rnkv, wei);
453 wei = (
type == 4) ? 0. : 1.;
455 etaData[ccid]->Fill(etav, wei);
457 phiData[ccid]->Fill(phiv, wei);
458 rnkData[ccid]->Fill(rnkv, wei);
461 unsigned int word[2];
463 std::bitset<32> dbits(
word[0]);
464 std::bitset<32> ebits(
word[1]);
465 unsigned int dexor = ((
word[0]) ^ (
word[1]));
467 std::bitset<32> debits(dexor);
469 std::bitset<32> dembits(((dexor) & (
mask)));
473 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 474 <<
" data:0x" << std::hex <<
word[0] <<
std::dec <<
" bitset:" << dbits <<
"\n" 475 <<
" emul:0x" << std::hex <<
word[1] <<
std::dec <<
" bitset:" << ebits <<
"\n" 476 <<
" xor:0x" << std::hex << dexor <<
std::dec <<
" bitset:" << debits
477 <<
" bitset:" << ((dbits) ^ (ebits)) <<
"\n" 481 for (
int ibit = 0; ibit < 32; ibit++) {
483 wei = (
type == 3 ||
type == 4) ? 0. : 1.;
485 dword[ccid]->Fill(ibit, wei);
487 eword[ccid]->Fill(ibit, wei);
489 deword[ccid]->Fill(ibit, wei);
495 int hasCol[nGctColl_] = {0};
496 int nagree[nGctColl_] = {0};
497 for (L1DEDigiCollection::const_iterator it = gctColl.begin(); it != gctColl.end(); it++) {
499 ccid = (ccid < 0 || ccid >= nGctColl_) ? 0 : ccid;
504 for (
int i = 0;
i < nGctColl_;
i++) {
511 nWithCol[
i] += hasCol[
i];
512 colCount[
i] += nagree[
i];
514 for (
int i = 0;
i < nGctColl_;
i++) {
516 double rate = nWithCol[
i] ? 1. - 1. * colCount[
i] / nWithCol[
i] : 0.;
517 sysrates->setBinContent(ibin,
rate);
519 std::cout <<
"[L1TDEMON] analyze rate computation\t\n" 520 <<
" colid:" <<
i <<
"(so far)" 521 <<
" nWithCol: " << nWithCol[
i] <<
" colCount: " << colCount[
i] <<
"(this event)" 522 <<
"hasCol: " << hasCol[
i] <<
" nagree: " << nagree[
i] <<
" rate:" << sysrates->getBinContent(ibin)
526 std::cout <<
"problem, error rate for " <<
SystLabel[
i] <<
" is " << sysrates->getBinContent(ibin) <<
"\n" 532 if (m_stage1_layer2_ ==
true) {
536 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record." 537 <<
" Skiping event!\n" 542 int DEncand[2] = {0};
543 for (
int j = 0;
j < 2;
j++)
548 <<
" data: " << DEncand[0] <<
" emul: " << DEncand[1] << std::endl;
557 stage1layer2Coll.reserve(21);
558 stage1layer2Coll.clear();
560 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
562 if (it->sid() ==
GCT)
563 stage1layer2Coll.push_back(*it);
566 std::cout <<
"[L1TdeSTAGE1LAYER2] record has " << stage1layer2Coll.size() <<
" stage1layer2 de digis\n" 568 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++)
577 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++) {
585 std::cout <<
"[L1TdeStage1Layer2] processing digi " 586 <<
" sys:" << sid <<
" type:" << cid <<
" \n\t" << *it <<
"\n" 589 if (sid !=
GCT || it->empty()) {
590 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-stage1layer2 digis!";
594 int type = it->type();
595 double phiv = it->x1();
596 double etav = it->x2();
599 float rnkv = rankarr[0];
603 unsigned int mask = (~0x0);
607 if (ccid < 0 || ccid >= nStage1Layer2Coll_) {
608 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" << ccid <<
"\n";
614 sysncand[0]->Fill(ccid);
616 sysncand[1]->Fill(ccid);
617 errortype_stage1layer2[ccid]->Fill(
type);
618 wei = (
type == 0) ? 0. : 1.;
619 if (etav != nullVal && phiv != nullVal)
620 etaphi_stage1layer2[ccid]->Fill(etav, phiv, wei);
622 eta_stage1layer2[ccid]->Fill(etav, wei);
624 phi_stage1layer2[ccid]->Fill(phiv, wei);
625 rnk_stage1layer2[ccid]->Fill(rnkv, wei);
628 wei = (
type == 4) ? 0. : 1.;
630 etaData_stage1layer2[ccid]->Fill(etav, wei);
632 phiData_stage1layer2[ccid]->Fill(phiv, wei);
633 rnkData_stage1layer2[ccid]->Fill(rnkv, wei);
636 unsigned int word_stage1layer2[2];
637 it->data(word_stage1layer2);
638 std::bitset<32> dbits(word_stage1layer2[0]);
639 std::bitset<32> ebits(word_stage1layer2[1]);
640 unsigned int dexor = ((word_stage1layer2[0]) ^ (word_stage1layer2[1]));
642 std::bitset<32> debits(dexor);
644 std::bitset<32> dembits(((dexor) & (
mask)));
648 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 649 <<
" data:0x" << std::hex << word_stage1layer2[0] <<
std::dec <<
" bitset:" << dbits <<
"\n" 650 <<
" emul:0x" << std::hex << word_stage1layer2[1] <<
std::dec <<
" bitset:" << ebits <<
"\n" 651 <<
" xor:0x" << std::hex << dexor <<
std::dec <<
" bitset:" << debits
652 <<
" bitset:" << ((dbits) ^ (ebits)) <<
"\n" 656 for (
int ibit = 0; ibit < 32; ibit++) {
658 wei = (
type == 3 ||
type == 4) ? 0. : 1.;
660 dword_stage1layer2[ccid]->Fill(ibit, wei);
662 eword_stage1layer2[ccid]->Fill(ibit, wei);
664 deword_stage1layer2[ccid]->Fill(ibit, wei);
669 int hasCol[nStage1Layer2Coll_] = {0};
670 int nagree[nStage1Layer2Coll_] = {0};
671 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++) {
673 ccid = (ccid < 0 || ccid >= nStage1Layer2Coll_) ? 0 : ccid;
678 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
685 nWithCol_stage1Layer2[
i] += hasCol[
i];
686 colCount_stage1Layer2[
i] += nagree[
i];
688 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
690 double rate = nWithCol_stage1Layer2[
i] ? 1. - 1. * colCount_stage1Layer2[
i] / nWithCol_stage1Layer2[
i] : 0.;
691 sysrates->setBinContent(ibin,
rate);
693 std::cout <<
"[L1TDEMON] analyze rate computation\t\n" 694 <<
" colid:" <<
i <<
"(so far)" 695 <<
" nWithCol: " << nWithCol_stage1Layer2[
i] <<
" colCount: " << colCount_stage1Layer2[
i]
697 <<
"hasCol: " << hasCol[
i] <<
" nagree: " << nagree[
i] <<
" rate:" << sysrates->getBinContent(ibin)
701 std::cout <<
"problem, error rate for " <<
SystLabel[
i] <<
" is " << sysrates->getBinContent(ibin) <<
"\n" std::pair< T, T > etaphi(T x, T y, T z)
T getParameter(std::string const &) const
virtual void setCurrentFolder(std::string const &fullpath)
std::vector< L1DataEmulDigi > L1DEDigiCollection
static const int nGctColl_
L1TdeGCT(const edm::ParameterSet &)
T getUntrackedParameter(std::string const &, T const &) const
L1DEDigiCollection getColl() const
bool get_isComp(int i) const
int getNCand(int i, int j) const
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Log< level::Info, false > LogInfo
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
const std::string SystLabel[DEnsys]
void analyze(const edm::Event &, const edm::EventSetup &) override
static const int nStage1Layer2Coll_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override