15 std::cout <<
"L1TdeGCT::L1TdeGCT()...\n" << std::flush;
24 if (histFile_.size()!=0) {
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_");
50 double rnkMinim = 0.5;
51 double rnkMaxim = 63.5;
55 std::cout <<
"L1TdeGCT::beginRun() start\n" << std::flush;
59 if (m_stage1_layer2_ ==
false) {
61 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES",nGctColl_, 0, nGctColl_ );
63 for(
int j=0; j<2; j++) {
65 lbl += (j==0?
"Data":
"Emul");
67 title += (j==0?
"(DATA)":
"(EMULATOR)");
68 sysncand[j] = ibooker.
book1D(lbl.data(),title.data(),nGctColl_, 0, nGctColl_ );
71 for(
int j=0; j<nGctColl_; j++) {
79 lbl+=cLabel[j];lbl+=
"ErrorFlag";
80 title+=cLabel[j];title+=
" ErrorFlag";
81 errortype[j] = ibooker.
book1D(lbl.data(),title.data(), nerr, 0, nerr);
85 lbl+=cLabel[j];lbl+=
"Eta";
86 title+=cLabel[j];title+=
" ETA OF COMPARISON FAILURES";
87 eta[j] = ibooker.
book1D(lbl.data(),title.data(),
88 etaNBins, etaMinim, etaMaxim);
91 lbl+=cLabel[j];lbl+=
"Phi";
92 title+=cLabel[j];title+=
" PHI OF COMPARISON FAILURES";
93 phi[j] = ibooker.
book1D(lbl.data(),title.data(),
94 phiNBins, phiMinim, phiMaxim);
98 lbl+=cLabel[j];lbl+=
"Etaphi";
99 title+=cLabel[j];title+=
" ETA PHI OF COMPARISON FAILURES";
101 etaNBins, etaMinim, etaMaxim,
102 phiNBins, phiMinim, phiMaxim
106 lbl+=cLabel[j];lbl+=
"Rank";
107 title+=cLabel[j];title+=
" RANK OF COMPARISON FAILURES";
108 rnk[j] = ibooker.
book1D(lbl.data(),title.data(),
109 rnkNBins, rnkMinim, rnkMaxim);
113 lbl+=cLabel[j];lbl+=
"Eta"; lbl+=
"Data";
114 title+=cLabel[j];title+=
" ETA (DATA)";
115 etaData[j] = ibooker.
book1D(lbl.data(),title.data(),
116 etaNBins, etaMinim, etaMaxim);
119 lbl+=cLabel[j];lbl+=
"Phi"; lbl+=
"Data";
120 title+=cLabel[j];title+=
" PHI (DATA)";
121 phiData[j] = ibooker.
book1D(lbl.data(),title.data(),
122 phiNBins, phiMinim, phiMaxim);
126 lbl+=cLabel[j];lbl+=
"Rank"; lbl+=
"Data";
127 title+=cLabel[j];title+=
" RANK (DATA)";
128 rnkData[j] = ibooker.
book1D(lbl.data(),title.data(),
129 rnkNBins, rnkMinim, rnkMaxim);
131 lbl+=cLabel[j];lbl+=
"Dword";
132 dword[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
134 lbl+=cLabel[j];lbl+=
"Eword";
135 eword[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
137 lbl+=cLabel[j];lbl+=
"DEword";
138 deword[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
144 for(
int i=0;
i<nGctColl_;
i++) {
146 sysncand[0]->setBinLabel(i+1,cLabel[i]);
147 sysncand[1]->setBinLabel(i+1,cLabel[i]);
150 for(
int i=0;
i<nGctColl_;
i++) {
151 for(
int j=0; j<nerr; j++) {
152 errortype[
i]->setBinLabel(j+1,errLabel[j]);
156 for(
int i=0;
i<nGctColl_;
i++) {
157 etaphi [
i]->setAxisTitle(
"GCT #eta",1);
158 etaphi [
i]->setAxisTitle(
"GCT #phi",2);
159 eta [
i]->setAxisTitle(
"GCT #eta");
160 phi [
i]->setAxisTitle(
"GCT #phi");
161 rnk [
i]->setAxisTitle(
"Rank");
162 etaData[
i]->setAxisTitle(
"GCT #eta");
163 phiData[
i]->setAxisTitle(
"GCT #phi");
164 rnkData[
i]->setAxisTitle(
"Rank");
165 dword [
i]->setAxisTitle(
"trigger data word bit");
166 eword [
i]->setAxisTitle(
"trigger data word bit");
167 deword [
i]->setAxisTitle(
"trigger data word bit");
170 for(
int i=0;
i<nGctColl_;
i++) {
178 if (m_stage1_layer2_ ==
true) {
180 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES",nStage1Layer2Coll_, 0, nStage1Layer2Coll_ );
182 for(
int j=0; j<2; j++) {
184 lbl += (j==0?
"Data":
"Emul");
186 title += (j==0?
"(DATA)":
"(EMULATOR)");
187 sysncand[j] = ibooker.
book1D(lbl.data(),title.data(),nStage1Layer2Coll_, 0, nStage1Layer2Coll_ );
190 for(
int j=0; j<nStage1Layer2Coll_; j++) {
194 if(sLabel[j]==
"MHT"){
200 if((sLabel[j]==
"HT")||(sLabel[j]==
"ET")||(sLabel[j]==
"MET")){
206 if(sLabel[j]==
"Stage1HFSums"){
212 if(sLabel[j]==
"IsoTauJet"){
222 lbl+=sLabel[j];lbl+=
"ErrorFlag";
223 title+=sLabel[j];title+=
" ErrorFlag";
224 errortype_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(), nerr, 0, nerr);
228 lbl+=sLabel[j];lbl+=
"Eta";
229 title+=sLabel[j];title+=
" ETA OF COMPARISON FAILURES";
230 eta_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
231 etaNBins, etaMinim, etaMaxim);
234 lbl+=sLabel[j];lbl+=
"Phi";
235 title+=sLabel[j];title+=
" PHI OF COMPARISON FAILURES";
236 phi_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
237 phiNBins, phiMinim, phiMaxim);
241 lbl+=sLabel[j];lbl+=
"Etaphi";
242 title+=sLabel[j];title+=
" ETA PHI OF COMPARISON FAILURES";
243 etaphi_stage1layer2[j] = ibooker.
book2D(lbl.data(),title.data(),
244 etaNBins, etaMinim, etaMaxim,
245 phiNBins, phiMinim, phiMaxim);
248 lbl+=sLabel[j];lbl+=
"Rank";
249 title+=sLabel[j];title+=
" RANK OF COMPARISON FAILURES";
250 rnk_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
251 rnkNBins, rnkMinim, rnkMaxim);
255 lbl+=sLabel[j];lbl+=
"Eta"; lbl+=
"Data";
256 title+=sLabel[j];title+=
" ETA (DATA)";
257 etaData_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
258 etaNBins, etaMinim, etaMaxim);
261 lbl+=sLabel[j];lbl+=
"Phi"; lbl+=
"Data";
262 title+=sLabel[j];title+=
" PHI (DATA)";
263 phiData_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
264 phiNBins, phiMinim, phiMaxim);
268 lbl+=sLabel[j];lbl+=
"Rank"; lbl+=
"Data";
269 title+=sLabel[j];title+=
" RANK (DATA)";
270 rnkData_stage1layer2[j] = ibooker.
book1D(lbl.data(),title.data(),
271 rnkNBins, rnkMinim, rnkMaxim);
273 lbl+=sLabel[j];lbl+=
"Dword";
274 dword_stage1layer2[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
276 lbl+=sLabel[j];lbl+=
"Eword";
277 eword_stage1layer2[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
279 lbl+=sLabel[j];lbl+=
"DEword";
280 deword_stage1layer2[j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
286 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
288 sysncand[0]->setBinLabel(i+1,sLabel[i]);
289 sysncand[1]->setBinLabel(i+1,sLabel[i]);
292 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
293 for(
int j=0; j<nerr; j++) {
294 errortype_stage1layer2[
i]->setBinLabel(j+1,errLabel[j]);
298 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
299 etaphi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta",1);
300 etaphi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi",2);
301 eta_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta");
302 phi_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi");
303 rnk_stage1layer2[
i]->setAxisTitle(
"Rank");
304 etaData_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #eta");
305 phiData_stage1layer2[
i]->setAxisTitle(
"Stage1Layer2 #phi");
306 rnkData_stage1layer2[
i]->setAxisTitle(
"Rank");
307 dword_stage1layer2 [
i]->setAxisTitle(
"trigger data word bit");
308 eword_stage1layer2 [
i]->setAxisTitle(
"trigger data word bit");
309 deword_stage1layer2 [
i]->setAxisTitle(
"trigger data word bit");
312 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
313 colCount_stage1Layer2[
i]=0;
314 nWithCol_stage1Layer2[
i]=0;
319 std::cout <<
"L1TdeGCT::beginJob() end.\n" << std::flush;
331 std::cout <<
"L1TdeGCT::analyze() start\n" << std::flush;
339 <<
"Cannot find L1DataEmulRecord" 340 <<
" Please verify that comparator was successfully executed." 341 <<
" Emulator DQM for GCT will be skipped!" 347 if (m_stage1_layer2_ ==
false) {
351 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record." 352 <<
" Skiping event!\n" << std::flush;
357 for(
int j=0; j<2; j++)
362 <<
" data: " << DEncand[0]
363 <<
" emul: " << DEncand[1]
377 for(L1DEDigiCollection::const_iterator it=deColl.begin();
378 it!=deColl.end(); it++)
381 gctColl.push_back(*it);
384 std::cout <<
"[L1TdeGCT] record has " << gctColl.size()
385 <<
" gct de digis\n" << std::flush;
386 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
387 it!=gctColl.end(); it++)
396 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
397 it!=gctColl.end(); it++) {
406 std::cout <<
"[L1TdeGCT] processing digi " 414 if(sid!=
GCT || it->empty()) {
415 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-gct digis!";
419 int type = it->type();
420 double phiv = it->x1();
421 double etav = it->x2();
424 float rnkv = rankarr[0];
428 unsigned int mask = (~0x0);
432 if(ccid<0 || ccid >= nGctColl_) {
433 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" 440 sysncand[0]->
Fill(ccid);
441 if(it->type()<5&&it->type()!=3)
442 sysncand[1]->
Fill(ccid);
444 errortype[ccid]->Fill(type);
446 wei=1.;
if(!type) wei=0.;
447 if(etav!=nullVal && phiv!=nullVal)
448 etaphi[ccid]->Fill(etav,phiv,wei);
450 eta [ccid]->Fill(etav,wei);
452 phi [ccid]->Fill(phiv,wei);
453 rnk[ccid]->Fill(rnkv,wei);
456 wei=1.;
if(type==4) wei=0.;
458 etaData[ccid]->Fill(etav,wei);
460 phiData[ccid]->Fill(phiv,wei);
461 rnkData[ccid]->Fill(rnkv,wei);
465 unsigned int word[2];
467 std::bitset<32> dbits(word[0]);
468 std::bitset<32> ebits(word[1]);
469 unsigned int dexor = ( (word[0]) ^ (word[1]) );
471 std::bitset<32> debits(dexor);
473 std::bitset<32> dembits( ( (dexor) & (mask) ) );
477 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 478 <<
" data:0x" << std::hex << word[0] <<
std::dec 479 <<
" bitset:" << dbits
481 <<
" emul:0x" << std::hex << word[1] <<
std::dec 482 <<
" bitset:" << ebits
484 <<
" xor:0x" << std::hex << dexor <<
std::dec 485 <<
" bitset:" << debits
486 <<
" bitset:" << ( (dbits) ^ (ebits) )
487 <<
"\n" << std::flush;
490 for(
int ibit=0; ibit<32; ibit++) {
493 if(type==3 || type==4) wei=0.;
494 if(dbits [ibit]) dword[ccid]->Fill(ibit,wei);
495 if(ebits [ibit]) eword[ccid]->Fill(ibit,wei);
496 if(debits [ibit])deword[ccid]->Fill(ibit,wei);
504 int hasCol[nGctColl_]={0};
505 int nagree[nGctColl_]={0};
506 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
507 it!=gctColl.end(); it++) {
509 ccid = (ccid<0 || ccid >= nGctColl_) ? 0:ccid;
514 for(
int i=0;
i<nGctColl_;
i++) {
515 if(!hasCol[
i])
continue;
520 nWithCol[
i]+=hasCol[
i];
521 colCount[
i]+=nagree[
i];
523 for(
int i=0;
i<nGctColl_;
i++) {
525 double rate = nWithCol[
i] ? 1.-1.*colCount[
i]/nWithCol[
i]: 0.;
526 sysrates->setBinContent(ibin,rate);
528 std::cout <<
"[L1TDEMON] analyze rate computation\t\n" 531 <<
" nWithCol: " << nWithCol[
i]
532 <<
" colCount: " << colCount[
i]
534 <<
"hasCol: " << hasCol[
i]
535 <<
" nagree: " << nagree[
i]
536 <<
" rate:" << sysrates->getBinContent(ibin)
537 <<
"\n" << std::flush;
538 if(rate>1. || rate<0.)
540 <<
" is "<<sysrates->getBinContent(ibin)
541 <<
"\n" << std::flush;
546 if (m_stage1_layer2_ ==
true) {
550 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record." 551 <<
" Skiping event!\n" << std::flush;
556 for(
int j=0; j<2; j++)
561 <<
" data: " << DEncand[0]
562 <<
" emul: " << DEncand[1]
572 stage1layer2Coll.reserve(21);
573 stage1layer2Coll.clear();
576 for(L1DEDigiCollection::const_iterator it=deColl.begin();
577 it!=deColl.end(); it++)
580 stage1layer2Coll.push_back(*it);
583 std::cout <<
"[L1TdeSTAGE1LAYER2] record has " << stage1layer2Coll.size()
584 <<
" stage1layer2 de digis\n" << std::endl;
585 for(L1DEDigiCollection::const_iterator it=stage1layer2Coll.begin();
586 it!=stage1layer2Coll.end(); it++)
595 for(L1DEDigiCollection::const_iterator it=stage1layer2Coll.begin();
596 it!=stage1layer2Coll.end(); it++) {
605 std::cout <<
"[L1TdeStage1Layer2] processing digi " 612 if(sid!=
GCT || it->empty()) {
613 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-stage1layer2 digis!";
617 int type = it->type();
618 double phiv = it->x1();
619 double etav = it->x2();
622 float rnkv = rankarr[0];
626 unsigned int mask = (~0x0);
630 if(ccid<0 || ccid >= nStage1Layer2Coll_) {
631 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:" 638 sysncand[0]->
Fill(ccid);
639 if(it->type()<5&&it->type()!=3)
640 sysncand[1]->
Fill(ccid);
641 errortype_stage1layer2[ccid]->Fill(type);
642 wei=1.;
if(!type) wei=0.;
643 if(etav!=nullVal && phiv!=nullVal)
644 etaphi_stage1layer2[ccid]->Fill(etav,phiv,wei);
646 eta_stage1layer2 [ccid]->Fill(etav,wei);
648 phi_stage1layer2 [ccid]->Fill(phiv,wei);
649 rnk_stage1layer2[ccid]->Fill(rnkv,wei);
652 wei=1.;
if(type==4) wei=0.;
654 etaData_stage1layer2[ccid]->Fill(etav,wei);
656 phiData_stage1layer2[ccid]->Fill(phiv,wei);
657 rnkData_stage1layer2[ccid]->Fill(rnkv,wei);
661 unsigned int word_stage1layer2[2];
662 it->data(word_stage1layer2);
663 std::bitset<32> dbits(word_stage1layer2[0]);
664 std::bitset<32> ebits(word_stage1layer2[1]);
665 unsigned int dexor = ( (word_stage1layer2[0]) ^ (word_stage1layer2[1]) );
667 std::bitset<32> debits(dexor);
669 std::bitset<32> dembits( ( (dexor) & (mask) ) );
673 <<
" sid:" << sid <<
" cid:" << cid <<
"\n" 674 <<
" data:0x" << std::hex << word_stage1layer2[0] <<
std::dec 675 <<
" bitset:" << dbits
677 <<
" emul:0x" << std::hex << word_stage1layer2[1] <<
std::dec 678 <<
" bitset:" << ebits
680 <<
" xor:0x" << std::hex << dexor <<
std::dec 681 <<
" bitset:" << debits
682 <<
" bitset:" << ( (dbits) ^ (ebits) )
683 <<
"\n" << std::flush;
686 for(
int ibit=0; ibit<32; ibit++) {
689 if(type==3 || type==4) wei=0.;
690 if(dbits [ibit]) dword_stage1layer2[ccid]->Fill(ibit,wei);
691 if(ebits [ibit]) eword_stage1layer2[ccid]->Fill(ibit,wei);
692 if(debits [ibit])deword_stage1layer2[ccid]->Fill(ibit,wei);
699 int hasCol[nStage1Layer2Coll_]={0};
700 int nagree[nStage1Layer2Coll_]={0};
701 for(L1DEDigiCollection::const_iterator it=stage1layer2Coll.begin();
702 it!=stage1layer2Coll.end(); it++) {
704 ccid = (ccid<0 || ccid >= nStage1Layer2Coll_) ? 0:ccid;
709 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
710 if(!hasCol[
i])
continue;
715 nWithCol_stage1Layer2[
i]+=hasCol[
i];
716 colCount_stage1Layer2[
i]+=nagree[
i];
718 for(
int i=0;
i<nStage1Layer2Coll_;
i++) {
720 double rate = nWithCol_stage1Layer2[
i] ? 1.-1.*colCount_stage1Layer2[
i]/nWithCol_stage1Layer2[
i]: 0.;
721 sysrates->setBinContent(ibin,rate);
723 std::cout <<
"[L1TDEMON] analyze rate computation\t\n" 726 <<
" nWithCol: " << nWithCol_stage1Layer2[
i]
727 <<
" colCount: " << colCount_stage1Layer2[
i]
729 <<
"hasCol: " << hasCol[
i]
730 <<
" nagree: " << nagree[
i]
731 <<
" rate:" << sysrates->getBinContent(ibin)
732 <<
"\n" << std::flush;
733 if(rate>1. || rate<0.)
735 <<
" is "<<sysrates->getBinContent(ibin)
736 <<
"\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 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
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
L1DEDigiCollection getColl() const
const std::string SystLabel[DEnsys]
void analyze(const edm::Event &, const edm::EventSetup &) override
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
static const int nStage1Layer2Coll_
bool get_isComp(int i) const
virtual void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override