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;
72 std::cout <<
"L1TDEMON::beginJob() start\n" << std::flush;
87 int phiNBins[
DEnsys] = { 71 , 71 , 18 ,18 , 12, 255, 160, 255, 144, 0, 255,0};
88 double phiMinim[
DEnsys] = { 0.5, 0.5, -0.5,-0.5,-0.5, 0, -0.5, 0, -0.5, 0, 0,0};
89 double phiMaxim[
DEnsys] = { 71.5, 71.5, 17.5,17.5,11.5, 255,159.5, 255, 143.5, 0, 255,0};
91 int etaNBins[
DEnsys] = { 35 , 35 , 22 ,22 , 5, 20, 120, 20, 64, 0, 20,0};
92 double etaMinim[
DEnsys] = {-17.5,-17.5, -0.5,-0.5,-2.5, 0, -0.5, 0, -0.5, 0, 0,0};
93 double etaMaxim[
DEnsys] = { 17.5, 17.5, 21.5,21.5, 2.5, 63,119.5, 63, 63.5, 0, 63,0};
95 int x3NBins [
DEnsys] = { 0, 0, 7, 0, 4, 0, 0, 0, 0, 0, 0,0};
96 double x3Minim [
DEnsys] = { 0, 0, -0.5, 0, 0.5, 0, 0, 0, 0, 0, 0,0};
97 double x3Maxim [
DEnsys] = { 0, 0, 6.5, 0, 4.5, 0, 0, 0, 0, 0, 0,0};
99 int rnkNBins[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
100 double rnkMinim[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
101 double rnkMaxim[
DEnsys] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
109 rnkMinim[
DTP] = -0.5;
112 rnkMinim[
CTP] = -0.5;
113 rnkMaxim[
CTP] = 15.5;
127 for (
int j = 0;
j < 2;
j++) {
128 std::string lbl(
"sysncand");
129 lbl += (
j == 0 ?
"Data" :
"Emul");
134 sysrates = dbe->
book1D(
"sysrates",
"sysrates", DEnsys, 0, DEnsys);
136 errordist = dbe->
book1D(
"errorflag",
"errorflag", nerr, 0, nerr);
154 errortype[
j] = dbe->
book1D(lbl.data(), lbl.data(), nerr, 0, nerr);
165 eta[
j] = dbe->
book1D(lbl.data(), lbl.data(), etaNBins[
j],
166 etaMinim[
j], etaMaxim[
j]);
170 phi[
j] = dbe->
book1D(lbl.data(), lbl.data(), phiNBins[
j],
171 phiMinim[
j], phiMaxim[
j]);
175 x3[
j] = dbe->
book1D(lbl.data(), lbl.data(), x3NBins[
j], x3Minim[
j],
181 etaMinim[
j], etaMaxim[
j], phiNBins[
j], phiMinim[
j],
188 etaData[
j] = dbe->
book1D(lbl.data(), lbl.data(), etaNBins[
j],
189 etaMinim[
j], etaMaxim[
j]);
194 phiData[
j] = dbe->
book1D(lbl.data(), lbl.data(), phiNBins[
j],
195 phiMinim[
j], phiMaxim[
j]);
200 x3Data[
j] = dbe->
book1D(lbl.data(), lbl.data(), x3NBins[
j],
201 x3Minim[
j], x3Maxim[
j]);
206 rnkData[
j] = dbe->
book1D(lbl.data(), lbl.data(), rnkNBins[
j],
207 rnkMinim[
j], rnkMaxim[
j]);
209 const int nbit = (j ==
GLT) ? 128 : 32;
213 dword[
j] = dbe->
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
217 eword[
j] = dbe->
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
221 deword[
j] = dbe->
book1D(lbl.data(), lbl.data(), nbit, 0, nbit);
232 sysncand[0]->setBinLabel(i + 1,
SystLabel[i]);
233 sysncand[1]->setBinLabel(i + 1,
SystLabel[i]);
236 std::string errLabel[nerr] = {
"Agree",
"Loc. Agree",
"L.Disagree",
237 "Data only",
"Emul only" };
238 for (
int j = 0;
j < nerr;
j++) {
239 errordist->setBinLabel(
j + 1, errLabel[
j]);
248 for (
int j = 0;
j < nerr;
j++) {
250 errortype[
i]->setBinLabel(
j + 1, errLabel[
j]);
265 etaphi[
i]->setAxisTitle(
"eta", 1);
266 etaphi[
i]->setAxisTitle(
"phi", 2);
267 eta[
i]->setAxisTitle(
"eta");
268 phi[
i]->setAxisTitle(
"phi");
269 x3[
i]->setAxisTitle(
"x3");
270 etaData[
i]->setAxisTitle(
"eta");
271 phiData[
i]->setAxisTitle(
"phi");
272 x3Data[
i]->setAxisTitle(
"x3");
273 rnkData[
i]->setAxisTitle(
"rank");
274 dword[
i]->setAxisTitle(
"trigger data word bit");
275 eword[
i]->setAxisTitle(
"trigger data word bit");
276 deword[
i]->setAxisTitle(
"trigger data word bit");
296 std::cout <<
"L1TDEMON::beginJob() end.\n" << std::flush;
302 std::cout <<
"L1TDEMON::endJob Nevents: " << nEvt_ <<
"\n"
306 std::cout <<
"[L1TDEMON] systems disagreement rate:\n\t";
308 printf(
"%4.2f ", sysrates->getBinContent(
i));
313 std::cout <<
"[L1TDEMON] verbose fill histo: ";
319 if (histFile_.size() != 0 && dbe)
320 dbe->save(histFile_);
323 std::cout <<
"L1TDEMON::endJob() end.\n" << std::flush;
334 std::cout <<
"L1TDEMON::analyze() start\n" << std::flush;
344 <<
"Cannot find L1DataEmulRecord with label "
346 <<
" Please verify that comparator was successfully executed."
347 <<
" Emulator DQM will be skipped!" << std::endl;
353 deRecord->get_status(deMatch);
355 std::cout <<
"[L1TDEMON] verbose sys match?: ";
363 isComp[
i] = deRecord->get_isComp(
i);
365 std::cout <<
"[L1TDEMON] verbose dosys?: ";
373 for (
int j = 0;
j < 2;
j++)
374 DEncand[
i][
j] = deRecord->getNCand(
i,
j);
390 deColl = deRecord->getColl();
393 int hasSys[
DEnsys] = { 0 };
394 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
395 != deColl.end(); it++)
408 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
409 != deColl.end(); it++)
426 for (
int j = 0;
j < 2;
j++)
427 sysncand[
j]->
Fill(i, DEncand[i][
j]);
431 double rate = nEvtWithSys[
i] ? (nEvtWithSys[
i] - 1. * deSysCount[
i])
432 / nEvtWithSys[i] : 0.;
433 sysrates->setBinContent(ibin, rate);
439 <<
" match?" << deMatch[
i]
440 <<
" ncands:" << hasSys[
i]
441 <<
" nevtwsys:" << nEvtWithSys[
i]
442 <<
" nevtgood:" << deSysCount[
i]
443 <<
" rate:" << sysrates->getBinContent(ibin)
448 <<
" is " << sysrates->getBinContent(ibin) << std::endl;
454 float LeadCandVal[
DEnsys][ncorr] = { { (float) nullVal } };
456 for (
int j = 0;
j < ncorr;
j++)
457 LeadCandVal[
i][
j] = nullVal;
460 for (L1DEDigiCollection::const_iterator it = deColl.begin(); it
461 != deColl.end(); it++) {
470 int type = it->type();
471 double phiv = it->x1();
472 double etav = it->x2();
473 double x3v = it->x3();
477 float rnkv = rankarr[0];
481 unsigned int mask = (~0x0);
510 if (sid ==
RPC || sid ==
CTF || sid ==
RPC) {
517 errordist ->Fill(type);
518 errortype[
sid]->Fill(type);
528 if (etav != nullVal && phiv != nullVal)
531 eta[
sid]->Fill(etav, wei);
533 phi[
sid]->Fill(phiv, wei);
536 x3[
sid]->Fill(x3v, wei);
538 unsigned int word[2];
540 std::bitset < 32 > dbits(word[0]);
541 std::bitset < 32 > ebits(word[1]);
542 unsigned int dexor = ((word[0]) ^ (word[1]));
544 std::bitset < 32 > debits(dexor);
546 std::bitset < 32 > dembits(((dexor) & (mask)));
549 std::cout <<
"l1demon" <<
" sid:" << sid <<
" cid:" << cid <<
"\n"
550 <<
" data:0x" << std::hex << word[0] << std::dec
551 <<
" bitset:" << dbits <<
"\n" <<
" emul:0x" << std::hex
552 << word[1] << std::dec <<
" bitset:" << ebits <<
"\n"
553 <<
" xor:0x" << std::hex << dexor << std::dec
554 <<
" bitset:" << debits <<
" bitset:"
555 << ((dbits) ^ (ebits)) <<
"\n" << std::flush;
558 for (
int ibit = 0; ibit < 32; ibit++) {
561 if (type == 3 || type == 4)
564 dword[
sid]->Fill(ibit, wei);
566 eword[
sid]->Fill(ibit, wei);
568 deword[
sid]->Fill(ibit, wei);
577 etaData[
sid]->Fill(etav, wei);
579 phiData[
sid]->Fill(phiv, wei);
582 x3Data[
sid]->Fill(x3v, wei);
583 rnkData[
sid]->Fill(rnkv, wei);
589 if (rnkv > LeadCandVal[sid][2])
591 else if (rnkv == LeadCandVal[sid][2]) {
592 if (phiv > LeadCandVal[sid][0])
594 else if (phiv == LeadCandVal[sid][0])
595 if (etav > LeadCandVal[sid][1])
600 LeadCandVal[
sid][0] = phiv;
601 LeadCandVal[
sid][1] = etav;
602 LeadCandVal[
sid][2] = rnkv;
610 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]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
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)
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)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const std::string SystLabel[DEnsys]
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setCurrentFolder(const std::string &fullpath)