CMS 3D CMS Logo

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