CMS 3D CMS Logo

HcalPedestalAnalysis.cc
Go to the documentation of this file.
7 #include "TFile.h"
8 #include <cmath>
9 
10 //
11 // Michal Szleper, Mar 30, 2007
12 //
13 
14 using namespace std;
15 
17  : fRefPedestals(nullptr),
18  fRefPedestalWidths(nullptr),
19  fRawPedestals(nullptr),
20  fRawPedestalWidths(nullptr),
21  fValPedestals(nullptr),
22  fValPedestalWidths(nullptr),
23  fTopology(nullptr) {
24  m_coder = nullptr;
25  m_shape = nullptr;
26  evt = 0;
27  sample = 0;
28  m_file = nullptr;
29  m_AllPedsOK = 0;
30  for (int i = 0; i < 4; i++)
31  m_stat[i] = 0;
32  for (int k = 0; k < 4; k++)
33  state.push_back(true);
34 
35  // user cfg parameters
36  m_outputFileMean = ps.getUntrackedParameter<string>("outputFileMeans", "");
37  if (!m_outputFileMean.empty()) {
38  cout << "Hcal pedestal means will be saved to " << m_outputFileMean.c_str() << endl;
39  }
40  m_outputFileWidth = ps.getUntrackedParameter<string>("outputFileWidths", "");
41  if (!m_outputFileWidth.empty()) {
42  cout << "Hcal pedestal widths will be saved to " << m_outputFileWidth.c_str() << endl;
43  }
44  m_outputFileROOT = ps.getUntrackedParameter<string>("outputFileHist", "");
45  if (!m_outputFileROOT.empty()) {
46  cout << "Hcal pedestal histograms will be saved to " << m_outputFileROOT.c_str() << endl;
47  }
48  m_nevtsample = ps.getUntrackedParameter<int>("nevtsample", 0);
49  // for compatibility with previous versions
50  if (m_nevtsample == 9999999)
51  m_nevtsample = 0;
52  m_pedsinADC = ps.getUntrackedParameter<int>("pedsinADC", 0);
53  m_hiSaveflag = ps.getUntrackedParameter<int>("hiSaveflag", 0);
54  m_pedValflag = ps.getUntrackedParameter<int>("pedValflag", 0);
55  if (m_pedValflag < 0)
56  m_pedValflag = 0;
57  if (m_nevtsample > 0 && m_pedValflag > 0) {
58  cout << "WARNING - incompatible cfg options: nevtsample = " << m_nevtsample << ", pedValflag = " << m_pedValflag
59  << endl;
60  cout << "Setting pedValflag = 0" << endl;
61  m_pedValflag = 0;
62  }
63  if (m_pedValflag > 1)
64  m_pedValflag = 1;
65  m_startTS = ps.getUntrackedParameter<int>("firstTS", 0);
66  if (m_startTS < 0)
67  m_startTS = 0;
68  m_endTS = ps.getUntrackedParameter<int>("lastTS", 9);
69 
70  // m_logFile.open("HcalPedestalAnalysis.log");
71 
72  hbHists.ALLPEDS = new TH1F("HBHE All Pedestals", "HBHE All Peds", 10, 0, 9);
73  hbHists.PEDRMS = new TH1F("HBHE All Pedestal Widths", "HBHE All Pedestal RMS", 100, 0, 3);
74  hbHists.PEDMEAN = new TH1F("HBHE All Pedestal Means", "HBHE All Pedestal Means", 100, 0, 9);
75  hbHists.CHI2 = new TH1F("HBHE Chi2/ndf for whole range Gauss fit", "HBHE Chi2/ndf Gauss", 200, 0., 50.);
76 
77  hoHists.ALLPEDS = new TH1F("HO All Pedestals", "HO All Peds", 10, 0, 9);
78  hoHists.PEDRMS = new TH1F("HO All Pedestal Widths", "HO All Pedestal RMS", 100, 0, 3);
79  hoHists.PEDMEAN = new TH1F("HO All Pedestal Means", "HO All Pedestal Means", 100, 0, 9);
80  hoHists.CHI2 = new TH1F("HO Chi2/ndf for whole range Gauss fit", "HO Chi2/ndf Gauss", 200, 0., 50.);
81 
82  hfHists.ALLPEDS = new TH1F("HF All Pedestals", "HF All Peds", 10, 0, 9);
83  hfHists.PEDRMS = new TH1F("HF All Pedestal Widths", "HF All Pedestal RMS", 100, 0, 3);
84  hfHists.PEDMEAN = new TH1F("HF All Pedestal Means", "HF All Pedestal Means", 100, 0, 9);
85  hfHists.CHI2 = new TH1F("HF Chi2/ndf for whole range Gauss fit", "HF Chi2/ndf Gauss", 200, 0., 50.);
86 }
87 
88 //-----------------------------------------------------------------------------
90  for (_meot = hbHists.PEDTRENDS.begin(); _meot != hbHists.PEDTRENDS.end(); _meot++) {
91  for (int i = 0; i < 16; i++)
92  _meot->second[i].first->Delete();
93  }
94  for (_meot = hoHists.PEDTRENDS.begin(); _meot != hoHists.PEDTRENDS.end(); _meot++) {
95  for (int i = 0; i < 16; i++)
96  _meot->second[i].first->Delete();
97  }
98  for (_meot = hfHists.PEDTRENDS.begin(); _meot != hfHists.PEDTRENDS.end(); _meot++) {
99  for (int i = 0; i < 16; i++)
100  _meot->second[i].first->Delete();
101  }
102  hbHists.ALLPEDS->Delete();
103  hbHists.PEDRMS->Delete();
104  hbHists.PEDMEAN->Delete();
105  hbHists.CHI2->Delete();
106 
107  hoHists.ALLPEDS->Delete();
108  hoHists.PEDRMS->Delete();
109  hoHists.PEDMEAN->Delete();
110  hoHists.CHI2->Delete();
111 
112  hfHists.ALLPEDS->Delete();
113  hfHists.PEDRMS->Delete();
114  hfHists.PEDMEAN->Delete();
115  hfHists.CHI2->Delete();
116 }
117 
118 //-----------------------------------------------------------------------------
119 void HcalPedestalAnalysis::setup(const std::string& m_outputFileROOT) {
120  // open the histogram file, create directories within
121  m_file = new TFile(m_outputFileROOT.c_str(), "RECREATE");
122  m_file->mkdir("HB");
123  m_file->cd();
124  m_file->mkdir("HO");
125  m_file->cd();
126  m_file->mkdir("HF");
127  m_file->cd();
128 }
129 
130 //-----------------------------------------------------------------------------
132  const HODigiCollection& ho,
133  const HFDigiCollection& hf,
134  const HcalDbService& cond) {
135  evt++;
136  sample = 1;
137  evt_curr = evt;
138  if (m_nevtsample > 0) {
139  sample = (evt - 1) / m_nevtsample + 1;
141  if (evt_curr == 0)
143  }
144 
145  // Get data for every CAPID.
146  // HBHE
147  try {
148  if (hbhe.empty())
149  throw(int) hbhe.size();
150  for (HBHEDigiCollection::const_iterator j = hbhe.begin(); j != hbhe.end(); ++j) {
151  const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
152  m_coder = cond.getHcalCoder(digi.id());
153  m_shape = cond.getHcalShape(m_coder);
154  for (int k = 0; k < (int)state.size(); k++)
155  state[k] = true;
156  // here we loop over pairs of time slices, it is more convenient
157  // in order to extract the correlation matrix
158  for (int i = m_startTS; i < digi.size() && i <= m_endTS; i++) {
159  for (int flag = 0; flag < 4; flag++) {
160  if (i + flag < digi.size() && i + flag <= m_endTS) {
161  per2CapsHists(flag, 0, digi.id(), digi.sample(i), digi.sample(i + flag), hbHists.PEDTRENDS, cond);
162  }
163  }
164  }
165  if (m_startTS == 0 && m_endTS > 4) {
166  AllChanHists(digi.id(),
167  digi.sample(0),
168  digi.sample(1),
169  digi.sample(2),
170  digi.sample(3),
171  digi.sample(4),
172  digi.sample(5),
173  hbHists.PEDTRENDS);
174  }
175  }
176  } catch (int i) {
177  // m_logFile<< "Event with " << i<<" HBHE Digis passed." << std::endl;
178  }
179  // HO
180  try {
181  if (ho.empty())
182  throw(int) ho.size();
183  for (HODigiCollection::const_iterator j = ho.begin(); j != ho.end(); ++j) {
184  const HODataFrame digi = (const HODataFrame)(*j);
185  m_coder = cond.getHcalCoder(digi.id());
186  for (int i = m_startTS; i < digi.size() && i <= m_endTS; i++) {
187  for (int flag = 0; flag < 4; flag++) {
188  if (i + flag < digi.size() && i + flag <= m_endTS) {
189  per2CapsHists(flag, 1, digi.id(), digi.sample(i), digi.sample(i + flag), hoHists.PEDTRENDS, cond);
190  }
191  }
192  }
193  if (m_startTS == 0 && m_endTS > 4) {
194  AllChanHists(digi.id(),
195  digi.sample(0),
196  digi.sample(1),
197  digi.sample(2),
198  digi.sample(3),
199  digi.sample(4),
200  digi.sample(5),
201  hoHists.PEDTRENDS);
202  }
203  }
204  } catch (int i) {
205  // m_logFile << "Event with " << i<<" HO Digis passed." << std::endl;
206  }
207  // HF
208  try {
209  if (hf.empty())
210  throw(int) hf.size();
211  for (HFDigiCollection::const_iterator j = hf.begin(); j != hf.end(); ++j) {
212  const HFDataFrame digi = (const HFDataFrame)(*j);
213  m_coder = cond.getHcalCoder(digi.id());
214  for (int i = m_startTS; i < digi.size() && i <= m_endTS; i++) {
215  for (int flag = 0; flag < 4; flag++) {
216  if (i + flag < digi.size() && i + flag <= m_endTS) {
217  per2CapsHists(flag, 2, digi.id(), digi.sample(i), digi.sample(i + flag), hfHists.PEDTRENDS, cond);
218  }
219  }
220  }
221  if (m_startTS == 0 && m_endTS > 4) {
222  AllChanHists(digi.id(),
223  digi.sample(0),
224  digi.sample(1),
225  digi.sample(2),
226  digi.sample(3),
227  digi.sample(4),
228  digi.sample(5),
229  hfHists.PEDTRENDS);
230  }
231  }
232  } catch (int i) {
233  // m_logFile << "Event with " << i<<" HF Digis passed." << std::endl;
234  }
235  // Call the function every m_nevtsample events
236  if (m_nevtsample > 0) {
237  if (evt % m_nevtsample == 0)
238  SampleAnalysis();
239  }
240 }
241 
242 //-----------------------------------------------------------------------------
244  int id,
245  const HcalDetId detid,
246  const HcalQIESample& qie1,
247  const HcalQIESample& qie2,
248  map<HcalDetId, map<int, PEDBUNCH> >& toolT,
249  const HcalDbService& cond) {
250  // this function is due to be called for every time slice, it fills either a charge
251  // histo for a single capID (flag=0) or a product histo for two capIDs (flag>0)
252 
253  static const int bins = 10;
254  static const int bins2 = 100;
255  float lo = -0.5;
256  float hi = 9.5;
257  map<int, PEDBUNCH> _mei;
258  static map<HcalDetId, map<int, float> > QieCalibMap;
259  string type = "HBHE";
260 
261  if (id == 0) {
262  if (detid.ieta() < 16)
263  type = "HB";
264  if (detid.ieta() > 16)
265  type = "HE";
266  if (detid.ieta() == 16) {
267  if (detid.depth() < 3)
268  type = "HB";
269  if (detid.depth() == 3)
270  type = "HE";
271  }
272  } else if (id == 1)
273  type = "HO";
274  else if (id == 2)
275  type = "HF";
276 
277  _meot = toolT.find(detid);
278 
279  // if histos for the current channel do not exist, first create them,
280  if (_meot == toolT.end()) {
281  map<int, PEDBUNCH> insert;
282  map<int, float> qiecalib;
283  char name[1024];
284  for (int i = 0; i < 4; i++) {
285  lo = -0.5;
286  // fix from Andy: if you convert to fC and then bin in units of 1, you may 'skip' a bin while
287  // filling, since the ADCs are quantized
288  if (m_pedsinADC)
289  hi = 9.5;
290  else
291  hi = 11.5;
292  sprintf(
293  name, "%s Pedestal, eta=%d phi=%d d=%d cap=%d", type.c_str(), detid.ieta(), detid.iphi(), detid.depth(), i);
294  insert[i].first = new TH1F(name, name, bins, lo, hi);
295  sprintf(name,
296  "%s Product, eta=%d phi=%d d=%d caps=%d*%d",
297  type.c_str(),
298  detid.ieta(),
299  detid.iphi(),
300  detid.depth(),
301  i,
302  (i + 1) % 4);
303  insert[4 + i].first = new TH1F(name, name, bins2, 0., 100.);
304  sprintf(name,
305  "%s Product, eta=%d phi=%d d=%d caps=%d*%d",
306  type.c_str(),
307  detid.ieta(),
308  detid.iphi(),
309  detid.depth(),
310  i,
311  (i + 2) % 4);
312  insert[8 + i].first = new TH1F(name, name, bins2, 0., 100.);
313  sprintf(name,
314  "%s Product, eta=%d phi=%d d=%d caps=%d*%d",
315  type.c_str(),
316  detid.ieta(),
317  detid.iphi(),
318  detid.depth(),
319  i,
320  (i + 3) % 4);
321  insert[12 + i].first = new TH1F(name, name, bins2, 0., 100.);
322  }
323  sprintf(name, "%s Signal in TS 4+5, eta=%d phi=%d d=%d", type.c_str(), detid.ieta(), detid.iphi(), detid.depth());
324  insert[16].first = new TH1F(name, name, 21, -0.5, 20.5);
325  sprintf(
326  name, "%s Signal in TS 4+5-2-3, eta=%d phi=%d d=%d", type.c_str(), detid.ieta(), detid.iphi(), detid.depth());
327  insert[17].first = new TH1F(name, name, 21, -10.5, 10.5);
328  sprintf(name,
329  "%s Signal in TS 4+5-(0+1+2+3)/2., eta=%d phi=%d d=%d",
330  type.c_str(),
331  detid.ieta(),
332  detid.iphi(),
333  detid.depth());
334  insert[18].first = new TH1F(name, name, 21, -10.5, 10.5);
335  toolT[detid] = insert;
336  _meot = toolT.find(detid);
337  // store QIE calibrations in a map for later reuse
338  QieCalibMap[detid] = qiecalib;
339  }
340 
341  _mei = _meot->second;
342 
343  const HcalQIECoder* coder = cond.getHcalCoder(detid);
344  const HcalQIEShape* shape = cond.getHcalShape(coder);
345  float charge1 = coder->charge(*shape, qie1.adc(), qie1.capid());
346  float charge2 = coder->charge(*shape, qie2.adc(), qie2.capid());
347 
348  // fill single capID histo
349  if (flag == 0) {
350  if (m_nevtsample > 0) {
351  if ((evt - 1) % m_nevtsample == 0 && state[qie1.capid()]) {
352  state[qie1.capid()] = false;
353  _mei[qie1.capid()].first->Reset();
354  _mei[qie1.capid() + 4].first->Reset();
355  _mei[qie1.capid() + 8].first->Reset();
356  _mei[qie1.capid() + 12].first->Reset();
357  }
358  }
359  if (qie1.adc() < bins) {
360  if (m_pedsinADC)
361  _mei[qie1.capid()].first->Fill(qie1.adc());
362  else
363  _mei[qie1.capid()].first->Fill(charge1);
364  } else if (qie1.adc() >= bins) {
365  _mei[qie1.capid()].first->AddBinContent(bins + 1, 1);
366  }
367  }
368 
369  // fill 2 capID histo
370  if (flag > 0) {
371  map<int, float> qiecalib = QieCalibMap[detid];
372  //float charge1=(qie1.adc()-qiecalib[qie1.capid()+4])/qiecalib[qie1.capid()];
373  //float charge2=(qie2.adc()-qiecalib[qie2.capid()+4])/qiecalib[qie2.capid()];
374  if (charge1 * charge2 < bins2) {
375  _mei[qie1.capid() + 4 * flag].first->Fill(charge1 * charge2);
376  } else {
377  _mei[qie1.capid() + 4 * flag].first->Fill(bins2);
378  }
379  }
380 
381  if (flag == 0) {
382  if (id == 0)
383  hbHists.ALLPEDS->Fill(qie1.adc());
384  else if (id == 1)
385  hoHists.ALLPEDS->Fill(qie1.adc());
386  else if (id == 2)
387  hfHists.ALLPEDS->Fill(qie1.adc());
388  }
389 }
390 
391 //-----------------------------------------------------------------------------
393  const HcalQIESample& qie0,
394  const HcalQIESample& qie1,
395  const HcalQIESample& qie2,
396  const HcalQIESample& qie3,
397  const HcalQIESample& qie4,
398  const HcalQIESample& qie5,
399  map<HcalDetId, map<int, PEDBUNCH> >& toolT) {
400  // this function is due to be called for every channel
401 
402  _meot = toolT.find(detid);
403  map<int, PEDBUNCH> _mei = _meot->second;
404  _mei[16].first->Fill(qie4.adc() + qie5.adc() - 1.);
405  _mei[17].first->Fill(qie4.adc() + qie5.adc() - qie2.adc() - qie3.adc());
406  _mei[18].first->Fill(qie4.adc() + qie5.adc() - (qie0.adc() + qie1.adc() + qie2.adc() + qie3.adc()) / 2.);
407 }
408 
409 //-----------------------------------------------------------------------------
411  // it is called every m_nevtsample events (a sample) and the end of run
412  char PedSampleNum[20];
413 
414  // Compute pedestal constants for each HBHE, HO, HF
415  sprintf(PedSampleNum, "HB_Sample%d", sample);
416  m_file->cd();
417  m_file->mkdir(PedSampleNum);
418  m_file->cd(PedSampleNum);
419  GetPedConst(hbHists.PEDTRENDS, hbHists.PEDMEAN, hbHists.PEDRMS);
420  sprintf(PedSampleNum, "HO_Sample%d", sample);
421  m_file->cd();
422  m_file->mkdir(PedSampleNum);
423  m_file->cd(PedSampleNum);
424  GetPedConst(hoHists.PEDTRENDS, hoHists.PEDMEAN, hoHists.PEDRMS);
425  sprintf(PedSampleNum, "HF_Sample%d", sample);
426  m_file->cd();
427  m_file->mkdir(PedSampleNum);
428  m_file->cd(PedSampleNum);
429  GetPedConst(hfHists.PEDTRENDS, hfHists.PEDMEAN, hfHists.PEDRMS);
430 }
431 
432 //-----------------------------------------------------------------------------
433 void HcalPedestalAnalysis::GetPedConst(map<HcalDetId, map<int, PEDBUNCH> >& toolT, TH1F* PedMeans, TH1F* PedWidths) {
434  // Completely rewritten version oct 2006
435  // Compute pedestal constants and fill into HcalPedestals and HcalPedestalWidths objects
436  float cap[4];
437  float sig[4][4];
438  float dcap[4];
439  float dsig[4][4];
440  float chi2[4];
441 
442  for (_meot = toolT.begin(); _meot != toolT.end(); _meot++) {
443  HcalDetId detid = _meot->first;
444 
445  // take mean and width from a Gaussian fit or directly from the histo
446  if (fitflag > 0) {
447  for (int i = 0; i < 4; i++) {
448  TF1* fit = _meot->second[i].first->GetFunction("gaus");
449  chi2[i] = 0;
450  if (fit->GetNDF() != 0)
451  chi2[i] = fit->GetChisquare() / fit->GetNDF();
452  cap[i] = fit->GetParameter(1);
453  sig[i][i] = fit->GetParameter(2);
454  dcap[i] = fit->GetParError(1);
455  dsig[i][i] = fit->GetParError(2);
456  }
457  } else {
458  for (int i = 0; i < 4; i++) {
459  cap[i] = _meot->second[i].first->GetMean();
460  sig[i][i] = _meot->second[i].first->GetRMS();
461  m_stat[i] = 0;
462 
463  for (int j = m_startTS; j < m_endTS + 1; j++) {
464  m_stat[i] += _meot->second[i].first->GetBinContent(j + 1);
465  }
466  dcap[i] = sig[i][i] / sqrt(m_stat[i]);
467  // dsig[i][i] = dcap[i]*sig[i][i]/cap[i];
468  dsig[i][i] = sig[i][i] / sqrt(2. * m_stat[i]);
469  chi2[i] = 0.;
470  }
471  }
472 
473  for (int i = 0; i < 4; i++) {
474  if (m_hiSaveflag > 0) {
475  if (m_pedsinADC)
476  _meot->second[i].first->GetXaxis()->SetTitle("ADC");
477  else
478  _meot->second[i].first->GetXaxis()->SetTitle("Charge, fC");
479  _meot->second[i].first->GetYaxis()->SetTitle("CapID samplings");
480  _meot->second[i].first->Write();
481  }
482  if (m_nevtsample > 0) {
483  _meot->second[i].second.first[0].push_back(cap[i]);
484  _meot->second[i].second.first[1].push_back(dcap[i]);
485  _meot->second[i].second.first[2].push_back(sig[i][i]);
486  _meot->second[i].second.first[3].push_back(dsig[i][i]);
487  _meot->second[i].second.first[4].push_back(chi2[i]);
488  }
489  PedMeans->Fill(cap[i]);
490  PedWidths->Fill(sig[i][i]);
491  }
492 
493  // special histos for Shuichi
494  if (m_hiSaveflag == -100) {
495  for (int i = 16; i < 19; i++) {
496  if (m_pedsinADC)
497  _meot->second[i].first->GetXaxis()->SetTitle("ADC");
498  else
499  _meot->second[i].first->GetXaxis()->SetTitle("Charge, fC");
500  _meot->second[i].first->GetYaxis()->SetTitle("Events");
501  _meot->second[i].first->Write();
502  }
503  }
504 
505  // diagonal sigma is width squared
506  sig[0][0] = sig[0][0] * sig[0][0];
507  sig[1][1] = sig[1][1] * sig[1][1];
508  sig[2][2] = sig[2][2] * sig[2][2];
509  sig[3][3] = sig[3][3] * sig[3][3];
510 
511  // off diagonal sigmas (correlations) are computed from 3 histograms
512  // here we still have all 4*3=12 combinations
513  sig[0][1] = _meot->second[4].first->GetMean() - cap[0] * cap[1];
514  sig[0][2] = _meot->second[8].first->GetMean() - cap[0] * cap[2];
515  sig[1][2] = _meot->second[5].first->GetMean() - cap[1] * cap[2];
516  sig[1][3] = _meot->second[9].first->GetMean() - cap[1] * cap[3];
517  sig[2][3] = _meot->second[6].first->GetMean() - cap[2] * cap[3];
518  sig[0][3] = _meot->second[12].first->GetMean() - cap[0] * cap[3];
519  sig[1][0] = _meot->second[13].first->GetMean() - cap[1] * cap[0];
520  sig[2][0] = _meot->second[10].first->GetMean() - cap[2] * cap[0];
521  sig[2][1] = _meot->second[14].first->GetMean() - cap[2] * cap[1];
522  sig[3][1] = _meot->second[11].first->GetMean() - cap[3] * cap[1];
523  sig[3][2] = _meot->second[15].first->GetMean() - cap[3] * cap[2];
524  sig[3][0] = _meot->second[7].first->GetMean() - cap[3] * cap[0];
525 
526  // there is no proper error calculation for the correlation coefficients
527  for (int i = 0; i < 4; i++) {
528  if (m_nevtsample > 0) {
529  _meot->second[i].second.first[5].push_back(sig[i][(i + 1) % 4]);
530  _meot->second[i].second.first[6].push_back(2 * sig[i][i] * dsig[i][i]);
531  _meot->second[i].second.first[7].push_back(sig[i][(i + 2) % 4]);
532  _meot->second[i].second.first[8].push_back(2 * sig[i][i] * dsig[i][i]);
533  _meot->second[i].second.first[9].push_back(sig[i][(i + 3) % 4]);
534  _meot->second[i].second.first[10].push_back(2 * sig[i][i] * dsig[i][i]);
535  }
536  // save product histos if desired
537  if (m_hiSaveflag > 10) {
538  if (m_pedsinADC)
539  _meot->second[i + 4].first->GetXaxis()->SetTitle("ADC^2");
540  else
541  _meot->second[i + 4].first->GetXaxis()->SetTitle("Charge^2, fC^2");
542  _meot->second[i + 4].first->GetYaxis()->SetTitle("2-CapID samplings");
543  _meot->second[i + 4].first->Write();
544  if (m_pedsinADC)
545  _meot->second[i + 8].first->GetXaxis()->SetTitle("ADC^2");
546  else
547  _meot->second[i + 8].first->GetXaxis()->SetTitle("Charge^2, fC^2");
548  _meot->second[i + 8].first->GetYaxis()->SetTitle("2-CapID samplings");
549  _meot->second[i + 8].first->Write();
550  if (m_pedsinADC)
551  _meot->second[i + 12].first->GetXaxis()->SetTitle("ADC^2");
552  else
553  _meot->second[i + 12].first->GetXaxis()->SetTitle("Charge^2, fC^2");
554  _meot->second[i + 12].first->GetYaxis()->SetTitle("2-CapID samplings");
555  _meot->second[i + 12].first->Write();
556  }
557  }
558 
559  // fill the objects - at this point only close and medium correlations are stored
560  // and the matrix is assumed symmetric
561  if (m_nevtsample < 1) {
562  sig[1][0] = sig[0][1];
563  sig[2][0] = sig[0][2];
564  sig[2][1] = sig[1][2];
565  sig[3][1] = sig[1][3];
566  sig[3][2] = sig[2][3];
567  sig[0][3] = sig[3][0];
568  if (fRawPedestals) {
569  HcalPedestal item(detid, cap[0], cap[1], cap[2], cap[3]);
571  }
572  if (fRawPedestalWidths) {
573  HcalPedestalWidth widthsp(detid);
574  widthsp.setSigma(0, 0, sig[0][0]);
575  widthsp.setSigma(0, 1, sig[0][1]);
576  widthsp.setSigma(0, 2, sig[0][2]);
577  widthsp.setSigma(1, 1, sig[1][1]);
578  widthsp.setSigma(1, 2, sig[1][2]);
579  widthsp.setSigma(1, 3, sig[1][3]);
580  widthsp.setSigma(2, 2, sig[2][2]);
581  widthsp.setSigma(2, 3, sig[2][3]);
582  widthsp.setSigma(3, 3, sig[3][3]);
583  widthsp.setSigma(3, 0, sig[0][3]);
584  fRawPedestalWidths->addValues(widthsp);
585  }
586  }
587  }
588 }
589 
590 //-----------------------------------------------------------------------------
591 int HcalPedestalAnalysis::done(const HcalPedestals* fInputPedestals,
592  const HcalPedestalWidths* fInputPedestalWidths,
593  HcalPedestals* fOutputPedestals,
594  HcalPedestalWidths* fOutputPedestalWidths) {
595  int nstat[4];
596 
597  // Pedestal objects
598  // inputs...
599  fRefPedestals = fInputPedestals;
600  fRefPedestalWidths = fInputPedestalWidths;
601 
602  // outputs...
603  if (m_pedValflag > 0) {
604  fValPedestals = fOutputPedestals;
605  fValPedestalWidths = fOutputPedestalWidths;
608  } else {
609  fRawPedestals = fOutputPedestals;
610  fRawPedestalWidths = fOutputPedestalWidths;
613  }
614 
615  // compute pedestal constants
616  if (m_nevtsample < 1)
617  SampleAnalysis();
618  if (m_nevtsample > 0) {
619  if (evt % m_nevtsample != 0)
620  SampleAnalysis();
621  }
622 
623  // trending histos
624  if (m_nevtsample > 0) {
625  m_file->cd();
626  m_file->cd("HB");
627  Trendings(hbHists.PEDTRENDS, hbHists.CHI2, hbHists.CAPID_AVERAGE, hbHists.CAPID_CHI2);
628  m_file->cd();
629  m_file->cd("HO");
630  Trendings(hoHists.PEDTRENDS, hoHists.CHI2, hoHists.CAPID_AVERAGE, hoHists.CAPID_CHI2);
631  m_file->cd();
632  m_file->cd("HF");
633  Trendings(hfHists.PEDTRENDS, hfHists.CHI2, hfHists.CAPID_AVERAGE, hfHists.CAPID_CHI2);
634  }
635 
636  if (m_nevtsample < 1) {
637  // pedestal validation: m_AllPedsOK=-1 means not validated,
638  // 0 everything OK,
639  // N>0 : mod(N,100000) drifts + width changes
640  // int(N/100000) missing channels
641  m_AllPedsOK = -1;
642  if (m_pedValflag > 0) {
643  for (int i = 0; i < 4; i++)
644  nstat[i] = (int)m_stat[i];
645  int NPedErrors = HcalPedVal(nstat,
652  m_AllPedsOK = NPedErrors;
653  }
654  // setting m_AllPedsOK=-2 will inhibit writing pedestals out
655  // if(m_pedValflag==1){
656  // if(evt<100)m_AllPedsOK=-2;
657  // }
658  }
659 
660  // Write other histograms.
661  // HB
662  m_file->cd();
663  m_file->cd("HB");
664  hbHists.ALLPEDS->Write();
665  hbHists.PEDRMS->Write();
666  hbHists.PEDMEAN->Write();
667  // HO
668  m_file->cd();
669  m_file->cd("HO");
670  hoHists.ALLPEDS->Write();
671  hoHists.PEDRMS->Write();
672  hoHists.PEDMEAN->Write();
673  // HF
674  m_file->cd();
675  m_file->cd("HF");
676  hfHists.ALLPEDS->Write();
677  hfHists.PEDRMS->Write();
678  hfHists.PEDMEAN->Write();
679 
680  m_file->Close();
681  cout << "Hcal histograms written to " << m_outputFileROOT.c_str() << endl;
682  return (int)m_AllPedsOK;
683 }
684 
685 //-----------------------------------------------------------------------------
686 void HcalPedestalAnalysis::Trendings(map<HcalDetId, map<int, PEDBUNCH> >& toolT,
687  TH1F* Chi2,
688  TH1F* CapidAverage,
689  TH1F* CapidChi2) {
690  // check stability of pedestal constants in a single long run
691 
692  map<int, std::vector<double> > AverageValues;
693 
694  for (_meot = toolT.begin(); _meot != toolT.end(); _meot++) {
695  for (int i = 0; i < 4; i++) {
696  char name[1024];
697  HcalDetId detid = _meot->first;
698  sprintf(name, "Pedestal trend, eta=%d phi=%d d=%d cap=%d", detid.ieta(), detid.iphi(), detid.depth(), i);
699  int bins = _meot->second[i].second.first[0].size();
700  float lo = 0.5;
701  float hi = (float)bins + 0.5;
702  _meot->second[i].second.second.push_back(new TH1F(name, name, bins, lo, hi));
703  sprintf(name, "Width trend, eta=%d phi=%d d=%d cap=%d", detid.ieta(), detid.iphi(), detid.depth(), i);
704  bins = _meot->second[i].second.first[2].size();
705  hi = (float)bins + 0.5;
706  _meot->second[i].second.second.push_back(new TH1F(name, name, bins, lo, hi));
707  sprintf(name,
708  "Correlation trend, eta=%d phi=%d d=%d caps=%d*%d",
709  detid.ieta(),
710  detid.iphi(),
711  detid.depth(),
712  i,
713  (i + 1) % 4);
714  bins = _meot->second[i].second.first[5].size();
715  hi = (float)bins + 0.5;
716  _meot->second[i].second.second.push_back(new TH1F(name, name, bins, lo, hi));
717  /* sprintf(name,"Correlation trend, eta=%d phi=%d d=%d caps=%d*%d",detid.ieta(),detid.iphi(),detid.depth(),i,(i+2)%4);
718  bins = _meot->second[i].second.first[7].size();
719  hi = (float)bins+0.5;
720  _meot->second[i].second.second.push_back(new TH1F(name,name,bins,lo,hi));
721  sprintf(name,"Correlation trend, eta=%d phi=%d d=%d caps=%d*%d",detid.ieta(),detid.iphi(),detid.depth(),i,(i+3)%4);
722  bins = _meot->second[i].second.first[9].size();
723  hi = (float)bins+0.5;
724  _meot->second[i].second.second.push_back(new TH1F(name,name,bins,lo,hi)); */
725 
726  std::vector<double>::iterator sample_it;
727  // Pedestal mean - put content and errors
728  int j = 0;
729  for (sample_it = _meot->second[i].second.first[0].begin(); sample_it != _meot->second[i].second.first[0].end();
730  ++sample_it) {
731  _meot->second[i].second.second[0]->SetBinContent(++j, *sample_it);
732  }
733  j = 0;
734  for (sample_it = _meot->second[i].second.first[1].begin(); sample_it != _meot->second[i].second.first[1].end();
735  ++sample_it) {
736  _meot->second[i].second.second[0]->SetBinError(++j, *sample_it);
737  }
738  // fit with a constant - extract parameters
739  _meot->second[i].second.second[0]->Fit("pol0", "Q");
740  TF1* fit = _meot->second[i].second.second[0]->GetFunction("pol0");
741  AverageValues[0].push_back(fit->GetParameter(0));
742  AverageValues[1].push_back(fit->GetParError(0));
743  if (sample > 1)
744  AverageValues[2].push_back(fit->GetChisquare() / fit->GetNDF());
745  else
746  AverageValues[2].push_back(fit->GetChisquare());
747  sprintf(name, "Sample (%d events)", m_nevtsample);
748  _meot->second[i].second.second[0]->GetXaxis()->SetTitle(name);
749  _meot->second[i].second.second[0]->GetYaxis()->SetTitle("Pedestal value");
750  _meot->second[i].second.second[0]->Write();
751  // Pedestal width - put content and errors
752  j = 0;
753  for (sample_it = _meot->second[i].second.first[2].begin(); sample_it != _meot->second[i].second.first[2].end();
754  ++sample_it) {
755  _meot->second[i].second.second[1]->SetBinContent(++j, *sample_it);
756  }
757  j = 0;
758  for (sample_it = _meot->second[i].second.first[3].begin(); sample_it != _meot->second[i].second.first[3].end();
759  ++sample_it) {
760  _meot->second[i].second.second[1]->SetBinError(++j, *sample_it);
761  }
762  _meot->second[i].second.second[1]->GetXaxis()->SetTitle(name);
763  _meot->second[i].second.second[1]->GetYaxis()->SetTitle("Pedestal width");
764  _meot->second[i].second.second[1]->Write();
765  // Correlation coeffs - put contents and errors
766  j = 0;
767  for (sample_it = _meot->second[i].second.first[5].begin(); sample_it != _meot->second[i].second.first[5].end();
768  ++sample_it) {
769  _meot->second[i].second.second[2]->SetBinContent(++j, *sample_it);
770  }
771  j = 0;
772  for (sample_it = _meot->second[i].second.first[6].begin(); sample_it != _meot->second[i].second.first[6].end();
773  ++sample_it) {
774  _meot->second[i].second.second[2]->SetBinError(++j, *sample_it);
775  }
776  _meot->second[i].second.second[2]->GetXaxis()->SetTitle(name);
777  _meot->second[i].second.second[2]->GetYaxis()->SetTitle("Close correlation");
778  _meot->second[i].second.second[2]->Write();
779  /* j=0;
780  for(sample_it=_meot->second[i].second.first[7].begin();
781  sample_it!=_meot->second[i].second.first[7].end();sample_it++){
782  _meot->second[i].second.second[3]->SetBinContent(++j,*sample_it);
783  }
784  j=0;
785  for(sample_it=_meot->second[i].second.first[8].begin();
786  sample_it!=_meot->second[i].second.first[8].end();sample_it++){
787  _meot->second[i].second.second[3]->SetBinError(++j,*sample_it);
788  }
789  _meot->second[i].second.second[3]->GetXaxis()->SetTitle(name);
790  _meot->second[i].second.second[3]->GetYaxis()->SetTitle("Intermediate correlation");
791  _meot->second[i].second.second[3]->Write();
792  j=0;
793  for(sample_it=_meot->second[i].second.first[9].begin();
794  sample_it!=_meot->second[i].second.first[9].end();sample_it++){
795  _meot->second[i].second.second[4]->SetBinContent(++j,*sample_it);
796  }
797  j=0;
798  for(sample_it=_meot->second[i].second.first[10].begin();
799  sample_it!=_meot->second[i].second.first[10].end();sample_it++){
800  _meot->second[i].second.second[4]->SetBinError(++j,*sample_it);
801  }
802  _meot->second[i].second.second[4]->GetXaxis()->SetTitle(name);
803  _meot->second[i].second.second[4]->GetYaxis()->SetTitle("Distant correlation");
804  _meot->second[i].second.second[4]->Write(); */
805  // chi2
806  for (sample_it = _meot->second[i].second.first[4].begin(); sample_it != _meot->second[i].second.first[4].end();
807  ++sample_it) {
808  Chi2->Fill(*sample_it);
809  }
810  }
811  }
812  CapidAverage = new TH1F("Constant fit: Pedestal Values",
813  "Constant fit: Pedestal Values",
814  AverageValues[0].size(),
815  0.,
816  AverageValues[0].size());
817  std::vector<double>::iterator sample_it;
818  int j = 0;
819  for (sample_it = AverageValues[0].begin(); sample_it != AverageValues[0].end(); ++sample_it) {
820  CapidAverage->SetBinContent(++j, *sample_it);
821  }
822  j = 0;
823  for (sample_it = AverageValues[1].begin(); sample_it != AverageValues[1].end(); ++sample_it) {
824  CapidAverage->SetBinError(++j, *sample_it);
825  }
826  CapidChi2 = new TH1F(
827  "Constant fit: Chi2/ndf", "Constant fit: Chi2/ndf", AverageValues[2].size(), 0., AverageValues[2].size());
828  j = 0;
829  for (sample_it = AverageValues[2].begin(); sample_it != AverageValues[2].end(); ++sample_it) {
830  CapidChi2->SetBinContent(++j, *sample_it);
831  //CapidChi2->SetBinError(++j,0);
832  }
833  Chi2->GetXaxis()->SetTitle("Chi2/ndf");
834  Chi2->GetYaxis()->SetTitle("50 x [(16+2) x 4 x 4] `events`");
835  Chi2->Write();
836  CapidAverage->GetYaxis()->SetTitle("Pedestal value");
837  CapidAverage->GetXaxis()->SetTitle("(16+2) x 4 x 4 `events`");
838  CapidAverage->Write();
839  CapidChi2->GetYaxis()->SetTitle("Chi2/ndf");
840  CapidChi2->GetXaxis()->SetTitle("(16+2) x 4 x 4 `events`");
841  CapidChi2->Write();
842 }
843 
844 //-----------------------------------------------------------------------------
846  const HcalPedestals* fRefPedestals,
847  const HcalPedestalWidths* fRefPedestalWidths,
848  HcalPedestals* fRawPedestals,
849  HcalPedestalWidths* fRawPedestalWidths,
850  HcalPedestals* fValPedestals,
851  HcalPedestalWidths* fValPedestalWidths) {
852  // new version of pedestal validation - it is designed to be as independent of
853  // all the rest as possible - you only need to provide valid pedestal objects
854  // and a vector of statistics per capID to use this as standalone code
855  HcalDetId detid;
856  float RefPedVals[4];
857  float RefPedSigs[4][4];
858  float RawPedVals[4];
859  float RawPedSigs[4][4];
860  map<HcalDetId, bool> isinRaw;
861  map<HcalDetId, bool> isinRef;
862  std::vector<DetId> RefChanns = fRefPedestals->getAllChannels();
863  std::vector<DetId> RawChanns = fRawPedestals->getAllChannels();
864  std::ofstream PedValLog;
865  PedValLog.open("HcalPedVal.log");
866 
867  if (nstat[0] + nstat[1] + nstat[2] + nstat[3] < 2500)
868  PedValLog << "HcalPedVal: warning - low statistics" << std::endl;
869  // find complete list of channels in current data and reference
870  for (int i = 0; i < (int)RawChanns.size(); i++) {
871  isinRef[HcalDetId(RawChanns[i])] = false;
872  }
873  for (int i = 0; i < (int)RefChanns.size(); i++) {
874  detid = HcalDetId(RefChanns[i]);
875  isinRaw[detid] = false;
876  isinRef[detid] = true;
877  }
878  for (int i = 0; i < (int)RawChanns.size(); i++) {
879  detid = HcalDetId(RawChanns[i]);
880  isinRaw[detid] = true;
881  if (isinRef[detid] == false) {
882  PedValLog << "HcalPedVal: channel " << detid << " not found in reference set" << std::endl;
883  std::cerr << "HcalPedVal: channel " << detid << " not found in reference set" << std::endl;
884  }
885  }
886 
887  // main loop over channels
888  int erflag = 0;
889  for (int i = 0; i < (int)RefChanns.size(); i++) {
890  detid = HcalDetId(RefChanns[i]);
891  for (int icap = 0; icap < 4; icap++) {
892  RefPedVals[icap] = fRefPedestals->getValues(detid)->getValue(icap);
893  for (int icap2 = icap; icap2 < 4; icap2++) {
894  RefPedSigs[icap][icap2] = fRefPedestalWidths->getValues(detid)->getSigma(icap, icap2);
895  if (icap2 != icap)
896  RefPedSigs[icap2][icap] = RefPedSigs[icap][icap2];
897  }
898  }
899 
900  // read new raw values
901  if (isinRaw[detid]) {
902  for (int icap = 0; icap < 4; icap++) {
903  RawPedVals[icap] = fRawPedestals->getValues(detid)->getValue(icap);
904  for (int icap2 = icap; icap2 < 4; icap2++) {
905  RawPedSigs[icap][icap2] = fRawPedestalWidths->getValues(detid)->getSigma(icap, icap2);
906  if (icap2 != icap)
907  RawPedSigs[icap2][icap] = RawPedSigs[icap][icap2];
908  }
909  }
910 
911  // first quick check if raw values make sense: if not, the channel is treated like absent
912  for (int icap = 0; icap < 4; icap++) {
913  if (RawPedVals[icap] < 1. || RawPedSigs[icap][icap] < 0.01)
914  isinRaw[detid] = false;
915  for (int icap2 = icap; icap2 < 4; icap2++) {
916  if (fabs(RawPedSigs[icap][icap2] / sqrt(RawPedSigs[icap][icap] * RawPedSigs[icap2][icap2])) > 1.)
917  isinRaw[detid] = false;
918  }
919  }
920  }
921 
922  // check raw values against reference
923  if (isinRaw[detid]) {
924  for (int icap = 0; icap < 4; icap++) {
925  int icap2 = (icap + 1) % 4;
926  float width = sqrt(RawPedSigs[icap][icap]);
927  float erof1 = width / sqrt((float)nstat[icap]);
928  float erof2 = sqrt(erof1 * erof1 + RawPedSigs[icap][icap] / (float)nstat[icap]);
929  float erofwidth = width / sqrt(2. * nstat[icap]);
930  float diffof1 = RawPedVals[icap] - RefPedVals[icap];
931  float diffof2 = RawPedVals[icap] + RawPedVals[icap2] - RefPedVals[icap] - RefPedVals[icap2];
932  float diffofw = width - sqrt(RefPedSigs[icap][icap]);
933 
934  // validation in 2 TS for HB, HE, HO, in 1 TS for HF
935  int nTS = 2;
936  if (detid.subdet() == HcalForward)
937  nTS = 1;
938  if (nTS == 1 && fabs(diffof1) > 0.5 + erof1) {
939  erflag += 1;
940  PedValLog << "HcalPedVal: drift in channel " << detid << " cap " << icap << ": " << RawPedVals[icap] << " - "
941  << RefPedVals[icap] << " = " << diffof1 << std::endl;
942  }
943  if (nTS == 2 && fabs(diffof2) > 0.5 + erof2) {
944  erflag += 1;
945  PedValLog << "HcalPedVal: drift in channel " << detid << " caps " << icap << "+" << icap2 << ": "
946  << RawPedVals[icap] << "+" << RawPedVals[icap2] << " - " << RefPedVals[icap] << "+"
947  << RefPedVals[icap2] << " = " << diffof2 << std::endl;
948  }
949  if (fabs(diffofw) > 0.15 * width + erofwidth) {
950  erflag += 1;
951  PedValLog << "HcalPedVal: width changed in channel " << detid << " cap " << icap << ": " << width << " - "
952  << sqrt(RefPedSigs[icap][icap]) << " = " << diffofw << std::endl;
953  }
954  }
955  }
956 
957  // for disconnected/bad channels restore reference values
958  else {
959  PedValLog << "HcalPedVal: no valid data from channel " << detid << std::endl;
960  erflag += 100000;
961  HcalPedestal item(detid, RefPedVals[0], RefPedVals[1], RefPedVals[2], RefPedVals[3]);
963  HcalPedestalWidth widthsp(detid);
964  for (int icap = 0; icap < 4; icap++) {
965  for (int icap2 = icap; icap2 < 4; icap2++)
966  widthsp.setSigma(icap2, icap, RefPedSigs[icap2][icap]);
967  }
968  fValPedestalWidths->addValues(widthsp);
969  }
970 
971  // end of channel loop
972  }
973 
974  if (erflag == 0)
975  PedValLog << "HcalPedVal: all pedestals checked OK" << std::endl;
976 
977  // now construct the remaining part of the validated objects
978  // if nothing changed outside tolerance, validated set = reference set
979  if (erflag % 100000 == 0) {
980  for (int i = 0; i < (int)RefChanns.size(); i++) {
981  detid = HcalDetId(RefChanns[i]);
982  if (isinRaw[detid]) {
983  HcalPedestalWidth widthsp(detid);
984  for (int icap = 0; icap < 4; icap++) {
985  RefPedVals[icap] = fRefPedestals->getValues(detid)->getValue(icap);
986  for (int icap2 = icap; icap2 < 4; icap2++) {
987  RefPedSigs[icap][icap2] = fRefPedestalWidths->getValues(detid)->getSigma(icap, icap2);
988  if (icap2 != icap)
989  RefPedSigs[icap2][icap] = RefPedSigs[icap][icap2];
990  widthsp.setSigma(icap2, icap, RefPedSigs[icap2][icap]);
991  }
992  }
993  fValPedestalWidths->addValues(widthsp);
994  HcalPedestal item(detid, RefPedVals[0], RefPedVals[1], RefPedVals[2], RefPedVals[3]);
996  }
997  }
998  }
999 
1000  // if anything changed, validated set = raw set + reference for missing/bad channels
1001  else {
1002  for (int i = 0; i < (int)RawChanns.size(); i++) {
1003  detid = HcalDetId(RawChanns[i]);
1004  if (isinRaw[detid]) {
1005  HcalPedestalWidth widthsp(detid);
1006  for (int icap = 0; icap < 4; icap++) {
1007  RawPedVals[icap] = fRawPedestals->getValues(detid)->getValue(icap);
1008  for (int icap2 = icap; icap2 < 4; icap2++) {
1009  RawPedSigs[icap][icap2] = fRawPedestalWidths->getValues(detid)->getSigma(icap, icap2);
1010  if (icap2 != icap)
1011  RawPedSigs[icap2][icap] = RawPedSigs[icap][icap2];
1012  widthsp.setSigma(icap2, icap, RawPedSigs[icap2][icap]);
1013  }
1014  }
1015  fValPedestalWidths->addValues(widthsp);
1016  HcalPedestal item(detid, RawPedVals[0], RawPedVals[1], RawPedVals[2], RawPedVals[3]);
1018  }
1019  }
1020  }
1021  return erflag;
1022 }
HODataFrame::sample
constexpr const HcalQIESample & sample(int i) const
access a sample
Definition: HODataFrame.h:40
HcalPedestalAnalysis::m_nevtsample
int m_nevtsample
Definition: HcalPedestalAnalysis.h:118
HcalPedestalAnalysis::m_pedValflag
int m_pedValflag
Definition: HcalPedestalAnalysis.h:121
HcalPedestalAnalysis::m_file
TFile * m_file
Definition: HcalPedestalAnalysis.h:110
HcalPedestalAnalysis::processEvent
void processEvent(const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalDbService &cond)
Definition: HcalPedestalAnalysis.cc:131
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
mps_fire.i
i
Definition: mps_fire.py:428
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
HcalPedestalWidth::setSigma
void setSigma(int fCapId1, int fCapId2, float fSigma)
Definition: HcalPedestalWidth.cc:35
HBHEDataFrame::sample
constexpr HcalQIESample const & sample(int i) const
access a sample
Definition: HBHEDataFrame.h:40
HFDataFrame::id
constexpr HcalDetId const & id() const
Definition: HFDataFrame.h:23
HcalDetId::iphi
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
HcalQIECoder::charge
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
Definition: HcalQIECoder.cc:20
HcalPedestalAnalysis::m_outputFileMean
std::string m_outputFileMean
Definition: HcalPedestalAnalysis.h:113
HcalQIESample::adc
constexpr int adc() const
get the ADC sample
Definition: HcalQIESample.h:43
HcalPedestalAnalysis::m_stat
float m_stat[4]
Definition: HcalPedestalAnalysis.h:145
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalPedestalAnalysis::hoHists
struct HcalPedestalAnalysis::@57 hoHists
HcalPedestalAnalysis::evt
int evt
Definition: HcalPedestalAnalysis.h:142
HcalPedestalAnalysis::setup
void setup(const std::string &m_outputFileROOT)
Definition: HcalPedestalAnalysis.cc:119
HcalPedestalAnalysis::m_outputFileWidth
std::string m_outputFileWidth
Definition: HcalPedestalAnalysis.h:114
edm::SortedCollection
Definition: SortedCollection.h:49
HcalPedestalAnalysis.h
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HcalPedestals.h
HFDataFrame::sample
constexpr HcalQIESample const & sample(int i) const
access a sample
Definition: HFDataFrame.h:40
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
tools.TF1
TF1
Definition: tools.py:23
HcalPedestalAnalysis::GetPedConst
void GetPedConst(std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, TH1F *PedMeans, TH1F *PedWidths)
Definition: HcalPedestalAnalysis.cc:433
HcalCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: HcalCondObjectContainer.h:159
HcalQIESample
Definition: HcalQIESample.h:32
HcalPedestalAnalysis::fRefPedestals
const HcalPedestals * fRefPedestals
Definition: HcalPedestalAnalysis.h:136
Chi2
Definition: Chi2.h:15
HcalPedestalWidths
Definition: HcalPedestalWidths.h:17
HcalPedestals
Definition: HcalPedestals.h:20
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
HcalQIECoder.h
HcalPedestalWidth::getSigma
float getSigma(int fCapId1, int fCapId2) const
get correlation element for capId1/2 = 0..3
Definition: HcalPedestalWidth.cc:33
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
HcalPedestalAnalysis::sample
int sample
Definition: HcalPedestalAnalysis.h:143
HcalPedestalAnalysis::per2CapsHists
void per2CapsHists(int flag, int id, const HcalDetId detid, const HcalQIESample &qie1, const HcalQIESample &qie2, std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, const HcalDbService &cond)
Definition: HcalPedestalAnalysis.cc:243
HcalPedestalAnalysis::AllChanHists
void AllChanHists(const HcalDetId detid, const HcalQIESample &qie0, const HcalQIESample &qie1, const HcalQIESample &qie2, const HcalQIESample &qie3, const HcalQIESample &qie4, const HcalQIESample &qie5, std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT)
Definition: HcalPedestalAnalysis.cc:392
HcalPedestal
Definition: HcalPedestal.h:15
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HcalPedestalAnalysis::Trendings
void Trendings(std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, TH1F *Chi2, TH1F *CapidAverage, TH1F *CapidChi2)
Definition: HcalPedestalAnalysis.cc:686
HcalPedestalAnalysis::m_AllPedsOK
int m_AllPedsOK
Definition: HcalPedestalAnalysis.h:122
HcalPedestalAnalysis::fRefPedestalWidths
const HcalPedestalWidths * fRefPedestalWidths
Definition: HcalPedestalAnalysis.h:137
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HBHEDataFrame
Definition: HBHEDataFrame.h:14
cond
Definition: plugin.cc:23
HFDataFrame::size
constexpr int size() const
total number of samples in the digi
Definition: HFDataFrame.h:27
HcalPedestalAnalysis::m_coder
const HcalQIECoder * m_coder
Definition: HcalPedestalAnalysis.h:125
HcalDetId::ieta
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
edm::ParameterSet
Definition: ParameterSet.h:47
HcalPedestalAnalysis::m_endTS
int m_endTS
Definition: HcalPedestalAnalysis.h:117
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
HcalCondObjectContainer::getAllChannels
std::vector< DetId > getAllChannels() const
Definition: HcalCondObjectContainer.h:312
HcalPedestalAnalysis::_meot
std::map< HcalDetId, std::map< int, PEDBUNCH > >::iterator _meot
Definition: HcalPedestalAnalysis.h:135
HcalPedestalAnalysis::HcalPedestalAnalysis
HcalPedestalAnalysis(const edm::ParameterSet &ps)
Constructor.
Definition: HcalPedestalAnalysis.cc:16
HcalPedestalAnalysis::state
std::vector< bool > state
Definition: HcalPedestalAnalysis.h:146
HcalDetId
Definition: HcalDetId.h:12
createfilelist.int
int
Definition: createfilelist.py:10
HFDataFrame
Definition: HFDataFrame.h:14
HcalPedestalAnalysis::m_pedsinADC
int m_pedsinADC
Definition: HcalPedestalAnalysis.h:119
HODataFrame::size
constexpr int size() const
total number of samples in the digi
Definition: HODataFrame.h:27
HLT_FULL_cff.cap
cap
Definition: HLT_FULL_cff.py:6332
photonIsolationHIProducer_cfi.ho
ho
Definition: photonIsolationHIProducer_cfi.py:10
HcalQIESample::capid
constexpr int capid() const
get the Capacitor id
Definition: HcalQIESample.h:47
HcalPedestalAnalysis::m_startTS
int m_startTS
Definition: HcalPedestalAnalysis.h:116
HcalPedestalAnalysis::fitflag
static const int fitflag
Definition: HcalPedestalAnalysis.h:149
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
HcalPedestalAnalysis::m_hiSaveflag
int m_hiSaveflag
Definition: HcalPedestalAnalysis.h:120
HcalPedestalWidths.h
HcalQIECoder
Definition: HcalQIECoder.h:20
photonIsolationHIProducer_cfi.hbhe
hbhe
Definition: photonIsolationHIProducer_cfi.py:8
HcalForward
Definition: HcalAssistant.h:36
hi
Definition: EPCuts.h:4
HcalPedestalAnalysis::~HcalPedestalAnalysis
~HcalPedestalAnalysis()
Destructor.
Definition: HcalPedestalAnalysis.cc:89
HBHEDataFrame::id
constexpr const HcalDetId & id() const
Definition: HBHEDataFrame.h:23
HcalTopology.h
HcalPedestalAnalysis::fValPedestals
HcalPedestals * fValPedestals
Definition: HcalPedestalAnalysis.h:140
HcalDbService
Definition: HcalDbService.h:26
HBHEDataFrame::size
constexpr int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:27
std
Definition: JetResolutionObject.h:76
HcalPedestalAnalysis::HcalPedVal
static int HcalPedVal(int nstat[4], const HcalPedestals *fRefPedestals, const HcalPedestalWidths *fRefPedestalWidths, HcalPedestals *fRawPedestals, HcalPedestalWidths *fRawPedestalWidths, HcalPedestals *fValPedestals, HcalPedestalWidths *fValPedestalWidths)
Definition: HcalPedestalAnalysis.cc:845
HODataFrame
Definition: HODataFrame.h:14
HcalPedestalAnalysis::hfHists
struct HcalPedestalAnalysis::@57 hfHists
HcalPedestalAnalysis::hbHists
struct HcalPedestalAnalysis::@57 hbHists
edm::eventsetup::heterocontainer::insert
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HcalPedestalAnalysis::m_outputFileROOT
std::string m_outputFileROOT
Definition: HcalPedestalAnalysis.h:112
HcalQIEShape
Definition: HcalQIEShape.h:17
HcalCondObjectContainer::addValues
bool addValues(const Item &myItem)
Definition: HcalCondObjectContainer.h:234
HcalPedestalAnalysis::fValPedestalWidths
HcalPedestalWidths * fValPedestalWidths
Definition: HcalPedestalAnalysis.h:141
HcalDbService.h
HcalPedestalAnalysis::fTopology
const HcalTopology * fTopology
Definition: HcalPedestalAnalysis.h:147
genParticles_cff.map
map
Definition: genParticles_cff.py:11
HcalPedestalWidth
Definition: HcalPedestalWidth.h:15
HcalPedestalAnalysis::evt_curr
int evt_curr
Definition: HcalPedestalAnalysis.h:144
trigObjTnPSource_cfi.bins
bins
Definition: trigObjTnPSource_cfi.py:20
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
HODataFrame::id
constexpr HcalDetId const & id() const
Definition: HODataFrame.h:23
HcalPedestalAnalysis::m_shape
const HcalQIEShape * m_shape
Definition: HcalPedestalAnalysis.h:124
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
HcalPedestalAnalysis::fRawPedestalWidths
HcalPedestalWidths * fRawPedestalWidths
Definition: HcalPedestalAnalysis.h:139
HcalPedestalAnalysis::fRawPedestals
HcalPedestals * fRawPedestals
Definition: HcalPedestalAnalysis.h:138
fit
Definition: CombinedChiSquaredLikelihood.h:6
HcalPedestalAnalysis::done
int done(const HcalPedestals *fInputPedestals, const HcalPedestalWidths *fInputWidths, HcalPedestals *fOutputPedestals, HcalPedestalWidths *fOutputWidths)
Definition: HcalPedestalAnalysis.cc:591
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
HcalPedestal::getValue
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalPedestal.h:20
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
HcalPedestalAnalysis::SampleAnalysis
void SampleAnalysis()
Definition: HcalPedestalAnalysis.cc:410