File indexing completed on 2024-04-06 12:07:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "DQM/DTMonitorClient/src/DTOfflineSummaryClients.h"
0011
0012
0013 #include "FWCore/Framework/interface/Event.h"
0014 #include "FWCore/Framework/interface/EventSetup.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "FWCore/ServiceRegistry/interface/Service.h"
0017
0018 #include "DQMServices/Core/interface/DQMStore.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020
0021 #include <string>
0022 #include <cmath>
0023
0024 using namespace edm;
0025 using namespace std;
0026
0027 DTOfflineSummaryClients::DTOfflineSummaryClients(const ParameterSet& ps) : nevents(0) {
0028 LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "[DTOfflineSummaryClients]: Constructor";
0029
0030 bookingdone = false;
0031 }
0032
0033 DTOfflineSummaryClients::~DTOfflineSummaryClients() {
0034 LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
0035 << "DTOfflineSummaryClients: analyzed " << nevents << " events";
0036 }
0037
0038 void DTOfflineSummaryClients::beginRun(const edm::Run& r, const edm::EventSetup& c){};
0039
0040 void DTOfflineSummaryClients::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker,
0041 DQMStore::IGetter& igetter,
0042 edm::LuminosityBlock const& lumiSeg,
0043 edm::EventSetup const& context) {
0044 LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
0045 << "[DTOfflineSummaryClients]: End of LS transition" << endl;
0046 }
0047
0048 void DTOfflineSummaryClients::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) {
0049 LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
0050 << "[DTOfflineSummaryClients]: end job. Performin client operation";
0051
0052
0053
0054 ibooker.setCurrentFolder("DT/EventInfo");
0055 summaryReport = ibooker.bookFloat("reportSummary");
0056
0057 summaryReport->Fill(1.);
0058
0059 summaryReportMap = ibooker.book2D("reportSummaryMap", "DT Report Summary Map", 12, 1, 13, 5, -2, 3);
0060 summaryReportMap->setAxisTitle("sector", 1);
0061 summaryReportMap->setAxisTitle("wheel", 2);
0062
0063 ibooker.setCurrentFolder("DT/EventInfo/reportSummaryContents");
0064
0065 for (int wheel = -2; wheel != 3; ++wheel) {
0066 stringstream streams;
0067 streams << "DT_Wheel" << wheel;
0068 string meName = streams.str();
0069
0070 theSummaryContents.push_back(ibooker.bookFloat(meName));
0071
0072 theSummaryContents[wheel + 2]->Fill(1.);
0073 }
0074
0075
0076 summaryReportMap->Reset();
0077 summaryReport->Fill(0.);
0078 for (int ii = 0; ii != 5; ++ii) {
0079 theSummaryContents[ii]->Fill(0.);
0080 }
0081
0082
0083
0084 for (int wheel = -2; wheel <= 2; wheel++) {
0085
0086 stringstream str;
0087 str << "DT/05-ChamberEff/EfficiencyMap_All_W" << wheel;
0088 MonitorElement* segmentWheelSummary = igetter.get(str.str());
0089 if (segmentWheelSummary != nullptr) {
0090 float nFailingChambers = 0.;
0091
0092 for (int sector = 1; sector <= 12; sector++) {
0093
0094 double meaneff = 0.;
0095 double errorsum = 0.;
0096
0097 for (int station = 1; station != 5; ++station) {
0098
0099 const double tmpefficiency = segmentWheelSummary->getBinContent(sector, station);
0100 const double tmpvariance = pow(segmentWheelSummary->getBinError(sector, station), 2);
0101
0102 if (tmpefficiency == 0 || tmpvariance == 0) {
0103 nFailingChambers++;
0104 continue;
0105 }
0106
0107 meaneff += tmpefficiency / tmpvariance;
0108 errorsum += 1. / tmpvariance;
0109
0110 if (tmpefficiency < 0.2)
0111 nFailingChambers++;
0112
0113 LogTrace("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
0114 << "Wheel: " << wheel << " Stat: " << station << " Sect: " << sector << " status: " << meaneff / errorsum
0115 << endl;
0116 }
0117
0118 const double eff_result = meaneff / errorsum;
0119
0120 if (eff_result > 0.7)
0121 summaryReportMap->Fill(sector, wheel, 1.);
0122 else if (eff_result < 0.7 && eff_result > 0.5)
0123 summaryReportMap->Fill(sector, wheel, 0.6);
0124 else if (eff_result < 0.5 && eff_result > 0.3)
0125 summaryReportMap->Fill(sector, wheel, 0.4);
0126 else if (eff_result < 0.3 && eff_result > 0.)
0127 summaryReportMap->Fill(sector, wheel, 0.15);
0128 }
0129 theSummaryContents[wheel + 2]->Fill((48. - nFailingChambers) / 48.);
0130 summaryReport->Fill(summaryReport->getFloatValue() + theSummaryContents[wheel + 2]->getFloatValue() / 5.);
0131 } else {
0132 LogWarning("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
0133 << " [DTOfflineSummaryClients] Segment Summary not found with name: " << str.str() << endl;
0134 }
0135 }
0136 }