CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/L1TMonitorClient/src/L1TEMUEventInfoClient.cc

Go to the documentation of this file.
00001 
00015 // this class header
00016 #include "DQM/L1TMonitorClient/interface/L1TEMUEventInfoClient.h"
00017 
00018 // system include files
00019 #include <stdio.h>
00020 #include <sstream>
00021 #include <fstream>
00022 #include <iostream>
00023 #include <iomanip>
00024 
00025 #include <math.h>
00026 #include <memory>
00027 
00028 #include <vector>
00029 #include <string>
00030 
00031 // user include files
00032 #include "FWCore/ServiceRegistry/interface/Service.h"
00033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00034 #include "FWCore/Framework/interface/EventSetup.h"
00035 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00036 #include "FWCore/Utilities/interface/Exception.h"
00037 
00038 #include "DQMServices/Core/interface/QReport.h"
00039 #include "DQMServices/Core/interface/DQMStore.h"
00040 # include "DQMServices/Core/interface/DQMDefinitions.h"
00041 
00042 #include <TH2F.h>
00043 #include "TROOT.h"
00044 
00045 // constructor
00046 L1TEMUEventInfoClient::L1TEMUEventInfoClient(const edm::ParameterSet& parSet) :
00047             m_verbose(parSet.getUntrackedParameter<bool>("verbose", false)),
00048             m_monitorDir(parSet.getUntrackedParameter<std::string>("monitorDir", "")),
00049             m_runInEventLoop(parSet.getUntrackedParameter<bool>("runInEventLoop", false)),
00050             m_runInEndLumi(parSet.getUntrackedParameter<bool>("runInEndLumi", false)),
00051             m_runInEndRun(parSet.getUntrackedParameter<bool>("runInEndRun", false)),
00052             m_runInEndJob(parSet.getUntrackedParameter<bool>("runInEndJob", false)),
00053             m_l1Systems(parSet.getParameter<std::vector<edm::ParameterSet> >("L1Systems")),
00054             m_l1Objects(parSet.getParameter<std::vector<edm::ParameterSet> >("L1Objects")),
00055             m_maskL1Systems(parSet.getParameter<std::vector<std::string> >("MaskL1Systems")),
00056             m_maskL1Objects(parSet.getParameter<std::vector<std::string> >("MaskL1Objects")),
00057             m_nrL1Systems(0),
00058             m_nrL1Objects(0),
00059             m_totalNrQtSummaryEnabled(0) {
00060 
00061     initialize();
00062 }
00063 
00064 // destructor
00065 L1TEMUEventInfoClient::~L1TEMUEventInfoClient() {
00066 
00067     //empty
00068 
00069 }
00070 
00071 void L1TEMUEventInfoClient::initialize() {
00072 
00073     // get back-end interface
00074     m_dbe = edm::Service<DQMStore>().operator->();
00075 
00076     if (m_verbose) {
00077         std::cout << "\nMonitor directory =             " << m_monitorDir
00078                 << std::endl;
00079     }
00080 
00081     //
00082 
00083     m_nrL1Systems = m_l1Systems.size();
00084 
00085     m_systemLabel.reserve(m_nrL1Systems);
00086     m_systemLabelExt.reserve(m_nrL1Systems);
00087     m_systemMask.reserve(m_nrL1Systems);
00088     m_systemFolder.reserve(m_nrL1Systems);
00089 
00090     // on average two quality test per system - just a best guess
00091     m_systemQualityTestName.reserve(2*m_nrL1Systems);
00092     m_systemQualityTestHist.reserve(2*m_nrL1Systems);
00093     m_systemQtSummaryEnabled.reserve(2*m_nrL1Systems);
00094 
00095     int indexSys = 0;
00096 
00097     int totalNrQualityTests = 0;
00098 
00099     for (std::vector<edm::ParameterSet>::const_iterator itSystem =
00100             m_l1Systems.begin(); itSystem != m_l1Systems.end(); ++itSystem) {
00101 
00102         m_systemLabel.push_back(itSystem->getParameter<std::string>(
00103                 "SystemLabel"));
00104 
00105         m_systemLabelExt.push_back(itSystem->getParameter<std::string>(
00106                 "HwValLabel"));
00107 
00108         m_systemMask.push_back(itSystem->getParameter<unsigned int>(
00109                 "SystemMask"));
00110         // check the additional mask from m_maskL1Systems
00111         for (std::vector<std::string>::const_iterator itSys =
00112                 m_maskL1Systems.begin(); itSys != m_maskL1Systems.end(); ++itSys) {
00113 
00114             if (*itSys == m_systemLabel[indexSys]) {
00115                 m_systemMask[indexSys] = 1;
00116 
00117             }
00118         }
00119 
00120         //
00121         std::string sysFolder = itSystem->getParameter<std::string> (
00122                 "SystemFolder");
00123         m_systemFolder.push_back(sysFolder);
00124 
00125         //
00126         std::vector<std::string> qtNames = itSystem->getParameter<
00127                 std::vector<std::string> >("QualityTestName");
00128         m_systemQualityTestName.push_back(qtNames);
00129 
00130         totalNrQualityTests = totalNrQualityTests + qtNames.size();
00131 
00132         //
00133         std::vector<std::string> qtHists = itSystem->getParameter<
00134                 std::vector<std::string> > ("QualityTestHist");
00135 
00136         std::vector<std::string> qtFullPathHists;
00137         qtFullPathHists.reserve(qtHists.size());
00138 
00139         for (std::vector<std::string>::const_iterator itQtHist =
00140                 qtHists.begin(); itQtHist != qtHists.end(); ++itQtHist) {
00141 
00142             std::string hist = *itQtHist;
00143 
00144             if (sysFolder == "") {
00145                 hist = "L1TEMU/" + m_systemLabel[indexSys] + "/" + hist;
00146             } else {
00147                 hist = sysFolder + "/" + hist;
00148             }
00149 
00150             qtFullPathHists.push_back(hist);
00151         }
00152 
00153         m_systemQualityTestHist.push_back(qtFullPathHists);
00154 
00155          //
00156         std::vector<unsigned int> qtSumEnabled = itSystem->getParameter<
00157                 std::vector<unsigned int> >("QualityTestSummaryEnabled");
00158         m_systemQtSummaryEnabled.push_back(qtSumEnabled);
00159 
00160         for (std::vector<unsigned int>::const_iterator itQtSumEnabled =
00161                 qtSumEnabled.begin(); itQtSumEnabled != qtSumEnabled.end(); ++itQtSumEnabled) {
00162 
00163             m_totalNrQtSummaryEnabled++;
00164         }
00165 
00166         // consistency check - throw exception, it will crash anyway if not consistent
00167         if (
00168                 (qtNames.size() != qtHists.size()) ||
00169                 (qtNames.size() != qtSumEnabled.size()) ||
00170                 (qtHists.size() != qtSumEnabled.size())) {
00171 
00172             throw cms::Exception("FailModule")
00173                     << "\nError: inconsistent size of input vector parameters"
00174                     << "\n  QualityTestName, QualityTestHistQuality, TestSummaryEnabled"
00175                     << "\nfor system " << m_systemLabel[indexSys]
00176                     << "\n They must have equal size.\n"
00177                     << std::endl;
00178         }
00179 
00180 
00181         indexSys++;
00182 
00183     }
00184 
00185     // L1 objects
00186 
00187     //
00188     m_nrL1Objects = m_l1Objects.size();
00189 
00190     m_objectLabel.reserve(m_nrL1Objects);
00191     m_objectMask.reserve(m_nrL1Objects);
00192     m_objectFolder.reserve(m_nrL1Objects);
00193 
00194     // on average two quality test per object - just a best guess
00195     m_objectQualityTestName.reserve(2*m_nrL1Objects);
00196     m_objectQualityTestHist.reserve(2*m_nrL1Objects);
00197     m_objectQtSummaryEnabled.reserve(2*m_nrL1Objects);
00198 
00199     int indexObj = 0;
00200 
00201     for (std::vector<edm::ParameterSet>::const_iterator itObject =
00202             m_l1Objects.begin(); itObject != m_l1Objects.end(); ++itObject) {
00203 
00204         m_objectLabel.push_back(itObject->getParameter<std::string>(
00205                 "ObjectLabel"));
00206 
00207         m_objectMask.push_back(itObject->getParameter<unsigned int>(
00208                 "ObjectMask"));
00209         // check the additional mask from m_maskL1Objects
00210         for (std::vector<std::string>::const_iterator itObj =
00211                 m_maskL1Objects.begin(); itObj != m_maskL1Objects.end(); ++itObj) {
00212 
00213             if (*itObj == m_objectLabel[indexObj]) {
00214                 m_objectMask[indexObj] = 1;
00215 
00216             }
00217         }
00218 
00219         //
00220         std::string objFolder = itObject->getParameter<std::string> (
00221                 "ObjectFolder");
00222         m_objectFolder.push_back(objFolder);
00223 
00224         //
00225         std::vector<std::string> qtNames = itObject->getParameter<
00226                 std::vector<std::string> >("QualityTestName");
00227         m_objectQualityTestName.push_back(qtNames);
00228 
00229         totalNrQualityTests = totalNrQualityTests + qtNames.size();
00230 
00231         //
00232         std::vector<std::string> qtHists = itObject->getParameter<
00233                 std::vector<std::string> > ("QualityTestHist");
00234 
00235         std::vector<std::string> qtFullPathHists;
00236         qtFullPathHists.reserve(qtHists.size());
00237 
00238         for (std::vector<std::string>::const_iterator itQtHist =
00239                 qtHists.begin(); itQtHist != qtHists.end(); ++itQtHist) {
00240 
00241             std::string hist = *itQtHist;
00242 
00243             if (objFolder == "") {
00244                 hist = "L1TEMU/" + m_objectLabel[indexObj] + "/" + hist;
00245             } else {
00246                 hist = objFolder + hist;
00247             }
00248 
00249             qtFullPathHists.push_back(hist);
00250         }
00251 
00252         m_objectQualityTestHist.push_back(qtFullPathHists);
00253 
00254          //
00255         std::vector<unsigned int> qtSumEnabled = itObject->getParameter<
00256                 std::vector<unsigned int> >("QualityTestSummaryEnabled");
00257         m_objectQtSummaryEnabled.push_back(qtSumEnabled);
00258 
00259         for (std::vector<unsigned int>::const_iterator itQtSumEnabled =
00260                 qtSumEnabled.begin(); itQtSumEnabled != qtSumEnabled.end(); ++itQtSumEnabled) {
00261 
00262             m_totalNrQtSummaryEnabled++;
00263         }
00264 
00265         // consistency check - throw exception, it will crash anyway if not consistent
00266         if (
00267                 (qtNames.size() != qtHists.size()) ||
00268                 (qtNames.size() != qtSumEnabled.size()) ||
00269                 (qtHists.size() != qtSumEnabled.size())) {
00270 
00271             throw cms::Exception("FailModule")
00272                     << "\nError: inconsistent size of input vector parameters"
00273                     << "\n  QualityTestName, QualityTestHistQuality, TestSummaryEnabled"
00274                     << "\nfor object " << m_objectLabel[indexObj]
00275                     << "\nThe three vectors must have equal size.\n"
00276                     << std::endl;
00277         }
00278 
00279 
00280 
00281 
00282         indexObj++;
00283 
00284     }
00285 
00286     m_summaryContent.reserve(m_nrL1Systems + m_nrL1Objects);
00287     m_meReportSummaryContent.reserve(totalNrQualityTests);
00288 
00289 }
00290 
00291 
00292 void L1TEMUEventInfoClient::beginJob() {
00293 
00294 
00295     // get backend interface
00296     m_dbe = edm::Service<DQMStore>().operator->();
00297 
00298 }
00299 
00300 
00301 void L1TEMUEventInfoClient::beginRun(const edm::Run& run,
00302         const edm::EventSetup& evSetup) {
00303 
00304     bookHistograms();
00305 
00306 }
00307 
00308 
00309 void L1TEMUEventInfoClient::beginLuminosityBlock(
00310         const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& evSetup) {
00311 
00312 }
00313 
00314 
00315 void L1TEMUEventInfoClient::analyze(const edm::Event& iEvent,
00316         const edm::EventSetup& evSetup) {
00317 
00318     // there is no loop on events in the offline harvesting step
00319     // code here will not be executed offline
00320 
00321     if (m_runInEventLoop) {
00322 
00323         readQtResults();
00324 
00325     }
00326 }
00327 
00328 
00329 void L1TEMUEventInfoClient::endLuminosityBlock(
00330         const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& evSetup) {
00331 
00332     if (m_runInEndLumi) {
00333 
00334         readQtResults();
00335 
00336         if (m_verbose) {
00337 
00338             std::cout << "\n  L1TEMUEventInfoClient::endLuminosityBlock\n"
00339                     << std::endl;
00340             dumpContentMonitorElements();
00341         }
00342 
00343     }
00344 }
00345 
00346 
00347 void L1TEMUEventInfoClient::endRun(const edm::Run& run,
00348         const edm::EventSetup& evSetup) {
00349 
00350     if (m_runInEndRun) {
00351 
00352         readQtResults();
00353 
00354         if (m_verbose) {
00355 
00356             std::cout << "\n  L1TEMUEventInfoClient::endRun\n" << std::endl;
00357             dumpContentMonitorElements();
00358         }
00359 
00360     }
00361 }
00362 
00363 
00364 void L1TEMUEventInfoClient::endJob() {
00365 
00366     if (m_runInEndJob) {
00367 
00368         readQtResults();
00369 
00370         if (m_verbose) {
00371 
00372             std::cout << "\n  L1TEMUEventInfoClient::endRun\n" << std::endl;
00373             dumpContentMonitorElements();
00374         }
00375     }
00376 }
00377 
00378 
00379 void L1TEMUEventInfoClient::dumpContentMonitorElements() {
00380 
00381     std::cout << "\nSummary report " << std::endl;
00382 
00383     // summary content
00384 
00385     MonitorElement* me = m_dbe->get(m_meReportSummaryMap->getName());
00386 
00387     std::cout
00388             << "\nSummary content per system and object as filled in histogram\n  "
00389             << m_meReportSummaryMap->getName() << std::endl;
00390 
00391     if (!me) {
00392 
00393         std::cout << "\nNo histogram " << m_meReportSummaryMap->getName()
00394                 << "\nNo summary content per system and object as filled in histogram.\n  "
00395                 << std::endl;
00396         return;
00397 
00398     }
00399 
00400     TH2F* hist = me->getTH2F();
00401 
00402     const int nBinsX = hist->GetNbinsX();
00403     const int nBinsY = hist->GetNbinsY();
00404     std::cout << nBinsX << " " << nBinsY;
00405 
00406     std::vector<std::vector<int> > meReportSummaryMap(nBinsX, std::vector<int>(
00407             nBinsY));
00408 
00409 //    for (int iBinX = 0; iBinX < nBinsX; iBinX++) {
00410 //        for (int iBinY = 0; iBinY < nBinsY; iBinY++) {
00411 //            meReportSummaryMap[iBinX][iBinY]
00412 //                    = static_cast<int>(me->GetBinContent(iBinX + 1, iBinY + 1));
00413 //        }
00414 //    }
00415 
00416     std::cout << "\nL1 systems: " << m_nrL1Systems << " systems included\n"
00417             << "\n Summary content size: " << (m_summaryContent.size())
00418             << std::endl;
00419 
00420     for (unsigned int iSys = 0; iSys < m_nrL1Systems; ++iSys) {
00421 
00422         std::cout << std::setw(10) << m_systemLabel[iSys] << std::setw(10)
00423                 << m_systemLabelExt[iSys] << " \t" << m_systemMask[iSys]
00424                 << " \t" << std::setw(25) << " m_summaryContent["
00425                 << std::setw(2) << iSys << "] = " << meReportSummaryMap[0][iSys]
00426                 << std::endl;
00427     }
00428 
00429     std::cout << "\n L1 trigger objects: " << m_nrL1Objects
00430             << " objects included\n" << std::endl;
00431 
00432     for (unsigned int iMon = m_nrL1Systems; iMon < m_nrL1Systems
00433             + m_nrL1Objects; ++iMon) {
00434 
00435         std::cout << std::setw(20) << m_objectLabel[iMon - m_nrL1Systems]
00436                 << " \t" << m_objectMask[iMon - m_nrL1Systems] << " \t"
00437                 << std::setw(25) << " m_summaryContent[" << std::setw(2)
00438                 << iMon << "] = \t" << m_summaryContent[iMon] << std::endl;
00439     }
00440 
00441     std::cout << std::endl;
00442 
00443     // quality tests
00444 
00445     std::cout << "\nQuality test results as filled in "
00446             << "\n  L1TEMU/EventInfo/reportSummaryContents\n"
00447             << "\n  Total number of quality tests: "
00448             << (m_meReportSummaryContent.size()) << "\n" << std::endl;
00449 
00450     for (std::vector<MonitorElement*>::const_iterator itME =
00451             m_meReportSummaryContent.begin(); itME
00452             != m_meReportSummaryContent.end(); ++itME) {
00453 
00454         std::cout << std::setw(50) << (*itME)->getName() << " \t"
00455                 << std::setw(25) << (*itME)->getFloatValue() << std::endl;
00456 
00457     }
00458 
00459     std::cout << std::endl;
00460 
00461 }
00462 
00463 
00464 
00465 void L1TEMUEventInfoClient::bookHistograms() {
00466 
00467     m_dbe->setCurrentFolder("L1TEMU/EventInfo");
00468 
00469     // remove m_meReportSummary if it exists
00470     if ((m_meReportSummary = m_dbe->get("L1TEMU/EventInfo/reportSummary"))) {
00471         m_dbe->removeElement(m_meReportSummary->getName());
00472     }
00473 
00474     // ...and book it again
00475     m_meReportSummary = m_dbe->bookFloat("reportSummary");
00476 
00477     // initialize reportSummary to 1
00478 
00479     if (m_meReportSummary) {
00480         m_meReportSummary->Fill(1);
00481     }
00482 
00483     // define float histograms for reportSummaryContents (one histogram per quality test),
00484     // initialize them to zero
00485     // initialize also m_summaryContent to dqm::qstatus::DISABLED
00486 
00487     m_dbe->setCurrentFolder("L1TEMU/EventInfo/reportSummaryContents");
00488 
00489     char histoQT[100];
00490 
00491     // general counters:
00492     //   iAllQTest: all quality tests for all systems and objects
00493     //   iAllMon:   all monitored systems and objects
00494     int iAllQTest = 0;
00495     int iAllMon = 0;
00496 
00497     for (unsigned int iMon = 0; iMon < m_nrL1Systems; ++iMon) {
00498 
00499         m_summaryContent.push_back(dqm::qstatus::DISABLED);
00500 
00501         const std::vector<std::string>& sysQtName =
00502                 m_systemQualityTestName[iMon];
00503 
00504         for (std::vector<std::string>::const_iterator itQtName =
00505                 sysQtName.begin(); itQtName != sysQtName.end(); ++itQtName) {
00506 
00507             const std::string hStr = "L1TEMU_L1Sys_" +m_systemLabel[iMon] + "_" + (*itQtName);
00508 
00509             const char* cStr = hStr.c_str();
00510             sprintf(histoQT, cStr);
00511 
00512             m_meReportSummaryContent.push_back(m_dbe->bookFloat(histoQT));
00513             m_meReportSummaryContent[iAllQTest]->Fill(0.);
00514 
00515             iAllQTest++;
00516         }
00517 
00518         iAllMon++;
00519     }
00520 
00521 
00522     for (unsigned int iMon = 0; iMon < m_nrL1Objects; ++iMon) {
00523 
00524         m_summaryContent.push_back(dqm::qstatus::DISABLED);
00525 
00526         const std::vector<std::string>& objQtName =
00527                 m_objectQualityTestName[iMon];
00528 
00529         for (std::vector<std::string>::const_iterator itQtName =
00530                 objQtName.begin(); itQtName != objQtName.end(); ++itQtName) {
00531 
00532             const std::string hStr = "L1TEMU_L1Obj_" + m_objectLabel[iMon] + "_"
00533                     + (*itQtName);
00534 
00535             const char* cStr = hStr.c_str();
00536             sprintf(histoQT, cStr);
00537 
00538             m_meReportSummaryContent.push_back(m_dbe->bookFloat(histoQT));
00539             m_meReportSummaryContent[iAllQTest]->Fill(0.);
00540 
00541             iAllQTest++;
00542         }
00543 
00544         iAllMon++;
00545 
00546     }
00547 
00548     m_dbe->setCurrentFolder("L1TEMU/EventInfo");
00549 
00550     if ((m_meReportSummaryMap = m_dbe->get("L1TEMU/EventInfo/reportSummaryMap"))) {
00551         m_dbe->removeElement(m_meReportSummaryMap->getName());
00552     }
00553 
00554     // define a histogram with two bins on X and maximum of m_nrL1Systems, m_nrL1Objects on Y
00555 
00556     int nBinsY = std::max(m_nrL1Systems, m_nrL1Objects);
00557 
00558     m_meReportSummaryMap = m_dbe->book2D("reportSummaryMap",
00559             "reportSummaryMap", 2, 1, 3, nBinsY, 1, nBinsY + 1);
00560 
00561     m_meReportSummaryMap->setAxisTitle("", 1);
00562     m_meReportSummaryMap->setAxisTitle("", 2);
00563 
00564     m_meReportSummaryMap->setBinLabel(1, " ", 1);
00565     m_meReportSummaryMap->setBinLabel(2, " ", 1);
00566 
00567     for (int iBin = 0; iBin < nBinsY; ++iBin) {
00568 
00569         m_meReportSummaryMap->setBinLabel(iBin + 1, " ", 2);
00570     }
00571 
00572 }
00573 
00574 
00575 void L1TEMUEventInfoClient::readQtResults() {
00576 
00577     // initialize summary content, summary sum and ReportSummaryContent float histograms
00578     // for all L1 systems and L1 objects
00579 
00580     for (std::vector<int>::iterator it = m_summaryContent.begin(); it
00581             != m_summaryContent.end(); ++it) {
00582 
00583         (*it) = dqm::qstatus::DISABLED;
00584 
00585     }
00586 
00587     m_summarySum = 0.;
00588 
00589     for (std::vector<MonitorElement*>::iterator itME =
00590             m_meReportSummaryContent.begin(); itME
00591             != m_meReportSummaryContent.end(); ++itME) {
00592 
00593         (*itME)->Fill(0.);
00594 
00595     }
00596 
00597 
00598     // general counters:
00599     //   iAllQTest: all quality tests for all systems and objects
00600     //   iAllMon:   all monitored systems and objects
00601     int iAllQTest = 0;
00602     int iAllMon = 0;
00603 
00604 
00605     // quality tests for all L1 systems
00606 
00607     for (unsigned int iSys = 0; iSys < m_nrL1Systems; ++iSys) {
00608 
00609         // get the reports for each quality test
00610 
00611         const std::vector<std::string>& sysQtName =
00612                 m_systemQualityTestName[iSys];
00613         const std::vector<std::string>& sysQtHist =
00614                 m_systemQualityTestHist[iSys];
00615         const std::vector<unsigned int>& sysQtSummaryEnabled =
00616                 m_systemQtSummaryEnabled[iSys];
00617 
00618         // pro system counter for quality tests
00619         int iSysQTest = 0;
00620 
00621         for (std::vector<std::string>::const_iterator itQtName =
00622                 sysQtName.begin(); itQtName != sysQtName.end(); ++itQtName) {
00623 
00624             // get results, status and message
00625 
00626             MonitorElement* qHist = m_dbe->get(sysQtHist[iSysQTest]);
00627 
00628             if (qHist) {
00629                 const std::vector<QReport*> qtVec = qHist->getQReports();
00630                 const std::string hName = qHist->getName();
00631 
00632                 if (m_verbose) {
00633 
00634                     std::cout << "\nNumber of quality tests "
00635                             << " for histogram " << sysQtHist[iSysQTest]
00636                             << ": " << qtVec.size() << "\n" << std::endl;
00637                 }
00638 
00639                 const QReport* sysQReport = qHist->getQReport(*itQtName);
00640                 if (sysQReport) {
00641                     const float sysQtResult = sysQReport->getQTresult();
00642                     const int sysQtStatus = sysQReport->getStatus();
00643                     const std::string& sysQtMessage = sysQReport->getMessage();
00644 
00645                     if (m_verbose) {
00646                         std::cout << "\n" << (*itQtName) << " quality test:"
00647                                 << "\n  result:  " << sysQtResult
00648                                 << "\n  status:  " << sysQtStatus
00649                                 << "\n  message: " << sysQtMessage << "\n"
00650                                 << "\nFilling m_meReportSummaryContent["
00651                                 << iAllQTest << "] with value "
00652                                 << sysQtResult << "\n" << std::endl;
00653                     }
00654 
00655                     m_meReportSummaryContent[iAllQTest]->Fill(sysQtResult);
00656 
00657                     // for the summary map, keep the highest status value ("ERROR") of all tests
00658                     // which are considered for the summary plot
00659                     if (sysQtSummaryEnabled[iSysQTest]) {
00660 
00661                         if (sysQtStatus > m_summaryContent[iAllMon]) {
00662                             m_summaryContent[iAllMon] = sysQtStatus;
00663                         }
00664 
00665                         m_summarySum += sysQtResult;
00666                     }
00667 
00668 
00669                 } else {
00670 
00671                     // for the summary map, if the test was not found but it is assumed to be
00672                     // considered for the summary plot, set it to dqm::qstatus::INVALID
00673 
00674                     int sysQtStatus = dqm::qstatus::INVALID;
00675 
00676                     if (sysQtSummaryEnabled[iSysQTest]) {
00677 
00678                         if (sysQtStatus > m_summaryContent[iAllMon]) {
00679                             m_summaryContent[iAllMon] = sysQtStatus;
00680                         }
00681                     }
00682 
00683                     m_meReportSummaryContent[iAllQTest]->Fill(0.);
00684 
00685                     if (m_verbose) {
00686 
00687                         std::cout << "\n" << (*itQtName)
00688                                 << " quality test not found\n" << std::endl;
00689                     }
00690                 }
00691 
00692             } else {
00693                 // for the summary map, if the histogram was not found but it is assumed
00694                 // to have a test be considered for the summary plot, set it to dqm::qstatus::INVALID
00695 
00696                 int sysQtStatus = dqm::qstatus::INVALID;
00697 
00698                 if (sysQtSummaryEnabled[iSysQTest]) {
00699 
00700                     if (sysQtStatus > m_summaryContent[iAllMon]) {
00701                         m_summaryContent[iAllMon] = sysQtStatus;
00702                     }
00703                 }
00704 
00705                 m_meReportSummaryContent[iAllQTest]->Fill(0.);
00706 
00707                 if (m_verbose) {
00708 
00709                     std::cout << "\nHistogram " << sysQtHist[iSysQTest]
00710                             << " not found\n" << std::endl;
00711                 }
00712 
00713             }
00714 
00715             // increase counters for quality tests
00716             iSysQTest++;
00717             iAllQTest++;
00718 
00719         }
00720 
00721         iAllMon++;
00722 
00723     }
00724 
00725     // quality tests for all L1 objects
00726 
00727     for (unsigned int iObj = 0; iObj < m_nrL1Objects; ++iObj) {
00728 
00729         // get the reports for each quality test
00730 
00731         const std::vector<std::string>& objQtName =
00732                 m_objectQualityTestName[iObj];
00733         const std::vector<std::string>& objQtHist =
00734                 m_objectQualityTestHist[iObj];
00735         const std::vector<unsigned int>& objQtSummaryEnabled =
00736                 m_objectQtSummaryEnabled[iObj];
00737 
00738         // pro object counter for quality tests
00739         int iObjQTest = 0;
00740 
00741         for (std::vector<std::string>::const_iterator itQtName =
00742                 objQtName.begin(); itQtName != objQtName.end(); ++itQtName) {
00743 
00744             // get results, status and message
00745 
00746             MonitorElement* qHist = m_dbe->get(objQtHist[iObjQTest]);
00747 
00748             if (qHist) {
00749                 const std::vector<QReport*> qtVec = qHist->getQReports();
00750                 const std::string hName = qHist->getName();
00751 
00752                 if (m_verbose) {
00753 
00754                     std::cout << "\nNumber of quality tests "
00755                             << " for histogram " << objQtHist[iObjQTest]
00756                             << ": " << qtVec.size() << "\n" << std::endl;
00757                 }
00758 
00759                 const QReport* objQReport = qHist->getQReport(*itQtName);
00760                 if (objQReport) {
00761                     const float objQtResult = objQReport->getQTresult();
00762                     const int objQtStatus = objQReport->getStatus();
00763                     const std::string& objQtMessage = objQReport->getMessage();
00764 
00765                     if (m_verbose) {
00766                         std::cout << "\n" << (*itQtName) << " quality test:"
00767                                 << "\n  result:  " << objQtResult
00768                                 << "\n  status:  " << objQtStatus
00769                                 << "\n  message: " << objQtMessage << "\n"
00770                                 << "\nFilling m_meReportSummaryContent["
00771                                 << iAllQTest << "] with value "
00772                                 << objQtResult << "\n" << std::endl;
00773                     }
00774 
00775                     m_meReportSummaryContent[iAllQTest]->Fill(objQtResult);
00776 
00777                     // for the summary map, keep the highest status value ("ERROR") of all tests
00778                     // which are considered for the summary plot
00779                     if (objQtSummaryEnabled[iObjQTest]) {
00780 
00781                         if (objQtStatus > m_summaryContent[iAllMon]) {
00782                             m_summaryContent[iAllMon] = objQtStatus;
00783                         }
00784 
00785                         m_summarySum += objQtResult;
00786                     }
00787 
00788                 } else {
00789 
00790                     // for the summary map, if the test was not found but it is assumed to be
00791                     // considered for the summary plot, set it to dqm::qstatus::INVALID
00792 
00793                     int objQtStatus = dqm::qstatus::INVALID;
00794 
00795                     if (objQtSummaryEnabled[iObjQTest]) {
00796 
00797                         if (objQtStatus > m_summaryContent[iAllMon]) {
00798                             m_summaryContent[iAllMon] = objQtStatus;
00799                         }
00800                     }
00801 
00802                     m_meReportSummaryContent[iAllQTest]->Fill(0.);
00803 
00804                     if (m_verbose) {
00805 
00806                         std::cout << "\n" << (*itQtName)
00807                                 << " quality test not found\n" << std::endl;
00808                     }
00809 
00810                 }
00811 
00812             } else {
00813                 // for the summary map, if the histogram was not found but it is assumed
00814                 // to have a test be considered for the summary plot, set it to dqm::qstatus::INVALID
00815 
00816                 int objQtStatus = dqm::qstatus::INVALID;
00817 
00818                 if (objQtSummaryEnabled[iObjQTest]) {
00819 
00820                     if (objQtStatus > m_summaryContent[iAllMon]) {
00821                         m_summaryContent[iAllMon] = objQtStatus;
00822                     }
00823                 }
00824 
00825                 m_meReportSummaryContent[iAllQTest]->Fill(0.);
00826 
00827                 if (m_verbose) {
00828                     std::cout << "\nHistogram " << objQtHist[iObjQTest]
00829                             << " not found\n" << std::endl;
00830                 }
00831 
00832             }
00833 
00834             // increase counters for quality tests
00835             iObjQTest++;
00836             iAllQTest++;
00837         }
00838 
00839         iAllMon++;
00840 
00841     }
00842 
00843 
00844 
00845     // reportSummary value
00846     m_reportSummary = m_summarySum / float(m_totalNrQtSummaryEnabled);
00847     if (m_meReportSummary) {
00848         m_meReportSummary->Fill(m_reportSummary);
00849     }
00850 
00851     // fill the ReportSummaryMap for L1 systems (bin 1 on X)
00852     for (unsigned int iSys = 0; iSys < m_nrL1Systems; ++iSys) {
00853 
00854         double summCont = static_cast<double>(m_summaryContent[iSys]);
00855         m_meReportSummaryMap->setBinContent(1, iSys + 1, summCont);
00856     }
00857 
00858     // fill the ReportSummaryMap for L1 objects (bin 2 on X)
00859     for (unsigned int iMon = m_nrL1Systems; iMon < m_nrL1Systems
00860             + m_nrL1Objects; ++iMon) {
00861 
00862         double summCont = static_cast<double>(m_summaryContent[iMon]);
00863         m_meReportSummaryMap->setBinContent(2, iMon - m_nrL1Systems + 1, summCont);
00864 
00865     }
00866 
00867 }
00868 
00869 
00870