CMS 3D CMS Logo

DTSummaryClients.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author G. Mila - INFN Torino
5  *
6  * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my
7  *
8  */
9 
11 
12 // Framework
16 
19 
20 #include <string>
21 
22 using namespace edm;
23 using namespace std;
24 
26  LogVerbatim("DTDQM|DTMonitorClient|DTSummaryClients") << "[DTSummaryClients]: Constructor";
27 
28  bookingdone = false;
29 }
30 
32  LogVerbatim("DTDQM|DTMonitorClient|DTSummaryClients") << "DTSummaryClients: analyzed " << nevents << " events";
33 }
34 
36  LogVerbatim("DTDQM|DTMonitorClient|DTSummaryClients") << "[DTSummaryClients]: endJob";
37 }
38 
40  DQMStore::IGetter& igetter,
41  edm::LuminosityBlock const& lumiSeg,
42  edm::EventSetup const& context) {
43  if (!bookingdone) {
44  // book the summary histos
45 
46  ibooker.setCurrentFolder("DT/EventInfo");
47 
48  summaryReport = ibooker.bookFloat("reportSummary");
49  // Initialize to 1 so that no alarms are thrown at the beginning of the run
50  summaryReport->Fill(1.);
51 
52  summaryReportMap = ibooker.book2D("reportSummaryMap", "DT Report Summary Map", 12, 1, 13, 5, -2, 3);
53  summaryReportMap->setAxisTitle("sector", 1);
54  summaryReportMap->setAxisTitle("wheel", 2);
55 
56  ibooker.setCurrentFolder("DT/EventInfo/reportSummaryContents");
57 
58  for (int wheel = -2; wheel != 3; ++wheel) {
59  stringstream streams;
60  streams << "DT_Wheel" << wheel;
61  string meName = streams.str();
62 
63  theSummaryContents.push_back(ibooker.bookFloat(meName));
64  // Initialize to 1 so that no alarms are thrown at the beginning of the run
65  theSummaryContents[wheel + 2]->Fill(1.);
66  }
67  }
68  bookingdone = true;
69 
70  LogVerbatim("DTDQM|DTMonitorClient|DTSummaryClients")
71  << "[DTSummaryClients]: End of LS transition, performing the DQM client operation" << endl;
72 
73  // reset the monitor elements
76  for (int ii = 0; ii != 5; ++ii) {
77  theSummaryContents[ii]->Reset();
78  }
79 
80  bool noDTData = false;
81 
82  // Check if DT data in each ROS have been read out and set the SummaryContents and the ErrorSummary
83  // accordignly
84  MonitorElement* dataIntegritySummary = igetter.get("DT/00-DataIntegrity/DataIntegritySummary");
85  if (dataIntegritySummary != nullptr) {
86  int nDisabledFED = 0;
87  for (int wheel = 1; wheel != 6; ++wheel) { // loop over the wheels
88  int nDisablesROS = 0;
89  for (int sect = 1; sect != 13; ++sect) { // loop over sectors
90  if (dataIntegritySummary->getBinContent(sect, wheel) == 0) {
91  nDisablesROS++;
92  }
93  }
94  if (nDisablesROS == 12) {
95  nDisabledFED++;
96  theSummaryContents[wheel - 1]->Fill(0);
97  }
98  }
99 
100  if (nDisabledFED == 5) {
101  noDTData = true;
102  summaryReport->Fill(-1);
103  }
104 
105  } else {
106  LogVerbatim("DTDQM|DTMonitorClient|DTSummaryClients")
107  << "Data Integrity Summary not found with name: DT/00-DataIntegrity/DataIntegritySummary" << endl;
108  }
109 
110  double totalStatus = 0;
111  // protection
112  bool occupancyFound = true;
113 
114  // Fill the map using, at the moment, only the information from DT occupancy
115  // problems at a granularity smaller than the chamber are ignored
116  for (int wheel = -2; wheel <= 2; wheel++) { // loop over wheels
117  // retrieve the occupancy summary
118  stringstream str;
119  str << "DT/01-Digi/OccupancySummary_W" << wheel;
120  MonitorElement* wheelOccupancySummary = igetter.get(str.str());
121  if (wheelOccupancySummary != nullptr) {
122  int nFailingChambers = 0;
123  for (int sector = 1; sector <= 12; sector++) { // loop over sectors
124  for (int station = 1; station != 5; ++station) { // loop over stations
125  double chamberStatus = wheelOccupancySummary->getBinContent(sector, station);
126  LogTrace("DTDQM|DTMonitorClient|DTSummaryClients")
127  << "Wheel: " << wheel << " Stat: " << station << " Sect: " << sector << " status: " << chamberStatus
128  << endl;
129  if (chamberStatus != 4) {
131  } else {
132  nFailingChambers++;
133  }
134  LogTrace("DTDQM|DTMonitorClient|DTSummaryClients")
135  << " sector (" << sector
136  << ") status on the map is: " << summaryReportMap->getBinContent(sector, wheel + 3) << endl;
137  }
138  }
139  theSummaryContents[wheel + 2]->Fill((48. - nFailingChambers) / 48.);
140  totalStatus += (48. - nFailingChambers) / 48.;
141  } else {
142  occupancyFound = false;
143  LogVerbatim("DTDQM|DTMonitorClient|DTSummaryClients")
144  << " Wheel Occupancy Summary not found with name: " << str.str() << endl;
145  }
146  }
147 
148  if (occupancyFound && !noDTData)
149  summaryReport->Fill(totalStatus / 5.);
150 }
DTSummaryClients(const edm::ParameterSet &ps)
Constructor.
Log< level::Info, true > LogVerbatim
std::vector< MonitorElement * > theSummaryContents
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
~DTSummaryClients() override
Destructor.
MonitorElement * summaryReport
MonitorElement * summaryReportMap
#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.
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
ii
Definition: cuy.py:589
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:697
HLT enums.
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
#define str(s)
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)