CMS 3D CMS Logo

SiPixelGainCalibrationAnalysis.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: SiPixelGainCalibrationAnalysis
4 // Class: SiPixelGainCalibrationAnalysis
5 //
13 //
14 // Original Author: Freya Blekman
15 // Created: Wed Nov 14 15:02:06 CET 2007
16 //
17 //
18 
19 // user include files
21 
23 #include <sstream>
24 #include <vector>
25 #include <cmath>
26 #include "TGraphErrors.h"
27 #include "TMath.h"
28 
29 using std::cout;
30 using std::endl;
31 //
32 // constructors and destructor
33 //
36  conf_(iConfig),
37  bookkeeper_(),
38  bookkeeper_pixels_(),
39  nfitparameters_(iConfig.getUntrackedParameter<int>("numberOfFitParameters", 2)),
40  fitfunction_(iConfig.getUntrackedParameter<std::string>("fitFunctionRootFormula", "pol1")),
41  listofdetids_(conf_.getUntrackedParameter<std::vector<uint32_t> >("listOfDetIDs")),
42  ignoreMode_(conf_.getUntrackedParameter<bool>("ignoreMode", false)),
43  reject_plateaupoints_(iConfig.getUntrackedParameter<bool>("suppressPlateauInFit", true)),
44  reject_single_entries_(iConfig.getUntrackedParameter<bool>("suppressPointsWithOneEntryOrLess", true)),
45  plateau_max_slope_(iConfig.getUntrackedParameter<double>("plateauSlopeMax", 1.0)),
46  reject_first_point_(iConfig.getUntrackedParameter<bool>("rejectVCalZero", true)),
47  reject_badpoints_frac_(iConfig.getUntrackedParameter<double>("suppressZeroAndPlateausInFitFrac", 0)),
48  bookBIGCalibPayload_(iConfig.getUntrackedParameter<bool>("saveFullPayloads", false)),
49  savePixelHists_(iConfig.getUntrackedParameter<bool>("savePixelLevelHists", false)),
50  chi2Threshold_(iConfig.getUntrackedParameter<double>("minChi2NDFforHistSave", 10)),
51  chi2ProbThreshold_(iConfig.getUntrackedParameter<double>("minChi2ProbforHistSave", 0.05)),
52  maxGainInHist_(iConfig.getUntrackedParameter<double>("maxGainInHist", 10)),
53  maxChi2InHist_(iConfig.getUntrackedParameter<double>("maxChi2InHist", 25)),
54  saveALLHistograms_(iConfig.getUntrackedParameter<bool>("saveAllHistograms", false)),
55 
56  filldb_(iConfig.getUntrackedParameter<bool>("writeDatabase", false)),
57  writeSummary_(iConfig.getUntrackedParameter<bool>("writeSummary", true)),
58  recordName_(conf_.getParameter<std::string>("record")),
59 
60  appendMode_(conf_.getUntrackedParameter<bool>("appendMode", true)),
61  /*theGainCalibrationDbInput_(0),
62  theGainCalibrationDbInputOffline_(0),
63  theGainCalibrationDbInputHLT_(0),
64  theGainCalibrationDbInputService_(iConfig),*/
65  gainlow_(10.),
66  gainhi_(0.),
67  pedlow_(255.),
68  pedhi_(0.),
69  useVcalHigh_(conf_.getParameter<bool>("useVCALHIGH")),
70  scalarVcalHigh_VcalLow_(conf_.getParameter<double>("vcalHighToLowConversionFac")) {
72  min_nentries_ = 1;
73  else
74  min_nentries_ = 0;
75  ::putenv((char *)"CORAL_AUTH_USER=me");
76  ::putenv((char *)"CORAL_AUTH_PASSWORD=test");
77  edm::LogInfo("SiPixelGainCalibrationAnalysis") << "now using fit function " << fitfunction_ << ", which has "
78  << nfitparameters_ << " free parameters. " << std::endl;
79  func_ = new TF1("func", fitfunction_.c_str(), 0, 256 * scalarVcalHigh_VcalLow_);
80  graph_ = new TGraphErrors();
81  currentDetID_ = 0;
82  summary_.open("SummaryPerDetID.txt");
83  statusNumbers_ = new int[10];
84  for (int ii = 0; ii < 10; ii++)
85  statusNumbers_[ii] = 0;
86 }
87 
89 // member functions
90 //
91 // ------------ method called once each job just before starting event loop ------------
92 
94  std::vector<float> result;
95  int ncols = bookkeeper_[detid][label]->getNbinsX();
96  int nrows = bookkeeper_[detid][label]->getNbinsY();
97  for (int icol = 1; icol <= ncols; ++icol) {
98  float val = 0;
99  float ntimes = 0;
100  for (int irow = 1; irow <= nrows; ++irow) {
101  val += bookkeeper_[detid][label]->getBinContent(icol, irow);
102  ntimes++;
103  }
104  val /= ntimes;
105  result.push_back(val);
106  }
107  return result;
108 }
109 
111  if (calibrationMode_ == "GainCalibration")
112  return true;
113  else if (ignoreMode_ == true)
114  return true;
115  else if (calibrationMode_ == "unknown") {
116  edm::LogInfo("SiPixelGainCalibrationAnalysis")
117  << "calibration mode is: " << calibrationMode_ << ", continuing anyway...";
118  return true;
119  } else {
120  // edm::LogError("SiPixelGainCalibrationAnalysis") << "unknown calibration mode for Gain calibration, should be \"Gain\" and is \"" << calibrationMode_ << "\"";
121  }
122  return false;
123 }
124 
126 //------- summary printing method. Very verbose.
128  uint32_t detid = 0;
129  for (std::map<uint32_t, std::map<std::string, MonitorElement *> >::const_iterator idet = bookkeeper_.begin();
130  idet != bookkeeper_.end();
131  ++idet) {
132  if (detid == idet->first)
133  continue; // only do things once per detid
134  detid = idet->first;
135  std::vector<float> gainvec = CalculateAveragePerColumn(detid, "gain_2d");
136  std::vector<float> pedvec = CalculateAveragePerColumn(detid, "ped_2d");
137  std::vector<float> chi2vec = CalculateAveragePerColumn(detid, "chi2_2d");
138  std::ostringstream summarytext;
139 
140  summarytext << "Summary for det ID " << detid << "(" << translateDetIdToString(detid) << ")\n";
141  summarytext << "\t Following: values per column: column #, gain, pedestal, chi2\n";
142  for (uint32_t i = 0; i < gainvec.size(); i++)
143  summarytext << "\t " << i << " \t" << gainvec[i] << " \t" << pedvec[i] << " \t" << chi2vec[i] << "\n";
144  summarytext << "\t list of pixels with high chi2 (chi2> " << chi2Threshold_ << "): \n";
145 
146  for (std::map<std::string, MonitorElement *>::const_iterator ipix = bookkeeper_pixels_[detid].begin();
147  ipix != bookkeeper_pixels_[detid].end();
148  ++ipix)
149  summarytext << "\t " << ipix->first << "\n";
150  edm::LogInfo("SiPixelGainCalibrationAnalysis") << summarytext.str() << std::endl;
151  }
152  if (summary_.is_open()) {
153  summary_.close();
154  summary_.open("Summary.txt");
155  summary_ << "Total Number of Pixel computed :" << statusNumbers_[9] << endl;
156  summary_ << "Number of pixel tagged with status :" << endl;
157  for (int ii = 0; ii < 9; ii++)
158  summary_ << ii << " -> " << statusNumbers_[ii] << " ~ "
159  << double(statusNumbers_[ii]) / double(statusNumbers_[9]) * 100. << " %" << endl;
160 
161  summary_.close();
162  }
163 }
164 
165 // ------------ method called once each job just after ending the event loop ------------
166 
168  if (writeSummary_)
169  printSummary();
170 
171  // this is where we loop over all histograms and save the database objects
172  if (filldb_)
173  fillDatabase();
174 }
175 //-----------method to fill the database
177  // only create when necessary.
178  // process the minimum and maximum gain & ped values...
179  edm::LogError("SiPixelGainCalibration::fillDatabase()")
180  << "PLEASE do not fill the database directly from the gain calibration analyzer. This function is currently "
181  "disabled and no DB payloads will be produced!"
182  << std::endl;
183 }
184 // ------------ method called to do fits to all objects available ------------
185 bool SiPixelGainCalibrationAnalysis::doFits(uint32_t detid, std::vector<SiPixelCalibDigi>::const_iterator ipix) {
186  float lowmeanval = 255;
187  float highmeanval = 0;
188  bool makehistopersistent = saveALLHistograms_;
189  std::vector<uint32_t>::const_iterator detidfinder = find(listofdetids_.begin(), listofdetids_.end(), detid);
190  if (detidfinder != listofdetids_.end())
191  makehistopersistent = true;
192  // first, fill the input arrays to the TLinearFitter.
193  double xvals[257];
194  double yvals[256];
195  double yerrvals[256];
196  double xvalsall[257];
197  double yvalsall[256];
198  double yerrvalsall[256];
199  int npoints = 0;
200  int nallpoints = 0;
201  bool use_point = true;
202  int status = 0;
203  statusNumbers_[9]++;
204 
205  bookkeeper_[detid]["status_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, 0);
206  if (writeSummary_ && detid != currentDetID_) {
207  currentDetID_ = detid;
208  summary_ << endl << "DetId_" << currentDetID_ << endl;
209  }
210 
211  for (uint32_t ii = 0; ii < ipix->getnpoints() && ii < 200; ii++) {
212  // std::cout << ipix->getsum(ii) << " " << ipix->getnentries(ii) << " " << ipix->getsumsquares(ii) << std::endl;
213  nallpoints++;
214  use_point = true;
215  if (useVcalHigh_) {
216  xvalsall[ii] = vCalValues_[ii] * scalarVcalHigh_VcalLow_;
217  } else
218  xvalsall[ii] = vCalValues_[ii];
219  yerrvalsall[ii] = yvalsall[ii] = 0;
220 
221  if (ipix->getnentries(ii) > min_nentries_) {
222  yvalsall[ii] = ipix->getsum(ii) / (float)ipix->getnentries(ii);
223  yerrvalsall[ii] = ipix->getsumsquares(ii) / (float)(ipix->getnentries(ii));
224  yerrvalsall[ii] -= pow(yvalsall[ii], 2);
225  yerrvalsall[ii] = sqrt(yerrvalsall[ii]) / sqrt(ipix->getnentries(ii));
226 
227  if (yvalsall[ii] < lowmeanval)
228  lowmeanval = yvalsall[ii];
229  if (yvalsall[ii] > highmeanval)
230  highmeanval = yvalsall[ii];
231  }
232  }
233 
234  // calculate plateau value from last 4 entries
235  double plateauval = 0;
236  bool noPlateau = false;
237  if (nallpoints >= 4) {
238  for (int ii = nallpoints - 1; ii > nallpoints - 5; --ii)
239  plateauval += yvalsall[ii];
240  plateauval /= 4;
241  for (int ii = nallpoints - 1; ii > nallpoints - 5; --ii) {
242  if (fabs(yvalsall[ii] - plateauval) > 5) {
243  plateauval = 255;
244  noPlateau = true;
245  continue;
246  }
247  }
248 
249  int NbofPointsInPlateau = 0;
250  for (int ii = 0; ii < nallpoints; ++ii)
251  if (fabs(yvalsall[ii] - plateauval) < 10 || yvalsall[ii] == 0)
252  NbofPointsInPlateau++;
253  //summary_<<"row_"<<ipix->row()<<" col_"<<ipix->col()<<" "<<plateauval<<" "<<NbofPointsInPlateau<<" "<<nallpoints<<endl;
254  if (NbofPointsInPlateau >= (nallpoints - 2)) {
255  status = -2;
256  bookkeeper_[detid]["status_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, status);
257  if (writeSummary_) {
258  summary_ << "row_" << ipix->row() << " col_" << ipix->col() << " status_" << status << endl;
260  }
261  return false;
262  }
263  } else
264  plateauval = 255;
265 
266  double maxgoodvalinfit = plateauval * (1. - reject_badpoints_frac_);
267  npoints = 0;
268  for (int ii = 0; ii < nallpoints; ++ii) {
269  // now selecting the appropriate points for the fit.
270  use_point = true;
271  if (reject_first_point_ && xvalsall[ii] < 0.1)
272  use_point = false;
273  if (ipix->getnentries(ii) <= min_nentries_ && reject_single_entries_)
274  use_point = false;
275  if (ipix->getnentries(ii) == 0 && reject_badpoints_)
276  use_point = false;
277  if (yvalsall[ii] > maxgoodvalinfit && !noPlateau)
278  use_point = false;
279  if (ii > 1 && fabs(yvalsall[ii] - yvalsall[ii - 1]) < 5. && yvalsall[ii] > 0.8 * maxgoodvalinfit &&
281  use_point = false;
282  break;
283  }
284 
285  if (use_point) {
286  xvals[npoints] = xvalsall[ii];
287  yvals[npoints] = yvalsall[ii];
288  yerrvals[npoints] = yerrvalsall[ii];
289  npoints++;
290  }
291  }
292 
293  float chi2, slope, intercept, prob, slopeerror, intercepterror;
294  prob = chi2 = -1;
295  slope = intercept = slopeerror = intercepterror = 0;
296 
297  // now check on number of points. If bad just start taking the first 4:
298 
299  if (npoints < 4) {
300  npoints = 0;
301  for (int ii = 0; ii < nallpoints && npoints < 4 && yvalsall[ii] < plateauval * 0.97; ++ii) {
302  if (yvalsall[ii] > 0) {
303  if (ii > 0 && yvalsall[ii] - yvalsall[ii - 1] < 0.1)
304  continue;
305  xvals[npoints] = xvalsall[ii];
306  yvals[npoints] = yvalsall[ii];
307  yerrvals[npoints] = yerrvalsall[ii];
308  npoints++;
309  }
310  }
311  }
312  if (npoints < 2) {
313  status = -7;
314  bookkeeper_[detid]["status_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, status);
315  if (writeSummary_) {
316  summary_ << "row_" << ipix->row() << " col_" << ipix->col() << " status_" << status << endl;
318  }
319  std::ostringstream pixelinfo;
320  pixelinfo << "GainCurve_row_" << ipix->row() << "_col_" << ipix->col();
321  std::string tempname = translateDetIdToString(detid);
322  tempname += "_";
323  tempname += pixelinfo.str();
324  setDQMDirectory(detid);
325  bookkeeper_pixels_[detid][pixelinfo.str()] = bookDQMHistogram1D(
326  detid, pixelinfo.str(), tempname, 105 * nallpoints, xvalsall[0], xvalsall[nallpoints - 1] * 1.05);
327  for (int ii = 0; ii < nallpoints; ++ii)
328  bookkeeper_pixels_[detid][pixelinfo.str()]->Fill(xvalsall[ii], yvalsall[ii]);
329  return false;
330  }
331 
332  // std::cout << "starting fit!" << std::endl;
333  graph_->Set(npoints);
334 
335  func_->SetParameter(0, 50.);
336  func_->SetParameter(1, 0.25);
337  for (int ipointtemp = 0; ipointtemp < npoints; ++ipointtemp) {
338  graph_->SetPoint(ipointtemp, xvals[ipointtemp], yvals[ipointtemp]);
339  graph_->SetPointError(ipointtemp, 0, yerrvals[ipointtemp]);
340  }
341  Int_t tempresult = graph_->Fit(func_, "FQ0N");
342  slope = func_->GetParameter(1);
343  slopeerror = func_->GetParError(1);
344  intercept = func_->GetParameter(0);
345  intercepterror = func_->GetParError(0);
346  chi2 = func_->GetChisquare() / ((float)npoints - func_->GetNpar());
347  prob = TMath::Prob(func_->GetChisquare(), npoints - func_->GetNpar());
348  size_t ntimes = 0;
349  while ((isnan(slope) || isnan(intercept)) && ntimes < 10) {
350  ntimes++;
351  makehistopersistent = true;
352  // std::cout << slope << " " << intercept << " " << prob << std::endl;
353  edm::LogWarning("SiPixelGainCalibrationAnalysis") << "impossible to fit values, try " << ntimes << ": ";
354  for (int ii = 0; ii < npoints; ++ii) {
355  edm::LogWarning("SiPixelGainCalibrationAnalysis")
356  << "vcal " << xvals[ii] << " response: " << yvals[ii] << "+/-" << yerrvals[ii] << std::endl;
357  }
358  tempresult = graph_->Fit(func_, "FQ0NW");
359  slope = func_->GetParameter(1);
360  slopeerror = func_->GetParError(1);
361  intercept = func_->GetParameter(0);
362  intercepterror = func_->GetParError(0);
363  chi2 = func_->GetChisquare() / ((float)npoints - func_->GetNpar());
364  prob = TMath::Prob(func_->GetChisquare(), npoints - func_->GetNpar());
365  }
366 
367  if (tempresult == 0)
368  status = 1;
369  else
370  status = 0;
371  if (slope != 0)
372  slope = 1. / slope;
373  if (isnan(slope) || isnan(intercept)) {
374  status = -6;
375  bookkeeper_[detid]["status_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, status);
376  if (writeSummary_) {
377  summary_ << "row_" << ipix->row() << " col_" << ipix->col() << " status_" << status << endl;
379  }
380  //return false;
381  }
382  if (chi2 > chi2Threshold_ && chi2Threshold_ >= 0)
383  status = 5;
384  if (prob < chi2ProbThreshold_)
385  status = 5;
386  if (noPlateau)
387  status = 3;
388  if (nallpoints < 4)
389  status = -7;
390  if (TMath::Abs(slope > maxGainInHist_) || slope < 0)
391  status = -8;
392  if (status != 1)
393  makehistopersistent = true;
395 
396  if (slope < gainlow_)
397  gainlow_ = slope;
398  if (slope > gainhi_)
399  gainhi_ = slope;
400  if (intercept > pedhi_)
401  pedhi_ = intercept;
402  if (intercept < pedlow_)
403  pedlow_ = intercept;
404  bookkeeper_[detid]["gain_1d"]->Fill(slope);
405  if (slope > maxGainInHist_) {
406  makehistopersistent = true;
407  edm::LogWarning("SiPixelGainCalibration")
408  << "For DETID " << detid << "pixel row,col " << ipix->row() << "," << ipix->col() << " Gain was measured to be "
409  << slope << " which is outside the range of the summary plot (" << maxGainInHist_ << ") !!!! " << std::endl;
410  }
411  bookkeeper_[detid]["dynamicrange_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, highmeanval - lowmeanval);
412  bookkeeper_[detid]["plateau_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, highmeanval);
413  bookkeeper_[detid]["gain_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, slope);
414  bookkeeper_[detid]["errorgain_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, slopeerror);
415  bookkeeper_[detid]["ped_1d"]->Fill(intercept);
416  bookkeeper_[detid]["ped_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, intercept);
417  bookkeeper_[detid]["errorped_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, intercepterror);
418  bookkeeper_[detid]["chi2_1d"]->Fill(chi2);
419  bookkeeper_[detid]["chi2_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, chi2);
420  bookkeeper_[detid]["prob_1d"]->Fill(prob);
421  bookkeeper_[detid]["prob_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, prob);
422  bookkeeper_[detid]["lowpoint_1d"]->Fill(xvals[0]);
423  bookkeeper_[detid]["lowpoint_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, xvals[0]);
424  bookkeeper_[detid]["highpoint_1d"]->Fill(xvals[npoints - 1]);
425  bookkeeper_[detid]["highpoint_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, xvals[npoints - 1]);
426  bookkeeper_[detid]["nfitpoints_1d"]->Fill(npoints);
427  bookkeeper_[detid]["endpoint_1d"]->Fill((255 - intercept) * slope);
428  bookkeeper_[detid]["status_2d"]->setBinContent(ipix->col() + 1, ipix->row() + 1, status);
429 
430  if (!savePixelHists_)
431  return true;
432  if (detidfinder == listofdetids_.end() && !listofdetids_.empty())
433  return true;
434  if (makehistopersistent) {
435  std::ostringstream pixelinfo;
436  pixelinfo << "GainCurve_row_" << ipix->row() << "_col_" << ipix->col();
437  std::string tempname = translateDetIdToString(detid);
438  tempname += "_";
439  tempname += pixelinfo.str();
440 
441  // and book the histo
442  // fill the last value of the vcal array...
443 
444  setDQMDirectory(detid);
445  bookkeeper_pixels_[detid][pixelinfo.str()] = bookDQMHistogram1D(
446  detid, pixelinfo.str(), tempname, 105 * nallpoints, xvalsall[0], xvalsall[nallpoints - 1] * 1.05);
447 
448  edm::LogInfo("SiPixelGainCalibrationAnalysis")
449  << "now saving histogram for pixel " << tempname << ", gain = " << slope << ", pedestal = " << intercept
450  << ", chi2/NDF=" << chi2 << "(prob:" << prob << "), fit status " << status;
451  for (int ii = 0; ii < nallpoints; ++ii) {
452  // std::cout << xvalsall[ii]<<","<<yvalsall[ii]<< " " << tempfloats[ii] << std::endl;
453  bookkeeper_pixels_[detid][pixelinfo.str()]->Fill(xvalsall[ii], yvalsall[ii]);
454  }
455 
456  // addTF1ToDQMMonitoringElement(bookkeeper_pixels_[detid][pixelinfo.str()],func_);
457 
458  if (writeSummary_) {
459  summary_ << "row_" << ipix->row() << " col_" << ipix->col();
460  summary_ << " status_" << status;
461  summary_ << endl;
462 
463  //std::cout<<detid<<" "<<"row " <<ipix->row()<<" col "<<ipix->col()<<" "<<status<<" "<<chi2<<" "<<prob<<" "<<npoints<<" "<<xvals[0]<<" "<<xvals[npoints-1]<<" "<<plateauval<<std::endl;
464  }
465  }
466  return true;
467 }
468 // ------------ method called to do fill new detids ------------
470  setDQMDirectory(detid);
471  std::string tempname = translateDetIdToString(detid);
472  bookkeeper_[detid]["gain_1d"] = bookDQMHistogram1D(detid, "Gain1d", "gain for " + tempname, 100, 0., maxGainInHist_);
473  bookkeeper_[detid]["gain_2d"] = bookDQMHistoPlaquetteSummary2D(detid, "Gain2d", "gain for " + tempname);
474  bookkeeper_[detid]["errorgain_2d"] =
475  bookDQMHistoPlaquetteSummary2D(detid, "ErrorGain2d", "error on gain for " + tempname);
476  bookkeeper_[detid]["ped_1d"] = bookDQMHistogram1D(detid, "Pedestal1d", "pedestal for " + tempname, 256, 0., 256.0);
477  bookkeeper_[detid]["ped_2d"] = bookDQMHistoPlaquetteSummary2D(detid, "Pedestal2d", "pedestal for " + tempname);
478  bookkeeper_[detid]["errorped_2d"] =
479  bookDQMHistoPlaquetteSummary2D(detid, "ErrorPedestal2d", "error on pedestal for " + tempname);
480  bookkeeper_[detid]["chi2_1d"] =
481  bookDQMHistogram1D(detid, "GainChi2NDF1d", "#chi^{2}/NDOF for " + tempname, 100, 0., maxChi2InHist_);
482  bookkeeper_[detid]["chi2_2d"] =
483  bookDQMHistoPlaquetteSummary2D(detid, "GainChi2NDF2d", "#chi^{2}/NDOF for " + tempname);
484  bookkeeper_[detid]["prob_1d"] =
485  bookDQMHistogram1D(detid, "GainChi2Prob1d", "P(#chi^{2},NDOF) for " + tempname, 100, 0., 1.0);
486  bookkeeper_[detid]["prob_2d"] =
487  bookDQMHistoPlaquetteSummary2D(detid, "GainChi2Prob2d", "P(#chi^{2},NDOF) for " + tempname);
488  bookkeeper_[detid]["status_2d"] =
489  bookDQMHistoPlaquetteSummary2D(detid, "GainFitResult2d", "Fit result for " + tempname);
490  bookkeeper_[detid]["endpoint_1d"] = bookDQMHistogram1D(
491  detid, "GainEndPoint1d", "point where fit meets ADC=255 for " + tempname, 256, 0., 256. * scalarVcalHigh_VcalLow_);
492  bookkeeper_[detid]["lowpoint_1d"] = bookDQMHistogram1D(
493  detid, "GainLowPoint1d", "lowest fit point for " + tempname, 256, 0., 256. * scalarVcalHigh_VcalLow_);
494  bookkeeper_[detid]["highpoint_1d"] = bookDQMHistogram1D(
495  detid, "GainHighPoint1d", "highest fit point for " + tempname, 256, 0., 256. * scalarVcalHigh_VcalLow_);
496  bookkeeper_[detid]["nfitpoints_1d"] =
497  bookDQMHistogram1D(detid, "GainNPoints1d", "number of fit point for " + tempname, 20, 0., 20);
498  bookkeeper_[detid]["dynamicrange_2d"] = bookDQMHistoPlaquetteSummary2D(
499  detid, "GainDynamicRange2d", "Difference lowest and highest points on gain curve for " + tempname);
500  bookkeeper_[detid]["lowpoint_2d"] =
501  bookDQMHistoPlaquetteSummary2D(detid, "GainLowPoint2d", "lowest fit point for " + tempname);
502  bookkeeper_[detid]["highpoint_2d"] =
503  bookDQMHistoPlaquetteSummary2D(detid, "GainHighPoint2d", "highest fit point for " + tempname);
504  bookkeeper_[detid]["plateau_2d"] =
505  bookDQMHistoPlaquetteSummary2D(detid, "GainSaturate2d", "Highest points on gain curve for " + tempname);
506 }
507 //define this as a plug-in
SiPixelGainCalibrationAnalysis::fillDatabase
void fillDatabase()
Definition: SiPixelGainCalibrationAnalysis.cc:176
npoints
static const int npoints
Definition: NuclearInteractionFTFSimulator.h:38
SiPixelGainCalibrationAnalysis::printSummary
void printSummary()
Definition: SiPixelGainCalibrationAnalysis.cc:127
SiPixelGainCalibrationAnalysis::saveALLHistograms_
bool saveALLHistograms_
Definition: SiPixelGainCalibrationAnalysis.h:93
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
SiPixelOfflineCalibAnalysisBase::translateDetIdToString
std::string translateDetIdToString(uint32_t detid)
Definition: SiPixelOfflineCalibAnalysisBase.cc:146
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
funct::false
false
Definition: Factorize.h:34
SiPixelGainCalibrationAnalysis::maxGainInHist_
double maxGainInHist_
Definition: SiPixelGainCalibrationAnalysis.h:91
SiPixelOfflineCalibAnalysisBase::calibrationMode_
std::string calibrationMode_
Definition: SiPixelOfflineCalibAnalysisBase.h:117
mps_update.status
status
Definition: mps_update.py:69
SiPixelGainCalibrationAnalysis::SiPixelGainCalibrationAnalysis
SiPixelGainCalibrationAnalysis(const edm::ParameterSet &iConfig)
Definition: SiPixelGainCalibrationAnalysis.cc:34
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiPixelGainCalibrationAnalysis::writeSummary_
bool writeSummary_
Definition: SiPixelGainCalibrationAnalysis.h:97
edm::LogInfo
Definition: MessageLogger.h:254
SiPixelOfflineCalibAnalysisBase::bookDQMHistogram1D
MonitorElement * bookDQMHistogram1D(uint32_t detid, std::string name, std::string title, int nchX, double lowX, double highX)
Definition: SiPixelOfflineCalibAnalysisBase.cc:172
SiPixelGainCalibrationAnalysis::newDetID
void newDetID(uint32_t detid) override
Definition: SiPixelGainCalibrationAnalysis.cc:469
SiPixelGainCalibrationAnalysis::useVcalHigh_
bool useVcalHigh_
Definition: SiPixelGainCalibrationAnalysis.h:113
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
SiPixelGainCalibrationAnalysis::bookkeeper_pixels_
std::map< uint32_t, std::map< std::string, MonitorElement * > > bookkeeper_pixels_
Definition: SiPixelGainCalibrationAnalysis.h:69
SiPixelGainCalibrationAnalysis::reject_plateaupoints_
bool reject_plateaupoints_
Definition: SiPixelGainCalibrationAnalysis.h:82
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
SiPixelGainCalibrationAnalysis::pedlow_
float pedlow_
Definition: SiPixelGainCalibrationAnalysis.h:110
tools.TF1
TF1
Definition: tools.py:23
SiPixelGainCalibrationAnalysis::bookkeeper_
std::map< uint32_t, std::map< std::string, MonitorElement * > > bookkeeper_
Definition: SiPixelGainCalibrationAnalysis.h:68
SiPixelOfflineCalibAnalysisBase::vCalValues_
static std::vector< short > vCalValues_
Definition: SiPixelOfflineCalibAnalysisBase.h:119
SiPixelGainCalibrationAnalysis::func_
TF1 * func_
Definition: SiPixelGainCalibrationAnalysis.h:74
SiPixelGainCalibrationAnalysis::summary_
std::ofstream summary_
Definition: SiPixelGainCalibrationAnalysis.h:117
SiPixelGainCalibrationAnalysis::graph_
TGraphErrors * graph_
Definition: SiPixelGainCalibrationAnalysis.h:75
PoolDBOutputService.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SiPixelGainCalibrationAnalysis::nfitparameters_
int nfitparameters_
Definition: SiPixelGainCalibrationAnalysis.h:72
Abs
T Abs(T a)
Definition: MathUtil.h:49
SiPixelGainCalibrationAnalysis::statusNumbers_
int * statusNumbers_
Definition: SiPixelGainCalibrationAnalysis.h:119
edm::detail::isnan
bool isnan(float x)
Definition: math.h:13
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SiPixelGainCalibrationAnalysis
Definition: SiPixelGainCalibrationAnalysis.h:47
SiPixelOfflineCalibAnalysisBase::bookDQMHistoPlaquetteSummary2D
MonitorElement * bookDQMHistoPlaquetteSummary2D(uint32_t detid, std::string name, std::string title)
Definition: SiPixelOfflineCalibAnalysisBase.cc:197
SiPixelGainCalibrationAnalysis::min_nentries_
uint16_t min_nentries_
Definition: SiPixelGainCalibrationAnalysis.h:112
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
funct::true
true
Definition: Factorize.h:173
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
SiPixelGainCalibrationAnalysis::scalarVcalHigh_VcalLow_
double scalarVcalHigh_VcalLow_
Definition: SiPixelGainCalibrationAnalysis.h:114
SiPixelGainCalibrationAnalysis::chi2Threshold_
double chi2Threshold_
Definition: SiPixelGainCalibrationAnalysis.h:89
SiPixelGainCalibrationAnalysis.h
SiPixelGainCalibrationAnalysis::reject_single_entries_
bool reject_single_entries_
Definition: SiPixelGainCalibrationAnalysis.h:83
SiPixelGainCalibrationAnalysis::savePixelHists_
bool savePixelHists_
Definition: SiPixelGainCalibrationAnalysis.h:88
createfilelist.int
int
Definition: createfilelist.py:10
SiPixelOfflineCalibAnalysisBase::setDQMDirectory
bool setDQMDirectory(std::string dirName)
Definition: SiPixelOfflineCalibAnalysisBase.cc:209
SiPixelGainCalibrationAnalysis::calibrationEnd
void calibrationEnd() override
Definition: SiPixelGainCalibrationAnalysis.cc:167
edm::EventSetup
Definition: EventSetup.h:57
SiPixelGainCalibrationAnalysis::listofdetids_
std::vector< uint32_t > listofdetids_
Definition: SiPixelGainCalibrationAnalysis.h:77
SiPixelGainCalibrationAnalysis::checkCorrectCalibrationType
bool checkCorrectCalibrationType() override
Definition: SiPixelGainCalibrationAnalysis.cc:110
SiPixelGainCalibrationAnalysis::gainhi_
float gainhi_
Definition: SiPixelGainCalibrationAnalysis.h:109
heppy_batch.val
val
Definition: heppy_batch.py:351
SiPixelGainCalibrationAnalysis::fitfunction_
std::string fitfunction_
Definition: SiPixelGainCalibrationAnalysis.h:73
std
Definition: JetResolutionObject.h:76
SiPixelGainCalibrationAnalysis::gainlow_
float gainlow_
Definition: SiPixelGainCalibrationAnalysis.h:108
SiPixelGainCalibrationAnalysis::reject_badpoints_frac_
double reject_badpoints_frac_
Definition: SiPixelGainCalibrationAnalysis.h:86
SiPixelOfflineCalibAnalysisBase
Definition: SiPixelOfflineCalibAnalysisBase.h:65
SiPixelGainCalibrationAnalysis::filldb_
bool filldb_
Definition: SiPixelGainCalibrationAnalysis.h:96
SiPixelGainCalibrationAnalysis::~SiPixelGainCalibrationAnalysis
~SiPixelGainCalibrationAnalysis() override
Definition: SiPixelGainCalibrationAnalysis.cc:88
SiPixelGainCalibrationAnalysis::ignoreMode_
bool ignoreMode_
Definition: SiPixelGainCalibrationAnalysis.h:78
SiPixelGainCalibrationAnalysis::reject_first_point_
bool reject_first_point_
Definition: SiPixelGainCalibrationAnalysis.h:85
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
SiPixelGainCalibrationAnalysis::currentDetID_
uint32_t currentDetID_
Definition: SiPixelGainCalibrationAnalysis.h:118
mps_fire.result
result
Definition: mps_fire.py:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
genParticles_cff.map
map
Definition: genParticles_cff.py:11
slope
static const double slope[3]
Definition: CastorTimeSlew.cc:6
SiPixelGainCalibrationAnalysis::chi2ProbThreshold_
double chi2ProbThreshold_
Definition: SiPixelGainCalibrationAnalysis.h:90
SiPixelGainCalibrationAnalysis::CalculateAveragePerColumn
std::vector< float > CalculateAveragePerColumn(uint32_t detid, std::string label)
Definition: SiPixelGainCalibrationAnalysis.cc:93
SiPixelGainCalibrationAnalysis::reject_badpoints_
bool reject_badpoints_
Definition: SiPixelGainCalibrationAnalysis.h:81
TtFullHadEvtBuilder_cfi.prob
prob
Definition: TtFullHadEvtBuilder_cfi.py:33
SiPixelGainCalibrationAnalysis::calibrationSetup
void calibrationSetup(const edm::EventSetup &iSetup) override
Definition: SiPixelGainCalibrationAnalysis.cc:125
cuy.ii
ii
Definition: cuy.py:590
begin
#define begin
Definition: vmac.h:32
label
const char * label
Definition: PFTauDecayModeTools.cc:11
SiPixelGainCalibrationAnalysis::pedhi_
float pedhi_
Definition: SiPixelGainCalibrationAnalysis.h:111
SiPixelGainCalibrationAnalysis::doFits
bool doFits(uint32_t detid, std::vector< SiPixelCalibDigi >::const_iterator ipix) override
Definition: SiPixelGainCalibrationAnalysis.cc:185
SiPixelGainCalibrationAnalysis::maxChi2InHist_
double maxChi2InHist_
Definition: SiPixelGainCalibrationAnalysis.h:92