CMS 3D CMS Logo

DTOfflineSummaryClients.cc

Go to the documentation of this file.
00001 
00002 
00003 /*
00004  *  See header file for a description of this class.
00005  *
00006  *  $Date: 2008/11/24 09:24:21 $
00007  *  $Revision: 1.4 $
00008  *  \author G. Mila - INFN Torino
00009  */
00010 
00011 
00012 #include <DQM/DTMonitorClient/src/DTOfflineSummaryClients.h>
00013 
00014 // Framework
00015 #include <FWCore/Framework/interface/Event.h>
00016 #include <FWCore/Framework/interface/EventSetup.h>
00017 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00018 #include "FWCore/ServiceRegistry/interface/Service.h"
00019 
00020 #include "DQMServices/Core/interface/DQMStore.h"
00021 #include "DQMServices/Core/interface/MonitorElement.h"
00022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00023 
00024 #include <string>
00025 
00026 using namespace edm;
00027 using namespace std;
00028 
00029 
00030 DTOfflineSummaryClients::DTOfflineSummaryClients(const ParameterSet& ps) : nevents(0) {
00031 
00032   LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "[DTOfflineSummaryClients]: Constructor";
00033   
00034   
00035   dbe = Service<DQMStore>().operator->();
00036 
00037 }
00038 
00039 DTOfflineSummaryClients::~DTOfflineSummaryClients(){
00040   LogVerbatim ("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "DTOfflineSummaryClients: analyzed " << nevents << " events";
00041   
00042 }
00043 
00044 void DTOfflineSummaryClients::beginRun(Run const& run, EventSetup const& eSetup) {
00045 
00046   LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") <<"[DTOfflineSummaryClients]: BeginRun"; 
00047 
00048   // book the summary histos
00049   dbe->setCurrentFolder("DT/EventInfo"); 
00050   summaryReport = dbe->bookFloat("reportSummary");
00051   // Initialize to 1 so that no alarms are thrown at the beginning of the run
00052   summaryReport->Fill(1.);
00053 
00054   summaryReportMap = dbe->book2D("reportSummaryMap","DT Report Summary Map",12,1,13,5,-2,3);
00055   summaryReportMap->setAxisTitle("sector",1);
00056   summaryReportMap->setAxisTitle("wheel",2);
00057 
00058   dbe->setCurrentFolder("DT/EventInfo/reportSummaryContents");
00059 
00060   for(int wheel = -2; wheel != 3; ++wheel) {
00061     stringstream streams;
00062     streams << "DT_Wheel" << wheel;
00063     string meName = streams.str();    
00064     theSummaryContents.push_back(dbe->bookFloat(meName));
00065     // Initialize to 1 so that no alarms are thrown at the beginning of the run
00066     theSummaryContents[wheel+2]->Fill(1.);
00067   }
00068 
00069 
00070 
00071 
00072 }
00073 
00074 
00075 void DTOfflineSummaryClients::endJob(void){
00076   
00077   LogVerbatim ("DTDQM|DTMonitorClient|DTOfflineSummaryClients") <<"[DTOfflineSummaryClients]: endJob"; 
00078 
00079 }
00080 
00081 
00082 void DTOfflineSummaryClients::endRun(Run const& run, EventSetup const& eSetup) {
00083   
00084   LogVerbatim ("DTDQM|DTMonitorClient|DTOfflineSummaryClients") <<"[DTOfflineSummaryClients]: endRun"; 
00085 
00086 }
00087 
00088 
00089 void DTOfflineSummaryClients::analyze(const Event& event, const EventSetup& context){
00090 
00091    nevents++;
00092    if(nevents%1000 == 0) {
00093      LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "[DTOfflineSummaryClients] Analyze #Run: " << event.id().run()
00094                                          << " #Event: " << event.id().event()
00095                                          << " LS: " << event.luminosityBlock()  
00096                                          << endl;
00097    }
00098 }
00099 
00100 
00101 void DTOfflineSummaryClients::endLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00102   
00103   LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
00104     << "[DTOfflineSummaryClients]: End of LS transition, performing the DQM client operation" << endl;
00105 
00106   // reset the monitor elements
00107   summaryReportMap->Reset();
00108   summaryReport->Reset();
00109   for(int ii = 0; ii != 5; ++ii) {
00110     theSummaryContents[ii]->Reset();
00111   }
00112 
00113 //   bool noDTData = false;
00114 
00115   // Check if DT data in each ROS have been read out and set the SummaryContents and the ErrorSummary
00116   // accordignly
00117   /*MonitorElement * dataIntegritySummary = dbe->get("DT/00-DataIntegrity/DataIntegritySummary");
00118   if(dataIntegritySummary != 0) {
00119   int nDisabledFED = 0;
00120   for(int wheel = 1; wheel != 6; ++wheel) { // loop over the wheels
00121     int nDisablesROS = 0;
00122     for(int sect = 1; sect != 13; ++sect) { // loop over sectors
00123       if(dataIntegritySummary->getBinContent(sect,wheel) == 1) {
00124         nDisablesROS++;
00125       }
00126     }
00127     if(nDisablesROS == 12) {
00128       nDisabledFED++;
00129       theSummaryContents[wheel-1]->Fill(0);
00130     }
00131   }
00132   
00133   if(nDisabledFED == 5) {
00134     noDTData = true;
00135     summaryReport->Fill(-1);
00136   }
00137   
00138   } else {
00139     LogError("DTDQM|DTMonitorClient|DTSummaryClients")
00140       << "Data Integrity Summary not found with name: DT/00-DataIntegrity/DataIntegritySummary" <<endl;
00141       }*/
00142 
00143   double totalStatus = 0;
00144   // protection 
00145   bool efficiencyFound = true;
00146 
00147   // Fill the map using, at the moment, only the information from DT chamber efficiency
00148   // problems at a granularity smaller than the chamber are ignored
00149   for(int wheel=-2; wheel<=2; wheel++) { // loop over wheels
00150     // retrieve the chamber efficiency summary
00151     stringstream str;
00152     str << "DT/02-Segments/segmentSummary_W" << wheel;
00153     MonitorElement * segmentWheelSummary =  dbe->get(str.str());
00154     if(segmentWheelSummary != 0) {
00155       int nFailingChambers = 0;
00156       for(int sector=1; sector<=12; sector++) { // loop over sectors
00157         for(int station = 1; station != 5; ++station) { // loop over stations
00158           double chamberStatus = segmentWheelSummary->getBinContent(sector, station);
00159           LogTrace("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
00160             << "Wheel: " << wheel << " Stat: " << station << " Sect: " << sector << " status: " << chamberStatus << endl;
00161           if(chamberStatus == 0 || chamberStatus == 1) {
00162             summaryReportMap->Fill(sector, wheel, 0.25);
00163           } else {
00164             nFailingChambers++;
00165           }
00166           LogTrace("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << " sector (" << sector << ") status on the map is: "
00167                                                              << summaryReportMap->getBinContent(sector, wheel+3) << endl;
00168         }
00169 
00170       }
00171       theSummaryContents[wheel+2]->Fill((48.-nFailingChambers)/48.);
00172       totalStatus += (48.-nFailingChambers)/48.;
00173     } else {
00174       efficiencyFound = false;
00175       LogWarning("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
00176         << " [DTOfflineSummaryClients] Segment Summary not found with name: " << str.str() << endl;
00177     }
00178   }
00179 
00180 
00181   //if(efficiencyFound && !noDTData)
00182 //   if(efficiencyFound)
00183 //     summaryReport->Fill(totalStatus/5.);
00184 
00185 //   cout << "-----------------------------------------------------------------------------" << endl;
00186 //   cout << " In the endLuminosityBlock: " << endl;
00187 //   for(int wheel = -2; wheel != 3; ++wheel) {
00188 //     for(int sector = 1; sector != 13; sector++) {
00189 //       cout << " wheel: " << wheel << " sector: " << sector << " status on the map is: "
00190 //         << summaryReportMap->getBinContent(sector, wheel+3) << endl;
00191 //     }
00192 //   }
00193 //   cout << "-----------------------------------------------------------------------------" << endl;
00194 
00195 
00196 }
00197 
00198 

Generated on Tue Jun 9 17:32:35 2009 for CMSSW by  doxygen 1.5.4