5 using namespace dedefs;
12 std::cout <<
"L1TDEMON::L1TDEMON()...\n" << std::flush;
21 std::cout <<
"Filter farm run setting? " << runInFF_ <<
"\n"
27 if (histFile_.size() != 0) {
29 <<
"L1TEmulator Monitoring histograms will be saved to "
30 << histFile_.c_str() << std::endl;
35 std::vector<unsigned int> dosys(0,
DEnsys);
37 "COMPARE_COLLS", dosys);
40 m_doSys[
i] = dosys[
i];
58 dbe->setCurrentFolder(histFolder_);
63 std::cout <<
"L1TDEMON::L1TDEMON constructor...done.\n" << std::flush;
75 std::cout <<
"L1TDEMON::beginJob() start\n" << std::flush;
80 dbe->setCurrentFolder(histFolder_);
90 int phiNBins[
DEnsys] = { 71 , 71 , 18 ,18 , 12, 255, 160, 255, 144, 0, 255,0};
91 double phiMinim[
DEnsys] = { 0.5, 0.5, -0.5,-0.5,-0.5, 0, -0.5, 0, -0.5, 0, 0,0};
92 double phiMaxim[
DEnsys] = { 71.5, 71.5, 17.5,17.5,11.5, 255,159.5, 255, 143.5, 0, 255,0};
94 int etaNBins[
DEnsys] = { 35 , 35 , 22 ,22 , 5, 20, 120, 20, 64, 0, 20,0};
95 double etaMinim[
DEnsys] = {-17.5,-17.5, -0.5,-0.5,-2.5, 0, -0.5, 0, -0.5, 0, 0,0};
96 double etaMaxim[
DEnsys] = { 17.5, 17.5, 21.5,21.5, 2.5, 63,119.5, 63, 63.5, 0, 63,0};
98 int x3NBins [
DEnsys] = { 0, 0, 7, 0, 4, 0, 0, 0, 0, 0, 0,0};
99 double x3Minim [
DEnsys] = { 0, 0, -0.5, 0, 0.5, 0, 0, 0, 0, 0, 0,0};
100 double x3Maxim [
DEnsys] = { 0, 0, 6.5, 0, 4.5, 0, 0, 0, 0, 0, 0,0};
102 int rnkNBins[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
103 double rnkMinim[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
104 double rnkMaxim[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
112 rnkMinim[
DTP] = -0.5;
115 rnkMinim[
CTP] = -0.5;
116 rnkMaxim[
CTP] = 15.5;
128 dbe->setCurrentFolder(
std::string(histFolder_ +
"/common"));
130 for (
int j = 0;
j < 2;
j++) {
132 lbl += (
j == 0 ?
"Data" :
"Emul");
134 = dbe->book1D(lbl.data(), lbl.data(),
DEnsys, 0,
DEnsys);
137 sysrates = dbe->book1D(
"sysrates",
"sysrates", DEnsys, 0, DEnsys);
139 errordist = dbe->book1D(
"errorflag",
"errorflag", nerr, 0, nerr);
149 dbe->setCurrentFolder(
157 errortype[
j] = dbe->book1D(lbl.data(), lbl.data(), nerr, 0, nerr);
168 eta[
j] = dbe->book1D(lbl.data(), lbl.data(), etaNBins[
j],
169 etaMinim[
j], etaMaxim[
j]);
173 phi[
j] = dbe->book1D(lbl.data(), lbl.data(), phiNBins[
j],
174 phiMinim[
j], phiMaxim[
j]);
178 x3[
j] = dbe->book1D(lbl.data(), lbl.data(), x3NBins[
j], x3Minim[
j],
183 etaphi[
j] = dbe->book2D(lbl.data(), lbl.data(), etaNBins[
j],
184 etaMinim[
j], etaMaxim[
j], phiNBins[
j], phiMinim[
j],
191 etaData[
j] = dbe->book1D(lbl.data(), lbl.data(), etaNBins[
j],
192 etaMinim[
j], etaMaxim[
j]);
197 phiData[
j] = dbe->book1D(lbl.data(), lbl.data(), phiNBins[
j],
198 phiMinim[
j], phiMaxim[
j]);
203 x3Data[
j] = dbe->book1D(lbl.data(), lbl.data(), x3NBins[
j],
204 x3Minim[
j], x3Maxim[
j]);
209 rnkData[
j] = dbe->book1D(lbl.data(), lbl.data(), rnkNBins[
j],
210 rnkMinim[
j], rnkMaxim[
j]);
212 const int nbit = (j ==
GLT) ? 128 : 32;
216 dword[
j] = dbe->book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
220 eword[
j] = dbe->book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
224 deword[
j] = dbe->book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
235 sysncand[0]->setBinLabel(i + 1,
SystLabel[i]);
236 sysncand[1]->setBinLabel(i + 1,
SystLabel[i]);
239 std::string errLabel[nerr] = {
"Agree",
"Loc. Agree",
"L.Disagree",
240 "Data only",
"Emul only" };
241 for (
int j = 0;
j < nerr;
j++) {
242 errordist->setBinLabel(
j + 1, errLabel[
j]);
251 for (
int j = 0;
j < nerr;
j++) {
253 errortype[
i]->setBinLabel(
j + 1, errLabel[
j]);
268 etaphi[
i]->setAxisTitle(
"eta", 1);
269 etaphi[
i]->setAxisTitle(
"phi", 2);
270 eta[
i]->setAxisTitle(
"eta");
271 phi[
i]->setAxisTitle(
"phi");
272 x3[
i]->setAxisTitle(
"x3");
273 etaData[
i]->setAxisTitle(
"eta");
274 phiData[
i]->setAxisTitle(
"phi");
275 x3Data[
i]->setAxisTitle(
"x3");
276 rnkData[
i]->setAxisTitle(
"rank");
277 dword[
i]->setAxisTitle(
"trigger data word bit");
278 eword[
i]->setAxisTitle(
"trigger data word bit");
279 deword[
i]->setAxisTitle(
"trigger data word bit");
299 std::cout <<
"L1TDEMON::beginJob() end.\n" << std::flush;
305 std::cout <<
"L1TDEMON::endJob Nevents: " << nEvt_ <<
"\n"
309 std::cout <<
"[L1TDEMON] systems disagreement rate:\n\t";
311 printf(
"%4.2f ", sysrates->getBinContent(
i));
316 std::cout <<
"[L1TDEMON] verbose fill histo: ";
322 if (histFile_.size() != 0 && dbe)
323 dbe->save(histFile_);
326 std::cout <<
"L1TDEMON::endJob() end.\n" << std::flush;
337 std::cout <<
"L1TDEMON::analyze() start\n" << std::flush;
347 <<
"Cannot find L1DataEmulRecord with label "
349 <<
" Please verify that comparator was successfully executed."
350 <<
" Emulator DQM will be skipped!" << std::endl;
356 deRecord->get_status(deMatch);
358 std::cout <<
"[L1TDEMON] verbose sys match?: ";
366 isComp[
i] = deRecord->get_isComp(
i);
368 std::cout <<
"[L1TDEMON] verbose dosys?: ";
376 for (
int j = 0;
j < 2;
j++)
377 DEncand[
i][
j] = deRecord->getNCand(
i,
j);
393 deColl = deRecord->getColl();
396 int hasSys[
DEnsys] = { 0 };
397 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
398 != deColl.end(); it++)
411 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
412 != deColl.end(); it++)
429 for (
int j = 0;
j < 2;
j++)
430 sysncand[
j]->
Fill(i, DEncand[i][
j]);
434 double rate = nEvtWithSys[
i] ? (nEvtWithSys[
i] - 1. * deSysCount[
i])
435 / nEvtWithSys[i] : 0.;
436 sysrates->setBinContent(ibin, rate);
442 <<
" match?" << deMatch[
i]
443 <<
" ncands:" << hasSys[
i]
444 <<
" nevtwsys:" << nEvtWithSys[
i]
445 <<
" nevtgood:" << deSysCount[
i]
446 <<
" rate:" << sysrates->getBinContent(ibin)
451 <<
" is " << sysrates->getBinContent(ibin) << std::endl;
457 float LeadCandVal[
DEnsys][ncorr] = { { (float) nullVal } };
459 for (
int j = 0;
j < ncorr;
j++)
460 LeadCandVal[
i][
j] = nullVal;
463 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
464 != deColl.end(); it++) {
473 int type = it->type();
474 double phiv = it->x1();
475 double etav = it->x2();
476 double x3v = it->x3();
480 float rnkv = rankarr[0];
484 unsigned int mask = (~0x0);
513 if (sid ==
RPC || sid ==
CTF || sid ==
RPC) {
520 errordist ->Fill(type);
521 errortype[sid]->Fill(type);
531 if (etav != nullVal && phiv != nullVal)
532 etaphi[sid]->Fill(etav, phiv, wei);
534 eta[sid]->Fill(etav, wei);
536 phi[sid]->Fill(phiv, wei);
539 x3[sid]->Fill(x3v, wei);
541 unsigned int word[2];
543 std::bitset < 32 > dbits(word[0]);
544 std::bitset < 32 > ebits(word[1]);
545 unsigned int dexor = ((word[0]) ^ (word[1]));
547 std::bitset < 32 > debits(dexor);
549 std::bitset < 32 > dembits(((dexor) & (mask)));
552 std::cout <<
"l1demon" <<
" sid:" << sid <<
" cid:" << cid <<
"\n"
553 <<
" data:0x" << std::hex << word[0] <<
std::dec
554 <<
" bitset:" << dbits <<
"\n" <<
" emul:0x" << std::hex
555 << word[1] <<
std::dec <<
" bitset:" << ebits <<
"\n"
556 <<
" xor:0x" << std::hex << dexor <<
std::dec
557 <<
" bitset:" << debits <<
" bitset:"
558 << ((dbits) ^ (ebits)) <<
"\n" << std::flush;
561 for (
int ibit = 0; ibit < 32; ibit++) {
564 if (type == 3 || type == 4)
567 dword[sid]->Fill(ibit, wei);
569 eword[sid]->Fill(ibit, wei);
571 deword[sid]->Fill(ibit, wei);
580 etaData[sid]->Fill(etav, wei);
582 phiData[sid]->Fill(phiv, wei);
585 x3Data[sid]->Fill(x3v, wei);
586 rnkData[sid]->Fill(rnkv, wei);
592 if (rnkv > LeadCandVal[sid][2])
594 else if (rnkv == LeadCandVal[sid][2]) {
595 if (phiv > LeadCandVal[sid][0])
597 else if (phiv == LeadCandVal[sid][0])
598 if (etav > LeadCandVal[sid][1])
603 LeadCandVal[sid][0] = phiv;
604 LeadCandVal[sid][1] = etav;
605 LeadCandVal[sid][2] = rnkv;
613 std::cout <<
"L1TDEMON::analyze() end.\n" << std::flush;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string SystLabelExt[DEnsys]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
L1TDEMON(const edm::ParameterSet &)
std::vector< L1DataEmulDigi > L1DEDigiCollection
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::pair< T, T > etaphi(T x, T y, T z)
virtual void beginJob(void)
const std::string SystLabel[DEnsys]
virtual void analyze(const edm::Event &, const edm::EventSetup &)