5 using namespace dedefs;
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;
267 std::cout <<
"L1TDEMON::analyze() start\n" << std::flush;
276 edm::LogInfo(
"DataNotFound") <<
"Cannot find L1DataEmulRecord with label " << DEsource_.label()
277 <<
" Please verify that comparator was successfully executed."
278 <<
" Emulator DQM will be skipped!" << std::endl;
284 deRecord->get_status(deMatch);
286 std::cout <<
"[L1TDEMON] verbose sys match?: ";
294 isComp[
i] = deRecord->get_isComp(
i);
296 std::cout <<
"[L1TDEMON] verbose dosys?: ";
304 for (
int j = 0;
j < 2;
j++)
305 DEncand[
i][
j] = deRecord->getNCand(
i,
j);
321 deColl = deRecord->getColl();
325 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
338 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++)
354 for (
int j = 0;
j < 2;
j++)
355 sysncand[
j]->
Fill(i, DEncand[i][
j]);
359 double rate = nEvtWithSys[
i] ? (nEvtWithSys[
i] - 1. * deSysCount[
i]) / nEvtWithSys[i] : 0.;
360 sysrates->setBinContent(ibin, rate);
364 <<
" sysid:" << i <<
" nEvt:" << nEvt_ <<
" match?" << deMatch[
i] <<
" ncands:" << hasSys[
i]
365 <<
" nevtwsys:" << nEvtWithSys[
i] <<
" nevtgood:" << deSysCount[
i]
366 <<
" rate:" << sysrates->getBinContent(ibin) <<
"\n";
369 std::cout <<
"problem, error rate for " <<
SystLabel[
i] <<
" is " << sysrates->getBinContent(ibin) << std::endl;
375 float LeadCandVal[
DEnsys][ncorr] = {{(float)nullVal}};
377 for (
int j = 0;
j < ncorr;
j++)
378 LeadCandVal[
i][
j] = nullVal;
381 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it != deColl.end(); it++) {
389 int type = it->type();
390 double phiv = it->x1();
391 double etav = it->x2();
392 double x3v = it->x3();
396 float rnkv = rankarr[0];
400 unsigned int mask = (~0x0);
429 if (sid ==
RPC || sid ==
CTF || sid ==
RPC) {
436 errordist->Fill(type);
437 errortype[sid]->Fill(type);
447 if (etav != nullVal && phiv != nullVal)
448 etaphi[sid]->Fill(etav, phiv, wei);
450 eta[sid]->Fill(etav, wei);
452 phi[sid]->Fill(phiv, wei);
455 x3[sid]->Fill(x3v, wei);
457 unsigned int word[2];
459 std::bitset<32> dbits(word[0]);
460 std::bitset<32> ebits(word[1]);
461 unsigned int dexor = ((word[0]) ^ (word[1]));
463 std::bitset<32> debits(dexor);
465 std::bitset<32> dembits(((dexor) & (mask)));
469 <<
" sid:" << sid <<
" cid:" << cid <<
"\n"
470 <<
" data:0x" << std::hex << word[0] <<
std::dec <<
" bitset:" << dbits <<
"\n"
471 <<
" emul:0x" << std::hex << word[1] <<
std::dec <<
" bitset:" << ebits <<
"\n"
472 <<
" xor:0x" << std::hex << dexor <<
std::dec <<
" bitset:" << debits
473 <<
" bitset:" << ((dbits) ^ (ebits)) <<
"\n"
477 for (
int ibit = 0; ibit < 32; ibit++) {
480 if (type == 3 || type == 4)
483 dword[sid]->Fill(ibit, wei);
485 eword[sid]->Fill(ibit, wei);
487 deword[sid]->Fill(ibit, wei);
496 etaData[sid]->Fill(etav, wei);
498 phiData[sid]->Fill(phiv, wei);
501 x3Data[sid]->Fill(x3v, wei);
502 rnkData[sid]->Fill(rnkv, wei);
508 if (rnkv > LeadCandVal[sid][2])
510 else if (rnkv == LeadCandVal[sid][2]) {
511 if (phiv > LeadCandVal[sid][0])
513 else if (phiv == LeadCandVal[sid][0])
514 if (etav > LeadCandVal[sid][1])
519 LeadCandVal[sid][0] = phiv;
520 LeadCandVal[sid][1] = etav;
521 LeadCandVal[sid][2] = rnkv;
std::pair< T, T > etaphi(T x, T y, T z)
T getUntrackedParameter(std::string const &, T const &) const
const std::string SystLabelExt[DEnsys]
void analyze(const edm::Event &, const edm::EventSetup &) override
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
L1TDEMON(const edm::ParameterSet &)
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
std::vector< L1DataEmulDigi > L1DEDigiCollection
static constexpr int verbose
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
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)
Log< level::Info, false > LogInfo
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
T getParameter(std::string const &) const
const std::string SystLabel[DEnsys]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())