15 std::cout <<
"L1TdeGCT::L1TdeGCT()...\n" << std::flush;
24 if (!histFile_.empty()) {
26 <<
"L1TEmulator GCT specific histograms will be saved to " 34 std::cout <<
"L1TdeGCT::L1TdeGCT()...done.\n" << std::flush;
35 m_stage1_layer2_ = iConfig.
getParameter<
bool>(
"stage1_layer2_");
48 double rnkMinim = 0.5;
49 double rnkMaxim = 63.5;
53 std::cout <<
"L1TdeGCT::beginRun() start\n" << std::flush;
57 if (m_stage1_layer2_ ==
false) {
59 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES",nGctColl_, 0, nGctColl_ );
61 for(
int j=0; j<2; j++) {
63 lbl += (j==0?
"Data":
"Emul");
65 title += (j==0?
"(DATA)":
"(EMULATOR)");
66 sysncand[j] = ibooker.
book1D(lbl.data(),title.data(),nGctColl_, 0, nGctColl_ );
69 for(
int j=0; j<nGctColl_; j++) {
77 lbl+=cLabel[j];lbl+=
"ErrorFlag";
78 title+=cLabel[j];title+=
" ErrorFlag";
79 errortype[j] = ibooker.
book1D(lbl.data(),title.data(), nerr, 0, nerr);
83 lbl+=cLabel[j];lbl+=
"Eta";
84 title+=cLabel[j];title+=
" ETA OF COMPARISON FAILURES";
85 eta[j] = ibooker.
book1D(lbl.data(),title.data(),
86 etaNBins, etaMinim, etaMaxim);
89 lbl+=cLabel[j];lbl+=
"Phi";
90 title+=cLabel[j];title+=
" PHI OF COMPARISON FAILURES";
91 phi[j] = ibooker.
book1D(lbl.data(),title.data(),
92 phiNBins, phiMinim, phiMaxim);
96 lbl+=cLabel[j];lbl+=
"Etaphi";
97 title+=cLabel[j];title+=
" ETA PHI OF COMPARISON FAILURES";
99 etaNBins, etaMinim, etaMaxim,
100 phiNBins, phiMinim, phiMaxim
104 lbl+=cLabel[j];lbl+=
"Rank";
105 title+=cLabel[j];title+=
" RANK OF COMPARISON FAILURES";
106 rnk[j] = ibooker.
book1D(lbl.data(),title.data(),
107 rnkNBins, rnkMinim, rnkMaxim);
111 lbl+=cLabel[j];lbl+=
"Eta"; lbl+=
"Data";
112 title+=cLabel[j];title+=
" ETA (DATA)";
113 etaData[j] = ibooker.
book1D(lbl.data(),title.data(),
114 etaNBins, etaMinim, etaMaxim);
117 lbl+=cLabel[j];lbl+=
"Phi"; lbl+=
"Data";
118 title+=cLabel[j];title+=
" PHI (DATA)";
119 phiData[j] = ibooker.
book1D(lbl.data(),title.data(),
120 phiNBins, phiMinim, phiMaxim);
124 lbl+=cLabel[j];lbl+=
"Rank"; lbl+=
"Data";
125 title+=cLabel[j];title+=
" RANK (DATA)";
126 rnkData[j] = ibooker.
book1D(lbl.data(),title.data(),
127 rnkNBins, rnkMinim, rnkMaxim);
129 lbl+=cLabel[j];lbl+=
"Dword";
130 dword[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
132 lbl+=cLabel[j];lbl+=
"Eword";
133 eword[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
135 lbl+=cLabel[j];lbl+=
"DEword";
136 deword[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
142 for(
int i=0;
i<nGctColl_;
i++) {
144 sysncand[0]->setBinLabel(i+1,cLabel[i]);
145 sysncand[1]->setBinLabel(i+1,cLabel[i]);
148 for(
int i=0;
i<nGctColl_;
i++) {
149 for(
int j=0; j<nerr; j++) {
150 errortype[
i]->setBinLabel(j+1,errLabel[j]);
154 for(
int i=0;
i<nGctColl_;
i++) {
155 etaphi [
i]->setAxisTitle(
"GCT #eta",1);
156 etaphi [
i]->setAxisTitle(
"GCT #phi",2);
157 eta [
i]->setAxisTitle(
"GCT #eta");
158 phi [
i]->setAxisTitle(
"GCT #phi");
159 rnk [
i]->setAxisTitle(
"Rank");
160 etaData[
i]->setAxisTitle(
"GCT #eta");
161 phiData[
i]->setAxisTitle(
"GCT #phi");
162 rnkData[
i]->setAxisTitle(
"Rank");
163 dword [
i]->setAxisTitle(
"trigger data word bit");
164 eword [
i]->setAxisTitle(
"trigger data word bit");
165 deword [
i]->setAxisTitle(
"trigger data word bit");
168 for(
int i=0;
i<nGctColl_;
i++) {
176 if (m_stage1_layer2_ ==
true) {
178 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES",nStage1Layer2Coll_, 0, nStage1Layer2Coll_ );
180 for(
int j=0; j<2; j++) {
182 lbl += (j==0?
"Data":
"Emul");
184 title += (j==0?
"(DATA)":
"(EMULATOR)");
185 sysncand[j] = ibooker.
book1D(lbl.data(),title.data(),nStage1Layer2Coll_, 0, nStage1Layer2Coll_ );
188 for(
int j=0; j<nStage1Layer2Coll_; j++) {
192 if(sLabel[j]==
"MHT"){
198 if((sLabel[j]==
"HT")||(sLabel[j]==
"ET")||(sLabel[j]==
"MET")){
204 if(sLabel[j]==
"Stage1HFSums"){
210 if(sLabel[j]==
"IsoTauJet"){
220 lbl+=sLabel[j];lbl+=
"ErrorFlag";
221 title+=sLabel[j];title+=
" ErrorFlag";
222 errortype_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(), nerr, 0, nerr);
226 lbl+=sLabel[j];lbl+=
"Eta";
227 title+=sLabel[j];title+=
" ETA OF COMPARISON FAILURES";
228 eta_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
229 etaNBins, etaMinim, etaMaxim);
232 lbl+=sLabel[j];lbl+=
"Phi";
233 title+=sLabel[j];title+=
" PHI OF COMPARISON FAILURES";
234 phi_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
235 phiNBins, phiMinim, phiMaxim);
239 lbl+=sLabel[j];lbl+=
"Etaphi";
240 title+=sLabel[j];title+=
" ETA PHI OF COMPARISON FAILURES";
241 etaphi_stage1layer2[j] = ibooker.
book2D(lbl.data(),title.data(),
242 etaNBins, etaMinim, etaMaxim,
243 phiNBins, phiMinim, phiMaxim);
246 lbl+=sLabel[j];lbl+=
"Rank";
247 title+=sLabel[j];title+=
" RANK OF COMPARISON FAILURES";
248 rnk_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
249 rnkNBins, rnkMinim, rnkMaxim);
253 lbl+=sLabel[j];lbl+=
"Eta"; lbl+=
"Data";
254 title+=sLabel[j];title+=
" ETA (DATA)";
255 etaData_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
256 etaNBins, etaMinim, etaMaxim);
259 lbl+=sLabel[j];lbl+=
"Phi"; lbl+=
"Data";
260 title+=sLabel[j];title+=
" PHI (DATA)";
261 phiData_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
262 phiNBins, phiMinim, phiMaxim);
266 lbl+=sLabel[j];lbl+=
"Rank"; lbl+=
"Data";
267 title+=sLabel[j];title+=
" RANK (DATA)";
268 rnkData_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
269 rnkNBins, rnkMinim, rnkMaxim);
271 lbl+=sLabel[j];lbl+=
"Dword";
272 dword_stage1layer2[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
274 lbl+=sLabel[j];lbl+=
"Eword";
275 eword_stage1layer2[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
277 lbl+=sLabel[j];lbl+=
"DEword";
278 deword_stage1layer2[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
284 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
286 sysncand[0]->setBinLabel(i+1,sLabel[i]);
287 sysncand[1]->setBinLabel(i+1,sLabel[i]);
290 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
291 for(
int j=0; j<nerr; j++) {
292 errortype_stage1layer2[
i]->setBinLabel(j+1,errLabel[j]);
296 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
297 etaphi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta",1);
298 etaphi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi",2);
299 eta_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta");
300 phi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi");
301 rnk_stage1layer2[
i]->setAxisTitle(
"Rank");
302 etaData_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta");
303 phiData_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi");
304 rnkData_stage1layer2[
i]->setAxisTitle(
"Rank");
305 dword_stage1layer2 [
i]->setAxisTitle(
"trigger data word bit");
306 eword_stage1layer2 [
i]->setAxisTitle(
"trigger data word bit");
307 deword_stage1layer2 [
i]->setAxisTitle(
"trigger data word bit");
310 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
311 colCount_stage1Layer2[
i]=0;
312 nWithCol_stage1Layer2[
i]=0;
317 std::cout <<
"L1TdeGCT::beginJob() end.\n" << std::flush;
329 std::cout <<
"L1TdeGCT::analyze() start\n" << std::flush;
337 <<
"Cannot find L1DataEmulRecord" 338 <<
" Please verify that comparator was successfully executed." 339 <<
" Emulator DQM for GCT will be skipped!" 345 if (m_stage1_layer2_ ==
false) {
349 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record." 350 <<
" Skiping event!\n" << std::flush;
355 for(
int j=0; j<2; j++)
360 <<
" data: " << DEncand[0]
361 <<
" emul: " << DEncand[1]
375 for(L1DEDigiCollection::const_iterator it=deColl.begin();
376 it!=deColl.end(); it++)
379 gctColl.push_back(*it);
382 std::cout <<
"[L1TdeGCT] record has " << gctColl.size()
383 <<
" gct de digis\n" << std::flush;
384 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
385 it!=gctColl.end(); it++)
394 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
395 it!=gctColl.end(); it++) {
404 std::cout <<
"[L1TdeGCT] processing digi " 412 if(sid!=
GCT || it->empty()) {
413 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-gct digis!";
417 int type = it->type();
418 double phiv = it->x1();
419 double etav = it->x2();
422 float rnkv = rankarr[0];
426 unsigned int mask = (~0x0);
430 if(ccid<0 || ccid >= nGctColl_) {
431 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" 438 sysncand[0]->
Fill(ccid);
439 if(it->type()<5&&it->type()!=3)
440 sysncand[1]->
Fill(ccid);
442 errortype[ccid]->Fill(type);
444 wei=1.;
if(!type) wei=0.;
445 if(etav!=nullVal && phiv!=nullVal)
446 etaphi[ccid]->Fill(etav,phiv,wei);
448 eta [ccid]->Fill(etav,wei);
450 phi [ccid]->Fill(phiv,wei);
451 rnk[ccid]->Fill(rnkv,wei);
454 wei=1.;
if(type==4) wei=0.;
456 etaData[ccid]->Fill(etav,wei);
458 phiData[ccid]->Fill(phiv,wei);
459 rnkData[ccid]->Fill(rnkv,wei);
463 unsigned int word[2];
465 std::bitset<32> dbits(word[0]);
466 std::bitset<32> ebits(word[1]);
467 unsigned int dexor = ( (word[0]) ^ (word[1]) );
469 std::bitset<32> debits(dexor);
471 std::bitset<32> dembits( ( (dexor) & (mask) ) );
475 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 476 <<
" data:0x" << std::hex << word[0] <<
std::dec 477 <<
" bitset:" << dbits
479 <<
" emul:0x" << std::hex << word[1] <<
std::dec 480 <<
" bitset:" << ebits
482 <<
" xor:0x" << std::hex << dexor <<
std::dec 483 <<
" bitset:" << debits
484 <<
" bitset:" << ( (dbits) ^ (ebits) )
485 <<
"\n" << std::flush;
488 for(
int ibit=0; ibit<32; ibit++) {
491 if(type==3 || type==4) wei=0.;
492 if(dbits [ibit]) dword[ccid]->Fill(ibit,wei);
493 if(ebits [ibit]) eword[ccid]->Fill(ibit,wei);
494 if(debits [ibit])deword[ccid]->Fill(ibit,wei);
502 int hasCol[nGctColl_]={0};
503 int nagree[nGctColl_]={0};
504 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
505 it!=gctColl.end(); it++) {
507 ccid = (ccid<0 || ccid >= nGctColl_) ? 0:ccid;
512 for(
int i=0;
i<nGctColl_;
i++) {
513 if(!hasCol[
i])
continue;
518 nWithCol[
i]+=hasCol[
i];
519 colCount[
i]+=nagree[
i];
521 for(
int i=0;
i<nGctColl_;
i++) {
523 double rate = nWithCol[
i] ? 1.-1.*colCount[
i]/nWithCol[
i]: 0.;
524 sysrates->setBinContent(ibin,rate);
526 std::cout <<
"[L1TDEMON] analyze rate computation\t\n" 529 <<
" nWithCol: " << nWithCol[
i]
530 <<
" colCount: " << colCount[
i]
532 <<
"hasCol: " << hasCol[
i]
533 <<
" nagree: " << nagree[
i]
534 <<
" rate:" << sysrates->getBinContent(ibin)
535 <<
"\n" << std::flush;
536 if(rate>1. || rate<0.)
538 <<
" is "<<sysrates->getBinContent(ibin)
539 <<
"\n" << std::flush;
544 if (m_stage1_layer2_ ==
true) {
548 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record." 549 <<
" Skiping event!\n" << std::flush;
554 for(
int j=0; j<2; j++)
559 <<
" data: " << DEncand[0]
560 <<
" emul: " << DEncand[1]
570 stage1layer2Coll.reserve(21);
571 stage1layer2Coll.clear();
574 for(L1DEDigiCollection::const_iterator it=deColl.begin();
575 it!=deColl.end(); it++)
578 stage1layer2Coll.push_back(*it);
581 std::cout <<
"[L1TdeSTAGE1LAYER2] record has " << stage1layer2Coll.size()
582 <<
" stage1layer2 de digis\n" << std::endl;
583 for(L1DEDigiCollection::const_iterator it=stage1layer2Coll.begin();
584 it!=stage1layer2Coll.end(); it++)
593 for(L1DEDigiCollection::const_iterator it=stage1layer2Coll.begin();
594 it!=stage1layer2Coll.end(); it++) {
603 std::cout <<
"[L1TdeStage1Layer2] processing digi " 610 if(sid!=
GCT || it->empty()) {
611 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-stage1layer2 digis!";
615 int type = it->type();
616 double phiv = it->x1();
617 double etav = it->x2();
620 float rnkv = rankarr[0];
624 unsigned int mask = (~0x0);
628 if(ccid<0 || ccid >= nStage1Layer2Coll_) {
629 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" 636 sysncand[0]->
Fill(ccid);
637 if(it->type()<5&&it->type()!=3)
638 sysncand[1]->
Fill(ccid);
639 errortype_stage1layer2[ccid]->Fill(type);
640 wei=1.;
if(!type) wei=0.;
641 if(etav!=nullVal && phiv!=nullVal)
642 etaphi_stage1layer2[ccid]->Fill(etav,phiv,wei);
644 eta_stage1layer2 [ccid]->Fill(etav,wei);
646 phi_stage1layer2 [ccid]->Fill(phiv,wei);
647 rnk_stage1layer2[ccid]->Fill(rnkv,wei);
650 wei=1.;
if(type==4) wei=0.;
652 etaData_stage1layer2[ccid]->Fill(etav,wei);
654 phiData_stage1layer2[ccid]->Fill(phiv,wei);
655 rnkData_stage1layer2[ccid]->Fill(rnkv,wei);
659 unsigned int word_stage1layer2[2];
660 it->data(word_stage1layer2);
661 std::bitset<32> dbits(word_stage1layer2[0]);
662 std::bitset<32> ebits(word_stage1layer2[1]);
663 unsigned int dexor = ( (word_stage1layer2[0]) ^ (word_stage1layer2[1]) );
665 std::bitset<32> debits(dexor);
667 std::bitset<32> dembits( ( (dexor) & (mask) ) );
671 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 672 <<
" data:0x" << std::hex << word_stage1layer2[0] <<
std::dec 673 <<
" bitset:" << dbits
675 <<
" emul:0x" << std::hex << word_stage1layer2[1] <<
std::dec 676 <<
" bitset:" << ebits
678 <<
" xor:0x" << std::hex << dexor <<
std::dec 679 <<
" bitset:" << debits
680 <<
" bitset:" << ( (dbits) ^ (ebits) )
681 <<
"\n" << std::flush;
684 for(
int ibit=0; ibit<32; ibit++) {
687 if(type==3 || type==4) wei=0.;
688 if(dbits [ibit]) dword_stage1layer2[ccid]->Fill(ibit,wei);
689 if(ebits [ibit]) eword_stage1layer2[ccid]->Fill(ibit,wei);
690 if(debits [ibit])deword_stage1layer2[ccid]->Fill(ibit,wei);
697 int hasCol[nStage1Layer2Coll_]={0};
698 int nagree[nStage1Layer2Coll_]={0};
699 for(L1DEDigiCollection::const_iterator it=stage1layer2Coll.begin();
700 it!=stage1layer2Coll.end(); it++) {
702 ccid = (ccid<0 || ccid >= nStage1Layer2Coll_) ? 0:ccid;
707 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
708 if(!hasCol[
i])
continue;
713 nWithCol_stage1Layer2[
i]+=hasCol[
i];
714 colCount_stage1Layer2[
i]+=nagree[
i];
716 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
718 double rate = nWithCol_stage1Layer2[
i] ? 1.-1.*colCount_stage1Layer2[
i]/nWithCol_stage1Layer2[
i]: 0.;
719 sysrates->setBinContent(ibin,rate);
721 std::cout <<
"[L1TDEMON] analyze rate computation\t\n" 724 <<
" nWithCol: " << nWithCol_stage1Layer2[
i]
725 <<
" colCount: " << colCount_stage1Layer2[
i]
727 <<
"hasCol: " << hasCol[
i]
728 <<
" nagree: " << nagree[
i]
729 <<
" rate:" << sysrates->getBinContent(ibin)
730 <<
"\n" << std::flush;
731 if(rate>1. || rate<0.)
733 <<
" is "<<sysrates->getBinContent(ibin)
734 <<
"\n" << std::flush;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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
static const int nGctColl_
L1TdeGCT(const edm::ParameterSet &)
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
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * book2D(Args &&...args)
L1DEDigiCollection getColl() const
const std::string SystLabel[DEnsys]
void analyze(const edm::Event &, const edm::EventSetup &) override
static const int nStage1Layer2Coll_
bool get_isComp(int i) const
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override