CMS 3D CMS Logo

DTOfflineSummaryClients.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author M. Pelliccioni - INFN Torino
5  *
6  * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my
7  *
8  */
9 
11 
12 // Framework
17 
20 
21 #include <string>
22 #include <cmath>
23 
24 using namespace edm;
25 using namespace std;
26 
28  LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients") << "[DTOfflineSummaryClients]: Constructor";
29 
30  bookingdone = false;
31 }
32 
34  LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
35  << "DTOfflineSummaryClients: analyzed " << nevents << " events";
36 }
37 
39 
41  DQMStore::IGetter& igetter,
42  edm::LuminosityBlock const& lumiSeg,
43  edm::EventSetup const& context) {
44  LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
45  << "[DTOfflineSummaryClients]: End of LS transition" << endl;
46 }
47 
49  LogVerbatim("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
50  << "[DTOfflineSummaryClients]: end job. Performin client operation";
51 
52  // book the summary histos
53 
54  ibooker.setCurrentFolder("DT/EventInfo");
55  summaryReport = ibooker.bookFloat("reportSummary");
56  // Initialize to 1 so that no alarms are thrown at the beginning of the run
57  summaryReport->Fill(1.);
58 
59  summaryReportMap = ibooker.book2D("reportSummaryMap", "DT Report Summary Map", 12, 1, 13, 5, -2, 3);
60  summaryReportMap->setAxisTitle("sector", 1);
61  summaryReportMap->setAxisTitle("wheel", 2);
62 
63  ibooker.setCurrentFolder("DT/EventInfo/reportSummaryContents");
64 
65  for (int wheel = -2; wheel != 3; ++wheel) {
66  stringstream streams;
67  streams << "DT_Wheel" << wheel;
68  string meName = streams.str();
69 
70  theSummaryContents.push_back(ibooker.bookFloat(meName));
71  // Initialize to 1 so that no alarms are thrown at the beginning of the run
72  theSummaryContents[wheel + 2]->Fill(1.);
73  }
74 
75  // reset the monitor elements
77  summaryReport->Fill(0.);
78  for (int ii = 0; ii != 5; ++ii) {
79  theSummaryContents[ii]->Fill(0.);
80  }
81 
82  // Fill the map using, at the moment, only the information from DT chamber efficiency
83  // problems at a granularity smaller than the chamber are ignored
84  for (int wheel = -2; wheel <= 2; wheel++) { // loop over wheels
85  // retrieve the chamber efficiency summary
86  stringstream str;
87  str << "DT/05-ChamberEff/EfficiencyMap_All_W" << wheel;
88  MonitorElement* segmentWheelSummary = igetter.get(str.str());
89  if (segmentWheelSummary != nullptr) {
90  float nFailingChambers = 0.;
91 
92  for (int sector = 1; sector <= 12; sector++) { // loop over sectors
93 
94  double meaneff = 0.;
95  double errorsum = 0.;
96 
97  for (int station = 1; station != 5; ++station) { // loop over stations
98 
99  const double tmpefficiency = segmentWheelSummary->getBinContent(sector, station);
100  const double tmpvariance = pow(segmentWheelSummary->getBinError(sector, station), 2);
101 
102  if (tmpefficiency == 0 || tmpvariance == 0) {
103  nFailingChambers++;
104  continue;
105  }
106 
107  meaneff += tmpefficiency / tmpvariance;
108  errorsum += 1. / tmpvariance;
109 
110  if (tmpefficiency < 0.2)
111  nFailingChambers++;
112 
113  LogTrace("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
114  << "Wheel: " << wheel << " Stat: " << station << " Sect: " << sector << " status: " << meaneff / errorsum
115  << endl;
116  }
117 
118  const double eff_result = meaneff / errorsum;
119 
120  if (eff_result > 0.7)
121  summaryReportMap->Fill(sector, wheel, 1.);
122  else if (eff_result < 0.7 && eff_result > 0.5)
123  summaryReportMap->Fill(sector, wheel, 0.6);
124  else if (eff_result < 0.5 && eff_result > 0.3)
125  summaryReportMap->Fill(sector, wheel, 0.4);
126  else if (eff_result < 0.3 && eff_result > 0.)
127  summaryReportMap->Fill(sector, wheel, 0.15);
128  }
129  theSummaryContents[wheel + 2]->Fill((48. - nFailingChambers) / 48.);
130  summaryReport->Fill(summaryReport->getFloatValue() + theSummaryContents[wheel + 2]->getFloatValue() / 5.);
131  } else {
132  LogWarning("DTDQM|DTMonitorClient|DTOfflineSummaryClients")
133  << " [DTOfflineSummaryClients] Segment Summary not found with name: " << str.str() << endl;
134  }
135  }
136 }
Log< level::Info, true > LogVerbatim
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
std::vector< MonitorElement * > theSummaryContents
#define LogTrace(id)
void Fill(long long x)
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
virtual double getFloatValue() const
~DTOfflineSummaryClients() override
Destructor.
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
EndJob.
ii
Definition: cuy.py:589
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:680
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
EndLumi.
HLT enums.
virtual double getBinError(int binx) const
get uncertainty on content of bin (1-D) - See TH1::GetBinError for details
DTOfflineSummaryClients(const edm::ParameterSet &ps)
Constructor.
Log< level::Warning, false > LogWarning
#define str(s)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
Definition: Run.h:45
virtual double getBinContent(int binx) const
get content of bin (1-D)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)