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];
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);
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],
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;
300 std::cout <<
"L1TDEMON::analyze() start\n" << std::flush;
310 <<
"Cannot find L1DataEmulRecord with label "
312 <<
" Please verify that comparator was successfully executed."
313 <<
" Emulator DQM will be skipped!" << std::endl;
319 deRecord->get_status(deMatch);
321 std::cout <<
"[L1TDEMON] verbose sys match?: ";
329 isComp[
i] = deRecord->get_isComp(
i);
331 std::cout <<
"[L1TDEMON] verbose dosys?: ";
339 for (
int j = 0;
j < 2;
j++)
340 DEncand[
i][
j] = deRecord->getNCand(
i,
j);
356 deColl = deRecord->getColl();
359 int hasSys[
DEnsys] = { 0 };
360 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
361 != deColl.end(); it++)
374 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
375 != deColl.end(); it++)
392 for (
int j = 0;
j < 2;
j++)
393 sysncand[
j]->
Fill(i, DEncand[i][
j]);
397 double rate = nEvtWithSys[
i] ? (nEvtWithSys[
i] - 1. * deSysCount[
i])
398 / nEvtWithSys[i] : 0.;
399 sysrates->setBinContent(ibin, rate);
405 <<
" match?" << deMatch[
i]
406 <<
" ncands:" << hasSys[
i]
407 <<
" nevtwsys:" << nEvtWithSys[
i]
408 <<
" nevtgood:" << deSysCount[
i]
409 <<
" rate:" << sysrates->getBinContent(ibin)
414 <<
" is " << sysrates->getBinContent(ibin) << std::endl;
420 float LeadCandVal[
DEnsys][ncorr] = { { (float) nullVal } };
422 for (
int j = 0;
j < ncorr;
j++)
423 LeadCandVal[
i][
j] = nullVal;
426 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
427 != deColl.end(); it++) {
436 int type = it->type();
437 double phiv = it->x1();
438 double etav = it->x2();
439 double x3v = it->x3();
443 float rnkv = rankarr[0];
447 unsigned int mask = (~0x0);
476 if (sid ==
RPC || sid ==
CTF || sid ==
RPC) {
483 errordist ->Fill(type);
484 errortype[sid]->Fill(type);
494 if (etav != nullVal && phiv != nullVal)
495 etaphi[sid]->Fill(etav, phiv, wei);
497 eta[sid]->Fill(etav, wei);
499 phi[sid]->Fill(phiv, wei);
502 x3[sid]->Fill(x3v, wei);
504 unsigned int word[2];
506 std::bitset < 32 > dbits(word[0]);
507 std::bitset < 32 > ebits(word[1]);
508 unsigned int dexor = ((word[0]) ^ (word[1]));
510 std::bitset < 32 > debits(dexor);
512 std::bitset < 32 > dembits(((dexor) & (mask)));
515 std::cout <<
"l1demon" <<
" sid:" << sid <<
" cid:" << cid <<
"\n"
516 <<
" data:0x" << std::hex << word[0] <<
std::dec
517 <<
" bitset:" << dbits <<
"\n" <<
" emul:0x" << std::hex
518 << word[1] <<
std::dec <<
" bitset:" << ebits <<
"\n"
519 <<
" xor:0x" << std::hex << dexor <<
std::dec
520 <<
" bitset:" << debits <<
" bitset:"
521 << ((dbits) ^ (ebits)) <<
"\n" << std::flush;
524 for (
int ibit = 0; ibit < 32; ibit++) {
527 if (type == 3 || type == 4)
530 dword[sid]->Fill(ibit, wei);
532 eword[sid]->Fill(ibit, wei);
534 deword[sid]->Fill(ibit, wei);
543 etaData[sid]->Fill(etav, wei);
545 phiData[sid]->Fill(phiv, wei);
548 x3Data[sid]->Fill(x3v, wei);
549 rnkData[sid]->Fill(rnkv, wei);
555 if (rnkv > LeadCandVal[sid][2])
557 else if (rnkv == LeadCandVal[sid][2]) {
558 if (phiv > LeadCandVal[sid][0])
560 else if (phiv == LeadCandVal[sid][0])
561 if (etav > LeadCandVal[sid][1])
566 LeadCandVal[sid][0] = phiv;
567 LeadCandVal[sid][1] = etav;
568 LeadCandVal[sid][2] = rnkv;
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 &)
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)
virtual void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
std::vector< L1DataEmulDigi > L1DEDigiCollection
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
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)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
Geom::Phi< T > phi() const
const std::string SystLabel[DEnsys]
virtual void analyze(const edm::Event &, const edm::EventSetup &)