12 std::cout <<
"L1TDEMON::L1TDEMON()...\n" << std::flush;
21 std::cout <<
"Filter farm run setting? " << runInFF_ <<
"\n" 27 if (!histFile_.empty()) {
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];
54 std::cout <<
"L1TDEMON::L1TDEMON constructor...done.\n" << std::flush;
66 std::cout <<
"L1TDEMON::beginJob() start\n" << std::flush;
76 int phiNBins[
DEnsys] = { 71 , 71 , 18 ,18 , 12, 255, 160, 255, 144, 0, 255,0};
77 double phiMinim[
DEnsys] = { 0.5, 0.5, -0.5,-0.5,-0.5, 0, -0.5, 0, -0.5, 0, 0,0};
78 double phiMaxim[
DEnsys] = { 71.5, 71.5, 17.5,17.5,11.5, 255,159.5, 255, 143.5, 0, 255,0};
80 int etaNBins[
DEnsys] = { 35 , 35 , 22 ,22 , 5, 20, 120, 20, 64, 0, 20,0};
81 double etaMinim[
DEnsys] = {-17.5,-17.5, -0.5,-0.5,-2.5, 0, -0.5, 0, -0.5, 0, 0,0};
82 double etaMaxim[
DEnsys] = { 17.5, 17.5, 21.5,21.5, 2.5, 63,119.5, 63, 63.5, 0, 63,0};
84 int x3NBins [
DEnsys] = { 0, 0, 7, 0, 4, 0, 0, 0, 0, 0, 0,0};
85 double x3Minim [
DEnsys] = { 0, 0, -0.5, 0, 0.5, 0, 0, 0, 0, 0, 0,0};
86 double x3Maxim [
DEnsys] = { 0, 0, 6.5, 0, 4.5, 0, 0, 0, 0, 0, 0,0};
88 int rnkNBins[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
89 double rnkMinim[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
90 double rnkMaxim[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
101 rnkMinim[
CTP] = -0.5;
102 rnkMaxim[
CTP] = 15.5;
114 for (
int j = 0; j < 2; j++) {
116 lbl += (j == 0 ?
"Data" :
"Emul");
120 sysrates = ibooker.
book1D(
"sysrates",
"sysrates", DEnsys, 0, DEnsys);
122 errordist = ibooker.
book1D(
"errorflag",
"errorflag", nerr, 0, nerr);
124 for (
int j = 0; j <
DEnsys; j++) {
140 errortype[j] = ibooker.
book1D(lbl.data(), lbl.data(), nerr, 0, nerr);
151 eta[j] = ibooker.
book1D(lbl.data(), lbl.data(), etaNBins[j],
152 etaMinim[j], etaMaxim[j]);
156 phi[j] = ibooker.
book1D(lbl.data(), lbl.data(), phiNBins[j],
157 phiMinim[j], phiMaxim[j]);
161 x3[j] = ibooker.
book1D(lbl.data(), lbl.data(), x3NBins[j], x3Minim[j],
166 etaphi[j] = ibooker.
book2D(lbl.data(), lbl.data(), etaNBins[j],
167 etaMinim[j], etaMaxim[j], phiNBins[j], phiMinim[j],
174 etaData[j] = ibooker.
book1D(lbl.data(), lbl.data(), etaNBins[j],
175 etaMinim[j], etaMaxim[j]);
180 phiData[j] = ibooker.
book1D(lbl.data(), lbl.data(), phiNBins[j],
181 phiMinim[j], phiMaxim[j]);
186 x3Data[j] = ibooker.
book1D(lbl.data(), lbl.data(), x3NBins[j],
187 x3Minim[j], x3Maxim[j]);
192 rnkData[j] = ibooker.
book1D(lbl.data(), lbl.data(), rnkNBins[j],
193 rnkMinim[j], rnkMaxim[j]);
195 const int nbit = (j ==
GLT) ? 128 : 32;
199 dword[j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
203 eword[j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
207 deword[j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
217 sysncand[0]->setBinLabel(i + 1,
SystLabel[i]);
218 sysncand[1]->setBinLabel(i + 1,
SystLabel[i]);
221 std::string errLabel[nerr] = {
"Agree",
"Loc. Agree",
"L.Disagree",
222 "Data only",
"Emul only" };
223 for (
int j = 0; j < nerr; j++) {
224 errordist->setBinLabel(j + 1, errLabel[j]);
233 for (
int j = 0; j < nerr; j++) {
235 errortype[
i]->setBinLabel(j + 1, errLabel[j]);
250 etaphi[
i]->setAxisTitle(
"eta", 1);
251 etaphi[
i]->setAxisTitle(
"phi", 2);
252 eta[
i]->setAxisTitle(
"eta");
253 phi[
i]->setAxisTitle(
"phi");
254 x3[
i]->setAxisTitle(
"x3");
255 etaData[
i]->setAxisTitle(
"eta");
256 phiData[
i]->setAxisTitle(
"phi");
257 x3Data[
i]->setAxisTitle(
"x3");
258 rnkData[
i]->setAxisTitle(
"rank");
259 dword[
i]->setAxisTitle(
"trigger data word bit");
260 eword[
i]->setAxisTitle(
"trigger data word bit");
261 deword[
i]->setAxisTitle(
"trigger data word bit");
281 std::cout <<
"L1TDEMON::bookHistograms() end.\n" << std::flush;
298 std::cout <<
"L1TDEMON::analyze() start\n" << std::flush;
308 <<
"Cannot find L1DataEmulRecord with label " 310 <<
" Please verify that comparator was successfully executed." 311 <<
" Emulator DQM will be skipped!" << std::endl;
319 std::cout <<
"[L1TDEMON] verbose sys match?: ";
329 std::cout <<
"[L1TDEMON] verbose dosys?: ";
337 for (
int j = 0; j < 2; j++)
357 int hasSys[
DEnsys] = { 0 };
358 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
359 != deColl.end(); it++)
372 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
373 != deColl.end(); it++)
390 for (
int j = 0; j < 2; j++)
391 sysncand[j]->
Fill(i, DEncand[i][j]);
395 double rate = nEvtWithSys[
i] ? (nEvtWithSys[
i] - 1. * deSysCount[
i])
396 / nEvtWithSys[i] : 0.;
397 sysrates->setBinContent(ibin, rate);
403 <<
" match?" << deMatch[
i]
404 <<
" ncands:" << hasSys[
i]
405 <<
" nevtwsys:" << nEvtWithSys[
i]
406 <<
" nevtgood:" << deSysCount[
i]
407 <<
" rate:" << sysrates->getBinContent(ibin)
412 <<
" is " << sysrates->getBinContent(ibin) << std::endl;
418 float LeadCandVal[
DEnsys][ncorr] = { { (
float) nullVal } };
420 for (
int j = 0; j < ncorr; j++)
421 LeadCandVal[
i][j] = nullVal;
424 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
425 != deColl.end(); it++) {
434 int type = it->type();
435 double phiv = it->x1();
436 double etav = it->x2();
437 double x3v = it->x3();
441 float rnkv = rankarr[0];
445 unsigned int mask = (~0x0);
474 if (sid ==
RPC || sid ==
CTF || sid ==
RPC) {
481 errordist ->Fill(type);
482 errortype[sid]->Fill(type);
492 if (etav != nullVal && phiv != nullVal)
493 etaphi[sid]->Fill(etav, phiv, wei);
495 eta[sid]->Fill(etav, wei);
497 phi[sid]->Fill(phiv, wei);
500 x3[sid]->Fill(x3v, wei);
502 unsigned int word[2];
504 std::bitset < 32 > dbits(word[0]);
505 std::bitset < 32 > ebits(word[1]);
506 unsigned int dexor = ((word[0]) ^ (word[1]));
508 std::bitset < 32 > debits(dexor);
510 std::bitset < 32 > dembits(((dexor) & (mask)));
513 std::cout <<
"l1demon" <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 514 <<
" data:0x" << std::hex << word[0] <<
std::dec 515 <<
" bitset:" << dbits <<
"\n" <<
" emul:0x" << std::hex
516 << word[1] <<
std::dec <<
" bitset:" << ebits <<
"\n" 517 <<
" xor:0x" << std::hex << dexor <<
std::dec 518 <<
" bitset:" << debits <<
" bitset:" 519 << ((dbits) ^ (ebits)) <<
"\n" << std::flush;
522 for (
int ibit = 0; ibit < 32; ibit++) {
525 if (type == 3 || type == 4)
528 dword[sid]->Fill(ibit, wei);
530 eword[sid]->Fill(ibit, wei);
532 deword[sid]->Fill(ibit, wei);
541 etaData[sid]->Fill(etav, wei);
543 phiData[sid]->Fill(phiv, wei);
546 x3Data[sid]->Fill(x3v, wei);
547 rnkData[sid]->Fill(rnkv, wei);
553 if (rnkv > LeadCandVal[sid][2])
555 else if (rnkv == LeadCandVal[sid][2]) {
556 if (phiv > LeadCandVal[sid][0])
558 else if (phiv == LeadCandVal[sid][0])
559 if (etav > LeadCandVal[sid][1])
564 LeadCandVal[sid][0] = phiv;
565 LeadCandVal[sid][1] = etav;
566 LeadCandVal[sid][2] = rnkv;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string SystLabelExt[DEnsys]
void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
L1TDEMON(const edm::ParameterSet &)
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)
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
std::vector< L1DataEmulDigi > L1DEDigiCollection
void setCurrentFolder(std::string const &fullpath)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * book1D(Args &&...args)
std::pair< T, T > etaphi(T x, T y, T z)
int getNCand(int i, int j) const
MonitorElement * book2D(Args &&...args)
L1DEDigiCollection getColl() const
const std::string SystLabel[DEnsys]
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
bool get_isComp(int i) const