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_");
41 double rnkMinim = 0.5;
42 double rnkMaxim = 63.5;
45 std::cout <<
"L1TdeGCT::beginRun() start\n" << std::flush;
49 if (m_stage1_layer2_ ==
false) {
50 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES", nGctColl_, 0, nGctColl_);
52 for (
int j = 0;
j < 2;
j++) {
54 lbl += (
j == 0 ?
"Data" :
"Emul");
56 title += (
j == 0 ?
"(DATA)" :
"(EMULATOR)");
57 sysncand[
j] = ibooker.
book1D(lbl.data(), title.data(), nGctColl_, 0, nGctColl_);
60 for (
int j = 0;
j < nGctColl_;
j++) {
70 title +=
" ErrorFlag";
71 errortype[
j] = ibooker.
book1D(lbl.data(), title.data(), nerr, 0, nerr);
78 title +=
" ETA OF COMPARISON FAILURES";
85 title +=
" PHI OF COMPARISON FAILURES";
86 phi[
j] = ibooker.
book1D(lbl.data(), title.data(),
phiNBins, phiMinim, phiMaxim);
93 title +=
" ETA PHI OF COMPARISON FAILURES";
100 title +=
" RANK OF COMPARISON FAILURES";
101 rnk[
j] = ibooker.
book1D(lbl.data(), title.data(), rnkNBins, rnkMinim, rnkMaxim);
109 title +=
" ETA (DATA)";
110 etaData[
j] = ibooker.
book1D(lbl.data(), title.data(),
etaNBins, etaMinim, etaMaxim);
117 title +=
" PHI (DATA)";
118 phiData[
j] = ibooker.
book1D(lbl.data(), title.data(),
phiNBins, phiMinim, phiMaxim);
126 title +=
" RANK (DATA)";
127 rnkData[
j] = ibooker.
book1D(lbl.data(), title.data(), rnkNBins, rnkMinim, rnkMaxim);
131 dword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
135 eword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
139 deword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
145 for (
int i = 0;
i < nGctColl_;
i++) {
147 sysncand[0]->setBinLabel(i + 1, cLabel[i]);
148 sysncand[1]->setBinLabel(i + 1, cLabel[i]);
151 for (
int i = 0;
i < nGctColl_;
i++) {
152 for (
int j = 0;
j < nerr;
j++) {
153 errortype[
i]->setBinLabel(
j + 1, errLabel[
j]);
157 for (
int i = 0;
i < nGctColl_;
i++) {
158 etaphi[
i]->setAxisTitle(
"GCT #eta", 1);
159 etaphi[
i]->setAxisTitle(
"GCT #phi", 2);
160 eta[
i]->setAxisTitle(
"GCT #eta");
161 phi[
i]->setAxisTitle(
"GCT #phi");
162 rnk[
i]->setAxisTitle(
"Rank");
163 etaData[
i]->setAxisTitle(
"GCT #eta");
164 phiData[
i]->setAxisTitle(
"GCT #phi");
165 rnkData[
i]->setAxisTitle(
"Rank");
166 dword[
i]->setAxisTitle(
"trigger data word bit");
167 eword[
i]->setAxisTitle(
"trigger data word bit");
168 deword[
i]->setAxisTitle(
"trigger data word bit");
171 for (
int i = 0;
i < nGctColl_;
i++) {
179 if (m_stage1_layer2_ ==
true) {
180 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES", nStage1Layer2Coll_, 0, nStage1Layer2Coll_);
182 for (
int j = 0;
j < 2;
j++) {
184 lbl += (
j == 0 ?
"Data" :
"Emul");
186 title += (
j == 0 ?
"(DATA)" :
"(EMULATOR)");
187 sysncand[
j] = ibooker.
book1D(lbl.data(), title.data(), nStage1Layer2Coll_, 0, nStage1Layer2Coll_);
190 for (
int j = 0;
j < nStage1Layer2Coll_;
j++) {
193 if (sLabel[j] ==
"MHT") {
199 if ((sLabel[j] ==
"HT") || (sLabel[j] ==
"ET") || (sLabel[j] ==
"MET")) {
205 if (sLabel[j] ==
"Stage1HFSums") {
211 if (sLabel[j] ==
"IsoTauJet") {
224 title +=
" ErrorFlag";
225 errortype_stage1layer2[
j] = ibooker.
book1D(lbl.data(), title.data(), nerr, 0, nerr);
232 title +=
" ETA OF COMPARISON FAILURES";
233 eta_stage1layer2[
j] = ibooker.
book1D(lbl.data(), title.data(),
etaNBins, etaMinim, etaMaxim);
239 title +=
" PHI OF COMPARISON FAILURES";
240 phi_stage1layer2[
j] = ibooker.
book1D(lbl.data(), title.data(),
phiNBins, phiMinim, phiMaxim);
247 title +=
" ETA PHI OF COMPARISON FAILURES";
248 etaphi_stage1layer2[
j] =
255 title +=
" RANK OF COMPARISON FAILURES";
256 rnk_stage1layer2[
j] = ibooker.
book1D(lbl.data(), title.data(), rnkNBins, rnkMinim, rnkMaxim);
264 title +=
" ETA (DATA)";
265 etaData_stage1layer2[
j] = ibooker.
book1D(lbl.data(), title.data(),
etaNBins, etaMinim, etaMaxim);
272 title +=
" PHI (DATA)";
273 phiData_stage1layer2[
j] = ibooker.
book1D(lbl.data(), title.data(),
phiNBins, phiMinim, phiMaxim);
281 title +=
" RANK (DATA)";
282 rnkData_stage1layer2[
j] = ibooker.
book1D(lbl.data(), title.data(), rnkNBins, rnkMinim, rnkMaxim);
286 dword_stage1layer2[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
290 eword_stage1layer2[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
294 deword_stage1layer2[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
300 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
302 sysncand[0]->setBinLabel(i + 1, sLabel[i]);
303 sysncand[1]->setBinLabel(i + 1, sLabel[i]);
306 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
307 for (
int j = 0;
j < nerr;
j++) {
308 errortype_stage1layer2[
i]->setBinLabel(
j + 1, errLabel[
j]);
312 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
313 etaphi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta", 1);
314 etaphi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi", 2);
315 eta_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta");
316 phi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi");
317 rnk_stage1layer2[
i]->setAxisTitle(
"Rank");
318 etaData_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta");
319 phiData_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi");
320 rnkData_stage1layer2[
i]->setAxisTitle(
"Rank");
321 dword_stage1layer2[
i]->setAxisTitle(
"trigger data word bit");
322 eword_stage1layer2[
i]->setAxisTitle(
"trigger data word bit");
323 deword_stage1layer2[
i]->setAxisTitle(
"trigger data word bit");
326 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
327 colCount_stage1Layer2[
i] = 0;
328 nWithCol_stage1Layer2[
i] = 0;
333 std::cout <<
"L1TdeGCT::beginJob() end.\n" << std::flush;
343 std::cout <<
"L1TdeGCT::analyze() start\n" << std::flush;
350 edm::LogInfo(
"DataNotFound") <<
"Cannot find L1DataEmulRecord" 351 <<
" Please verify that comparator was successfully executed." 352 <<
" Emulator DQM for GCT will be skipped!" << std::endl;
357 if (m_stage1_layer2_ ==
false) {
361 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record." 362 <<
" Skiping event!\n" 367 int DEncand[2] = {0};
368 for (
int j = 0;
j < 2;
j++)
373 <<
" data: " << DEncand[0] <<
" emul: " << DEncand[1] << std::endl;
385 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
387 if (it->sid() ==
GCT)
388 gctColl.push_back(*it);
391 std::cout <<
"[L1TdeGCT] record has " << gctColl.size() <<
" gct de digis\n" << std::flush;
392 for (L1DEDigiCollection::const_iterator it = gctColl.begin(); it != gctColl.end(); it++)
401 for (L1DEDigiCollection::const_iterator it = gctColl.begin(); it != gctColl.end(); it++) {
409 std::cout <<
"[L1TdeGCT] processing digi " 410 <<
" sys:" << sid <<
" type:" << cid <<
" \n\t" << *it <<
"\n" 414 if (sid !=
GCT || it->empty()) {
415 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-gct digis!";
419 int type = it->type();
420 double phiv = it->x1();
421 double etav = it->x2();
424 float rnkv = rankarr[0];
428 unsigned int mask = (~0x0);
432 if (ccid < 0 || ccid >= nGctColl_) {
433 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" << ccid <<
"\n";
439 sysncand[0]->
Fill(ccid);
440 if (it->type() < 5 && it->type() != 3)
441 sysncand[1]->
Fill(ccid);
443 errortype[ccid]->Fill(type);
448 if (etav != nullVal && phiv != nullVal)
449 etaphi[ccid]->Fill(etav, phiv, wei);
451 eta[ccid]->Fill(etav, wei);
453 phi[ccid]->Fill(phiv, wei);
454 rnk[ccid]->Fill(rnkv, wei);
461 etaData[ccid]->Fill(etav, wei);
463 phiData[ccid]->Fill(phiv, wei);
464 rnkData[ccid]->Fill(rnkv, wei);
468 unsigned int word[2];
470 std::bitset<32> dbits(word[0]);
471 std::bitset<32> ebits(word[1]);
472 unsigned int dexor = ((word[0]) ^ (word[1]));
474 std::bitset<32> debits(dexor);
476 std::bitset<32> dembits(((dexor) & (mask)));
480 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 481 <<
" data:0x" << std::hex << word[0] <<
std::dec <<
" bitset:" << dbits <<
"\n" 482 <<
" emul:0x" << std::hex << word[1] <<
std::dec <<
" bitset:" << ebits <<
"\n" 483 <<
" xor:0x" << std::hex << dexor <<
std::dec <<
" bitset:" << debits
484 <<
" bitset:" << ((dbits) ^ (ebits)) <<
"\n" 488 for (
int ibit = 0; ibit < 32; ibit++) {
491 if (type == 3 || type == 4)
494 dword[ccid]->Fill(ibit, wei);
496 eword[ccid]->Fill(ibit, wei);
498 deword[ccid]->Fill(ibit, wei);
505 int hasCol[nGctColl_] = {0};
506 int nagree[nGctColl_] = {0};
507 for (L1DEDigiCollection::const_iterator it = gctColl.begin(); it != gctColl.end(); it++) {
509 ccid = (ccid < 0 || ccid >= nGctColl_) ? 0 : ccid;
514 for (
int i = 0;
i < nGctColl_;
i++) {
521 nWithCol[
i] += hasCol[
i];
522 colCount[
i] += nagree[
i];
524 for (
int i = 0;
i < nGctColl_;
i++) {
526 double rate = nWithCol[
i] ? 1. - 1. * colCount[
i] / nWithCol[
i] : 0.;
527 sysrates->setBinContent(ibin, rate);
529 std::cout <<
"[L1TDEMON] analyze rate computation\t\n" 530 <<
" colid:" <<
i <<
"(so far)" 531 <<
" nWithCol: " << nWithCol[
i] <<
" colCount: " << colCount[
i] <<
"(this event)" 532 <<
"hasCol: " << hasCol[
i] <<
" nagree: " << nagree[
i] <<
" rate:" << sysrates->getBinContent(ibin)
535 if (rate > 1. || rate < 0.)
536 std::cout <<
"problem, error rate for " <<
SystLabel[
i] <<
" is " << sysrates->getBinContent(ibin) <<
"\n" 542 if (m_stage1_layer2_ ==
true) {
546 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record." 547 <<
" Skiping event!\n" 552 int DEncand[2] = {0};
553 for (
int j = 0;
j < 2;
j++)
558 <<
" data: " << DEncand[0] <<
" emul: " << DEncand[1] << std::endl;
567 stage1layer2Coll.reserve(21);
568 stage1layer2Coll.clear();
570 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
572 if (it->sid() ==
GCT)
573 stage1layer2Coll.push_back(*it);
576 std::cout <<
"[L1TdeSTAGE1LAYER2] record has " << stage1layer2Coll.size() <<
" stage1layer2 de digis\n" 578 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++)
587 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++) {
595 std::cout <<
"[L1TdeStage1Layer2] processing digi " 596 <<
" sys:" << sid <<
" type:" << cid <<
" \n\t" << *it <<
"\n" 599 if (sid !=
GCT || it->empty()) {
600 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-stage1layer2 digis!";
604 int type = it->type();
605 double phiv = it->x1();
606 double etav = it->x2();
609 float rnkv = rankarr[0];
613 unsigned int mask = (~0x0);
617 if (ccid < 0 || ccid >= nStage1Layer2Coll_) {
618 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" << ccid <<
"\n";
624 sysncand[0]->
Fill(ccid);
625 if (it->type() < 5 && it->type() != 3)
626 sysncand[1]->
Fill(ccid);
627 errortype_stage1layer2[ccid]->Fill(type);
631 if (etav != nullVal && phiv != nullVal)
632 etaphi_stage1layer2[ccid]->Fill(etav, phiv, wei);
634 eta_stage1layer2[ccid]->Fill(etav, wei);
636 phi_stage1layer2[ccid]->Fill(phiv, wei);
637 rnk_stage1layer2[ccid]->Fill(rnkv, wei);
644 etaData_stage1layer2[ccid]->Fill(etav, wei);
646 phiData_stage1layer2[ccid]->Fill(phiv, wei);
647 rnkData_stage1layer2[ccid]->Fill(rnkv, wei);
651 unsigned int word_stage1layer2[2];
652 it->data(word_stage1layer2);
653 std::bitset<32> dbits(word_stage1layer2[0]);
654 std::bitset<32> ebits(word_stage1layer2[1]);
655 unsigned int dexor = ((word_stage1layer2[0]) ^ (word_stage1layer2[1]));
657 std::bitset<32> debits(dexor);
659 std::bitset<32> dembits(((dexor) & (mask)));
663 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 664 <<
" data:0x" << std::hex << word_stage1layer2[0] <<
std::dec <<
" bitset:" << dbits <<
"\n" 665 <<
" emul:0x" << std::hex << word_stage1layer2[1] <<
std::dec <<
" bitset:" << ebits <<
"\n" 666 <<
" xor:0x" << std::hex << dexor <<
std::dec <<
" bitset:" << debits
667 <<
" bitset:" << ((dbits) ^ (ebits)) <<
"\n" 671 for (
int ibit = 0; ibit < 32; ibit++) {
674 if (type == 3 || type == 4)
677 dword_stage1layer2[ccid]->Fill(ibit, wei);
679 eword_stage1layer2[ccid]->Fill(ibit, wei);
681 deword_stage1layer2[ccid]->Fill(ibit, wei);
687 int hasCol[nStage1Layer2Coll_] = {0};
688 int nagree[nStage1Layer2Coll_] = {0};
689 for (L1DEDigiCollection::const_iterator it = stage1layer2Coll.begin(); it != stage1layer2Coll.end(); it++) {
691 ccid = (ccid < 0 || ccid >= nStage1Layer2Coll_) ? 0 : ccid;
696 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
703 nWithCol_stage1Layer2[
i] += hasCol[
i];
704 colCount_stage1Layer2[
i] += nagree[
i];
706 for (
int i = 0;
i < nStage1Layer2Coll_;
i++) {
708 double rate = nWithCol_stage1Layer2[
i] ? 1. - 1. * colCount_stage1Layer2[
i] / nWithCol_stage1Layer2[
i] : 0.;
709 sysrates->setBinContent(ibin, rate);
711 std::cout <<
"[L1TDEMON] analyze rate computation\t\n" 712 <<
" colid:" <<
i <<
"(so far)" 713 <<
" nWithCol: " << nWithCol_stage1Layer2[
i] <<
" colCount: " << colCount_stage1Layer2[
i]
715 <<
"hasCol: " << hasCol[
i] <<
" nagree: " << nagree[
i] <<
" rate:" << sysrates->getBinContent(ibin)
718 if (rate > 1. || rate < 0.)
719 std::cout <<
"problem, error rate for " <<
SystLabel[
i] <<
" is " << sysrates->getBinContent(ibin) <<
"\n"
std::pair< T, T > etaphi(T x, T y, T z)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
std::vector< L1DataEmulDigi > L1DEDigiCollection
static const int nGctColl_
L1TdeGCT(const edm::ParameterSet &)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int getNCand(int i, int j) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
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)
L1DEDigiCollection getColl() const
const std::string SystLabel[DEnsys]
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
void analyze(const edm::Event &, const edm::EventSetup &) override
static const int nStage1Layer2Coll_
bool get_isComp(int i) const
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override