CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DQMFEDIntegrityClient.cc
Go to the documentation of this file.
1 
2 /*
3  * \file DQMFEDIntegrityClient.cc
4  * \author M. Marienfeld
5  * Last Update:
6  *
7  * Description: Summing up FED entries from all subdetectors.
8  *
9 */
10 
11 #include "DQMFEDIntegrityClient.h"
13 
14 // -----------------------------
15 // constructors and destructor
16 // -----------------------------
17 
19  parameters_ = ps;
20  initialize();
21  fillInEventloop = ps.getUntrackedParameter<bool>("fillInEventloop", false);
22  fillOnEndRun = ps.getUntrackedParameter<bool>("fillOnEndRun", false);
23  fillOnEndJob = ps.getUntrackedParameter<bool>("fillOnEndJob", false);
24  fillOnEndLumi = ps.getUntrackedParameter<bool>("fillOnEndLumi", true);
25  moduleName = ps.getUntrackedParameter<std::string>("moduleName", "FED");
26  fedFolderName = ps.getUntrackedParameter<std::string>("fedFolderName", "FEDIntegrity");
27 }
28 
30 
32  // get back-end interface
34 }
35 
37  NBINS = 850;
38  XMIN = 0.;
39  XMAX = 850.;
40 
42 
43  // ----------------------------------------------------------------------------------
44  std::string currentFolder = moduleName + "/" + fedFolderName;
45  dbe_->setCurrentFolder(currentFolder);
46 
47  FedEntries = dbe_->book1D("FedEntries", "FED Entries", NBINS, XMIN, XMAX);
48  FedFatal = dbe_->book1D("FedFatal", "FED Fatal Errors", NBINS, XMIN, XMAX);
49  FedNonFatal = dbe_->book1D("FedNonFatal", "FED Non Fatal Errors", NBINS, XMIN, XMAX);
50 
51  FedEntries->setAxisTitle("", 1);
52  FedFatal->setAxisTitle("", 1);
53  FedNonFatal->setAxisTitle("", 1);
54 
55  FedEntries->setAxisTitle("", 2);
56  FedFatal->setAxisTitle("", 2);
57  FedNonFatal->setAxisTitle("", 2);
58 
59  FedEntries->setBinLabel(11, "PIXEL", 1);
60  FedEntries->setBinLabel(221, "SIST", 1);
61  FedEntries->setBinLabel(606, "EE", 1);
62  FedEntries->setBinLabel(628, "EB", 1);
63  FedEntries->setBinLabel(651, "EE", 1);
64  FedEntries->setBinLabel(550, "ES", 1);
65  FedEntries->setBinLabel(716, "HCAL", 1);
66  FedEntries->setBinLabel(754, "CSC", 1);
67  FedEntries->setBinLabel(772, "DT", 1);
68  FedEntries->setBinLabel(791, "RPC", 1);
69  FedEntries->setBinLabel(804, "L1T", 1);
70 
71  FedFatal->setBinLabel(11, "PIXEL", 1);
72  FedFatal->setBinLabel(221, "SIST", 1);
73  FedFatal->setBinLabel(606, "EE", 1);
74  FedFatal->setBinLabel(628, "EB", 1);
75  FedFatal->setBinLabel(651, "EE", 1);
76  FedFatal->setBinLabel(550, "ES", 1);
77  FedFatal->setBinLabel(716, "HCAL", 1);
78  FedFatal->setBinLabel(754, "CSC", 1);
79  FedFatal->setBinLabel(772, "DT", 1);
80  FedFatal->setBinLabel(791, "RPC", 1);
81  FedFatal->setBinLabel(804, "L1T", 1);
82 
83  FedNonFatal->setBinLabel(11, "PIXEL", 1);
84  FedNonFatal->setBinLabel(221, "SIST", 1);
85  FedNonFatal->setBinLabel(606, "EE", 1);
86  FedNonFatal->setBinLabel(628, "EB", 1);
87  FedNonFatal->setBinLabel(651, "EE", 1);
88  FedNonFatal->setBinLabel(550, "ES", 1);
89  FedNonFatal->setBinLabel(716, "HCAL", 1);
90  FedNonFatal->setBinLabel(754, "CSC", 1);
91  FedNonFatal->setBinLabel(772, "DT", 1);
92  FedNonFatal->setBinLabel(791, "RPC", 1);
93  FedNonFatal->setBinLabel(804, "L1T", 1);
94 
95  //-----------------------------------------------------------------------------------
96  currentFolder = moduleName + "/EventInfo";
97  dbe_->setCurrentFolder(currentFolder);
98 
99  reportSummary = dbe_->bookFloat("reportSummary");
100 
101  int nSubsystems = 10;
102 
103  if (reportSummary)
104  reportSummary->Fill(1.);
105 
106  currentFolder = moduleName + "/EventInfo/reportSummaryContents";
107  dbe_->setCurrentFolder(currentFolder);
108 
109  reportSummaryContent[0] = dbe_->bookFloat("CSC FEDs");
110  reportSummaryContent[1] = dbe_->bookFloat("DT FEDs");
111  reportSummaryContent[2] = dbe_->bookFloat("EB FEDs");
112  reportSummaryContent[3] = dbe_->bookFloat("EE FEDs");
113  reportSummaryContent[4] = dbe_->bookFloat("ES FEDs");
114  reportSummaryContent[5] = dbe_->bookFloat("Hcal FEDs");
115  reportSummaryContent[6] = dbe_->bookFloat("L1T FEDs");
116  reportSummaryContent[7] = dbe_->bookFloat("Pixel FEDs");
117  reportSummaryContent[8] = dbe_->bookFloat("RPC FEDs");
118  reportSummaryContent[9] = dbe_->bookFloat("SiStrip FEDs");
119 
120  // initialize reportSummaryContents to 1
121  for (int i = 0; i < nSubsystems; ++i) {
122  SummaryContent[i] = 1.;
124  }
125 
126  currentFolder = moduleName + "/EventInfo";
127  dbe_->setCurrentFolder(currentFolder);
128 
129  reportSummaryMap = dbe_->book2D("reportSummaryMap", "FED Report Summary Map", 1, 1, 2, 10, 1, 11);
130 
133 
134  reportSummaryMap->setBinLabel(1, " ", 1);
135  reportSummaryMap->setBinLabel(10, "CSC", 2);
136  reportSummaryMap->setBinLabel(9, "DT", 2);
137  reportSummaryMap->setBinLabel(8, "EB", 2);
138  reportSummaryMap->setBinLabel(7, "EE", 2);
139  reportSummaryMap->setBinLabel(6, "ES", 2);
140  reportSummaryMap->setBinLabel(5, "Hcal", 2);
141  reportSummaryMap->setBinLabel(4, "L1T", 2);
142  reportSummaryMap->setBinLabel(3, "Pixel", 2);
143  reportSummaryMap->setBinLabel(2, "RPC", 2);
144  reportSummaryMap->setBinLabel(1, "SiStrip", 2);
145 }
146 
148 
150  if (fillInEventloop)
151  fillHistograms();
152 }
153 
155  if (fillOnEndLumi)
156  fillHistograms();
157 }
158 
160  // FED Entries
161 
162  std::vector<std::string> entries;
163  entries.push_back("CSC/" + fedFolderName + "/FEDEntries");
164  entries.push_back("DT/" + fedFolderName + "/FEDEntries");
165  entries.push_back("EcalBarrel/" + fedFolderName + "/FEDEntries");
166  entries.push_back("EcalEndcap/" + fedFolderName + "/FEDEntries");
167  entries.push_back("EcalPreshower/" + fedFolderName + "/FEDEntries");
168  entries.push_back("Hcal/" + fedFolderName + "/FEDEntries");
169  entries.push_back("L1T/" + fedFolderName + "/FEDEntries");
170  entries.push_back("Pixel/" + fedFolderName + "/FEDEntries");
171  entries.push_back("RPC/" + fedFolderName + "/FEDEntries");
172  entries.push_back("SiStrip/" + fedFolderName + "/FEDEntries");
173 
174  for (auto ent = entries.begin(); ent != entries.end(); ++ent) {
175  if (!(dbe_->get(*ent))) {
176  continue;
177  }
178 
179  MonitorElement* me = dbe_->get(*ent);
180  if (TH1F* rootHisto = me->getTH1F()) {
181  int Nbins = me->getNbinsX();
182  float entry = 0.;
183  int xmin = (int)rootHisto->GetXaxis()->GetXmin();
184  if (*ent == "L1T/" + fedFolderName + "/FEDEntries")
185  xmin = xmin + 800;
186  if (*ent == "DT/" + fedFolderName + "/FEDEntries")
187  xmin = 770; //Real DT FEDIDs are 1369-1371
188 
189  for (int bin = 1; bin <= Nbins; ++bin) {
190  int id = xmin + bin;
191  entry = rootHisto->GetBinContent(bin);
192  if (entry > 0.)
193  FedEntries->setBinContent(id, entry);
194  }
195  }
196  }
197 
198  // FED Fatal
199 
200  int nSubsystems = 10;
201 
202  std::vector<std::string> fatal;
203  fatal.push_back("CSC/" + fedFolderName + "/FEDFatal");
204  fatal.push_back("DT/" + fedFolderName + "/FEDFatal");
205  fatal.push_back("EcalBarrel/" + fedFolderName + "/FEDFatal");
206  fatal.push_back("EcalEndcap/" + fedFolderName + "/FEDFatal");
207  fatal.push_back("EcalPreshower/" + fedFolderName + "/FEDFatal");
208  fatal.push_back("Hcal/" + fedFolderName + "/FEDFatal");
209  fatal.push_back("L1T/" + fedFolderName + "/FEDFatal");
210  fatal.push_back("Pixel/" + fedFolderName + "/FEDFatal");
211  fatal.push_back("RPC/" + fedFolderName + "/FEDFatal");
212  fatal.push_back("SiStrip/" + fedFolderName + "/FEDFatal");
213 
214  int k = 0, count = 0;
215 
216  float sum = 0.;
217 
218  auto ent = entries.begin();
219  for (auto fat = fatal.begin(); fat != fatal.end(); ++fat) {
220  if (!(dbe_->get(*fat))) {
222  reportSummaryMap->setBinContent(1, nSubsystems - k, -1);
223  k++;
224  ent++;
225  continue;
226  }
227 
228  MonitorElement* me = dbe_->get(*fat);
229  MonitorElement* meNorm = dbe_->get(*ent);
230 
231  float entry = 0.;
232  float norm = 0.;
233 
234  if (TH1F* rootHisto = me->getTH1F()) {
235  if (TH1F* rootHistoNorm = meNorm->getTH1F()) {
236  int Nbins = me->getNbinsX();
237  int xmin = (int)rootHisto->GetXaxis()->GetXmin();
238  if (*fat == "L1T/" + fedFolderName + "/FEDFatal")
239  xmin = xmin + 800;
240  if (*fat == "DT/" + fedFolderName + "/FEDFatal")
241  xmin = 770; //Real DT FED IDs are 1369-1371
242 
243  float binentry = 0.;
244  for (int bin = 1; bin <= Nbins; ++bin) {
245  int id = xmin + bin;
246  binentry = rootHisto->GetBinContent(bin);
247  entry += binentry;
248  norm += rootHistoNorm->GetBinContent(bin);
249  FedFatal->setBinContent(id, binentry);
250  }
251  }
252  }
253 
254  if (norm > 0)
255  SummaryContent[k] = 1.0 - entry / norm;
257  if ((k == 2 || k == 3) // for EE and EB only show yellow when more than 1% errors.
258  && SummaryContent[k] >= 0.95 && SummaryContent[k] < 0.99)
259  SummaryContent[k] = 0.949;
260  reportSummaryMap->setBinContent(1, nSubsystems - k, SummaryContent[k]);
261  sum = sum + SummaryContent[k];
262 
263  k++;
264  ent++;
265  count++;
266  }
267 
268  if (count > 0)
269  reportSummary->Fill(sum / (float)count);
270 
271  // FED Non Fatal
272 
273  std::vector<std::string> nonfatal;
274  nonfatal.push_back("CSC/" + fedFolderName + "/FEDNonFatal");
275  nonfatal.push_back("DT/" + fedFolderName + "/FEDNonFatal");
276  nonfatal.push_back("EcalBarrel/" + fedFolderName + "/FEDNonFatal");
277  nonfatal.push_back("EcalEndcap/" + fedFolderName + "/FEDNonFatal");
278  nonfatal.push_back("EcalPreshower/" + fedFolderName + "/FEDNonFatal");
279  nonfatal.push_back("Hcal/" + fedFolderName + "/FEDNonFatal");
280  nonfatal.push_back("L1T/" + fedFolderName + "/FEDNonFatal");
281  nonfatal.push_back("Pixel/" + fedFolderName + "/FEDNonFatal");
282  nonfatal.push_back("RPC/" + fedFolderName + "/FEDNonFatal");
283  nonfatal.push_back("SiStrip/" + fedFolderName + "/FEDNonFatal");
284 
285  for (auto non = nonfatal.begin(); non != nonfatal.end(); ++non) {
286  if (!(dbe_->get(*non))) {
287  continue;
288  }
289 
290  MonitorElement* me = dbe_->get(*non);
291 
292  if (TH1F* rootHisto = me->getTH1F()) {
293  int Nbins = me->getNbinsX();
294  float entry = 0.;
295  int xmin = (int)rootHisto->GetXaxis()->GetXmin();
296  if (*non == "L1T/" + fedFolderName + "/FEDNonFatal")
297  xmin = xmin + 800;
298 
299  for (int bin = 1; bin <= Nbins; ++bin) {
300  int id = xmin + bin;
301  entry = rootHisto->GetBinContent(bin);
302  if (entry > 0.)
303  FedNonFatal->setBinContent(id, entry);
304  }
305  }
306  }
307 }
308 
310  if (fillOnEndRun)
311  fillHistograms();
312 }
313 
315  if (fillOnEndJob)
316  fillHistograms();
317 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:80
MonitorElement * FedNonFatal
virtual TH1F * getTH1F() const
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
void Fill(long long x)
DQMFEDIntegrityClient(const edm::ParameterSet &)
virtual int getNbinsX() const
get # of bins in X-axis
void endRun(const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * reportSummaryContent[10]
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c) override
~DQMFEDIntegrityClient() override
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
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:177
edm::ParameterSet parameters_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * reportSummary
list entry
Definition: mps_splice.py:68
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * reportSummaryMap
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)