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