CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelHistoricInfoDQMClient.cc
Go to the documentation of this file.
1 #include <memory>
2 #include <math.h>
3 #include <iostream>
4 #include <string>
5 #include <stdio.h>
6 #include <sys/time.h>
7 
10 
11 
12 using namespace edm;
13 using namespace std;
14 
15 
17  parameterSet_ = parameterSet;
18 
19  useSummary_ = parameterSet_.getUntrackedParameter<bool>("useSummary", true);
20  printDebug_ = parameterSet_.getUntrackedParameter<bool>("printDebug",false);
21  writeHisto_ = parameterSet_.getUntrackedParameter<bool>("writeHisto",false);
22 
23  inputFiles_ = parameterSet_.getUntrackedParameter<vstring>("inputFiles");
24  outputDir_ = parameterSet_.getUntrackedParameter<string>("outputDir",".");
25 }
26 
27 
30 }
31 
32 
34  for (vector<string>::const_iterator iFile = inputFiles_.begin(); iFile!=inputFiles_.end(); ++iFile) {
35  unsigned int runNumber=0;
36  if (iFile->find("R0000",0)!=string::npos) runNumber = atoi(iFile->substr(iFile->find("R0000",0)+5,5).data());
37  else if (iFile->find("Run",0)!=string::npos) runNumber = atoi(iFile->substr(iFile->find("Run",0)+3,5).data());
38  else cout << "run number cannot be extracted from file name" << endl;
39 
40  if (runNumber==run.run()) {
41  dbe_->open(iFile->data(), true);
42 
43  performanceSummary = new SiPixelPerformanceSummary();
44  performanceSummary->setRunNumber(runNumber);
45 
46  retrieveMEs();
47  fillPerformanceSummary();
48  writeDB();
49 
50  if (writeHisto_) {
51  ostringstream endRunOutputFile;
52  endRunOutputFile << outputDir_<<"/SiPixelHistoricInfoDQMClient_"<< runNumber <<".root";
53  dbe_->save(endRunOutputFile.str());
54  }
55  }
56  }
57 }
58 
59 
61  if (writeHisto_) {
62  ostringstream endJobOutputFile;
63  endJobOutputFile << outputDir_ << "/SiPixelHistoricInfoDQMClient_endJob.root";
64  dbe_->save(endJobOutputFile.str());
65  }
66 }
67 
68 
70  mapOfdetIDtoMEs.clear();
71  bool noModules = true, noSummary = true;
72 
73  vector<string> listOfMEswithFullPath;
74  dbe_->getContents(listOfMEswithFullPath);
75 
76  for (vector<string>::const_iterator iMEstr = listOfMEswithFullPath.begin();
77  iMEstr!=listOfMEswithFullPath.end(); iMEstr++) {
78  if (printDebug_) cout << iMEstr->data() << endl;
79 
80  size_t pathLength = iMEstr->find(":",0);
81  string thePath = iMEstr->substr(0, pathLength);
82  string allHists = iMEstr->substr(pathLength+1);
83 
84  if (thePath.find("Pixel",0)!=string::npos) {
85  if (thePath.find("FED_",0)!=string::npos) {
86  size_t histnameLength;
87  do {
88  histnameLength = allHists.find(",",0);
89  string theHist;
90  if (histnameLength!=string::npos) {
91  theHist = allHists.substr(0, histnameLength);
92  allHists.erase(0, histnameLength+1);
93  }
94  else theHist = allHists;
95 
96  string fullPathHist = thePath + "/" + theHist;
97  MonitorElement* newME = dbe_->get(fullPathHist);
98  if (newME) {
99  uint32_t newMEdetID = histogramManager.getRawId(newME->getName());
100 
101  if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
102  vector<MonitorElement*> newMEvector;
103  newMEvector.push_back(newME);
104  mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
105  }
106  else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
107  }
108  }
109  while (histnameLength!=string::npos);
110  }
111  if (thePath.find("Module_",0)!=string::npos) {
112  if (!useSummary_) {
113  size_t histnameLength;
114  do {
115  histnameLength = allHists.find(",",0);
116  string theHist;
117  if (histnameLength!=string::npos) {
118  theHist = allHists.substr(0, histnameLength);
119  allHists.erase(0, histnameLength+1);
120  }
121  else theHist = allHists;
122 
123  string fullPathHist = thePath + "/" + theHist;
124  MonitorElement* newME = dbe_->get(fullPathHist);
125  if (newME) {
126  uint32_t newMEdetID = histogramManager.getRawId(newME->getName());
127 
128  if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
129  vector<MonitorElement*> newMEvector;
130  newMEvector.push_back(newME);
131  mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
132  }
133  else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
134  }
135  }
136  while(histnameLength!=string::npos);
137  }
138  if (noModules) noModules = false;
139  }
140  else if( (thePath.find("Layer_",0)!=string::npos ||
141  (thePath.find("Disk_",0)!=string::npos && thePath.find("Panel_",0)==string::npos)) ) {
142  if (useSummary_) {
143  uint32_t newMEdetID = getSummaryRegionID(thePath);
144  if (printDebug_) cout << thePath.data() <<" in region "<< newMEdetID << endl;
145  size_t histnameLength;
146  do {
147  histnameLength = allHists.find(",",0);
148  string theHist;
149  if (histnameLength!=string::npos) {
150  theHist = allHists.substr(0, histnameLength);
151  allHists.erase(0, histnameLength+1);
152  }
153  else theHist = allHists;
154 
155  string fullPathHist = thePath + "/" + theHist;
156  MonitorElement* newME = dbe_->get(fullPathHist);
157  if (newME) {
158  if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
159  vector<MonitorElement*> newMEvector;
160  newMEvector.push_back(newME);
161  mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
162  }
163  else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
164  }
165  }
166  while (histnameLength!=string::npos);
167  }
168  if (noSummary) noSummary = false;
169  }
170  if (thePath.find("Track",0)!=string::npos) { // for Pixel/Tracks, Pixel/Clusters/OnTrack, Pixel/Clusters/OffTrack
171  uint32_t newMEdetID = 77;
172  if (thePath.find("On", 0)!=string::npos) newMEdetID = 78;
173  if (thePath.find("Off",0)!=string::npos) newMEdetID = 79;
174 
175  size_t histnameLength;
176  do {
177  histnameLength = allHists.find(",",0);
178  string theHist;
179  if (histnameLength!=string::npos) {
180  theHist = allHists.substr(0, histnameLength);
181  allHists.erase(0, histnameLength+1);
182  }
183  else theHist = allHists;
184 
185  string fullPathHist = thePath + "/" + theHist;
186  MonitorElement* newME = dbe_->get(fullPathHist);
187  if (newME) {
188  if (mapOfdetIDtoMEs.find(newMEdetID)==mapOfdetIDtoMEs.end()) {
189  vector<MonitorElement*> newMEvector;
190  newMEvector.push_back(newME);
191  mapOfdetIDtoMEs.insert(make_pair(newMEdetID, newMEvector));
192  }
193  else (mapOfdetIDtoMEs.find(newMEdetID)->second).push_back(newME);
194  }
195  }
196  while (histnameLength!=string::npos);
197  }
198  if (thePath.find("EventInfo",0)!=string::npos) {
199  size_t histnameLength;
200  do {
201  histnameLength = allHists.find(",",0);
202  string theHist;
203  if (histnameLength!=string::npos) {
204  theHist = allHists.substr(0, histnameLength);
205  allHists.erase(0, histnameLength+1);
206  }
207  else theHist = allHists;
208 
209  if (theHist.find("iRun",0)!=string::npos) {
210  string fullPathHist = thePath + "/" + theHist;
211  MonitorElement* strME = dbe_->get(fullPathHist);
212  if (strME) performanceSummary->setRunNumber(strME->getIntValue());
213  }
214  if (theHist.find("iLumiSection",0)!=string::npos) {
215  string fullPathHist = thePath + "/" + theHist;
216  MonitorElement* strME = dbe_->get(fullPathHist);
217  if (strME) performanceSummary->setLuminosityBlock(strME->getIntValue());
218  }
219  if (theHist.find("processedEvents",0)!=string::npos) {
220  string fullPathHist = thePath + "/" + theHist;
221  MonitorElement* strME = dbe_->get(fullPathHist);
222  if (strME) performanceSummary->setNumberOfEvents(strME->getIntValue());
223  }
224  if (theHist.find("eventTimeStamp",0)!=string::npos) {
225  string fullPathHist = thePath + "/" + theHist;
226  MonitorElement* strME = dbe_->get(fullPathHist);
227  if (strME) performanceSummary->setTimeStamp((unsigned long long)strME->getFloatValue());
228  }
229  }
230  while (histnameLength!=string::npos);
231  }
232  }
233  }
234  if ( useSummary_ && noSummary) cout << endl << "use "<<"summary MEs but NO "<<"summary MEs in the input file" << endl << endl;
235  if (!useSummary_ && noModules) cout << endl << "use "<< "module MEs but NO "<< "module MEs in the input file" << endl << endl;
236 }
237 
238 
239 uint32_t SiPixelHistoricInfoDQMClient::getSummaryRegionID(string thePath) const {
240  uint32_t regionID = 666;
241  if (thePath.find("Ladder",0)==string::npos && thePath.find("Blade",0)==string::npos) {
242  regionID = 100;
243  if (thePath.find("Barrel",0)!=string::npos) {
244  regionID += 0;
245  string shell = thePath.substr(thePath.find("Shell",0)+6,2);
246  if (shell.compare("mI")==0) regionID += 0;
247  else if (shell.compare("mO")==0) regionID += 3;
248  else if (shell.compare("pI")==0) regionID += 6;
249  else if (shell.compare("pO")==0) regionID += 9;
250  else cout << "Shell_" << shell.data() << "?!" << endl;
251  string layer = thePath.substr(thePath.find("Layer",0)+6,1);
252  regionID += (atoi(layer.data())-1);
253  }
254  else if (thePath.find("Endcap",0)!=string::npos) {
255  regionID += 12;
256  string halfCylinder = thePath.substr(thePath.find("HalfCylinder",0)+13,2);
257  if (halfCylinder.compare("mI")==0) regionID += 0;
258  else if (halfCylinder.compare("mO")==0) regionID += 2;
259  else if (halfCylinder.compare("pI")==0) regionID += 4;
260  else if (halfCylinder.compare("pO")==0) regionID += 6;
261  else cout << "HalfCylinder_" << halfCylinder.data() << "?!" << endl;
262  string disk = thePath.substr(thePath.find("Disk",0)+5,1);
263  regionID += (atoi(disk.data())-1);
264  }
265  }
266  else if (thePath.find("Ladder",0)!=string::npos || thePath.find("Blade",0)!=string::npos) {
267  regionID = 1000;
268  if (thePath.find("Barrel",0)!=string::npos) {
269  regionID += 0;
270  string shell = thePath.substr(thePath.find("Shell",0)+6,2);
271  if (shell.compare("mI")==0) regionID += 0;
272  else if (shell.compare("mO")==0) regionID += 48;
273  else if (shell.compare("pI")==0) regionID += 96;
274  else if (shell.compare("pO")==0) regionID += 144;
275  else cout << "Shell_" << shell.data() << "?!" << endl;
276  string layer = thePath.substr(thePath.find("Layer",0)+6,1);
277  if (layer.compare("1")==0) regionID += 0;
278  else if (layer.compare("2")==0) regionID += 10;
279  else if (layer.compare("3")==0) regionID += 26;
280  else cout << "Layer_" << layer.data() << "?!" << endl;
281  string ladder = thePath.substr(thePath.find("Ladder",0)+7,2);
282  regionID += (atoi(ladder.data())-1);
283  }
284  else if (thePath.find("Endcap",0)!=string::npos) {
285  regionID += 192;
286  string halfCylinder = thePath.substr(thePath.find("HalfCylinder",0)+13,2);
287  if (halfCylinder.compare("mI")==0) regionID += 0;
288  else if (halfCylinder.compare("mO")==0) regionID += 24;
289  else if (halfCylinder.compare("pI")==0) regionID += 48;
290  else if (halfCylinder.compare("pO")==0) regionID += 72;
291  else cout << "HalfCylinder_" << halfCylinder.data() << "?!" << endl;
292  string disk = thePath.substr(thePath.find("Disk",0)+5,1);
293  string blade = thePath.substr(thePath.find("Blade",0)+6,2);
294  regionID += (12*(atoi(disk.data())-1) + atoi(blade.data())-1);
295  }
296  }
297  return regionID;
298 }
299 
300 
301 void SiPixelHistoricInfoDQMClient::getSummaryMEmeanRMSnBins(vector<MonitorElement*>::const_iterator iME,
302  float& mean, float& RMS, float& emPtn) const {
303  int nBins=0; for (int b=0; b<(*iME)->getNbinsX(); b++) {
304  float binMean = (*iME)->getBinContent(b+1);
305  float binRMS = (*iME)->getBinError(b+1);
306  if (binMean!=0.0 || binRMS!=0.0) { nBins++; mean += binMean; RMS += pow(binRMS,2); }
307  }
308  if (nBins>0) {
309  mean = mean/float(nBins);
310  RMS = sqrt(RMS/float(nBins)); // emPtn = proportion of empty modules in a summary ME
311  }
312  if ((*iME)->getNbinsX()>0) emPtn = 1.0 - float(nBins)/float((*iME)->getNbinsX());
313 }
314 
315 
317  for (map< uint32_t, vector<MonitorElement*> >::const_iterator iMEvec = mapOfdetIDtoMEs.begin();
318  iMEvec!=mapOfdetIDtoMEs.end(); iMEvec++) {
319  uint32_t theMEdetID = iMEvec->first;
320  vector<MonitorElement*> theMEvector = iMEvec->second;
321 
322  if (printDebug_) {
323  cout << theMEdetID << ":"; for (vector<MonitorElement*>::const_iterator iME = theMEvector.begin();
324  iME!=theMEvector.end(); iME++) cout << (*iME)->getName() << ","; cout << endl;
325  }
326  for (vector<MonitorElement*>::const_iterator iME = theMEvector.begin(); iME!=theMEvector.end(); iME++) {
327  string theMEname = (*iME)->getName();
328 
329  if (theMEdetID<50) {
330  // from SiPixelMonitorRawData
331  if (theMEname.find("errorType_siPixelDigis")!=string::npos) {
332  for (int v=25; v<40; v++) {
333  int b = (*iME)->getTH1()->GetXaxis()->FindBin(v);
334  performanceSummary->setRawDataErrorType(theMEdetID, v-25, (*iME)->getBinContent(b));
335  }
336  }
337  }
338  // from SiPixelMonitorTrack
339  else if (theMEdetID==77) {
340  if (theMEname.find("ntracks")!=string::npos && theMEname.find("InPixVol")==string::npos) {
341  float trkMean=0.0, trkRMS=0.0;
342  if ((*iME)->getBinContent(1)>0.0) {
343  trkMean = float((*iME)->getBinContent(3))/(*iME)->getBinContent(1); // Barrel regionID: 80
344  trkRMS = sqrt(trkMean*(trkMean+1.0)/(*iME)->getBinContent(1));
345  performanceSummary->setFractionOfTracks(80, trkMean, trkRMS);
346 
347  trkMean = float((*iME)->getBinContent(4))/(*iME)->getBinContent(1); // Endcap regionID: 81
348  trkRMS = sqrt(trkMean*(trkMean+1.0)/(*iME)->getBinContent(1));
349  performanceSummary->setFractionOfTracks(81, trkMean, trkRMS);
350  }
351  }
352  }
353  else if (theMEdetID==78) { // OnTrack
354  if (theMEname.find("nclusters_siPixelClusters")!=string::npos) {
355  performanceSummary->setNumberOfOnTrackClusters(80, (*iME)->getBinContent(2));
356  performanceSummary->setNumberOfOnTrackClusters(81, (*iME)->getBinContent(3));
357  }
358  if (theMEname.find("charge_siPixelClusters_Barrel")!=string::npos) {
359  performanceSummary->setClusterChargeOnTrack(80, (*iME)->getMean(), (*iME)->getRMS());
360  }
361  if (theMEname.find("charge_siPixelClusters_Endcap")!=string::npos) {
362  performanceSummary->setClusterChargeOnTrack(81, (*iME)->getMean(), (*iME)->getRMS());
363  }
364  if (theMEname.find("size_siPixelClusters_Barrel")!=string::npos) {
365  performanceSummary->setClusterSizeOnTrack(80, (*iME)->getMean(), (*iME)->getRMS());
366  }
367  if (theMEname.find("size_siPixelClusters_Endcap")!=string::npos) {
368  performanceSummary->setClusterSizeOnTrack(81, (*iME)->getMean(), (*iME)->getRMS());
369  }
370  }
371  else if (theMEdetID==79) { // OffTrack
372  if (theMEname.find("nclusters_siPixelClusters")!=string::npos) {
373  performanceSummary->setNumberOfOffTrackClusters(80, (*iME)->getBinContent(2));
374  performanceSummary->setNumberOfOffTrackClusters(81, (*iME)->getBinContent(3));
375  }
376  if (theMEname.find("charge_siPixelClusters_Barrel")!=string::npos) {
377  performanceSummary->setClusterChargeOffTrack(80, (*iME)->getMean(), (*iME)->getRMS());
378  }
379  if (theMEname.find("charge_siPixelClusters_Endcap")!=string::npos) {
380  performanceSummary->setClusterChargeOffTrack(81, (*iME)->getMean(), (*iME)->getRMS());
381  }
382  if (theMEname.find("size_siPixelClusters_Barrel")!=string::npos) {
383  performanceSummary->setClusterSizeOffTrack(80, (*iME)->getMean(), (*iME)->getRMS());
384  }
385  if (theMEname.find("size_siPixelClusters_Endcap")!=string::npos) {
386  performanceSummary->setClusterSizeOffTrack(81, (*iME)->getMean(), (*iME)->getRMS());
387  }
388  }
389  else {
390  if (useSummary_) {
391  if (theMEname.find("SUM")!=string::npos) {
392  // from SiPixelMonitorDigi
393  if (theMEname.find("ndigis")!=string::npos && theMEname.find("FREQ")==string::npos) {
394  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
395  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
396  performanceSummary->setNumberOfDigis(theMEdetID, avgMean, avgRMS, emPtn);
397  }
398  if (theMEname.find("adc")!=string::npos) {
399  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
400  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
401  performanceSummary->setADC(theMEdetID, avgMean, avgRMS, emPtn);
402  }
403  // from SiPixelMonitorCluster
404  if (theMEname.find("nclusters")!=string::npos) {
405  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
406  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
407  performanceSummary->setNumberOfClusters(theMEdetID, avgMean, avgRMS, emPtn);
408  }
409  if (theMEname.find("charge")!=string::npos) {
410  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
411  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
412  performanceSummary->setClusterCharge(theMEdetID, avgMean, avgRMS, emPtn);
413  }
414  if (theMEname.find("size")!=string::npos) {
415  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
416  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
417  performanceSummary->setClusterSize(theMEdetID, avgMean, avgRMS, emPtn);
418  }
419  if (theMEname.find("sizeX")!=string::npos) {
420  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
421  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
422  performanceSummary->setClusterSizeX(theMEdetID, avgMean, avgRMS, emPtn);
423  }
424  if (theMEname.find("sizeY")!=string::npos) {
425  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
426  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
427  performanceSummary->setClusterSizeY(theMEdetID, avgMean, avgRMS, emPtn);
428  }
429  // from SiPixelMonitorRecHit
430  if (theMEname.find("nRecHits")!=string::npos) {
431  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
432  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
433  performanceSummary->setNumberOfRecHits(theMEdetID, avgMean, avgRMS, emPtn);
434  }
435  // from SiPixelMonitorTrack
436  if (theMEname.find("residualX")!=string::npos) {
437  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
438  getSummaryMEmeanRMSnBins(iME, avgMean, avgRMS, emPtn);
439  performanceSummary->setResidualX(theMEdetID, avgMean, avgRMS, emPtn);
440  }
441  if (theMEname.find("residualY")!=string::npos) {
442  float avgMean=0.0, avgRMS=0.0, emPtn=0.0;
443  performanceSummary->setResidualY(theMEdetID, avgMean, avgRMS, emPtn);
444  }
445  // temporary solutions
446  if (theMEname.find("OccupancyMap")!=std::string::npos) { // entire barrel and entire endcap only
447  int nNoisyCells=0, nEmptyCells=0;
448  for (int xBin=0; xBin<(*iME)->getNbinsX(); xBin++) { // 1 pixel per bin
449  for (int yBin=0; yBin<(*iME)->getNbinsY(); yBin++) {
450  if ((*iME)->getBinContent(xBin+1, yBin+1)>0.01*(*iME)->getEntries()) nNoisyCells++;
451  if ((*iME)->getBinContent(xBin+1, yBin+1)==.0 && (*iME)->getBinError(xBin+1, yBin+1)==0.0) nEmptyCells++;
452  }
453  }
454  performanceSummary->setNumberOfNoisCells(theMEdetID, float(nNoisyCells));
455  performanceSummary->setNumberOfDeadCells(theMEdetID, float(nEmptyCells));
456  }
457  // performanceSummary->setNumberOfPixelHitsInTrackFit(theMEdetId, float(nPixelHits));
458  }
459  else {
460  // from SiPixelMonitorDigi
461  if (theMEname.find("ndigis_siPixelDigis")!=string::npos && theMEname.find("FREQ")==string::npos) {
462  performanceSummary->setNumberOfDigis(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
463  }
464  if (theMEname.find("adc_siPixelDigis")!=string::npos) {
465  performanceSummary->setADC(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
466  }
467  // from SiPixelMonitorCluster
468  if (theMEname.find("nclusters_siPixelClusters")!=string::npos) {
469  performanceSummary->setNumberOfClusters(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
470  }
471  if (theMEname.find("charge_siPixelClusters")!=string::npos) {
472  performanceSummary->setClusterCharge(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
473  }
474  if (theMEname.find("size_siPixelClusters")!=string::npos) {
475  performanceSummary->setClusterSize(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
476  }
477  if (theMEname.find("sizeX_siPixelClusters")!=string::npos) {
478  performanceSummary->setClusterSizeX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
479  }
480  if (theMEname.find("sizeY_siPixelClusters")!=string::npos) {
481  performanceSummary->setClusterSizeY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
482  }
483  // from SiPixelMonitorRecHit
484  if (theMEname.find("nRecHits_siPixelRecHits")!=string::npos) {
485  performanceSummary->setNumberOfRecHits(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
486  }
487  // from SiPixelMonitorTrack
488  if (theMEname.find("residualX_siPixelTrackResiduals")!=string::npos) {
489  performanceSummary->setResidualX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
490  }
491  if (theMEname.find("residualY_siPixelTrackResiduals")!=string::npos) {
492  performanceSummary->setResidualY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:-99.9));
493  }
494  }
495  }
496  else {
497  // from SiPixelMonitorDigi
498  if (theMEname.find("ndigis_siPixelDigis")!=string::npos && theMEname.find("FREQ")==string::npos) {
499  performanceSummary->setNumberOfDigis(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
500  }
501  if (theMEname.find("adc_siPixelDigis")!=string::npos) {
502  performanceSummary->setADC(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
503  }
504  // from SiPixelMonitorCluster
505  if (theMEname.find("nclusters_siPixelClusters")!=string::npos) {
506  performanceSummary->setNumberOfClusters(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
507  }
508  if (theMEname.find("charge_siPixelClusters")!=string::npos) {
509  performanceSummary->setClusterCharge(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
510  }
511  if (theMEname.find("size_siPixelClusters")!=string::npos) {
512  performanceSummary->setClusterSize(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
513  }
514  if (theMEname.find("sizeX_siPixelClusters")!=string::npos) {
515  performanceSummary->setClusterSizeX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
516  }
517  if (theMEname.find("sizeY_siPixelClusters")!=string::npos) {
518  performanceSummary->setClusterSizeY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
519  }
520  // from SiPixelMonitorRecHit
521  if (theMEname.find("nRecHits_siPixelRecHits")!=string::npos) {
522  performanceSummary->setNumberOfRecHits(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
523  }
524  // from SiPixelMonitorTrack
525  if (theMEname.find("residualX_siPixelTrackResiduals")!=string::npos) {
526  performanceSummary->setResidualX(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
527  }
528  if (theMEname.find("residualY_siPixelTrackResiduals")!=string::npos) {
529  performanceSummary->setResidualY(theMEdetID, (*iME)->getMean(), (*iME)->getRMS(), ((*iME)->getEntries()==0.0 ? 1.0:0.0));
530  }
531  // temporary solutions
532  if (theMEname.find("hitmap_siPixelClusters")!=std::string::npos ||
533  theMEname.find("hitmap_siPixelDigis")!=std::string::npos) { // if digi map exists, use it; else use cluster map
534  int nNoisyCells=0, nEmptyCells=0; // not use xypos_siPixelRecHits
535  for (int xBin=0; xBin<(*iME)->getNbinsX(); xBin++) { // 4-1 pixel per bin
536  for (int yBin=0; yBin<(*iME)->getNbinsY(); yBin++) {
537  if ((*iME)->getBinContent(xBin+1, yBin+1)>0.01*(*iME)->getEntries()) nNoisyCells++;
538  if ((*iME)->getBinContent(xBin+1, yBin+1)==.0 && (*iME)->getBinError(xBin+1, yBin+1)==0.0) nEmptyCells++;
539  }
540  }
541  performanceSummary->setNumberOfNoisCells(theMEdetID, float(nNoisyCells));
542  performanceSummary->setNumberOfDeadCells(theMEdetID, float(nEmptyCells));
543  }
544  // performanceSummary->setNumberOfPixelHitsInTrackFit(theMEdetId, float(nPixelHits));
545  }
546  }
547  }
548  }
549 }
550 
551 
553  if (printDebug_) performanceSummary->printAll();
554  else performanceSummary->print();
555  cout << "SiPixelHistoricInfoDQMClient::writeDB()" << endl;
556 
558  if (mydbservice.isAvailable()) {
559  if (mydbservice->isNewTagRequest("SiPixelPerformanceSummaryRcd")) {
560  mydbservice->createNewIOV<SiPixelPerformanceSummary>(performanceSummary,
561  mydbservice->beginOfTime(),
562  mydbservice->endOfTime(),
563  "SiPixelPerformanceSummaryRcd");
564  }
565  else {
566  mydbservice->appendSinceTime<SiPixelPerformanceSummary>(performanceSummary,
567  mydbservice->currentTime(),
568  "SiPixelPerformanceSummaryRcd");
569  }
570  }
571  else LogError("writeDB") << "service unavailable" << endl;
572 }
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
RunNumber_t run() const
Definition: RunBase.h:42
tuple yBin
Definition: cuy.py:891
void endRun(const edm::Run &, const edm::EventSetup &)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
dictionary map
Definition: Association.py:205
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
T sqrt(T t)
Definition: SSEVec.h:48
void getSummaryMEmeanRMSnBins(std::vector< MonitorElement * >::const_iterator, float &, float &, float &) const
uint32_t getSummaryRegionID(std::string) const
double getFloatValue(void) const
bool isAvailable() const
Definition: Service.h:47
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
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1502
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
DQMStore * dbe_
SiPixelHistoricInfoDQMClient(const edm::ParameterSet &)
int64_t getIntValue(void) const
double b
Definition: hdecay.h:120
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
Definition: DQMStore.cc:2437
tuple cout
Definition: gather_cfg.py:121
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
Definition: Run.h:36