CMS 3D CMS Logo

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