CMS 3D CMS Logo

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  // dbe_->showDirStructure();
163 
164  std::vector<std::string> entries;
165  entries.push_back("CSC/" + fedFolderName + "/FEDEntries");
166  entries.push_back("DT/" + fedFolderName + "/FEDEntries");
167  entries.push_back("EcalBarrel/" + fedFolderName + "/FEDEntries");
168  entries.push_back("EcalEndcap/" + fedFolderName + "/FEDEntries");
169  entries.push_back("EcalPreshower/" + fedFolderName + "/FEDEntries");
170  entries.push_back("Hcal/" + fedFolderName + "/FEDEntries");
171  entries.push_back("L1T/" + fedFolderName + "/FEDEntries");
172  entries.push_back("Pixel/" + fedFolderName + "/FEDEntries");
173  entries.push_back("RPC/" + fedFolderName + "/FEDEntries");
174  entries.push_back("SiStrip/" + fedFolderName + "/FEDEntries");
175 
176  for (auto ent = entries.begin(); ent != entries.end(); ++ent) {
177  if (!(dbe_->get(*ent))) {
178  // cout << ">> Endluminosity No histogram! <<" << endl;
179  continue;
180  }
181 
182  MonitorElement* me = dbe_->get(*ent);
183 
184  if (TH1F* rootHisto = me->getTH1F()) {
185  int xmin = 0;
186  int Nbins = me->getNbinsX();
187 
188  float entry = 0.;
189 
190  xmin = (int)rootHisto->GetXaxis()->GetXmin();
191  if (*ent == "L1T/" + fedFolderName + "/FEDEntries")
192  xmin = xmin + 800;
193 
194  for (int bin = 1; bin <= Nbins; ++bin) {
195  int id = xmin + bin;
196  entry = rootHisto->GetBinContent(bin);
197  if (entry > 0.)
198  FedEntries->setBinContent(id, entry);
199  }
200  }
201  }
202 
203  // FED Fatal
204 
205  int nSubsystems = 10;
206 
207  std::vector<std::string> fatal;
208  fatal.push_back("CSC/" + fedFolderName + "/FEDFatal");
209  fatal.push_back("DT/" + fedFolderName + "/FEDFatal");
210  fatal.push_back("EcalBarrel/" + fedFolderName + "/FEDFatal");
211  fatal.push_back("EcalEndcap/" + fedFolderName + "/FEDFatal");
212  fatal.push_back("EcalPreshower/" + fedFolderName + "/FEDFatal");
213  fatal.push_back("Hcal/" + fedFolderName + "/FEDFatal");
214  fatal.push_back("L1T/" + fedFolderName + "/FEDFatal");
215  fatal.push_back("Pixel/" + fedFolderName + "/FEDFatal");
216  fatal.push_back("RPC/" + fedFolderName + "/FEDFatal");
217  fatal.push_back("SiStrip/" + fedFolderName + "/FEDFatal");
218 
219  int k = 0, count = 0;
220 
221  float sum = 0.;
222 
223  auto ent = entries.begin();
224  for (auto fat = fatal.begin(); fat != fatal.end(); ++fat) {
225  if (!(dbe_->get(*fat))) {
226  // cout << ">> No histogram! <<" << endl;
228  reportSummaryMap->setBinContent(1, nSubsystems - k, -1);
229  k++;
230  ent++;
231  continue;
232  }
233 
234  MonitorElement* me = dbe_->get(*fat);
235  MonitorElement* meNorm = dbe_->get(*ent);
236  // cout << "Path : " << me->getFullname() << endl;
237 
238  int Nbins = me->getNbinsX();
239 
240  float entry = 0.;
241  float norm = 0.;
242 
243  if (TH1F* rootHisto = me->getTH1F()) {
244  if (TH1F* rootHistoNorm = meNorm->getTH1F()) {
245  int xmin = 0;
246  int xmax = 0;
247 
248  xmin = (int)rootHisto->GetXaxis()->GetXmin();
249  if (*fat == "L1T/" + fedFolderName + "/FEDFatal")
250  xmin = xmin + 800;
251 
252  xmax = (int)rootHisto->GetXaxis()->GetXmax();
253  if (*fat == "L1T/" + fedFolderName + "/FEDFatal")
254  xmax = xmax + 800;
255 
256  // cout << "FED ID range : " << xmin << " - " << xmax << endl;
257 
258  float binentry = 0.;
259  for (int bin = 1; bin <= Nbins; ++bin) {
260  int id = xmin + bin;
261  binentry = rootHisto->GetBinContent(bin);
262  entry += binentry;
263  norm += rootHistoNorm->GetBinContent(bin);
264  // cout << *fat << "errors = " << entry << "\tnorm = " << norm << endl;
265  // cout << "Bin content : " << entry << endl;
266  FedFatal->setBinContent(id, binentry);
267  }
268  }
269  }
270 
271  if (norm > 0)
272  SummaryContent[k] = 1.0 - entry / norm;
273  // cout << "Summary Content : " << SummaryContent[k] << endl;
275  if ((k == 2 || k == 3) // for EE and EB only show yellow when more than 1% errors.
276  && SummaryContent[k] >= 0.95 && SummaryContent[k] < 0.99)
277  SummaryContent[k] = 0.949;
278  reportSummaryMap->setBinContent(1, nSubsystems - k, SummaryContent[k]);
279  sum = sum + SummaryContent[k];
280 
281  k++;
282  ent++;
283  count++;
284  }
285 
286  if (count > 0)
287  reportSummary->Fill(sum / (float)count);
288 
289  // FED Non Fatal
290 
291  std::vector<std::string> nonfatal;
292  nonfatal.push_back("CSC/" + fedFolderName + "/FEDNonFatal");
293  nonfatal.push_back("DT/" + fedFolderName + "/FEDNonFatal");
294  nonfatal.push_back("EcalBarrel/" + fedFolderName + "/FEDNonFatal");
295  nonfatal.push_back("EcalEndcap/" + fedFolderName + "/FEDNonFatal");
296  nonfatal.push_back("EcalPreshower/" + fedFolderName + "/FEDNonFatal");
297  nonfatal.push_back("Hcal/" + fedFolderName + "/FEDNonFatal");
298  nonfatal.push_back("L1T/" + fedFolderName + "/FEDNonFatal");
299  nonfatal.push_back("Pixel/" + fedFolderName + "/FEDNonFatal");
300  nonfatal.push_back("RPC/" + fedFolderName + "/FEDNonFatal");
301  nonfatal.push_back("SiStrip/" + fedFolderName + "/FEDNonFatal");
302 
303  for (auto non = nonfatal.begin(); non != nonfatal.end(); ++non) {
304  if (!(dbe_->get(*non))) {
305  // cout << ">> No histogram! <<" << endl;
306  continue;
307  }
308 
309  MonitorElement* me = dbe_->get(*non);
310 
311  if (TH1F* rootHisto = me->getTH1F()) {
312  int xmin = 0;
313  int Nbins = me->getNbinsX();
314 
315  float entry = 0.;
316 
317  xmin = (int)rootHisto->GetXaxis()->GetXmin();
318  if (*non == "L1T/" + fedFolderName + "/FEDNonFatal")
319  xmin = xmin + 800;
320 
321  for (int bin = 1; bin <= Nbins; ++bin) {
322  int id = xmin + bin;
323  entry = rootHisto->GetBinContent(bin);
324  if (entry > 0.)
325  FedNonFatal->setBinContent(id, entry);
326  }
327  }
328  }
329 }
330 
332  if (fillOnEndRun)
333  fillHistograms();
334 }
335 
337  if (fillOnEndJob)
338  fillHistograms();
339 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1178
MonitorElement * FedNonFatal
virtual TH1F * getTH1F() const
void Fill(long long x)
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1509
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 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)
edm::ParameterSet parameters_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
MonitorElement * reportSummary
MonitorElement * bookFloat(char_string const &name)
Book float.
Definition: DQMStore.cc:1087
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
Definition: DQMStore.cc:1121
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)