00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <DQM/DTMonitorClient/src/DTOfflineSummaryClients.h>
00013
00014
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
00049 dbe->setCurrentFolder("DT/EventInfo");
00050 summaryReport = dbe->bookFloat("reportSummary");
00051
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
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
00107 summaryReportMap->Reset();
00108 summaryReport->Reset();
00109 for(int ii = 0; ii != 5; ++ii) {
00110 theSummaryContents[ii]->Reset();
00111 }
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 double totalStatus = 0;
00144
00145 bool efficiencyFound = true;
00146
00147
00148
00149 for(int wheel=-2; wheel<=2; wheel++) {
00150
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++) {
00157 for(int station = 1; station != 5; ++station) {
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
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 }
00197
00198