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 
20  parameters_ = ps;
21  initialize();
22  fillInEventloop = ps.getUntrackedParameter<bool>("fillInEventloop",false);
23  fillOnEndRun = ps.getUntrackedParameter<bool>("fillOnEndRun",false);
24  fillOnEndJob = ps.getUntrackedParameter<bool>("fillOnEndJob",false);
25  fillOnEndLumi = ps.getUntrackedParameter<bool>("fillOnEndLumi",true);
26  moduleName = ps.getUntrackedParameter<std::string>("moduleName", "FED");
27  fedFolderName = ps.getUntrackedParameter<std::string>("fedFolderName", "FEDIntegrity");
28 
29 }
30 
32 
33 
35 
36  // get back-end interface
38 
39 }
40 
41 
43 
44  NBINS = 850;
45  XMIN = 0.;
46  XMAX = 850.;
47 
49 
50  // ----------------------------------------------------------------------------------
51  std::string currentFolder = moduleName + "/" + fedFolderName ;
52  dbe_->setCurrentFolder(currentFolder);
53 
54  FedEntries = dbe_->book1D("FedEntries", "FED Entries", NBINS, XMIN, XMAX);
55  FedFatal = dbe_->book1D("FedFatal", "FED Fatal Errors", NBINS, XMIN, XMAX);
56  FedNonFatal = dbe_->book1D("FedNonFatal", "FED Non Fatal Errors", NBINS, XMIN, XMAX);
57 
58  FedEntries->setAxisTitle( "", 1);
59  FedFatal->setAxisTitle( "", 1);
60  FedNonFatal->setAxisTitle("", 1);
61 
62  FedEntries->setAxisTitle( "", 2);
63  FedFatal->setAxisTitle( "", 2);
64  FedNonFatal->setAxisTitle("", 2);
65 
66  FedEntries->setBinLabel(11, "PIXEL", 1);
67  FedEntries->setBinLabel(221, "SIST", 1);
68  FedEntries->setBinLabel(606, "EE", 1);
69  FedEntries->setBinLabel(628, "EB", 1);
70  FedEntries->setBinLabel(651, "EE", 1);
71  FedEntries->setBinLabel(550, "ES", 1);
72  FedEntries->setBinLabel(716, "HCAL", 1);
73  FedEntries->setBinLabel(754, "CSC", 1);
74  FedEntries->setBinLabel(772, "DT", 1);
75  FedEntries->setBinLabel(791, "RPC", 1);
76  FedEntries->setBinLabel(804, "L1T", 1);
77 
78  FedFatal->setBinLabel(11, "PIXEL", 1);
79  FedFatal->setBinLabel(221, "SIST", 1);
80  FedFatal->setBinLabel(606, "EE", 1);
81  FedFatal->setBinLabel(628, "EB", 1);
82  FedFatal->setBinLabel(651, "EE", 1);
83  FedFatal->setBinLabel(550, "ES", 1);
84  FedFatal->setBinLabel(716, "HCAL", 1);
85  FedFatal->setBinLabel(754, "CSC", 1);
86  FedFatal->setBinLabel(772, "DT", 1);
87  FedFatal->setBinLabel(791, "RPC", 1);
88  FedFatal->setBinLabel(804, "L1T", 1);
89 
90  FedNonFatal->setBinLabel(11, "PIXEL", 1);
91  FedNonFatal->setBinLabel(221, "SIST", 1);
92  FedNonFatal->setBinLabel(606, "EE", 1);
93  FedNonFatal->setBinLabel(628, "EB", 1);
94  FedNonFatal->setBinLabel(651, "EE", 1);
95  FedNonFatal->setBinLabel(550, "ES", 1);
96  FedNonFatal->setBinLabel(716, "HCAL", 1);
97  FedNonFatal->setBinLabel(754, "CSC", 1);
98  FedNonFatal->setBinLabel(772, "DT", 1);
99  FedNonFatal->setBinLabel(791, "RPC", 1);
100  FedNonFatal->setBinLabel(804, "L1T", 1);
101 
102  //-----------------------------------------------------------------------------------
103  currentFolder = moduleName + "/EventInfo";
104  dbe_->setCurrentFolder(currentFolder);
105 
106  reportSummary = dbe_->bookFloat("reportSummary");
107 
108  int nSubsystems = 10;
109 
111 
112  currentFolder = moduleName + "/EventInfo/reportSummaryContents";
113  dbe_->setCurrentFolder(currentFolder);
114 
115  reportSummaryContent[0] = dbe_->bookFloat("CSC FEDs");
116  reportSummaryContent[1] = dbe_->bookFloat("DT FEDs");
117  reportSummaryContent[2] = dbe_->bookFloat("EB FEDs");
118  reportSummaryContent[3] = dbe_->bookFloat("EE FEDs");
119  reportSummaryContent[4] = dbe_->bookFloat("ES FEDs");
120  reportSummaryContent[5] = dbe_->bookFloat("Hcal FEDs");
121  reportSummaryContent[6] = dbe_->bookFloat("L1T FEDs");
122  reportSummaryContent[7] = dbe_->bookFloat("Pixel FEDs");
123  reportSummaryContent[8] = dbe_->bookFloat("RPC FEDs");
124  reportSummaryContent[9] = dbe_->bookFloat("SiStrip FEDs");
125 
126  // initialize reportSummaryContents to 1
127  for (int i = 0; i < nSubsystems; ++i) {
128  SummaryContent[i] = 1.;
130  }
131 
132  currentFolder = moduleName + "/EventInfo";
133  dbe_->setCurrentFolder(currentFolder);
134 
135  reportSummaryMap = dbe_->book2D("reportSummaryMap",
136  "FED Report Summary Map", 1, 1, 2, 10, 1, 11);
137 
140 
141  reportSummaryMap->setBinLabel( 1, " ", 1);
142  reportSummaryMap->setBinLabel(10, "CSC", 2);
143  reportSummaryMap->setBinLabel( 9, "DT", 2);
144  reportSummaryMap->setBinLabel( 8, "EB", 2);
145  reportSummaryMap->setBinLabel( 7, "EE", 2);
146  reportSummaryMap->setBinLabel( 6, "ES", 2);
147  reportSummaryMap->setBinLabel( 5, "Hcal", 2);
148  reportSummaryMap->setBinLabel( 4, "L1T", 2);
149  reportSummaryMap->setBinLabel( 3, "Pixel", 2);
150  reportSummaryMap->setBinLabel( 2, "RPC", 2);
151  reportSummaryMap->setBinLabel( 1, "SiStrip", 2);
152 
153 }
154 
156 
157 }
158 
161 }
162 
165 }
166 
168  // FED Entries
169 
170  // dbe_->showDirStructure();
171 
172  std::vector<std::string> entries;
173  entries.push_back("CSC/" + fedFolderName + "/FEDEntries");
174  entries.push_back("DT/" + fedFolderName + "/FEDEntries");
175  entries.push_back("EcalBarrel/" + fedFolderName + "/FEDEntries");
176  entries.push_back("EcalEndcap/" + fedFolderName + "/FEDEntries");
177  entries.push_back("EcalPreshower/" + fedFolderName + "/FEDEntries");
178  entries.push_back("Hcal/" + fedFolderName + "/FEDEntries");
179  entries.push_back("L1T/" + fedFolderName + "/FEDEntries");
180  entries.push_back("Pixel/" + fedFolderName + "/FEDEntries");
181  entries.push_back("RPC/" + fedFolderName + "/FEDEntries");
182  entries.push_back("SiStrip/" + fedFolderName + "/FEDEntries");
183 
184  for(auto ent = entries.begin();
185  ent != entries.end(); ++ent) {
186 
187  if( !(dbe_->get(*ent)) ) {
188  // cout << ">> Endluminosity No histogram! <<" << endl;
189  continue;
190  }
191 
192  MonitorElement * me = dbe_->get(*ent);
193 
194  if (TH1F * rootHisto = me->getTH1F()) {
195 
196  int xmin = 0;
197  int Nbins = me->getNbinsX();
198 
199  float entry = 0.;
200 
201  xmin = (int)rootHisto->GetXaxis()->GetXmin();
202  if(*ent == "L1T/" + fedFolderName +"/FEDEntries") xmin = xmin + 800;
203 
204  for(int bin = 1; bin <= Nbins ; ++bin) {
205  int id = xmin+bin;
206  entry = rootHisto->GetBinContent(bin);
207  if(entry > 0.) FedEntries->setBinContent(id, entry);
208  }
209 
210  }
211 
212  }
213 
214  // FED Fatal
215 
216  int nSubsystems = 10;
217 
218  std::vector<std::string> fatal;
219  fatal.push_back("CSC/" + fedFolderName + "/FEDFatal");
220  fatal.push_back("DT/" + fedFolderName + "/FEDFatal");
221  fatal.push_back("EcalBarrel/" + fedFolderName + "/FEDFatal");
222  fatal.push_back("EcalEndcap/" + fedFolderName + "/FEDFatal");
223  fatal.push_back("EcalPreshower/" + fedFolderName + "/FEDFatal");
224  fatal.push_back("Hcal/" + fedFolderName + "/FEDFatal");
225  fatal.push_back("L1T/" + fedFolderName + "/FEDFatal");
226  fatal.push_back("Pixel/" + fedFolderName + "/FEDFatal");
227  fatal.push_back("RPC/" + fedFolderName + "/FEDFatal");
228  fatal.push_back("SiStrip/" + fedFolderName + "/FEDFatal");
229 
230  int k = 0, count = 0;
231 
232  float sum = 0.;
233 
234  auto ent = entries.begin();
235  for(auto fat = fatal.begin();
236  fat != fatal.end(); ++fat) {
237 
238  if( !(dbe_->get(*fat)) ) {
239  // cout << ">> No histogram! <<" << endl;
241  reportSummaryMap->setBinContent(1, nSubsystems-k, -1);
242  k++;
243  ent++;
244  continue;
245  }
246 
247  MonitorElement * me = dbe_->get(*fat);
248  MonitorElement * meNorm = dbe_->get(*ent);
249  // cout << "Path : " << me->getFullname() << endl;
250 
251  int Nbins = me->getNbinsX();
252 
253  float entry = 0.;
254  float norm = 0.;
255 
256  if (TH1F * rootHisto = me->getTH1F()) {
257  if (TH1F * rootHistoNorm = meNorm->getTH1F()) {
258 
259  int xmin = 0;
260  int xmax = 0;
261 
262  xmin = (int)rootHisto->GetXaxis()->GetXmin();
263  if(*fat == "L1T/" + fedFolderName + "/FEDFatal") xmin = xmin + 800;
264 
265  xmax = (int)rootHisto->GetXaxis()->GetXmax();
266  if(*fat == "L1T/" + fedFolderName + "/FEDFatal") xmax = xmax + 800;
267 
268  // cout << "FED ID range : " << xmin << " - " << xmax << endl;
269 
270  float binentry = 0.;
271  for(int bin = 1; bin <= Nbins ; ++bin) {
272  int id = xmin+bin;
273  binentry = rootHisto->GetBinContent(bin);
274  entry += binentry;
275  norm += rootHistoNorm->GetBinContent(bin);
276  // cout << *fat << "errors = " << entry << "\tnorm = " << norm << endl;
277  // cout << "Bin content : " << entry << endl;
278  FedFatal->setBinContent(id, binentry);
279  }
280  }
281  }
282 
283  if (norm > 0) SummaryContent[k] = 1.0 - entry/norm;
284  // cout << "Summary Content : " << SummaryContent[k] << endl;
286  if ( (k==2 || k==3) // for EE and EB only show yellow when more than 1% errors.
287  && SummaryContent[k] >=0.95 && SummaryContent[k] < 0.99 ) SummaryContent[k] = 0.949;
288  reportSummaryMap->setBinContent(1, nSubsystems-k, SummaryContent[k]);
289  sum = sum + SummaryContent[k];
290 
291  k++;
292  ent++;
293  count++;
294 
295  }
296 
297  if (count > 0) reportSummary->Fill( sum/(float)count );
298 
299  // FED Non Fatal
300 
301  std::vector<std::string> nonfatal;
302  nonfatal.push_back("CSC/" + fedFolderName + "/FEDNonFatal");
303  nonfatal.push_back("DT/" + fedFolderName + "/FEDNonFatal");
304  nonfatal.push_back("EcalBarrel/" + fedFolderName + "/FEDNonFatal");
305  nonfatal.push_back("EcalEndcap/" + fedFolderName + "/FEDNonFatal");
306  nonfatal.push_back("EcalPreshower/" + fedFolderName + "/FEDNonFatal");
307  nonfatal.push_back("Hcal/" + fedFolderName + "/FEDNonFatal");
308  nonfatal.push_back("L1T/" + fedFolderName + "/FEDNonFatal");
309  nonfatal.push_back("Pixel/" + fedFolderName + "/FEDNonFatal");
310  nonfatal.push_back("RPC/" + fedFolderName + "/FEDNonFatal");
311  nonfatal.push_back("SiStrip/" + fedFolderName + "/FEDNonFatal");
312 
313  for(auto non = nonfatal.begin();
314  non != nonfatal.end(); ++non) {
315 
316  if( !(dbe_->get(*non)) ) {
317  // cout << ">> No histogram! <<" << endl;
318  continue;
319  }
320 
321  MonitorElement * me = dbe_->get(*non);
322 
323  if (TH1F * rootHisto = me->getTH1F()) {
324 
325  int xmin = 0;
326  int Nbins = me->getNbinsX();
327 
328  float entry = 0.;
329 
330  xmin = (int)rootHisto->GetXaxis()->GetXmin();
331  if(*non == "L1T/" + fedFolderName + "/FEDNonFatal") xmin = xmin + 800;
332 
333  for(int bin = 1; bin <= Nbins ; ++bin) {
334  int id = xmin+bin;
335  entry = rootHisto->GetBinContent(bin);
336  if(entry > 0.) FedNonFatal->setBinContent(id, entry);
337  }
338 
339  }
340 
341  }
342 
343 }
344 
345 
348 }
349 
350 
353 
354 }
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:1173
T getUntrackedParameter(std::string const &, T const &) const
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * FedNonFatal
TH1F * getTH1F() const
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)
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:1098
MonitorElement * bookFloat(char_string const &name)
Book float.
Definition: DQMStore.cc:1048
void Fill(long long x)
DQMFEDIntegrityClient(const edm::ParameterSet &)
void endRun(const edm::Run &r, const edm::EventSetup &c) override
MonitorElement * reportSummaryContent[10]
MonitorElement * get(std::string const &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
Definition: DQMStore.cc:1613
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
int k[5][pyjets_maxn]
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c) override
bin
set the eta bin as selection string.
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:571
~DQMFEDIntegrityClient() override
edm::ParameterSet parameters_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * reportSummary
int getNbinsX() const
get # of bins in X-axis
MonitorElement * reportSummaryMap
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: Run.h:45