CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/L1TMonitor/src/L1TDEMON.cc

Go to the documentation of this file.
00001 #include "DQM/L1TMonitor/interface/L1TDEMON.h"
00002 #include "DQMServices/Core/interface/DQMStore.h"
00003 #include <bitset>
00004 
00005 using namespace dedefs;
00006 
00007 L1TDEMON::L1TDEMON(const edm::ParameterSet& iConfig) {
00008 
00009   verbose_ = iConfig.getUntrackedParameter<int>("VerboseFlag",0);
00010 
00011   if(verbose())
00012     std::cout << "L1TDEMON::L1TDEMON()...\n" << std::flush;
00013   
00014   DEsource_ = iConfig.getParameter<edm::InputTag>("DataEmulCompareSource");
00015   histFolder_ = iConfig.getUntrackedParameter<std::string>("HistFolder", "L1TEMU/");
00016   histFile_ = iConfig.getUntrackedParameter<std::string>("HistFile", "");
00017 
00018   runInFF_ = iConfig.getUntrackedParameter<bool> ("RunInFilterFarm", false);
00019   if(verbose())
00020     std::cout << "Filter farm run setting? " << runInFF_
00021               << "\n" << std::flush;
00022   
00023   if(iConfig.getUntrackedParameter<bool> ("disableROOToutput", true))
00024     histFile_ = "";
00025 
00026 
00027   if (histFile_.size()!=0) {
00028     edm::LogInfo("OutputRootFile") 
00029       << "L1TEmulator Monitoring histograms will be saved to " 
00030       << histFile_.c_str() 
00031       << std::endl;
00032   }
00033 
00034   nEvt_ = 0;
00035   for(int i=0; i<DEnsys; i++) {
00036     deSysCount[i]=0;
00037     nEvtWithSys[i]=0;
00038   }
00039   
00040   dbe = NULL;
00041   if (iConfig.getUntrackedParameter<bool>("DQMStore", false)) { 
00042     dbe = edm::Service<DQMStore>().operator->();
00043     dbe->setVerbose(0);
00044   }
00045   
00046   if(dbe!=NULL)
00047     dbe->setCurrentFolder(histFolder_);
00048   
00049   hasRecord_=true;
00050   
00051   if(verbose())
00052     std::cout << "L1TDEMON::L1TDEMON constructor...done.\n" << std::flush;
00053 }
00054 
00055 L1TDEMON::~L1TDEMON() {}
00056 
00057 void 
00058 L1TDEMON::beginJob(void) {
00059 
00060   if(verbose())
00061     std::cout << "L1TDEMON::beginJob()  start\n" << std::flush;
00062 
00063   DQMStore* dbe = 0;
00064   dbe = edm::Service<DQMStore>().operator->();
00065   if(dbe) {
00066     dbe->setCurrentFolder(histFolder_);
00067     // dbe->rmdir(histFolder_);
00068   }
00069 
00070   //physical values disabled now, waiting for scale procedure 
00071   //const double tpi = 6.2832;
00072   //const double amin=   -0.5;
00073   //const double amax=tpi+0.5;
00074   
00075   //                           ETP,  HTP,  RCT, GCT, DTP, DTF,  CTP, CTF, RPC,LTC, GMT,GLT
00076   int    phiNBins[DEnsys] = { 71  , 71  , 18  ,18  ,  12, 255,  160, 255, 144,  0, 255,0};
00077   double phiMinim[DEnsys] = {  0.5,  0.5, -0.5,-0.5,-0.5,   0, -0.5,   0,  -0.5,  0,   0,0};
00078   double phiMaxim[DEnsys] = { 71.5, 71.5, 17.5,17.5,11.5, 255,159.5, 255,  143.5,  0, 255,0};
00079   
00080   int    etaNBins[DEnsys] = { 35  , 35  , 22  ,22  ,   5,  20,  120,  20,  64,  0, 20,0};
00081   double etaMinim[DEnsys] = {-17.5,-17.5, -0.5,-0.5,-2.5,   0, -0.5,   0,   -0.5,  0,  0,0};
00082   double etaMaxim[DEnsys] = { 17.5, 17.5, 21.5,21.5, 2.5,  63,119.5,  63,  63.5,  0, 63,0};
00083   
00084   int    x3NBins [DEnsys] = {    0,    0,    7,   0,   4,   0,    0,   0,   0,  0,   0,0};
00085   double x3Minim [DEnsys] = {    0,    0, -0.5,   0, 0.5,   0,    0,   0,   0,  0,   0,0};
00086   double x3Maxim [DEnsys] = {    0,    0,  6.5,   0, 4.5,   0,    0,   0,   0,  0,   0,0};
00087   
00088   int    rnkNBins[DEnsys] = {    0,    0,    0,   0,   0,   0,    0,   0,   0,  0,   0,0};
00089   double rnkMinim[DEnsys] = {    0,    0,    0,   0,   0,   0,    0,   0,   0,  0,   0,0};
00090   double rnkMaxim[DEnsys] = {    0,    0,    0,   0,   0,   0,    0,   0,   0,  0,   0,0};
00091   //assume for 
00092   for(int i=0; i<DEnsys; i++) {rnkNBins[i]=63;rnkMinim[i]=0.5;rnkMaxim[i]=63.5;}//rank 0x3f->63
00093   rnkNBins[DTP]=7; rnkMinim[DTP]=-0.5;rnkMaxim[DTP]=6.5;  //rank 0-6
00094   rnkNBins[CTP]=16;rnkMinim[CTP]=-0.5;rnkMaxim[CTP]=15.5; //quality 0-15
00095   
00096   /*--notes 
00097     RCT: global index ieta (0-21)=[22,-0.5,21.5] , iphi (0-17)=[18,-0.5,17.5]; card (0-6)
00098     GCT: phi index (0-17); eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z -> 0.17
00099     DTP: usc 0..11; uwh -2..2; ust 1..4;
00100     CTP: rank is quality 0..15
00101   */
00102 
00103   if(dbe) {
00104 
00105     if(!runInFF_)
00106       dbe->setCurrentFolder(std::string(histFolder_+"common/"));
00107 
00108     for(int j=0; j<2; j++) {
00109       std::string lbl("sysncand"); 
00110       lbl += (j==0?"Data":"Emul");
00111       sysncand[j] = dbe->book1D(lbl.data(),lbl.data(),DEnsys, 0, DEnsys );
00112     }
00113 
00114     sysrates = dbe->book1D("sysrates","sysrates",DEnsys, 0, DEnsys );
00115     const int nerr = 5; 
00116     errordist = dbe->book1D("errorflag","errorflag",nerr, 0, nerr);
00117 
00118     for(int j=0; j<DEnsys; j++) {
00119 
00120       if(!runInFF_)
00121         dbe->setCurrentFolder(std::string(histFolder_+SystLabelExt[j]));
00122 
00123       std::string lbl("");
00124       lbl.clear();
00125       lbl+=SystLabel[j];lbl+="ErrorFlag"; 
00126       errortype[j] = dbe->book1D(lbl.data(),lbl.data(), nerr, 0, nerr);
00127 
00128       // skip next histos if running in filter farm
00129       if(runInFF_)
00130         continue;
00131 
00132       //
00133       lbl.clear();
00134       lbl+=SystLabel[j];lbl+="eta"; 
00135       eta[j] = dbe->book1D(lbl.data(),lbl.data(),
00136                            etaNBins[j], etaMinim[j], etaMaxim[j]);
00137       lbl.clear();
00138       lbl+=SystLabel[j];lbl+="phi"; 
00139       phi[j] = dbe->book1D(lbl.data(),lbl.data(),
00140                            phiNBins[j], phiMinim[j], phiMaxim[j]);
00141       lbl.clear();
00142       lbl+=SystLabel[j];lbl+="x3"; 
00143       x3[j] = dbe->book1D(lbl.data(),lbl.data(),
00144                            x3NBins[j], x3Minim[j], x3Maxim[j]);
00145       lbl.clear();
00146       lbl+=SystLabel[j];lbl+="etaphi"; 
00147       etaphi[j] = dbe->book2D(lbl.data(),lbl.data(), 
00148                               etaNBins[j], etaMinim[j], etaMaxim[j],
00149                               phiNBins[j], phiMinim[j], phiMaxim[j]
00150                               );
00151       //
00152       lbl.clear();
00153       lbl+=SystLabel[j];lbl+="eta"; lbl+="Data";
00154       etaData[j] = dbe->book1D(lbl.data(),lbl.data(),
00155                                etaNBins[j], etaMinim[j], etaMaxim[j]);
00156       lbl.clear();
00157       lbl+=SystLabel[j];lbl+="phi";  lbl+="Data";
00158       phiData[j] = dbe->book1D(lbl.data(),lbl.data(),
00159                                phiNBins[j], phiMinim[j], phiMaxim[j]);
00160       lbl.clear();
00161       lbl+=SystLabel[j];lbl+="x3";  lbl+="Data";
00162       x3Data[j] = dbe->book1D(lbl.data(),lbl.data(),
00163                               x3NBins[j], x3Minim[j], x3Maxim[j]);
00164       lbl.clear();
00165       lbl+=SystLabel[j];lbl+="rank";  lbl+="Data";
00166       rnkData[j] = dbe->book1D(lbl.data(),lbl.data(),
00167                                rnkNBins[j], rnkMinim[j], rnkMaxim[j]);
00168       
00169       const int nbit = (j==GLT)?128:32;
00170       lbl.clear();
00171       lbl+=SystLabel[j];lbl+="dword"; 
00172       dword[j] = dbe->book1D(lbl.data(),lbl.data(),nbit,0,nbit);
00173       lbl.clear();
00174       lbl+=SystLabel[j];lbl+="eword"; 
00175       eword[j] = dbe->book1D(lbl.data(),lbl.data(),nbit,0,nbit);
00176       lbl.clear();
00177       lbl+=SystLabel[j];lbl+="deword"; 
00178       deword[j] = dbe->book1D(lbl.data(),lbl.data(),nbit,0,nbit);
00179       //lbl.clear();
00180       //lbl+=SystLabel[j];lbl+="masked"; 
00181       //masked[j] = dbe->book1D(lbl.data(),lbl.data(),nbit,0,nbit);
00182     }
00183   }
00184 
00185   if(dbe && !runInFF_) {
00187     dbe->setCurrentFolder(histFolder_+"xcorr");
00188     const int ncorr = 3;
00189     std::string corrl[ncorr] = {"phi","eta","rank"};
00190     for(int i=0; i<DEnsys; i++) {
00191       for(int j=0; j<DEnsys; j++) {
00192         if(i>j) continue;
00193         std::string lbl("");
00194         lbl.clear(); lbl+=SystLabel[i]; lbl+=SystLabel[j]; lbl+=corrl[0]; 
00195         CORR[i][j][0]= dbe->book2D(lbl.data(),lbl.data(), 
00196                                    phiNBins[i], phiMinim[i], phiMaxim[i],
00197                                    phiNBins[j], phiMinim[j], phiMaxim[j]
00198                                    );
00199         lbl.clear(); lbl+=SystLabel[i]; lbl+=SystLabel[j]; lbl+=corrl[1]; 
00200         CORR[i][j][1]= dbe->book2D(lbl.data(),lbl.data(), 
00201                                    etaNBins[i], etaMinim[i], etaMaxim[i],
00202                                    etaNBins[j], etaMinim[j], etaMaxim[j]
00203                                    );
00204         lbl.clear(); lbl+=SystLabel[i]; lbl+=SystLabel[j]; lbl+=corrl[2]; 
00205         CORR[i][j][2]= dbe->book2D(lbl.data(),lbl.data(), 
00206                                    rnkNBins[i], rnkMinim[i], rnkMaxim[i],
00207                                    rnkNBins[j], rnkMinim[j], rnkMaxim[j]
00208                                    );
00209       }
00210     }
00211     
00212   }
00213   
00215   for(int i=0; i<DEnsys; i++) {
00216     sysrates   ->setBinLabel(i+1,SystLabel[i]);
00217     sysncand[0]->setBinLabel(i+1,SystLabel[i]);
00218     sysncand[1]->setBinLabel(i+1,SystLabel[i]);
00219   }
00220   const int nerr=5;
00221   std::string errLabel[nerr]= {
00222     "Agree", "Loc. Agree", "L.Disagree", "Data only", "Emul only"
00223   };
00224   for(int j=0; j<nerr; j++) {
00225     errordist->setBinLabel(j+1,errLabel[j]);
00226   }
00227   for(int i=0; i<DEnsys; i++) {
00228     for(int j=0; j<nerr; j++) {
00229       errortype[i]->setBinLabel(j+1,errLabel[j]);
00230     }
00231   }
00232 
00233   // done if running in filter farm
00234   if(runInFF_)
00235     return;
00236 
00237   for(int i=0; i<DEnsys; i++) {
00238     etaphi [i]->setAxisTitle("eta",1);
00239     etaphi [i]->setAxisTitle("phi",2);
00240     eta    [i]->setAxisTitle("eta");
00241     phi    [i]->setAxisTitle("phi");
00242     x3     [i]->setAxisTitle("x3");
00243     etaData[i]->setAxisTitle("eta");
00244     phiData[i]->setAxisTitle("phi");
00245     x3Data [i]->setAxisTitle("x3");
00246     rnkData[i]->setAxisTitle("rank");
00247     dword  [i]->setAxisTitle("trigger data word bit");
00248     eword  [i]->setAxisTitle("trigger data word bit");
00249     deword [i]->setAxisTitle("trigger data word bit");
00250     //masked [i]->setAxisTitle("trigger data word bit");
00251   }
00252   for(int i=0; i<DEnsys; i++) {
00253     for(int j=0; j<DEnsys; j++) {
00254       if(i>j) continue;
00255       for(int k=0; k<3; k++) {
00256         CORR[i][j][k]->setAxisTitle(SystLabel[i],1);
00257         CORR[i][j][k]->setAxisTitle(SystLabel[j],2);
00258       }
00259     }
00260   }
00261 
00263   assert(ETP==0); assert(HTP==1); assert(RCT== 2); assert(GCT== 3);
00264   assert(DTP==4); assert(DTF==5); assert(CTP== 6); assert(CTF== 7);
00265   assert(RPC==8); assert(LTC==9); assert(GMT==10); assert(GLT==11);
00266   
00267   if(verbose())
00268     std::cout << "L1TDEMON::beginJob()  end.\n" << std::flush;
00269 }
00270 
00271 void 
00272 L1TDEMON::endJob() {
00273 
00274   if(verbose())
00275     std::cout << "L1TDEMON::endJob Nevents: " << nEvt_ << "\n" << std::flush;
00276 
00277   if(verbose()) {
00278     std::cout << "[L1TDEMON] systems disagreement rate:\n\t";
00279     for(int i=0; i<DEnsys; i++)
00280       printf("%4.2f ",sysrates->getBinContent(i));
00281     std::cout << std::endl;  
00282   }
00283 
00284   if(verbose()) {
00285     std::cout << "[L1TDEMON] verbose fill histo: ";
00286     for(int i=0; i<DEnsys; i++)
00287       std::cout <<  deSysCount[i] << " ";
00288     std::cout << std::endl;  
00289   }
00290 
00291   if(histFile_.size()!=0  && dbe) 
00292     dbe->save(histFile_);
00293   
00294   if(verbose())
00295     std::cout << "L1TDEMON::endJob()  end.\n" << std::flush;
00296 }
00297 
00298 
00299 // ------------ method called to for each event  ------------
00300 void
00301 L1TDEMON::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
00302   
00303   if(!hasRecord_)
00304     return;
00305   
00306   if(verbose())
00307     std::cout << "L1TDEMON::analyze()  start\n" << std::flush;
00308 
00309   nEvt_++;
00310 
00312   edm::Handle<L1DataEmulRecord> deRecord;
00313   iEvent.getByLabel(DEsource_, deRecord);
00314   
00315   if (!deRecord.isValid()) {
00316     edm::LogInfo("DataNotFound") 
00317       << "Cannot find L1DataEmulRecord with label "
00318       << DEsource_.label() 
00319       << " Please verify that comparator was successfully executed."
00320       << " Emulator DQM will be skipped!"
00321       << std::endl;
00322     hasRecord_=false;
00323     return;
00324   }
00325 
00326   bool deMatch[DEnsys];
00327   deRecord->get_status(deMatch);  
00328   if(verbose()) {
00329     std::cout << "[L1TDEMON] verbose sys match?: ";
00330     for(int i=0; i<DEnsys; i++)
00331       std::cout << deMatch[i] << " ";
00332     std::cout << std::endl;
00333   }
00334 
00335   bool isComp[DEnsys];
00336   for(int i=0; i<DEnsys; i++)
00337     isComp[i] = deRecord->get_isComp(i);
00338   if(verbose()) {
00339     std::cout << "[L1TDEMON] verbose dosys?: ";
00340     for(int i=0; i<DEnsys; i++)
00341       std::cout << isComp[i];
00342     std::cout << std::endl;
00343   }
00344 
00345   int DEncand[DEnsys][2];
00346   for(int i=0; i<DEnsys; i++)
00347     for(int j=0; j<2; j++) 
00348       DEncand[i][j] = deRecord->getNCand(i,j);
00349   if(verbose()) {
00350     std::cout << "[L1TDEMON] ncands d: ";
00351     for(int i=0; i<DEnsys; i++)
00352       std::cout << DEncand[i][0] << " ";
00353     std::cout << "\n[L1TDEMON] ncands e: ";
00354     for(int i=0; i<DEnsys; i++)
00355       std::cout << DEncand[i][1] << " ";
00356     std::cout << std::endl;
00357   }
00358 
00359 
00360   const int nullVal = L1DataEmulDigi().reset();
00361 
00363   L1DEDigiCollection deColl;
00364   deColl = deRecord->getColl();
00365 
00366   // global counters 
00367   int hasSys[DEnsys]={0};
00368   for(L1DEDigiCollection::const_iterator it=deColl.begin(); it!=deColl.end(); it++) 
00369     if(!it->empty()) hasSys[it->sid()]++;
00370   for(int i=0; i<DEnsys; i++) {
00371     if(!hasSys[i]) continue;
00372     nEvtWithSys[i]++;
00373     if(deMatch[i])
00374       deSysCount[i]++;
00375   }
00376 
00377   if(verbose()) {
00378     std::cout << "[L1TDEMON] digis: \n";
00379     for(L1DEDigiCollection::const_iterator it=deColl.begin(); it!=deColl.end(); it++)
00380       std::cout << "\t" << *it << std::endl;
00381   }
00382   
00383 
00385 
00386   // global, sub-systems d|e match, ncands
00387   for(int i=0; i<DEnsys; i++) {
00388     if(!isComp[i]) continue;
00389 
00390     for(int j=0; j<2; j++) 
00391       sysncand[j]->Fill(i,DEncand[i][j]);
00392 
00393    //sysrates->Fill(i,(int)!deMatch[i]);
00394     int ibin = i+1;
00395     double rate = nEvtWithSys[i]?(nEvtWithSys[i]-1.*deSysCount[i])/nEvtWithSys[i]:0.;
00396     sysrates->setBinContent(ibin,rate);
00397     if(verbose()) {
00398       std::cout << "[L1TDEMON] analyze "
00399                 << " sysid:"   << i
00400                 << " nEvt:"    << nEvt_
00401                 << " match?"   << deMatch[i]
00402                 << " ncands:"  << hasSys[i]
00403                 << " nevtwsys:"<< nEvtWithSys[i]
00404                 << " nevtgood:"<< deSysCount[i]
00405                 << " rate:"    << sysrates->getBinContent(ibin) 
00406                 << "\n";
00407       if(rate>1)
00408         std::cout << "problem, error rate for " << SystLabel[i] 
00409                   <<" is "<<sysrates->getBinContent(ibin)
00410                   << std::endl;
00411     }
00412   }
00413   
00414   // container for subsystem's leading candidate
00415   const int ncorr = 3;
00416   float LeadCandVal[DEnsys][ncorr] = {{(float)nullVal}};
00417   for(int i=0; i<DEnsys; i++) 
00418     for(int j=0; j<ncorr; j++)
00419       LeadCandVal[i][j]=nullVal;
00420 
00421   // d|e candidate loop
00422   for(L1DEDigiCollection::const_iterator it=deColl.begin(); it!=deColl.end(); it++) {
00423 
00424     int    sid = it->sid();
00425     int    cid = it->cid();
00426 
00427     if(it->empty())
00428       continue;
00429     assert(isComp[sid]);
00430 
00431     int type    = it->type();
00432     double phiv = it->x1();
00433     double etav = it->x2();
00434     double x3v  = it->x3();
00435 
00436     float rankarr[2]; 
00437     it->rank(rankarr);
00438     float rnkv = rankarr[0];
00439 
00440     double wei = 1.;
00441 
00442     unsigned int mask = (~0x0);
00443 
00444     if(sid==RCT) {
00445       //if(cid!=RCTem)  continue;
00446       //if(cid!=RCTrgn) continue;
00447     }
00448 //     if(sid==GCT) { 
00449 //       // For the moment just include EM and jet objects, energy sums being debugged in the expert DQM first.
00450 //       if(cid!=GCTisolaem && 
00451 //          cid!=GCTnoisoem &&
00452 //          cid!=GCTcenjets &&
00453 //          cid!=GCTforjets &&
00454 //          cid!=GCTtaujets) continue;
00455 //     } 
00456     if(sid==DTP) {
00457       //tbd cols:th,ph; plots per wheel
00458       //if(it->x3()!=0) continue;
00459     }
00460     if(sid==GMT) { 
00461       //select gmt cands only for GMT sys 
00462       if(cid!=GMTcnd) continue;
00463       //masking: gres -- I.Mikulec: mask bits 0,5,16,21,22,23
00464       //mask = (~(0x0e10021));
00465     }
00466     if(sid==DTF) {
00467       if(cid!=DTtftrk) continue;
00468     }
00469     if(sid==RPC || sid==CTF || sid==RPC) { 
00470       //select mu regional cands only for dtf,ctf,rpc
00471       //if(cid!=MUrtf) continue;
00472       //masking: gres dttf only -- I.Mikulec: lowest 16 bits only
00473       //if(sid==DTF) mask = 0xffff;
00474     }
00475     
00476     errordist     ->Fill(type);
00477     errortype[sid]->Fill(type);
00478 
00479     // skip next if running in filter farm
00480     if(runInFF_)
00481       continue;
00482 
00483     //exclude agreeing cands
00484     wei=1.; if(!type) wei=0.;
00485     if(etav!=nullVal && phiv!=nullVal)
00486       etaphi[sid]->Fill(etav,phiv,wei);
00487     if(etav!=nullVal)
00488       eta   [sid]->Fill(etav,wei);
00489     if(phiv!=nullVal)
00490       phi   [sid]->Fill(phiv,wei);
00491     if(sid==DTP)
00492       if(x3v!=nullVal)
00493         x3    [sid]->Fill( x3v,wei);
00494     
00495     unsigned int word[2];
00496     it->data(word);
00497     std::bitset<32> dbits(word[0]);
00498     std::bitset<32> ebits(word[1]);
00499     unsigned int dexor = ( (word[0]) ^ (word[1]) );
00500     //disagreeing bits
00501     std::bitset<32> debits(dexor);
00502     //disagreeing bits after masking
00503     std::bitset<32> dembits( ( (dexor) & (mask) ) );
00504     
00505     if(verbose())
00506       std::cout << "l1demon" 
00507                 << " sid:" << sid << " cid:" << cid << "\n"
00508                 << " data:0x" << std::hex << word[0] << std::dec
00509                 << " bitset:" << dbits
00510                 << "\n"
00511                 << " emul:0x" << std::hex << word[1] << std::dec
00512                 << " bitset:" << ebits
00513                 << "\n"
00514                 << "  xor:0x" << std::hex << dexor << std::dec
00515                 << " bitset:" << debits
00516                 << " bitset:" << ( (dbits) ^ (ebits) )
00517                 << "\n" << std::flush;
00518 
00520     for(int ibit=0; ibit<32; ibit++) {
00521       wei=1.;
00522       //comparison gives no info if there's only 1 candidate
00523       if(type==3 || type==4) wei=0.; 
00524       if(dbits  [ibit]) dword[sid]->Fill(ibit,wei);
00525       if(ebits  [ibit]) eword[sid]->Fill(ibit,wei);
00526       if(debits [ibit])deword[sid]->Fill(ibit,wei);
00527       //if(dembits[ibit])masked[sid]->Fill(ibit,wei);
00528     }
00529 
00530     //exclude e-only cands (only data)
00531     wei=1.;if(type==4) wei=0.;
00532     if(etav!=nullVal)
00533       etaData[sid]->Fill(etav,wei);
00534     if(phiv!=nullVal)
00535       phiData[sid]->Fill(phiv,wei);
00536     if(sid==DTP)
00537       if(x3v!=nullVal)
00538         x3Data [sid]->Fill( x3v,wei);
00539     rnkData[sid]->Fill(rnkv,wei);
00540 
00541     //correlations: store leading candidate
00542     if(type==4) continue; //exclude e-only cands
00543     bool islead = false;
00544     if(rnkv>LeadCandVal[sid][2])
00545       islead = true;
00546     else if (rnkv==LeadCandVal[sid][2]) {
00547       if (phiv>LeadCandVal[sid][0]) 
00548         islead = true;
00549       else if (phiv==LeadCandVal[sid][0]) 
00550         if (etav>LeadCandVal[sid][1]) 
00551           islead = true;
00552     }
00553     
00554     if(islead) {
00555       LeadCandVal[sid][0] = phiv;
00556       LeadCandVal[sid][1] = etav;
00557       LeadCandVal[sid][2] = rnkv;
00558     }
00559     
00560   }//close loop over dedigi-cands
00561 
00562 
00563   // done if running in filter farm
00564   if(runInFF_)
00565     return;
00566 
00567   // hBxDiffAllFed hBxDiffAllFedSpread hBxOccyAllFedSpread
00568 
00570   //if(isComp[GLT]&&false) {
00571   if(isComp[GLT]) {
00572     const int w64=64;
00573     GltDEDigi gltdigimon = deRecord->getGlt();
00574 
00575     const std::vector<bool>& edecbitv = gltdigimon.gltDecBits[0];
00576     const std::vector<bool>& ddecbitv = gltdigimon.gltDecBits[1];
00577     const std::vector<bool>& etchbitv = gltdigimon.gltTchBits[0] ;
00578     const std::vector<bool>& dtchbitv = gltdigimon.gltTchBits[1];
00579 
00580     std::vector<bool> 
00581       dedecbitv  (2*w64,false), 
00582       debitmaskv (2*w64,false), 
00583       gtbitmasked(2*w64,false);
00584 
00585     for(int i=0; i<2*w64; i++) {
00586       dedecbitv[i]=(ddecbitv[i]^edecbitv[i]);
00587       debitmaskv[i]=(dedecbitv[i]&& !gtbitmasked[i]);
00588       if(ddecbitv[i])  dword[GLT]->Fill(i,1);
00589       if(edecbitv[i])  eword[GLT]->Fill(i,1);
00590       if(dedecbitv[i]) deword[GLT]->Fill(i,1);
00591       //if(debitmaskv[i])masked[GLT]->Fill(i,1);
00592     }
00593     
00594     std::vector<bool> detchbitv(w64,false);
00595     for(int i=0; i<w64; i++) {
00596       detchbitv[i]=(dtchbitv[i]&&etchbitv[i]);
00597     }
00598     
00599     if(verbose()) {
00600       std::cout << "L1TDEMON gt dec bits:\n";
00601       std::cout << "\ndata:"; for(int i=0; i<2*w64; i++) std::cout << ddecbitv[i];
00602       std::cout << "\nemul:"; for(int i=0; i<2*w64; i++) std::cout << edecbitv[i];
00603       std::cout << "\nand :"; for(int i=0; i<2*w64; i++) std::cout << dedecbitv[i];
00604       std::cout << "\nmask:"; for(int i=0; i<2*w64; i++) std::cout << debitmaskv[i];
00605       std::cout << "\n gt tech trig bits:\n";
00606       std::cout << "\ndata:"; for(int i=0; i<w64; i++) std::cout << dtchbitv[i];
00607       std::cout << "\nemul:"; for(int i=0; i<w64; i++) std::cout << etchbitv[i];
00608       std::cout << "\n";
00609     }      
00610   }
00611 
00612 
00614   double wei=1.;
00615   for(int i=0; i<DEnsys; i++) {
00616     for(int j=0; j<DEnsys; j++) {
00617       if(i>=j) continue;
00618       for(int k=0; k<ncorr; k++) {
00619         if(LeadCandVal[i][k]!=nullVal && LeadCandVal[j][k]!=nullVal)
00620           CORR[i][j][k]->Fill(LeadCandVal[i][k],LeadCandVal[j][k],wei);
00621       }
00622     }
00623   }
00624 
00625   if(verbose())
00626     std::cout << "L1TDEMON::analyze() end.\n" << std::flush;
00627 
00628 }