11 std::cout <<
"L1TDEMON::L1TDEMON()...\n" << std::flush;
19 std::cout <<
"Filter farm run setting? " << runInFF_ <<
"\n" << std::flush;
24 if (!histFile_.empty()) {
25 edm::LogInfo(
"OutputRootFile") <<
"L1TEmulator Monitoring histograms will be saved to " << histFile_.c_str()
31 std::vector<unsigned int> dosys(0,
DEnsys);
35 m_doSys[
i] = dosys[
i];
49 std::cout <<
"L1TDEMON::L1TDEMON constructor...done.\n" << std::flush;
59 std::cout <<
"L1TDEMON::beginJob() start\n" << std::flush;
69 int phiNBins[
DEnsys] = {71, 71, 18, 18, 12, 255, 160, 255, 144, 0, 255, 0};
70 double phiMinim[
DEnsys] = {0.5, 0.5, -0.5, -0.5, -0.5, 0, -0.5, 0, -0.5, 0, 0, 0};
71 double phiMaxim[
DEnsys] = {71.5, 71.5, 17.5, 17.5, 11.5, 255, 159.5, 255, 143.5, 0, 255, 0};
73 int etaNBins[
DEnsys] = {35, 35, 22, 22, 5, 20, 120, 20, 64, 0, 20, 0};
74 double etaMinim[
DEnsys] = {-17.5, -17.5, -0.5, -0.5, -2.5, 0, -0.5, 0, -0.5, 0, 0, 0};
75 double etaMaxim[
DEnsys] = {17.5, 17.5, 21.5, 21.5, 2.5, 63, 119.5, 63, 63.5, 0, 63, 0};
77 int x3NBins[
DEnsys] = {0, 0, 7, 0, 4, 0, 0, 0, 0, 0, 0, 0};
78 double x3Minim[
DEnsys] = {0, 0, -0.5, 0, 0.5, 0, 0, 0, 0, 0, 0, 0};
79 double x3Maxim[
DEnsys] = {0, 0, 6.5, 0, 4.5, 0, 0, 0, 0, 0, 0, 0};
81 int rnkNBins[
DEnsys] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
82 double rnkMinim[
DEnsys] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
83 double rnkMaxim[
DEnsys] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
107 for (
int j = 0;
j < 2;
j++) {
109 lbl += (
j == 0 ?
"Data" :
"Emul");
113 sysrates = ibooker.
book1D(
"sysrates",
"sysrates", DEnsys, 0, DEnsys);
115 errordist = ibooker.
book1D(
"errorflag",
"errorflag", nerr, 0, nerr);
131 errortype[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nerr, 0, nerr);
142 eta[
j] = ibooker.
book1D(lbl.data(), lbl.data(), etaNBins[
j], etaMinim[
j], etaMaxim[
j]);
146 phi[
j] = ibooker.
book1D(lbl.data(), lbl.data(), phiNBins[
j], phiMinim[
j], phiMaxim[
j]);
150 x3[
j] = ibooker.
book1D(lbl.data(), lbl.data(), x3NBins[
j], x3Minim[
j], x3Maxim[
j]);
155 lbl.data(), lbl.data(), etaNBins[
j], etaMinim[
j], etaMaxim[
j], phiNBins[
j], phiMinim[
j], phiMaxim[
j]);
161 etaData[
j] = ibooker.
book1D(lbl.data(), lbl.data(), etaNBins[
j], etaMinim[
j], etaMaxim[
j]);
166 phiData[
j] = ibooker.
book1D(lbl.data(), lbl.data(), phiNBins[
j], phiMinim[
j], phiMaxim[
j]);
171 x3Data[
j] = ibooker.
book1D(lbl.data(), lbl.data(), x3NBins[
j], x3Minim[
j], x3Maxim[
j]);
176 rnkData[
j] = ibooker.
book1D(lbl.data(), lbl.data(), rnkNBins[
j], rnkMinim[
j], rnkMaxim[
j]);
178 const int nbit = (j ==
GLT) ? 128 : 32;
182 dword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
186 eword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
190 deword[
j] = ibooker.
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
199 sysncand[0]->setBinLabel(i + 1,
SystLabel[i]);
200 sysncand[1]->setBinLabel(i + 1,
SystLabel[i]);
203 std::string errLabel[nerr] = {
"Agree",
"Loc. Agree",
"L.Disagree",
"Data only",
"Emul only"};
204 for (
int j = 0;
j < nerr;
j++) {
205 errordist->setBinLabel(
j + 1, errLabel[
j]);
213 for (
int j = 0;
j < nerr;
j++) {
214 errortype[
i]->setBinLabel(
j + 1, errLabel[
j]);
228 etaphi[
i]->setAxisTitle(
"eta", 1);
229 etaphi[
i]->setAxisTitle(
"phi", 2);
230 eta[
i]->setAxisTitle(
"eta");
231 phi[
i]->setAxisTitle(
"phi");
232 x3[
i]->setAxisTitle(
"x3");
233 etaData[
i]->setAxisTitle(
"eta");
234 phiData[
i]->setAxisTitle(
"phi");
235 x3Data[
i]->setAxisTitle(
"x3");
236 rnkData[
i]->setAxisTitle(
"rank");
237 dword[
i]->setAxisTitle(
"trigger data word bit");
238 eword[
i]->setAxisTitle(
"trigger data word bit");
239 deword[
i]->setAxisTitle(
"trigger data word bit");
258 std::cout <<
"L1TDEMON::bookHistograms() end.\n" << std::flush;
269 std::cout <<
"L1TDEMON::analyze() start\n" << std::flush;
278 edm::LogInfo(
"DataNotFound") <<
"Cannot find L1DataEmulRecord with label " << DEsource_.label()
279 <<
" Please verify that comparator was successfully executed." 280 <<
" Emulator DQM will be skipped!" << std::endl;
288 std::cout <<
"[L1TDEMON] verbose sys match?: ";
298 std::cout <<
"[L1TDEMON] verbose dosys?: ";
306 for (
int j = 0;
j < 2;
j++)
327 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
340 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
356 for (
int j = 0;
j < 2;
j++)
357 sysncand[
j]->
Fill(i, DEncand[i][
j]);
361 double rate = nEvtWithSys[
i] ? (nEvtWithSys[
i] - 1. * deSysCount[
i]) / nEvtWithSys[i] : 0.;
362 sysrates->setBinContent(ibin, rate);
366 <<
" sysid:" << i <<
" nEvt:" << nEvt_ <<
" match?" << deMatch[
i] <<
" ncands:" << hasSys[
i]
367 <<
" nevtwsys:" << nEvtWithSys[
i] <<
" nevtgood:" << deSysCount[
i]
368 <<
" rate:" << sysrates->getBinContent(ibin) <<
"\n";
371 std::cout <<
"problem, error rate for " <<
SystLabel[
i] <<
" is " << sysrates->getBinContent(ibin) << std::endl;
377 float LeadCandVal[
DEnsys][ncorr] = {{(
float)nullVal}};
379 for (
int j = 0;
j < ncorr;
j++)
380 LeadCandVal[
i][
j] = nullVal;
383 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++) {
391 int type = it->type();
392 double phiv = it->x1();
393 double etav = it->x2();
394 double x3v = it->x3();
398 float rnkv = rankarr[0];
402 unsigned int mask = (~0x0);
431 if (sid ==
RPC || sid ==
CTF || sid ==
RPC) {
438 errordist->Fill(type);
439 errortype[sid]->Fill(type);
449 if (etav != nullVal && phiv != nullVal)
450 etaphi[sid]->Fill(etav, phiv, wei);
452 eta[sid]->Fill(etav, wei);
454 phi[sid]->Fill(phiv, wei);
457 x3[sid]->Fill(x3v, wei);
459 unsigned int word[2];
461 std::bitset<32> dbits(word[0]);
462 std::bitset<32> ebits(word[1]);
463 unsigned int dexor = ((word[0]) ^ (word[1]));
465 std::bitset<32> debits(dexor);
467 std::bitset<32> dembits(((dexor) & (mask)));
471 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 472 <<
" data:0x" << std::hex << word[0] <<
std::dec <<
" bitset:" << dbits <<
"\n" 473 <<
" emul:0x" << std::hex << word[1] <<
std::dec <<
" bitset:" << ebits <<
"\n" 474 <<
" xor:0x" << std::hex << dexor <<
std::dec <<
" bitset:" << debits
475 <<
" bitset:" << ((dbits) ^ (ebits)) <<
"\n" 479 for (
int ibit = 0; ibit < 32; ibit++) {
482 if (type == 3 || type == 4)
485 dword[sid]->Fill(ibit, wei);
487 eword[sid]->Fill(ibit, wei);
489 deword[sid]->Fill(ibit, wei);
498 etaData[sid]->Fill(etav, wei);
500 phiData[sid]->Fill(phiv, wei);
503 x3Data[sid]->Fill(x3v, wei);
504 rnkData[sid]->Fill(rnkv, wei);
510 if (rnkv > LeadCandVal[sid][2])
512 else if (rnkv == LeadCandVal[sid][2]) {
513 if (phiv > LeadCandVal[sid][0])
515 else if (phiv == LeadCandVal[sid][0])
516 if (etav > LeadCandVal[sid][1])
521 LeadCandVal[sid][0] = phiv;
522 LeadCandVal[sid][1] = etav;
523 LeadCandVal[sid][2] = rnkv;
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
const std::string SystLabelExt[DEnsys]
void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
L1TDEMON(const edm::ParameterSet &)
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
std::vector< L1DataEmulDigi > L1DEDigiCollection
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
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)
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 dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
bool get_isComp(int i) const