4 using namespace dedefs;
14 std::cout <<
"L1TdeGCT::L1TdeGCT()...\n" << std::flush;
23 if (histFile_.size()!=0) {
25 <<
"L1TEmulator GCT specific histograms will be saved to "
33 std::cout <<
"L1TdeGCT::L1TdeGCT()...done.\n" << std::flush;
48 std::cout <<
"L1TdeGCT::beginRun() start\n" << std::flush;
53 sysrates = ibooker.
book1D(
"sysrates",
"RATE OF COMPARISON FAILURES",nGctColl_, 0, nGctColl_ );
55 for(
int j=0;
j<2;
j++) {
57 lbl += (
j==0?
"Data":
"Emul");
59 title += (
j==0?
"(DATA)":
"(EMULATOR)");
60 sysncand[
j] = ibooker.
book1D(lbl.data(),title.data(),nGctColl_, 0, nGctColl_ );
63 for(
int j=0;
j<nGctColl_;
j++) {
71 lbl+=cLabel[
j];lbl+=
"ErrorFlag";
72 title+=cLabel[
j];title+=
" ErrorFlag";
73 errortype[
j] = ibooker.
book1D(lbl.data(),title.data(), nerr, 0, nerr);
77 lbl+=cLabel[
j];lbl+=
"Eta";
78 title+=cLabel[
j];title+=
" ETA OF COMPARISON FAILURES";
79 eta[
j] = ibooker.
book1D(lbl.data(),title.data(),
80 etaNBins, etaMinim, etaMaxim);
83 lbl+=cLabel[
j];lbl+=
"Phi";
84 title+=cLabel[
j];title+=
" PHI OF COMPARISON FAILURES";
85 phi[
j] = ibooker.
book1D(lbl.data(),title.data(),
86 phiNBins, phiMinim, phiMaxim);
90 lbl+=cLabel[
j];lbl+=
"Etaphi";
91 title+=cLabel[
j];title+=
" ETA PHI OF COMPARISON FAILURES";
93 etaNBins, etaMinim, etaMaxim,
94 phiNBins, phiMinim, phiMaxim
98 lbl+=cLabel[
j];lbl+=
"Rank";
99 title+=cLabel[
j];title+=
" RANK OF COMPARISON FAILURES";
100 rnk[
j] = ibooker.
book1D(lbl.data(),title.data(),
101 rnkNBins, rnkMinim, rnkMaxim);
105 lbl+=cLabel[
j];lbl+=
"Eta"; lbl+=
"Data";
106 title+=cLabel[
j];title+=
" ETA (DATA)";
107 etaData[
j] = ibooker.
book1D(lbl.data(),title.data(),
108 etaNBins, etaMinim, etaMaxim);
111 lbl+=cLabel[
j];lbl+=
"Phi"; lbl+=
"Data";
112 title+=cLabel[
j];title+=
" PHI (DATA)";
113 phiData[
j] = ibooker.
book1D(lbl.data(),title.data(),
114 phiNBins, phiMinim, phiMaxim);
118 lbl+=cLabel[
j];lbl+=
"Rank"; lbl+=
"Data";
119 title+=cLabel[
j];title+=
" RANK (DATA)";
120 rnkData[
j] = ibooker.
book1D(lbl.data(),title.data(),
121 rnkNBins, rnkMinim, rnkMaxim);
123 lbl+=cLabel[
j];lbl+=
"Dword";
124 dword[
j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
126 lbl+=cLabel[
j];lbl+=
"Eword";
127 eword[
j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
129 lbl+=cLabel[
j];lbl+=
"DEword";
130 deword[
j] = ibooker.
book1D(lbl.data(),lbl.data(),nbit,0,nbit);
136 for(
int i=0;
i<nGctColl_;
i++) {
138 sysncand[0]->setBinLabel(i+1,cLabel[i]);
139 sysncand[1]->setBinLabel(i+1,cLabel[i]);
142 for(
int i=0;
i<nGctColl_;
i++) {
143 for(
int j=0;
j<nerr;
j++) {
144 errortype[
i]->setBinLabel(
j+1,errLabel[
j]);
148 for(
int i=0;
i<nGctColl_;
i++) {
149 etaphi [
i]->setAxisTitle(
"GCT #eta",1);
150 etaphi [
i]->setAxisTitle(
"GCT #phi",2);
151 eta [
i]->setAxisTitle(
"GCT #eta");
152 phi [
i]->setAxisTitle(
"GCT #phi");
153 rnk [
i]->setAxisTitle(
"Rank");
154 etaData[
i]->setAxisTitle(
"GCT #eta");
155 phiData[
i]->setAxisTitle(
"GCT #phi");
156 rnkData[
i]->setAxisTitle(
"Rank");
157 dword [
i]->setAxisTitle(
"trigger data word bit");
158 eword [
i]->setAxisTitle(
"trigger data word bit");
159 deword [
i]->setAxisTitle(
"trigger data word bit");
163 for(
int i=0;
i<nGctColl_;
i++) {
170 std::cout <<
"L1TdeGCT::beginJob() end.\n" << std::flush;
182 std::cout <<
"L1TdeGCT::analyze() start\n" << std::flush;
190 <<
"Cannot find L1DataEmulRecord"
191 <<
" Please verify that comparator was successfully executed."
192 <<
" Emulator DQM for GCT will be skipped!"
198 bool isComp = deRecord->get_isComp(
GCT);
201 std::cout <<
"[L1TdeGCT] Gct information not generated in de-record."
202 <<
" Skiping event!\n" << std::flush;
207 for(
int j=0;
j<2;
j++)
208 DEncand[
j] = deRecord->getNCand(
GCT,
j);
212 <<
" data: " << DEncand[0]
213 <<
" emul: " << DEncand[1]
218 deColl = deRecord->getColl();
227 for(L1DEDigiCollection::const_iterator it=deColl.begin();
228 it!=deColl.end(); it++)
231 gctColl.push_back(*it);
234 std::cout <<
"[L1TdeGCT] record has " << gctColl.size()
235 <<
" gct de digis\n" << std::flush;
236 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
237 it!=gctColl.end(); it++)
246 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
247 it!=gctColl.end(); it++) {
256 std::cout <<
"[L1TdeGCT] processing digi "
264 if(sid!=
GCT || it->empty()) {
265 LogDebug(
"L1TdeGCT") <<
"consistency check failure, non-gct digis!";
269 int type = it->type();
270 double phiv = it->x1();
271 double etav = it->x2();
274 float rnkv = rankarr[0];
278 unsigned int mask = (~0x0);
282 if(ccid<0 || ccid >= nGctColl_) {
283 LogDebug(
"L1TdeGCT") <<
"consistency check failure, col type outbounds:"
290 sysncand[0]->
Fill(ccid);
291 if(it->type()<5&&it->type()!=3)
292 sysncand[1]->
Fill(ccid);
294 errortype[ccid]->Fill(type);
296 wei=1.;
if(!type) wei=0.;
297 if(etav!=nullVal && phiv!=nullVal)
298 etaphi[ccid]->Fill(etav,phiv,wei);
300 eta [ccid]->Fill(etav,wei);
302 phi [ccid]->Fill(phiv,wei);
303 rnk[ccid]->Fill(rnkv,wei);
306 wei=1.;
if(type==4) wei=0.;
308 etaData[ccid]->Fill(etav,wei);
310 phiData[ccid]->Fill(phiv,wei);
311 rnkData[ccid]->Fill(rnkv,wei);
315 unsigned int word[2];
317 std::bitset<32> dbits(word[0]);
318 std::bitset<32> ebits(word[1]);
319 unsigned int dexor = ( (word[0]) ^ (word[1]) );
321 std::bitset<32> debits(dexor);
323 std::bitset<32> dembits( ( (dexor) & (mask) ) );
327 <<
" sid:" << sid <<
" cid:" << cid <<
"\n"
328 <<
" data:0x" << std::hex << word[0] <<
std::dec
329 <<
" bitset:" << dbits
331 <<
" emul:0x" << std::hex << word[1] <<
std::dec
332 <<
" bitset:" << ebits
334 <<
" xor:0x" << std::hex << dexor <<
std::dec
335 <<
" bitset:" << debits
336 <<
" bitset:" << ( (dbits) ^ (ebits) )
337 <<
"\n" << std::flush;
340 for(
int ibit=0; ibit<32; ibit++) {
343 if(type==3 || type==4) wei=0.;
344 if(dbits [ibit]) dword[sid]->Fill(ibit,wei);
345 if(ebits [ibit]) eword[sid]->Fill(ibit,wei);
346 if(debits [ibit])deword[sid]->Fill(ibit,wei);
354 int hasCol[nGctColl_]={0};
355 int nagree[nGctColl_]={0};
356 for(L1DEDigiCollection::const_iterator it=gctColl.begin();
357 it!=gctColl.end(); it++) {
359 ccid = (ccid<0 || ccid >= nGctColl_) ? 0:ccid;
364 for(
int i=0;
i<nGctColl_;
i++) {
365 if(!hasCol[
i])
continue;
370 nWithCol[
i]+=hasCol[
i];
371 colCount[
i]+=nagree[
i];
373 for(
int i=0;
i<nGctColl_;
i++) {
375 double rate = nWithCol[
i] ? 1.-1.*colCount[
i]/nWithCol[
i]: 0.;
376 sysrates->setBinContent(ibin,rate);
378 std::cout <<
"[L1TDEMON] analyze rate computation\t\n"
381 <<
" nWithCol: " << nWithCol[
i]
382 <<
" colCount: " << colCount[
i]
384 <<
"hasCol: " << hasCol[
i]
385 <<
" nagree: " << nagree[
i]
386 <<
" rate:" << sysrates->getBinContent(ibin)
387 <<
"\n" << std::flush;
388 if(rate>1. || rate<0.)
390 <<
" is "<<sysrates->getBinContent(ibin)
391 <<
"\n" << std::flush;
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
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 analyze(const edm::Event &, const edm::EventSetup &)
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)
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
const std::string SystLabel[DEnsys]
virtual void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override