CMS 3D CMS Logo

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