Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <DQM/DTMonitorClient/src/DTOfflineSummaryClients.h>
00011
00012
00013 #include <FWCore/Framework/interface/Event.h>
00014 #include <FWCore/Framework/interface/EventSetup.h>
00015 #include <FWCore/ParameterSet/interface/ParameterSet.h>
00016 #include "FWCore/ServiceRegistry/interface/Service.h"
00017
00018 #include "DQMServices/Core/interface/DQMStore.h"
00019 #include "DQMServices/Core/interface/MonitorElement.h"
00020 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00021
00022 #include <string>
00023 #include <cmath>
00024
00025 using namespace edm;
00026 using namespace std;
00027
00028
00029 DTOfflineSummaryClients::DTOfflineSummaryClients(const ParameterSet& ps) : nevents(0) {
00030
00031 LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "[DTOfflineSummaryClients]: Constructor";
00032
00033
00034 dbe = Service<DQMStore>().operator->();
00035
00036 }
00037
00038 DTOfflineSummaryClients::~DTOfflineSummaryClients(){
00039 LogVerbatim ("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "DTOfflineSummaryClients: analyzed " << nevents << " events";
00040
00041 }
00042
00043 void DTOfflineSummaryClients::beginRun(Run const& run, EventSetup const& eSetup) {
00044
00045 LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") <<"[DTOfflineSummaryClients]: BeginRun";
00046
00047
00048 dbe->setCurrentFolder("DT/EventInfo");
00049 summaryReport = dbe->bookFloat("reportSummary");
00050
00051 summaryReport->Fill(1.);
00052
00053 summaryReportMap = dbe->book2D("reportSummaryMap","DT Report Summary Map",12,1,13,5,-2,3);
00054 summaryReportMap->setAxisTitle("sector",1);
00055 summaryReportMap->setAxisTitle("wheel",2);
00056
00057 dbe->setCurrentFolder("DT/EventInfo/reportSummaryContents");
00058
00059 for(int wheel = -2; wheel != 3; ++wheel) {
00060 stringstream streams;
00061 streams << "DT_Wheel" << wheel;
00062 string meName = streams.str();
00063 theSummaryContents.push_back(dbe->bookFloat(meName));
00064
00065 theSummaryContents[wheel+2]->Fill(1.);
00066 }
00067
00068
00069
00070
00071 }
00072
00073
00074 void DTOfflineSummaryClients::endJob(void){
00075
00076 LogVerbatim ("DTDQM|DTMonitorClient|DTOfflineSummaryClients") <<"[DTOfflineSummaryClients]: endJob";
00077
00078 }
00079
00080
00081 void DTOfflineSummaryClients::analyze(const Event& event, const EventSetup& context){
00082
00083 nevents++;
00084 if(nevents%1000 == 0) {
00085 LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "[DTOfflineSummaryClients] Analyze #Run: " << event.id().run()
00086 << " #Event: " << event.id().event()
00087 << " LS: " << event.luminosityBlock()
00088 << endl;
00089 }
00090 }
00091
00092
00093 void DTOfflineSummaryClients::endLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) {
00094
00095 LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
00096 << "[DTOfflineSummaryClients]: End of LS transition" << endl;
00097
00098 }
00099
00100
00101 void DTOfflineSummaryClients::endRun(Run const& run, EventSetup const& context) {
00102
00103 LogVerbatim ("DTDQM|DTMonitorClient|DTOfflineSummaryClients") <<"[DTOfflineSummaryClients]: endRun. Performin client operation";
00104
00105
00106
00107 summaryReportMap->Reset();
00108 summaryReport->Fill(0.);
00109 for(int ii = 0; ii != 5; ++ii) {
00110 theSummaryContents[ii]->Fill(0.);
00111 }
00112
00113
00114 bool efficiencyFound = true;
00115
00116
00117
00118 for(int wheel=-2; wheel<=2; wheel++) {
00119
00120 stringstream str;
00121 str << "DT/05-ChamberEff/EfficiencyMap_All_W" << wheel;
00122 MonitorElement * segmentWheelSummary = dbe->get(str.str());
00123 if(segmentWheelSummary != 0) {
00124
00125 float nFailingChambers = 0.;
00126
00127 for(int sector=1; sector<=12; sector++) {
00128
00129 double meaneff = 0.;
00130 double errorsum = 0.;
00131
00132 for(int station = 1; station != 5; ++station) {
00133
00134 const double tmpefficiency = segmentWheelSummary->getBinContent(sector, station);
00135 const double tmpvariance = pow(segmentWheelSummary->getBinError(sector, station),2);
00136
00137 if(tmpefficiency == 0 || tmpvariance == 0){
00138 nFailingChambers++;
00139 continue;
00140 }
00141
00142 meaneff += tmpefficiency/tmpvariance;
00143 errorsum += 1./tmpvariance;
00144
00145 if(tmpefficiency < 0.2) nFailingChambers++;
00146
00147 LogTrace("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
00148 << "Wheel: " << wheel << " Stat: " << station << " Sect: " << sector << " status: " << meaneff/errorsum << endl;
00149 }
00150
00151 const double eff_result = meaneff/errorsum;
00152
00153 if(eff_result > 0.7) summaryReportMap->Fill(sector,wheel,1.);
00154 else if(eff_result < 0.7 && eff_result > 0.5) summaryReportMap->Fill(sector,wheel,0.6);
00155 else if(eff_result < 0.5 && eff_result > 0.3) summaryReportMap->Fill(sector,wheel,0.4);
00156 else if(eff_result < 0.3 && eff_result > 0.) summaryReportMap->Fill(sector,wheel,0.15);
00157
00158 }
00159 theSummaryContents[wheel+2]->Fill((48.-nFailingChambers)/48.);
00160 summaryReport->Fill(summaryReport->getFloatValue() + theSummaryContents[wheel+2]->getFloatValue()/5.);
00161 } else {
00162 efficiencyFound = false;
00163 LogWarning("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
00164 << " [DTOfflineSummaryClients] Segment Summary not found with name: " << str.str() << endl;
00165 }
00166 }
00167
00168 }
00169
00170