ATLAS Offline Software
TileRawChannelMonTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ********************************************************************
6 //
7 // NAME: TileRawChannelMonTool.cxx
8 // PACKAGE:
9 //
10 // AUTHOR: Alexander Solodkov
11 //
12 //
13 // ********************************************************************
14 
15 #include "TileRawChannelMonTool.h"
16 
22 #include "StoreGate/ReadHandle.h"
23 
24 #include "TH1S.h"
25 #include "TH2S.h"
26 #include "TH1F.h"
27 #include "TProfile.h"
28 #include "TGraphAsymmErrors.h"
29 #include "TVirtualPad.h"
30 #include "TCanvas.h"
31 #include "TStyle.h"
32 #include "TLine.h"
33 #include "TF1.h"
34 
35 #include <iostream>
36 #include <sstream>
37 #include <iomanip>
38 #include <cmath>
39 #include <algorithm>
40 
41 
42 /*---------------------------------------------------------*/
43 TileRawChannelMonTool::TileRawChannelMonTool(const std::string & type, const std::string & name, const IInterface* parent)
45  , m_tileToolEmscale("TileCondToolEmscale")
46  , m_cispar(0)
47  , m_nEventsTileMon(0)
48  , m_calibUnit(TileRawChannelUnit::Invalid)
49  , m_drawHists(true)
50  , m_tileInfo(0)
51 
52 /*---------------------------------------------------------*/
53 {
54  declareInterface<IMonitorToolBase>(this);
55 
56  declareProperty("bookAllDrawers", m_bookAll = false);
57  declareProperty("overlaphists", m_overlaphists = false);
58  declareProperty("book2D", m_book2D = true);
59 
60  // run type 1 - phys, 2 - las, 4 - ped, 8 - cis
61  declareProperty("runType", m_runType = 0);
62  declareProperty("bigain", m_bigain = true);
63  declareProperty("TileRawChannelContainer", m_contName = "TileRawChannelOpt2"); //SG RC Container
64  declareProperty("TileRawChannelContainerDSP", m_contNameDSP = "TileRawChannelCnt"); //SG DSP RC Cell Container
65 
66  declareProperty("AmpQ_down_Limit", m_DownLimit = 0.7);
67  declareProperty("AmpQ_up_Limit", m_UpLimit = 1.3);
68  declareProperty("AmpQ_loIntegralLimit", m_lo_IntegralLimit = 0.005);
69  declareProperty("AmpQ_medIntegralLimit", m_med_IntegralLimit = 0.010);
70  declareProperty("AmpQ_hiIntegralLimit", m_hi_IntegralLimit = 0.015);
71  declareProperty("RatioErrorBar", m_useratioerror = true);
72  declareProperty("PlotDSP", m_plotDsp = false);
73  declareProperty("StoreGraph", m_storeGraph = true);
74  m_path = "/Tile/RawChannel"; //ROOT file directory
75  declareProperty("EfitThresh", m_efitThresh = 0.30); //threshold in pC for DSP check
76  declareProperty("TileCondToolEmscale", m_tileToolEmscale);
77  declareProperty("SummaryUpdateFrequency", m_summaryUpdateFrequency = 0);
78  declareProperty("ResetAfterSummaryUpdate", m_resetAfterSummaryUpdate = false);
79  declareProperty("DoLaserSummaryVsPMT", m_doLaserSummaryVsPMT = false);
80  declareProperty("MinAmpForCorrectedTime", m_minAmpForCorrectedTime = 0.5);
81  declareProperty("TileInfoName", m_infoName = "TileInfo");
82  declareProperty("TileDQstatus", m_DQstatusKey = "TileDQstatus");
84 }
85 
86 /*---------------------------------------------------------*/
88 /*---------------------------------------------------------*/
89 {
90 }
91 
92 /*---------------------------------------------------------*/
94 /*---------------------------------------------------------*/
95 {
96 
97  ATH_MSG_INFO("in initialize()");
98 
99  m_data = std::make_unique<Data>();
100 
101  CHECK(m_tileToolEmscale.retrieve());
102 
103  m_nEventsTileMon = 0;
104 
105  memset(m_data->m_timeCov, 0, sizeof(m_data->m_timeCov));
106  memset(m_data->m_timeCovCorr, 0, sizeof(m_data->m_timeCovCorr));
107 
109 
111  if (m_tileInfo->ADCmax() == 4095) m_is12bit = true;
112 
113  m_dac2Charge[0] = 100.* 2.0 * 4.096 / double(m_tileInfo->ADCmax()); // 100 pF * 2 for legacy or 200 pF for demonstrator
114  m_dac2Charge[1] = 5.2 * 2.0 * 4.096 / double(m_tileInfo->ADCmax()); // use the same number 5.2 pF as in TileCisDefaultCalibTool
115  m_dac2Charge[2] = 5.2 * 4.096 / double(m_tileInfo->ADCmax()); // effective value of small capacitor is twice smaller for demonstrator
116 
118 
119  return StatusCode::SUCCESS;
120 }
121 
122 /*---------------------------------------------------------*/
124 /*---------------------------------------------------------*/
125 {
126 
127  if (msgLvl(MSG::DEBUG)) {
128  msg(MSG::DEBUG) << "in bookHists()" << endmsg;
129  msg(MSG::DEBUG) << "Using base path " << m_path << endmsg;
130  }
131 
132  if (m_intCalibUnit>=0 && m_intCalibUnit<=3) {
134  }
136  if (m_runType == PhysRun) {
138  } else {
140  }
141  }
142 
143  if (m_bookAll) {
144  for (int ros = 1; ros < 5; ++ros) {
145  for (int drawer = 0; drawer < 64; ++drawer) {
146  bookHists(ros, drawer);
147 
148  if (m_plotDsp) bookDsp(ros, drawer);
149 
150  }
151  }
152  }
153 
154  /* float X_axis[48];
155  float X_errors[48];
156  for (int i = 0; i < 48; i++) {
157  X_axis[i] = i+0.5;
158  X_errors[i] = 0.;
159  }
160 
161  TGraph* test = new TGraph(48,X_axis,X_errors);
162  test->SetNameTitle("LFTESTLBC01","LFTESTLBC01");
163  m_rootsvc->regGraph("/HIST1/Tile/RawChannel/Summary/LFTESTBC01", test);
164 
165  TGraph* test2 = new TGraph(48,X_axis,X_errors);
166  test2->SetNameTitle("LFTESTLBC02","LFTESTLBC02");
167  m_rootsvc->regGraph("/HIST1/Tile/RawChannel/Summary/LFTESTBC02", test2);
168  */
169 
170  //SetBookStatus(true);
171 
172 
173  return StatusCode::SUCCESS;
174 }
175 
176 
177 /*---------------------------------------------------------*/
179 /*---------------------------------------------------------*/
180 {
181  const char *gain[6] = { "_lo", "_hi", "", " low gain", " high gain", "" };
182 
183  std::ostringstream sStr;
184  std::string moduleName = TileCalibUtils::getDrawerString(ros, drawer);
185  std::string subDir = moduleName;
186  std::string histName, histTitle;
187 
188  ATH_MSG_DEBUG("in bookHists() for module " << moduleName);
189 
190  // for bigain run book 2 histograms per channel
191  // for monogain run book just one histogram per channel
192  int mingain = (m_bigain) ? 0 : 2;
193  int maxgain = (m_bigain) ? 2 : 3;
194 
195  for (int ch = 0; ch < 48; ++ch) {
196 
197  // int pmt=m_cabling->channel2hole(ros,ch); // 1:48, negative for non-connected channels
198  // int pmt0 = ((pmt > 0)? pmt-1 : pmt+1); // 0:47, negaitve for non-connected channels
199  sStr.str("");
200  sStr << std::setfill('0') << std::setw(2) << ch << std::setfill(' ');
201  // sStr << std::setfill('0') << std::setw(2) << (abs(pmt)-1) << std::setfill(' ');
202  std::string sCh = sStr.str(); // 00:47, always positive
203 
204  for (int gn = mingain; gn < maxgain; ++gn) {
205 
206  if ((m_runType == CisRun) || (m_runType == CisRamp)) {
207 
208  std::string HistName[4] = { "_amp_ratio_100", "_amp_ratio_5", "_time_100", "_time_5" };
209  std::string HistTitle[4] = { " amp to charge ratio for 100 pF", " amp to charge ratio for 5 pF", " time for 100 pF", " time for 5 pF" };
210 
211  for (int type = 0; type < 4; type++) {
212  sStr.str("");
213  sStr << moduleName << "_ch_" << sCh << gain[gn] << HistName[type];
214  histName = sStr.str();
215 
216  sStr.str("");
217  sStr << moduleName << " CH " << ch << gain[3 + gn] << HistTitle[type];
218  histTitle = sStr.str();
219 
220  if (type < 2)
221  m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(book1S(subDir, histName, histTitle, 101, -0.01, 2.01));
222  else
223  m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(book1S(subDir, histName, histTitle, 101, -101.0, 101.0));
224  }
225 
226  if (m_book2D) {
227  std::string Hist2DName[4] = { "_amp_vs_q_100", "_amp_vs_q_5", "_time_vs_time_100", "_time_vs_time_5" };
228  std::string Hist2DTitle[4] = { " amp vs charge 100 pF", " amp vs charge 5 pF", " time vs time 100 pF", " time vs time 5 pF" };
229  float factor_charge = m_is12bit ? 2. : 1.;
230  float factor_adc = m_is12bit ? 4. : 1.;
231  // Below, static_cast<float> is used to avoid warnings from -Wnarrowing
232  float LowX_low2D[4] = { -4., -0.5, -0.25, -0.25 };
233  float HighX_low2D[4] = { 804., 50.5, 25.25, 25.25 };
234  float LowX_hi2D[4] = { static_cast<float>(-0.0625 * factor_charge), static_cast<float>(-0.0625 * factor_charge), -0.25, -0.25 };
235  float HighX_hi2D[4] = { static_cast<float>(12.5625 * factor_charge), static_cast<float>(12.5625 * factor_charge), 25.25, 25.25 };
236  float LowY_low2D[4] = { -25., -5.3125, -64.0, -64.0 };
237  float HighY_low2D[4] = { 1025., 60.3125, 32.0, 32.0 };
238  float LowY_hi2D[4] = { static_cast<float>(-25. * factor_adc), static_cast<float>(-25. * factor_adc), -64.0, -64.0 };
239  float HighY_hi2D[4] = { static_cast<float>(1025. * factor_adc), static_cast<float>(1025. * factor_adc), 32.0, 32.0 };
240  float LowY_hi2D_pC[4] = { static_cast<float>(-.391 * factor_adc), static_cast<float>(-.391 * factor_adc), -64.0, -64.0 };
241  float HighY_hi2D_pC[4] = { static_cast<float>(16.02 * factor_adc), static_cast<float>(16.02 * factor_adc), 32.0, 32.0 };
242 
243  for (int type = 0; type < 4; type++) {
244 
245  sStr.str("");
246  sStr << moduleName << "_ch_" << sCh << gain[gn] << Hist2DName[type];
247  histName = sStr.str();
248 
249  sStr.str("");
250  sStr << moduleName << " CH " << ch << gain[3 + gn] << Hist2DTitle[type];
251  histTitle = sStr.str();
252 
253  switch (gn) {
254  case 0: // low gain
255  m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
256  book2S(subDir, histName, histTitle, 51, LowX_low2D[type], HighX_low2D[type], 160, LowY_low2D[type], HighY_low2D[type]));
257  break;
258  case 1: // high gain
260  m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
261  book2S(subDir, histName, histTitle, 51, LowX_hi2D[type], HighX_hi2D[type], 160, LowY_hi2D_pC[type], HighY_hi2D_pC[type]));
262  else
263  m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
264  book2S(subDir, histName, histTitle, 51, LowX_hi2D[type], HighX_hi2D[type], 160, LowY_hi2D[type], HighY_hi2D[type]));
265  break;
266  default: // single gain mode
268  m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
269  book2S(subDir, histName, histTitle, 51, LowX_hi2D[type], HighX_hi2D[type], 160, LowY_hi2D_pC[type], HighY_hi2D_pC[type]));
270  else
271  m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
272  book2S(subDir, histName, histTitle, 51, LowX_hi2D[type], HighX_hi2D[type], 160, LowY_hi2D[type], HighY_hi2D[type]));
273  }
274  } //loop over type hist
275  } // if(book2D)
276 
277  } else { // not CIS run
278 
279  sStr.str("");
280  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_amp";
281  histName = sStr.str();
282 
283  sStr.str("");
284  sStr << moduleName << " CH " << ch << gain[3 + gn] << " amp";
285  histTitle = sStr.str();
286 
287  if (m_runType == PedRun) {
288  switch (gn) {
289  case 0: // low gain
290  m_data->m_hist1[ros][drawer][ch][gn].push_back(book1S(subDir, histName, histTitle, 101, -10.1, 10.1));
291  break;
292  case 1: // high gain
293  m_data->m_hist1[ros][drawer][ch][gn].push_back(book1S(subDir, histName, histTitle, 101, -0.404, 0.404));
294  break;
295  default: // single gain mode
296  m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(book1S(subDir, histName, histTitle, 101, -10.1, 10.1));
297  }
298  } else {
299  switch (gn) {
300  case 0: // low gain
301  if (m_overlaphists) {
302  const Int_t nlg1 = 49;
303  const Int_t nlg2 = 500;
304  const Int_t nlg3 = 1027;
305  Double_t xlgbin[nlg1 + nlg2 + nlg3 + 1];
306  for(Int_t i = 0; i <= nlg1; ++i)
307  xlgbin[i] = -50.5+1.0*i;
308  for(Int_t i = 1; i <= nlg2; ++i)
309  xlgbin[i + nlg1] = -1.5 + 0.05 * i;
310  for(Int_t i = 1; i <= nlg3; ++i)
311  xlgbin[i + nlg1 + nlg2] = 23.5 + 1.0 * i;
312  m_data->m_hist1[ros][drawer][ch][gn].push_back(book1Sx(subDir, histName, histTitle, nlg1 + nlg2 + nlg3, xlgbin));
313  } else {
314  m_data->m_hist1[ros][drawer][ch][gn].push_back(book1S(subDir, histName, histTitle, 1101, -50.5, 1050.5));
315  }
316  break;
317  case 1: // high gain
318  if (m_overlaphists)
319  m_data->m_hist1[ros][drawer][ch][gn].push_back(book1S(subDir, histName, histTitle, 500, -1.5, 23.5));
320  else
321  m_data->m_hist1[ros][drawer][ch][gn].push_back(book1S(subDir, histName, histTitle, 826, -1.01, 15.51));
322  break;
323  default: // single gain mode
324  if (m_runType == PhysRun) {
325  m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(book1S(subDir, histName, histTitle, 206, -0.55, 20.05));
326  } else {
327  m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(book1S(subDir, histName, histTitle, 801, -0.5, 800.5));
328  }
329  }
330  }
331 
332  sStr.str("");
333  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_time";
334  histName = sStr.str();
335 
336  sStr.str("");
337  sStr << moduleName << " CH " << ch << gain[3 + gn] << " time";
338  histTitle = sStr.str();
339 
340  m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(book1S(subDir, histName, histTitle, 201, -100.5, 100.5));
341  //Lukas
342  sStr.str("");
343  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_time_corr";
344  histName = sStr.str();
345 
346  sStr.str("");
347  sStr << moduleName << " CH " << ch << gain[3 + gn] << " time_corr";
348  histTitle = sStr.str();
349 
350  m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(book1S(subDir, histName, histTitle, 201, -100.5, 100.5));
351  //Lukas
352  }
353  }
354  }
355 
357 }
358 
359 /*---------------------------------------------------------*/
361 /*---------------------------------------------------------*/
362 {
363  const char *gain[6] = { "_lo", "_hi", "", " low gain", " high gain", "" };
364 
365 
366  std::ostringstream sStr;
367 
368  std::string moduleName = TileCalibUtils::getDrawerString(ros, drawer);
369  std::string subDir = moduleName;
370  std::string histName, histTitle;
371 
372  ATH_MSG_DEBUG("in bookDSP() for module " << moduleName);
373 
374  // for bigain run book 2 histograms per channel
375  // for monogain run book just one histogram per channel
376  int mingain = (m_bigain) ? 0 : 2;
377  int maxgain = (m_bigain) ? 2 : 3;
378 
379  for (int gn = mingain; gn < maxgain; ++gn) {
380  std::string finalsubDir = "Summary";
381  sStr.str("");
382  sStr << moduleName << gain[gn] << "_summary_chi2_amp";
383  std::string finalhistName = sStr.str();
384 
385  sStr.str("");
386  sStr << moduleName << gain[3 + gn] << " Summary chi2 versus amp";
387  std::string finalhistTitle = sStr.str();
388 
389  switch (gn) {
390  case 0: // low gain
391  m_data->m_finalHistDsp2[ros][drawer][gn].push_back(book2F(finalsubDir, finalhistName, finalhistTitle, 200, -45.1, 855.1, 16, 0., 16.));
392  break;
393  case 1: // high gain
394  m_data->m_finalHistDsp2[ros][drawer][gn].push_back(book2F(finalsubDir, finalhistName, finalhistTitle, 150, -7.0, 12.0, 16, 0., 16.));
395  break;
396  default: // single gain mode
397  if (m_runType == PhysRun) {
398  m_data->m_finalHistDsp2[ros][drawer][gn & 1].push_back(book2F(subDir, finalhistName, finalhistTitle, 150, -7.005, 7.005, 16, 0., 16.));
399 
400  } else {
401  m_data->m_finalHistDsp2[ros][drawer][gn & 1].push_back(book2F(subDir, finalhistName, finalhistTitle, 200, -45.1, 855.1, 16, 0., 16.));
402  }
403  }
404 
405  }
406 
407  for (int ch = 0; ch < 48; ++ch) {
408 
409  // int pmt=m_cabling->channel2hole(ros,ch); // 1:48, negative for non-connected channels
410  // int pmt0 = ((pmt > 0)? pmt-1 : pmt+1); // 0:47, negaitve for non-connected channels
411  sStr.str("");
412  // sStr << std::setfill('0') << std::setw(2) << (abs(pmt)-1) << std::setfill(' ');
413  sStr << std::setfill('0') << std::setw(2) << ch << std::setfill(' ');
414  std::string sCh = sStr.str(); // 00:47, always positive
415 
416  for (int gn = mingain; gn < maxgain; ++gn) {
417 
418  sStr.str("");
419  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_dsp_amp";
420  histName = sStr.str();
421 
422  sStr.str("");
423  sStr << moduleName << " CH " << ch << gain[3 + gn] << " Dsp Amp";
424  histTitle = sStr.str();
425 
426  switch (gn) {
427  case 0: // low gain
428  m_data->m_histDsp1[ros][drawer][ch][gn].push_back(book1F(subDir, histName, histTitle, 491, -50.5, 1049.34));
429  break;
430  case 1: // high gain
431  m_data->m_histDsp1[ros][drawer][ch][gn].push_back(book1F(subDir, histName, histTitle, 413, -1.01, 15.51));
432  break;
433  default: // single gain mode
434  if (m_runType == PhysRun) {
435  m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(book1F(subDir, histName, histTitle, 100, -0.55, 20.05));
436  } else {
437  m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(book1F(subDir, histName, histTitle, 200, -0.5, 800.5));
438  }
439  }
440 
441  sStr.str("");
442  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_dsp_time";
443  histName = sStr.str();
444 
445  sStr.str("");
446  sStr << moduleName << " CH " << ch << gain[3 + gn] << " Dsp Time";
447  histTitle = sStr.str();
448 
449  m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(book1F(subDir, histName, histTitle, 101, -100.5, 100.5));
450 
451  sStr.str("");
452  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_dsp_chi2";
453  histName = sStr.str();
454 
455  sStr.str("");
456  sStr << moduleName << " CH " << ch << gain[3 + gn] << " Dsp Chi2";
457  histTitle = sStr.str();
458 
459  m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(book1F(subDir, histName, histTitle, 16, -0.5, 15.5));
460 
461  sStr.str("");
462  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_dsp-fit_amp_diff";
463  histName = sStr.str();
464 
465  sStr.str("");
466  sStr << moduleName << " CH " << ch << gain[3 + gn] << " Dsp-OF Amp difference";
467  histTitle = sStr.str();
468 
469  auto ix = (gn < 2) ? gn : (gn & 1);
470  m_data->m_histDsp1[ros][drawer][ch][ix].push_back(book1F(subDir, histName, histTitle, 404, -1.01, 1.01));
471 
472  sStr.str("");
473  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_dsp-fit_time_diff";
474  histName = sStr.str();
475 
476  sStr.str("");
477  sStr << moduleName << " CH " << ch << gain[3 + gn] << " Dsp-OF Time diff";
478  histTitle = sStr.str();
479 
480  m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(book1F(subDir, histName, histTitle, 101, -2.02, 2.02));
481 
482  sStr.str("");
483  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_chi2_amp";
484  histName = sStr.str();
485 
486  sStr.str("");
487  sStr << moduleName << " CH " << ch << gain[3 + gn] << " Dsp Chi2 versus Amp";
488  histTitle = sStr.str();
489 
490  switch (gn) {
491  case 0: // low gain
492  m_data->m_histDsp2[ros][drawer][ch][gn].push_back(book2F(subDir, histName, histTitle, 200, -45.1, 855.1, 16, 0., 16.));
493  break;
494  case 1: // high gain
495  m_data->m_histDsp2[ros][drawer][ch][gn].push_back(book2F(subDir, histName, histTitle, 150, -7.0, 12.0, 16, 0., 16.));
496  break;
497  default: // single gain mode
498  if (m_runType == PhysRun) {
499  m_data->m_histDsp2[ros][drawer][ch][gn & 1].push_back(book2F(subDir, histName, histTitle, 150, -7.005, 7.005, 16, 0., 16.));
500  } else {
501  m_data->m_histDsp2[ros][drawer][ch][gn & 1].push_back(book2F(subDir, histName, histTitle, 200, -45.1, 855.1, 16, 0., 16.));
502  }
503  }
504 
505  } //end for over gains
506  } // end for over chans
507 }
508 
509 /*---------------------------------------------------------*/
511 /*---------------------------------------------------------*/
512 {
513 
514  ATH_MSG_DEBUG("in fillHists()");
515 
516  if (m_nEventsTileMon % 1000 == 0) ATH_MSG_INFO(m_nEventsTileMon<<" events processed so far");
517  // array of 16 CIS parameters
518  const TileDQstatus* dqStatus = SG::makeHandle (m_DQstatusKey).get();
519  m_cispar = dqStatus->cispar();
521 
522  m_efitMap.clear();
523  m_tfitMap.clear();
524 
525  //ndulchin: start filter code
526  const TileDigitsContainer* DigitsCnt;
527  CHECK(evtStore()->retrieve(DigitsCnt, "TileDigitsCnt"));
528 
529  TileDigitsContainer::const_iterator collItr2 = DigitsCnt->begin();
530  TileDigitsContainer::const_iterator lastColl2 = DigitsCnt->end();
531 
532  for (; collItr2 != lastColl2; ++collItr2) {
533  TileDigitsCollection::const_iterator digitsItr = (*collItr2)->begin();
534  TileDigitsCollection::const_iterator lastDigits = (*collItr2)->end();
535 
536  if (digitsItr != lastDigits) {
537 
538  HWIdentifier adc_id = (*digitsItr)->adc_HWID();
539  int ros = m_tileHWID->ros(adc_id);
540  int drawer = m_tileHWID->drawer(adc_id);
541  std::vector<uint32_t> headerVec = (*collItr2)->getFragChipHeaderWords();
542  int headsize = headerVec.size();
543  if (headsize > 16) headsize = 16;
544 
545  int fragId = (*collItr2)->identify();
546  if (!std::binary_search(m_fragIDsToIgnoreDMUerrors.begin(), m_fragIDsToIgnoreDMUerrors.end(), fragId)) {
547 
548  for (int dmu = 0; dmu < headsize; dmu++) {
549  m_corrup[ros][drawer][0][dmu] = checkDmuHeader(&headerVec, dmu);
550  m_corrup[ros][drawer][1][dmu] = checkDmuHeader(&headerVec, dmu);
551  }
552 
553  } else {
554  for (int dmu = 0; dmu < headsize; dmu++) {
555  m_corrup[ros][drawer][0][dmu] = false;
556  m_corrup[ros][drawer][1][dmu] = false;
557  }
558  }
559 
560  for (int dmu = headsize; dmu < 16; dmu++) {
561  m_corrup[ros][drawer][0][dmu] = false;
562  m_corrup[ros][drawer][1][dmu] = false;
563  }
564 
565  }
566  }
567 
568  //if (!isErr)
569  //ndulchin: end Filter code
570 
571  const TileRawChannelContainer* RawChannelCnt;
572  CHECK(evtStore()->retrieve(RawChannelCnt, m_contName));
573 
574  TileRawChannelUnit::UNIT RChUnit = RawChannelCnt->get_unit();
575 
576  //Lukas
577  double avgTimePerPart[5], sumTimeCh[5];
578  int nCh[5];
579  for (int iros = 0; iros < 5; iros++) {
580  avgTimePerPart[iros] = 0;
581  sumTimeCh[iros] = 0;
582  nCh[iros] = 0;
583  } //for iros
584  //Lukas
585 
586  for (int k = 0; k < 2; k++) { //Lukas
587 
588  TileRawChannelContainer::const_iterator collItr = RawChannelCnt->begin();
589  TileRawChannelContainer::const_iterator lastColl = RawChannelCnt->end();
590 
591  for (; collItr != lastColl; ++collItr) {
592 
593  int cap = (m_cispar[7] > 10) ? 0 : 1; // 100 pF or 5 pF
594  int cap_index = cap;
595 
596  double hg_small_charge = 1.; // ignore charges below 1 pC in HG
597  double lg_small_charge = (cap) ? 10. : 15.; // ignore charges below 10 pC for small cap and below 15 pC for big cap in LG
598  double hg_charge_cut = 11.5; // ignore charges above 11.5 pC in HG (full range is 12.5 pC)
599  double lg_charge_cut = 750.; // ignore charges above 750. pC in LG (full range is 800. pC)
600 
601  int fragId = (*collItr)->identify();
602  bool demonstrator = (std::binary_search(m_fragIDsDemonstrators.begin(), m_fragIDsDemonstrators.end(), fragId));
603  if (demonstrator) {
604  hg_small_charge *= 2.;
605  hg_charge_cut *= 2;
606  cap_index *= 2;
607  }
608  double charge = (m_cispar[6] < 1024) ? m_cispar[6] * m_dac2Charge[cap_index] : 0;
609  double timeInj = m_cispar[5] * 0.104;
610 
611  TileRawChannelCollection::const_iterator chItr = (*collItr)->begin();
612  TileRawChannelCollection::const_iterator lastCh = (*collItr)->end();
613 
614  if (chItr != lastCh) {
615 
616  HWIdentifier adc_id = (*chItr)->adc_HWID();
617  int ros = m_tileHWID->ros(adc_id);
618  int drawer = m_tileHWID->drawer(adc_id);
619  unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
620 
621  if (m_data->m_hist1[ros][drawer][0][0].size() == 0) {
622  // m_bigain = (dqStatus->calibMode() == 1); // true if bi-gain run
623  // we fill both high and low gain plots
624  m_bigain = true;
625  if (k == 0) bookHists(ros, drawer); //Lukas
626  }
627 
628  std::vector<double> efitVec(m_bigain ? 96 : 48, 0.), tfitVec(m_bigain ? 96 : 48, 0.); //I need these variables later for comparison with dsp
629 
630  for (; chItr != lastCh; ++chItr) {
631 
632  const TileRawChannel * rch = (*chItr);
633 
634  adc_id = rch->adc_HWID();
635  unsigned int chan = m_tileHWID->channel(adc_id);
636  int adc = m_tileHWID->adc(adc_id);
637  int gain = (m_bigain) ? adc : 0; // ignore gain in monogain run
638 
639  if ((m_cispar[8] == 0) /* || ( m_cispar[8] == abs(m_cabling->channel2hole(ros,chan)) )*/) { // channel is fired
640 
641  double amp = rch->amplitude();
642  if (RChUnit != m_calibUnit) {
643  //Put everything in PicoCoulomb by default for all run types
644  //For Laser and Physcs calibrate in CesiumPicoCoulomb for all channels,
645  // but the MBTS channels, for which we keep the calibration in PicoCoulombCesium pC for consistency
646  //(no Cs calibration is possible)
648  if (ros < 3) //if LB then it's ok CesiumPicoCoulomb
649  {
650  amp = m_tileToolEmscale->channelCalib(drawerIdx, chan, adc, amp, RChUnit, TileRawChannelUnit::CesiumPicoCoulombs);
651  } else // check that they are not MBTS channel
652  {
653  int index, pmt;
654  /*Identifier cell_id =*/rch->cell_ID_index(index, pmt);
655  if (index < -1) // MBTS channel
656  {
657  amp = m_tileToolEmscale->channelCalib(drawerIdx, chan, adc, amp, RChUnit, TileRawChannelUnit::PicoCoulombs);
658  } else //not MBTS channel
659  {
660  amp = m_tileToolEmscale->channelCalib(drawerIdx, chan, adc, amp, RChUnit, TileRawChannelUnit::CesiumPicoCoulombs);
661  }
662  }
663  } //close if on CesiumPicoCoulomb units
664  else { //calibrate in PicoCoulomb
665  amp = m_tileToolEmscale->channelCalib(drawerIdx, chan, adc, amp, RChUnit, m_calibUnit);
666  }
667  } // no need to calibrate
668 
669  efitVec[chan + gain * 48] = amp;
670  double time = rch->time();
671  double timeCorr = 0; //Lukas
672  tfitVec[chan + gain * 48] = time;
673 
674  if (!m_corrup[ros][drawer][gain][chan / 3]) {
675  if ((m_runType == CisRun) || (m_runType == CisRamp)) {
676  if (k == 0) { //Lukas
677 
678  if (m_book2D) {
679  m_data->m_hist2[ros][drawer][chan][gain][cap]->Fill(charge, amp);
680  }
681 
682  // avoid small signals and overflows in both gains
683  if ( ( (adc == 1) && (charge < hg_charge_cut) && (charge > hg_small_charge) ) ||
684  ( (adc == 0) && (charge < lg_charge_cut) && (charge > lg_small_charge) ) ) {
685 
686  double ratio = amp / charge;
687 
688  m_data->m_hist1[ros][drawer][chan][gain][0 + cap]->Fill(ratio);
689  m_data->m_hist1[ros][drawer][chan][gain][2 + cap]->Fill(time);
690  if (m_book2D) {
691  m_data->m_hist2[ros][drawer][chan][gain][cap + 2]->Fill(timeInj, time);
692  }
693 
694  /*TimeCov[ros][drawer][chan][gain][cap][0] += timeInj;
695  TimeCov[ros][drawer][chan][gain][cap][1] += timeInj*timeInj;
696  TimeCov[ros][drawer][chan][gain][cap][2] += time;
697  TimeCov[ros][drawer][chan][gain][cap][3] += time*time;
698  TimeCov[ros][drawer][chan][gain][cap][4] += timeInj*time;*/
699  ++m_data->m_timeCov[ros][drawer][chan][gain][cap][5];
700  }
701  } //if k==0 //Lukas
702  } else { // not CisRun
703  if (k == 0) { //Lukas
704  m_data->m_hist1[ros][drawer][chan][gain][0]->Fill(amp, 1.0);
705  if (time != 0) { // we don't fill the time when it is exactly 0, which is a conventional value to say that it is not
706  // calculated when the difference between the max(samples)-min(samples)< threshold
707  m_data->m_hist1[ros][drawer][chan][gain][1]->Fill(time, 1.0);
708  }
709 
710  m_data->m_timeCov[ros][drawer][chan][gain][0][0] += amp;
711  m_data->m_timeCov[ros][drawer][chan][gain][0][1] += amp * amp;
712  m_data->m_timeCov[ros][drawer][chan][gain][0][2] += time;
713  m_data->m_timeCov[ros][drawer][chan][gain][0][3] += time * time;
714  //TimeCov[ros][drawer][chan][gain][0][4] += amp*time;
715  ++m_data->m_timeCov[ros][drawer][chan][gain][0][5];
716  /*
717  //Lukas
718  if((ros==3 && drawer==14 && (chan==12 || chan==13 || chan==18 || chan==19))||(ros==4 && drawer==17 && (chan==12 || chan==13 || chan==18 || chan==19))){
719  }else if((ros==3 || ros==4) && (chan==0 || chan==1 || chan==12 || chan==13)){
720  }else{
721  sumTimeCh[ros][gain]+=time;
722  nCh[ros][gain]+=1;
723  }
724  //Lukas
725  */
726  //Lukas
727  if (isDisconnected(ros, drawer, chan) || amp < m_minAmpForCorrectedTime) continue;
728  if ((ros == 3 || ros == 4)
729  && (chan == 0 || chan == 1 || chan == 2 || chan == 3 || chan == 4 || chan == 5 || chan == 12 || chan == 13 || chan == 18
730  || chan == 19)) {
731  } else {
732  sumTimeCh[ros] += time;
733  nCh[ros] += 1;
734  }
735  //Lukas
736 
737  } //if k==0 //Lukas
738  else if (k == 1) { //Lukas
739  if (isDisconnected(ros, drawer, chan) || amp < m_minAmpForCorrectedTime) continue;
740 
741  timeCorr = time - avgTimePerPart[ros]; //Lukas
742  m_data->m_hist1[ros][drawer][chan][gain][2]->Fill(timeCorr, 1.0); //Lukas
743 
744  m_data->m_timeCovCorr[ros][drawer][chan][gain][0][0] += timeCorr; //Lukas
745  m_data->m_timeCovCorr[ros][drawer][chan][gain][0][1] += timeCorr * timeCorr; //Lukas
746  ++m_data->m_timeCovCorr[ros][drawer][chan][gain][0][2]; //Lukas
747 
748  } //k==1 //Lukas
749  } // end of nonCisRun
750  }
751 
752  } else { // if channel is not fired
753  }
754 
755  } // loop over channels
756  if (k == 0) { //Lukas
757  if (m_plotDsp) {
758  m_efitMap.insert(make_pair(ros * 100 + drawer, efitVec)); // needed later for dspreco comparison
759  m_tfitMap.insert(make_pair(ros * 100 + drawer, tfitVec)); // needed later for dspreco comparison
760  }
761  } //if k==0 //Lukas
762  }
763  }
764  //Lukas
765  if (k == 0) {
766  for (int iros = 0; iros < 5; iros++) {
767  if (nCh[iros] != 0) {
768  avgTimePerPart[iros] = sumTimeCh[iros] / nCh[iros];
769  } else {
770  avgTimePerPart[iros] = 0;
771  }
772  sumTimeCh[iros] = 0;
773  nCh[iros] = 0;
774  } //for
775  } //if k==0
776  //Lukas
777  } // loop over k //Lukas
778 
779  if (m_plotDsp) {
780  if (fillDsp(m_efitMap, m_tfitMap).isFailure()) ATH_MSG_WARNING("Error filling DSP histograms");
781  }
782 
783 
785  m_drawHists = false;
788  }
789 
790 
791 
793  return StatusCode::SUCCESS;
794 }
795 
796 /*---------------------------------------------------------*/
797 StatusCode TileRawChannelMonTool::fillDsp(std::map<int, std::vector<double> > &efitMap, std::map<int, std::vector<double> > &tfitMap)
798 /*---------------------------------------------------------*/
799 {
800 
801  ATH_MSG_DEBUG("in fillDsp()");
802 
803  const TileRawChannelContainer* RawChannelCnt;
804  CHECK(evtStore()->retrieve(RawChannelCnt, m_contNameDSP));
805 
806  TileRawChannelUnit::UNIT RChUnit = RawChannelCnt->get_unit();
807 
808  TileRawChannelContainer::const_iterator collItr = RawChannelCnt->begin();
809  TileRawChannelContainer::const_iterator lastColl = RawChannelCnt->end();
810 
811  for (; collItr != lastColl; ++collItr) {
812 
813  TileRawChannelCollection::const_iterator chItr = (*collItr)->begin();
814  TileRawChannelCollection::const_iterator lastCh = (*collItr)->end();
815 
816  if (chItr != lastCh) {
817 
818  HWIdentifier adc_id = (*chItr)->adc_HWID();
819  int ros = m_tileHWID->ros(adc_id);
820  int drawer = m_tileHWID->drawer(adc_id);
821 
822  if (m_data->m_histDsp1[ros][drawer][0][0].size() == 0) {
823  m_bigain = true;
824  bookDsp(ros, drawer);
825  }
826 
827  for (; chItr != lastCh; ++chItr) {
828 
829  const TileRawChannel * rch = (*chItr);
830 
831  adc_id = rch->adc_HWID();
832  unsigned int chan = m_tileHWID->channel(adc_id);
833  int adc = m_tileHWID->adc(adc_id);
834  int gain = (m_bigain) ? adc : 0; // ignore gain in monogain run
835  unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
836 
837  if ((m_cispar[8] == 0) /* || ( m_cispar[8] == abs(m_cabling->channel2hole(ros,chan)) )*/
838  && !m_corrup[ros][drawer][gain][chan / 3]) { // channel is fired and not corrupted
839 
840  double amp = rch->amplitude();
841  if (RChUnit != m_calibUnit) {
842  if (m_calibUnit != TileRawChannelUnit::CesiumPicoCoulombs) { //We put everythin in the same unit
843  amp = m_tileToolEmscale->channelCalib(drawerIdx, chan, adc, amp, RChUnit, m_calibUnit);
844  } else { // it is =TileRawChannelUnit::CesiumPicoCoulombs, careful with MBTS channels
845  if (ros < 3) //if LB then it's ok CesiumPicoCoulomb
846  {
847  amp = m_tileToolEmscale->channelCalib(drawerIdx, chan, adc, amp, RChUnit, TileRawChannelUnit::CesiumPicoCoulombs);
848  //conversion factor if of the order of 1000MeV=1.05pC
849  } else // check that they are not MBTS channel
850  {
851  int index, pmt;
852  /*Identifier cell_id =*/rch->cell_ID_index(index, pmt);
853  if (index < -1) // MBTS channel
854  {
855  amp = m_tileToolEmscale->channelCalib(drawerIdx, chan, adc, amp, RChUnit, TileRawChannelUnit::PicoCoulombs);
856  } else //not MBTS channel
857  {
858  amp = m_tileToolEmscale->channelCalib(drawerIdx, chan, adc, amp, RChUnit, TileRawChannelUnit::CesiumPicoCoulombs);
859  }
860  }
861  } // end if CesiumPicoCouloumb
862  }
863 
864  double time = rch->time();
865  double chi2 = rch->quality();
866 
867  m_data->m_histDsp1[ros][drawer][chan][gain][Edsp]->Fill(amp, 1.0);
868  m_data->m_histDsp1[ros][drawer][chan][gain][Tdsp]->Fill(time, 1.0);
869  m_data->m_histDsp1[ros][drawer][chan][gain][chi2dsp]->Fill(chi2, 1.0);
870  m_data->m_histDsp2[ros][drawer][chan][gain][0]->Fill(amp, chi2, 1.0);
871  m_data->m_finalHistDsp2[ros][drawer][gain][0]->Fill(amp, chi2, 1.0);
872 
873  std::map<int, std::vector<double> >::iterator it = efitMap.find(ros * 100 + drawer);
874  if (it != efitMap.end()) {
875  double efit = (*it).second.at(chan + gain * 48);
876  it = tfitMap.find(ros * 100 + drawer);
877  double tfit = (*it).second.at(chan + gain * 48);
878  //convert from pC to ADC counts
879  if (TMath::Abs(efit) > m_efitThresh) { // fill the histogram only if the efit is above threshold
880  m_data->m_histDsp1[ros][drawer][chan][gain][Edsp_fit]->Fill((amp - efit) / efit, 1.0);
881  }
882 
883  if (tfit != 0.) {
884  m_data->m_histDsp1[ros][drawer][chan][gain][Tdsp_fit]->Fill((time - tfit), 1.0);
885  }
886 
887  }
888  }
889 
890  } // loop over channels
891 
892  }
893  }
894  return StatusCode::SUCCESS;
895 }
896 
897 
898 
899 
900 /*---------------------------------------------------------*/
902 /*---------------------------------------------------------*/
903 {
904 
905 
906  const char *gain[6] = { "_lo", "_hi", "", " low gain", " high gain", "" };
907 
908  // for bigain run book 2 histograms per channel
909  // for monogain run book just one histogram per channel
910  int mingain = (m_bigain) ? 0 : 2;
911  int maxgain = (m_bigain) ? 2 : 3;
912 
913  std::ostringstream sStr;
914 
915  if ((m_runType == CisRun) || (m_runType == CisRamp)) {
916 
917  const char *HistName[6] = { "_tslope", "_toffset", "_qratio", " Time slope", " Time offset", " Amp/Q ratio" };
918  const char *CapName[4] = { "_100", "_5", " 100 pF", " 5 pF" };
919 
920 
921  std::string moduleName = TileCalibUtils::getDrawerString(ros, drawer);
922  std::string subDir = "Summary";
923  std::string histName, histTitle;
924 
925  for (int gn = mingain; gn < maxgain; ++gn) {
926  int adc = gn & 1;
927  for (int cap = 0; cap < 2; ++cap) {
928  for (int type = 0; type < 3; ++type) {
929 
930  sStr.str("");
931  sStr << moduleName << gain[gn] << HistName[type] << CapName[cap];
932  histName = sStr.str();
933  sStr.str("");
934  sStr << moduleName << gain[3 + gn] << HistName[3 + type] << CapName[2 + cap];
935  histTitle = sStr.str();
936  m_data->m_finalHist1[ros][drawer][adc][cap].push_back(book1F(subDir, histName, histTitle, 48, 0, 48));
937  }
938  } //end of loop over capacitors
939  } //end of loop over gn
940 
941  } else { // not CisRun
942  const char *HistName[10] = { "_amp", "_rms", "_sigma", "_time", "_time_corr", " Amplitude", " RMS of amplitude", " Sigma amp from Gaussian fit",
943  " Average time and RMS", " Average time corr. and RMS" };
944  //Lukas
945 
946  std::string moduleName = TileCalibUtils::getDrawerString(ros, drawer);
947  std::string subDir = "Summary";
948  std::string histName, histTitle;
949 
950  for (int gn = mingain; gn < maxgain; ++gn) {
951 
952  int adc = gn & 1;
953 
954  //for (int type = 0; type < 4; ++type) {
955  for (int type = 0; type < 5; ++type) { //Lukas
956 
957  sStr.str("");
958  sStr << moduleName << gain[gn] << HistName[type];
959  histName = sStr.str();
960  sStr.str("");
961  //sStr << moduleName << gain[3+gn] << HistName[4+type];
962  sStr << moduleName << gain[3 + gn] << HistName[5 + type]; //Lukas
963  histTitle = sStr.str();
964  m_data->m_finalHist1[ros][drawer][adc][0].push_back(book1F(subDir, histName, histTitle, 48, 0.0, 48.0));
965 
966  std::string hTitle(histTitle);
967 
969 
970  hTitle += " (Even PMTs)";
971  m_data->m_summaryPmts[ros][drawer][adc][0].push_back(book1F(subDir + "/pmt", histName + "_pmt_even", hTitle, 49, -0.5, 48.5));
972  m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerStyle(22);
973  m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerColor(2);
974  m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerSize(0.75);
975 
976  hTitle = histTitle;
977  hTitle += " (Odd PMTs)";
978  m_data->m_summaryPmts[ros][drawer][adc][1].push_back(book1F(subDir + "/pmt", histName + "_pmt_odd", hTitle, 49, -0.5, 48.5));
979  m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerStyle(23);
980  m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerColor(4);
981  m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerSize(0.75);
982 
983  if (ros < 3 && m_data->m_summaryPmts[0][drawer][adc][0].size() < (unsigned int)(type + 1)) {
984 
985  histName.replace(histName.begin(), histName.begin() + 3, "LB");
986  histTitle.replace(histTitle.begin(), histTitle.begin() + 3, "LB");
987  hTitle = histTitle;
988 
989  hTitle += " (LBA even PMTs + LBC odd PMTs: negative)";
990  m_data->m_summaryPmts[0][drawer][adc][0].push_back(book1F(subDir + "/pmt", histName + "_pmt_LBA-even_LBC-odd", hTitle, 97, -48.5, 48.5));
991  m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerStyle(22);
992  m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerColor(2);
993  m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerSize(0.75);
994 
995  hTitle = histTitle;
996  hTitle += " (LBA odd PMTs + LBC even PMTs: negative)";
997  m_data->m_summaryPmts[0][drawer][adc][1].push_back(book1F(subDir + "/pmt", histName + "_pmt_LBA-odd_LBC-even", hTitle, 97, -48.5, 48.5));
998  m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerStyle(23);
999  m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerColor(4);
1000  m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerSize(0.75);
1001  }
1002  }
1003  }
1004 
1005  } //end of loop over gn
1006  }
1007 
1008 }
1009 
1010 
1011 /*---------------------------------------------------------*/
1013 /*---------------------------------------------------------*/
1014 {
1015 
1016  memset(m_data->m_timeCov, 0, sizeof(m_data->m_timeCov));
1017  memset(m_data->m_timeCovCorr, 0, sizeof(m_data->m_timeCovCorr));
1018 
1019  int mingain = (m_bigain) ? 0 : 2;
1020  int maxgain = (m_bigain) ? 2 : 3;
1021 
1022  for (int ros = 1; ros < 5; ++ros) {
1023  for (int drawer = 0; drawer < 64; ++drawer) {
1024  if (m_data->m_hist1[ros][drawer][0][0].size() != 0) {
1025  for (int ch = 0; ch < 48; ++ch) {
1026  for (int gn = mingain; gn < maxgain; ++gn) {
1027  for (auto h : m_data->m_hist1[ros][drawer][ch][gn]) h->Reset();
1028  for (auto h : m_data->m_hist2[ros][drawer][ch][gn]) h->Reset();
1029  }
1030  }
1031  }
1032  }
1033  }
1034 }
1035 
1036 
1037 /*---------------------------------------------------------*/
1039 /*---------------------------------------------------------*/
1040 {
1041 
1042  ATH_MSG_INFO("in fillFfinalHiststograms()");
1043 
1044  memset(m_data->m_rangeQ, 0, sizeof(m_data->m_rangeQ));
1045 
1046  TF1 * fit_gaus = new TF1("g", "gaus");
1047 
1048  // for bigain run book 2 histograms per channel
1049  // for monogain run book just one histogram per channel
1050  int mingain = (m_bigain) ? 0 : 2;
1051  int maxgain = (m_bigain) ? 2 : 3;
1052 
1053  if ((m_runType == CisRun) || (m_runType == CisRamp)) {
1054  for (int ros = 1; ros < 5; ++ros) {
1055  for (int drawer = 0; drawer < 64; ++drawer) {
1056  if (m_data->m_hist1[ros][drawer][0][0].size() != 0) {
1057  for (int gn = mingain; gn < maxgain; ++gn) {
1058 
1059  int adc = gn & 1;
1060  for (int cap = 0; cap < 2; ++cap) {
1061  for (int ch = 0; ch < 48; ++ch) {
1062 
1063  // int pmt = abs(m_cabling->channel2hole(ros,ch)); // number in range [1,48]
1064 
1065  TF1* polyfunc = 0;
1066  if (m_book2D) polyfunc = GetTimeFitFunc(m_data->m_hist2[ros][drawer][ch][adc][cap + 2]);
1067  if (polyfunc) {
1068  m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinContent(ch + 1, polyfunc->GetParameter(1));
1069  if (polyfunc->GetParError(1) > 5) {
1070  m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, 5.);
1071  } else {
1072  m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, polyfunc->GetParError(1));
1073  }
1074  m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinContent(ch + 1, polyfunc->GetParameter(0));
1075  if (polyfunc->GetParError(0) > 5) {
1076  m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, 5.);
1077  } else {
1078  m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, polyfunc->GetParError(0));
1079  }
1080 
1081  delete polyfunc; //important!
1082  }
1083 
1084  else {
1085  m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinContent(ch + 1, 0.);
1086  m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, 0.);
1087  m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinContent(ch + 1, 0.);
1088  m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, 0.);
1089  }
1090 
1091  TH1S * hist = m_data->m_hist1[ros][drawer][ch][adc][cap];
1092  int nbins = hist->GetNbinsX();
1093  int minbin = 1;
1094  for (; minbin < nbins; ++minbin) {
1095  if (hist->GetBinContent(minbin) > 0.0) {
1096  break;
1097  }
1098  }
1099  int maxbin = nbins;
1100  for (; maxbin > 1; --maxbin) {
1101  if (hist->GetBinContent(maxbin) > 0.0) {
1102  break;
1103  }
1104  }
1105 
1106  double mean = hist->GetMean();
1107  double xmin = hist->GetBinCenter(minbin);
1108  double xmax = hist->GetBinCenter(maxbin);
1109 
1110  //rangeErrorBar(xmin,xmax,mean);
1111  if (m_useratioerror) { // /use ratioerror bar or rangeerror bar ?
1113  } else {
1115  }
1116 
1117  //std::cout << hist->GetName() <<" mean-xmin= "<< mean-xmin <<"\n";
1118  m_data->m_rangeQ[adc][cap][0][ch] = mean;
1119  m_data->m_rangeQ[adc][cap][1][ch] = std::max(0.0, mean - xmin);
1120  m_data->m_rangeQ[adc][cap][2][ch] = std::max(0.0, xmax - mean);
1121 
1122  m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetBinContent(ch + 1, mean);
1123  }
1124  } //end of loop over capacitors
1125  } //end of loop over gn
1126 
1127  if(m_drawHists) {
1128  std::string moduleName = TileCalibUtils::getDrawerString(ros, drawer);
1129  drawHists(ros, drawer, moduleName);
1130  }
1131  }
1132  } //end of loop over drawer
1133  } //end of loop over ros
1134 
1135  } else { // not CisRun
1136 
1137  for (int ros = 1; ros < 5; ++ros) {
1138  for (int drawer = 0; drawer < 64; ++drawer) {
1139  if (m_data->m_hist1[ros][drawer][0][0].size() != 0) {
1140  for (int gn = mingain; gn < maxgain; ++gn) {
1141 
1142  int adc = gn & 1;
1143  for (int ch = 0; ch < 48; ++ch) {
1144 
1145  // int pmt = abs(m_cabling->channel2hole(ros,ch)); // number in range [1,48]
1146 
1147  double Amp = 0.0, ErrA = 0.0, RMS = 0.0, ErrR = 0.0;
1148  double Time = 0.0, RMST = 0.0, Sigma = 0.0, ErrS = 0.0;
1149  double NEvents = m_data->m_timeCov[ros][drawer][ch][adc][0][5];
1150 
1151  double TimeCorr = 0.0, RMSTCorr = 0.0; //Lukas
1152  double NEventsCorr = m_data->m_timeCovCorr[ros][drawer][ch][adc][0][2]; //Lukas
1153 
1154  if (NEvents > 0.0) {
1155 
1156  Amp = m_data->m_timeCov[ros][drawer][ch][adc][0][0] / NEvents;
1157  RMS = m_data->m_timeCov[ros][drawer][ch][adc][0][1] / NEvents - Amp * Amp;
1158  if (RMS > 0.0) {
1159  RMS = sqrt(RMS);
1160  ErrA = RMS / sqrt(NEvents);
1161  ErrR = RMS / sqrt(2 * NEvents);
1162  } else {
1163  RMS = 0.0;
1164  }
1165 
1166  Time = m_data->m_timeCov[ros][drawer][ch][adc][0][2] / NEvents;
1167  RMST = m_data->m_timeCov[ros][drawer][ch][adc][0][3] / NEvents - Time * Time;
1168  if (RMST > 0.0) {
1169  RMST = sqrt(RMST);
1170  } else {
1171  RMST = 0.0;
1172  }
1173  }
1174 
1175  //Lukas
1176  if (NEventsCorr > 0.0) {
1177  TimeCorr = m_data->m_timeCovCorr[ros][drawer][ch][adc][0][0] / NEventsCorr;
1178  RMSTCorr = m_data->m_timeCovCorr[ros][drawer][ch][adc][0][1] / NEventsCorr - TimeCorr * TimeCorr;
1179  if (RMSTCorr > 0.0) {
1180  RMSTCorr = sqrt(RMSTCorr);
1181  } else {
1182  RMSTCorr = 0.0;
1183  }
1184  }
1185  //Lukas
1186 
1187  if (m_data->m_hist1[ros][drawer][ch][adc][0]->GetEntries() > 0) {
1188  if (adc == 0 && m_overlaphists) { // We have for LB histograms with variable-width bins, not suitable for a fit
1189  TH1S *h4fit=new TH1S(*(m_data->m_hist1[ros][drawer][ch][adc][0]));
1190  h4fit->Scale(1,"width");
1191  h4fit->Fit("g", "NQ");
1192  delete(h4fit);
1193  } else {
1194  m_data->m_hist1[ros][drawer][ch][adc][0]->Fit("g", "NQ");
1195  }
1196  Sigma = fit_gaus->GetParameter(2);
1197  ErrS = fit_gaus->GetParError(2);
1198  }
1199 
1200  m_data->m_finalHist1[ros][drawer][adc][0][0]->SetBinContent(ch + 1, Amp);
1201  m_data->m_finalHist1[ros][drawer][adc][0][0]->SetBinError(ch + 1, ErrA);
1202  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetBinContent(ch + 1, RMS);
1203  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetBinError(ch + 1, ErrR);
1204  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetBinContent(ch + 1, Sigma);
1205  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetBinError(ch + 1, ErrS);
1206  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetBinContent(ch + 1, Time);
1207  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetBinError(ch + 1, RMST);
1208  m_data->m_finalHist1[ros][drawer][adc][0][4]->SetBinContent(ch + 1, TimeCorr); //Lukas
1209  m_data->m_finalHist1[ros][drawer][adc][0][4]->SetBinError(ch + 1, RMSTCorr); //Lukas
1210 
1212 
1213  int pmt = m_cabling->channel2hole(ros, ch);
1214  if (pmt < 0) continue;
1215 
1216  int fiber = (pmt % 2);
1217 
1218  m_data->m_summaryPmts[ros][drawer][adc][fiber][0]->SetBinContent(pmt + 1, Amp);
1219  m_data->m_summaryPmts[ros][drawer][adc][fiber][0]->SetBinError(pmt + 1, ErrA);
1220  m_data->m_summaryPmts[ros][drawer][adc][fiber][1]->SetBinContent(pmt + 1, RMS);
1221  m_data->m_summaryPmts[ros][drawer][adc][fiber][1]->SetBinError(pmt + 1, ErrR);
1222  m_data->m_summaryPmts[ros][drawer][adc][fiber][2]->SetBinContent(pmt + 1, Sigma);
1223  m_data->m_summaryPmts[ros][drawer][adc][fiber][2]->SetBinError(pmt + 1, ErrS);
1224  m_data->m_summaryPmts[ros][drawer][adc][fiber][3]->SetBinContent(pmt + 1, Time);
1225  m_data->m_summaryPmts[ros][drawer][adc][fiber][3]->SetBinError(pmt + 1, RMST);
1226  m_data->m_summaryPmts[ros][drawer][adc][fiber][4]->SetBinContent(pmt + 1, TimeCorr); //Lukas
1227  m_data->m_summaryPmts[ros][drawer][adc][fiber][4]->SetBinError(pmt + 1, RMSTCorr); //Lukas
1228 
1229  if (ros == 1) {
1230 
1231  int bin = m_data->m_summaryPmts[0][drawer][adc][fiber][0]->FindBin(pmt);
1232 
1233  m_data->m_summaryPmts[0][drawer][adc][fiber][0]->SetBinContent(bin, Amp);
1234  m_data->m_summaryPmts[0][drawer][adc][fiber][0]->SetBinError(bin, ErrA);
1235  m_data->m_summaryPmts[0][drawer][adc][fiber][1]->SetBinContent(bin, RMS);
1236  m_data->m_summaryPmts[0][drawer][adc][fiber][1]->SetBinError(bin, ErrR);
1237  m_data->m_summaryPmts[0][drawer][adc][fiber][2]->SetBinContent(bin, Sigma);
1238  m_data->m_summaryPmts[0][drawer][adc][fiber][2]->SetBinError(bin, ErrS);
1239  m_data->m_summaryPmts[0][drawer][adc][fiber][3]->SetBinContent(bin, Time);
1240  m_data->m_summaryPmts[0][drawer][adc][fiber][3]->SetBinError(bin, RMST);
1241  m_data->m_summaryPmts[0][drawer][adc][fiber][4]->SetBinContent(bin, TimeCorr); //Lukas
1242  m_data->m_summaryPmts[0][drawer][adc][fiber][4]->SetBinError(bin, RMSTCorr); //Lukas
1243 
1244  }
1245 
1246  if (ros == 2) {
1247 
1248  int bin = m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->FindBin(-pmt);
1249 
1250  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->SetBinContent(bin, Amp);
1251  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->SetBinError(bin, ErrA);
1252  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][1]->SetBinContent(bin, RMS);
1253  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][1]->SetBinError(bin, ErrR);
1254  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][2]->SetBinContent(bin, Sigma);
1255  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][2]->SetBinError(bin, ErrS);
1256  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][3]->SetBinContent(bin, Time);
1257  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][3]->SetBinError(bin, RMST);
1258  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][4]->SetBinContent(bin, TimeCorr); //Lukas
1259  m_data->m_summaryPmts[0][drawer][adc][1 - fiber][4]->SetBinError(bin, RMSTCorr); //Lukas
1260 
1261  }
1262  }
1263 
1264  }
1265  } //end of loop over gn
1266 
1267  if(m_drawHists){
1268  std::string moduleName = TileCalibUtils::getDrawerString(ros, drawer);
1269  drawHists(ros, drawer, moduleName);
1270  if (m_plotDsp) {
1271  if (finalDsp(ros, drawer).isFailure()) ATH_MSG_WARNING("Error finalizing DSP histograms");
1272  }
1273  }
1274 
1275  }
1276  } //loop over drawer
1277  } //loop over ros
1278  }
1279 
1280  delete fit_gaus;
1281 
1282  return StatusCode::SUCCESS;
1283 }
1284 
1285 
1286 
1287 
1288 /*---------------------------------------------------------*/
1290 /*---------------------------------------------------------*/
1291 {
1292  ATH_MSG_INFO("in finalHists()");
1293 
1294  if (m_summaryUpdateFrequency == 0) {
1295  for (int ros = 1; ros < 5; ++ros) {
1296  for (int drawer = 0; drawer < 64; ++drawer) {
1297  if (m_data->m_hist1[ros][drawer][0][0].size() != 0) {
1299  }
1300  }
1301  }
1302  }
1303 
1304  m_drawHists = true;
1306 
1307 
1308  return StatusCode::SUCCESS;
1309 }
1310 
1311 /*---------------------------------------------------------*/
1313 /*---------------------------------------------------------*/
1314 {
1315 
1316  if (m_data->m_histDsp1[ros][drawer][0][0].size() != 0) {
1317 
1319  const TileRawChannelContainer* RawChannelCntDsp;
1320 
1321  unsigned int iteration = 0u;
1322  unsigned int algorithm = 0u;
1323  if (evtStore()->retrieve(RawChannelCntDsp, m_contNameDSP).isSuccess()) {
1324  uint32_t info = RawChannelCntDsp->get_bsflags() >> 24u;
1325  iteration = info & 3u;
1326  algorithm = (info >> 2u) & 1u;
1327 
1328  // iteration: "NI", "I1", "I2", "I3"
1329  // algorithm: "OF1", "OF2"
1330  }
1331 
1332  const char *alg_name[2] = { "OF1", "OF2" };
1333  const char * iter_name[4] = { "NI", "I1", "I2", "I3" };
1334 
1335  const char *part[5] = { "AUX", "LBA", "LBC", "EBA", "EBC" };
1336  const char *gain[4] = { "_lo", "_hi", " low gain", " high gain" };
1337 
1338  int mingain = 0;
1339  int maxgain = 2;
1340 
1341 // const char *HistName[9] = {"_dspfit_ampdiff","_dspfit_timediff","_dspamp",
1342 // " Average (DSP-"," Average DSP-", " Average DSP-",
1343 // " - OFF-OF2-I) divided by OFF-OF2-I Amplitudes and RMS"," - OFF-OF2-I Time and RMS", " Amplitudes and RMS"};
1344  const char *HistName[9] = { "_dspfit_ampdiff", "_dspfit_timediff", "_dspamp", " Avg. (DSP-", " Average DSP-", " Average DSP-",
1345  " - OFF-OF2-I) / OFF Amplitudes and RMS", " - OFF-OF2-I Time and RMS", " Amplitudes and RMS" };
1346 
1347  std::ostringstream sStr;
1348  sStr << part[ros] << std::setfill('0') << std::setw(2) << drawer + 1 << std::setfill(' ');
1349  std::string moduleName = sStr.str();
1350  std::string subDir = "Summary";
1351  std::string histName, histTitle;
1352 
1353  for (int gn = mingain; gn < maxgain; ++gn) {
1354 
1355  int adc = gn & 1;
1356 
1357  for (int type = sumEdsp_fit; type < NsumDsp; ++type) {
1358  sStr.str("");
1359  sStr << moduleName << gain[gn] << HistName[type];
1360  histName = sStr.str();
1361  sStr.str("");
1362  sStr << moduleName << gain[2 + gn] << HistName[3 + type] << alg_name[algorithm] << "-" << iter_name[iteration] << HistName[6 + type];
1363  histTitle = sStr.str();
1364  m_data->m_finalHistDsp1[ros][drawer][adc].push_back(book1F(subDir, histName, histTitle, 48, 0.0, 48.0));
1365  }
1366 
1367  //Create hbar histograms to be used in drawDsp
1368  sStr.str("");
1369  sStr << moduleName << gain[gn] << "_dspfit_amphbar";
1370  histName = sStr.str();
1371  sStr.str("");
1372  sStr << moduleName << gain[2 + gn] << " (DSP-" << alg_name[algorithm] << "-" << iter_name[iteration]
1373  << " - OFF-OF2-I) divided by OFF Amplitudes for all chans";
1374  histTitle = sStr.str();
1375  m_data->m_hBarDsp1[ros][drawer][adc].push_back(book1F(subDir, histName, histTitle, 404, -1.01, 1.01));
1376 
1377  sStr.str("");
1378  sStr << moduleName << gain[gn] << "_dspfit_timehbar";
1379  histName = sStr.str();
1380  sStr.str("");
1381  sStr << moduleName << gain[2 + gn] << " (DSP-" << alg_name[algorithm] << "-" << iter_name[iteration] << " - OFF-OF2-I) Time for all chans";
1382  histTitle = sStr.str();
1383  m_data->m_hBarDsp1[ros][drawer][adc].push_back(book1F(subDir, histName, histTitle, 101, -2.02, 2.02));
1384 
1385  for (int ch = 0; ch < 48; ++ch) {
1386  // int pmt = abs(m_cabling->channel2hole(ros,ch)); // number in range [1,48]
1387 
1388  if (m_data->m_histDsp1[ros][drawer][ch][adc][Edsp_fit]->GetEntries() > 0) {
1389  double dspmean = m_data->m_histDsp1[ros][drawer][ch][adc][Edsp]->GetMean();
1390  double dsprms = m_data->m_histDsp1[ros][drawer][ch][adc][Edsp]->GetRMS();
1391  double emean = m_data->m_histDsp1[ros][drawer][ch][adc][Edsp_fit]->GetMean();
1392  double erms = m_data->m_histDsp1[ros][drawer][ch][adc][Edsp_fit]->GetRMS();
1393  double tmean = m_data->m_histDsp1[ros][drawer][ch][adc][Tdsp_fit]->GetMean();
1394  double trms = m_data->m_histDsp1[ros][drawer][ch][adc][Tdsp_fit]->GetRMS();
1395 
1396  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp]->SetBinContent(ch + 1, dspmean);
1397  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp]->SetBinError(ch + 1, dsprms);
1398  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->SetBinContent(ch + 1, emean);
1399  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->SetBinError(ch + 1, erms);
1400  m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->SetBinContent(ch + 1, tmean);
1401  m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->SetBinError(ch + 1, trms);
1402 
1403  m_data->m_hBarDsp1[ros][drawer][adc][sumEdsp_fit]->Add(m_data->m_histDsp1[ros][drawer][ch][adc][Edsp_fit]);
1404  m_data->m_hBarDsp1[ros][drawer][adc][sumTdsp_fit]->Add(m_data->m_histDsp1[ros][drawer][ch][adc][Tdsp_fit]);
1405 
1406  }
1407  }
1408  } // close loops over chans, gain
1409 
1410  // log << MSG::WARNING << "LUCA Calling drawDsp" << endreq;
1411  drawDsp(ros, drawer, moduleName);
1412 
1413  } //close if there are histograms for this Module
1414 
1415  return StatusCode::SUCCESS;
1416 }
1417 
1418 /*---------------------------------------------------------*/
1420 /*---------------------------------------------------------*/
1421 {
1422 
1423  ATH_MSG_INFO("in checkHists()");
1424 
1425  return StatusCode::SUCCESS;
1426 }
1427 
1428 /*---------------------------------------------------------*/
1429 void TileRawChannelMonTool::drawHists(int ros, int drawer, const std::string& moduleName)
1430 /*---------------------------------------------------------*/
1431 {
1432 
1433  ATH_MSG_DEBUG("in drawHists()");
1434 
1435  int maxgain = (m_bigain) ? 2 : 1;
1436  double ms = (m_bigain) ? 0.75 : 1.0; // marker size
1437 
1438  bool do_plots = m_savePng || m_savePs || m_saveSvg;
1439 
1440  if ((m_runType == CisRun) || (m_runType == CisRamp)) {
1441 
1442  float X_axis[48];
1443  float X_errors[48];
1444  for (int i = 0; i < 48; i++) {
1445  X_axis[i] = i + 0.5;
1446  X_errors[i] = 0.;
1447  }
1448 
1449  const char *gain[6] = { "_lo", "_hi", "", " low gain", " high gain", "" };
1450  const char *CapName[4] = { "_100", "_5", " 100 pF", " 5 pF" };
1451  if (maxgain == 1) gain[0] = gain[1] = gain[2] = gain[3] = gain[4] = gain[5];
1452 
1453  /* TGraph* test = new TGraph(48,X_errors,X_errors);
1454  test->SetName(("/HIST1/Tile/RawChannel/Summary/LFTEST"+moduleName).c_str());
1455  m_rootsvc->regGraph("/HIST1/Tile/RawChannel/Summary/LFTEST"+moduleName, test);
1456  */
1457 
1458  TCanvas * Can = NULL;
1459  if (do_plots) {
1460  Can = new TCanvas("amp_ratio", "amp_ratio", 402 * maxgain, 588);
1461  Can->Divide(maxgain, 2);
1462  gStyle->SetOptStat(0);
1463  gStyle->SetTitleFontSize(0.1);
1464  }
1465 
1466  TLine line(0., 1., 48., 1.); //Draw a green line to guide the sight
1467  line.SetLineColor(3);
1468 
1469  std::string subDir = "Summary";
1470  std::vector<TGraphAsymmErrors*> grapherrVec;
1471 
1472  for (int adc = 0; adc < maxgain; ++adc) {
1473  for (int cap = 0; cap < 2; ++cap) {
1474 
1475  std::ostringstream sStr;
1476  sStr << moduleName << gain[adc] << "_tails" << CapName[cap];
1477  std::string graphName = sStr.str();
1478  sStr.str("");
1479  sStr << moduleName << gain[adc + 3] << " Mean Amp/Q ratio and up/down tails " << CapName[2 + cap];
1480  std::string graphTitle = sStr.str();
1481 
1482  TVirtualPad * pad;
1483  if (do_plots) {
1484  pad = Can->cd(cap * maxgain + adc + 1);
1485  pad->SetTopMargin(0.15);
1486  pad->SetGridx();
1487  }
1488 
1489  TGraphAsymmErrors * final_Egraph = bookGraphAsymmErrors(subDir, graphName, graphTitle, 48, X_axis, m_data->m_rangeQ[adc][cap][0], X_errors, X_errors,
1490  m_data->m_rangeQ[adc][cap][1], m_data->m_rangeQ[adc][cap][2]);
1491  grapherrVec.push_back(final_Egraph);
1492 
1493  m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetStats(kFALSE);
1494  m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMarkerStyle(21);
1495  m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMarkerSize(ms);
1496  m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetLabelSize(0.06, "X");
1497  m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetLabelSize(0.06, "Y");
1498  m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMaximum(2.2);
1499  m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMinimum(-0.2);
1500  if (do_plots) m_data->m_finalHist1[ros][drawer][adc][cap][2]->Draw("P0");
1501 
1502  final_Egraph->SetMarkerStyle(21);
1503  final_Egraph->SetMarkerSize(ms);
1504  final_Egraph->SetMaximum(2.2);
1505  final_Egraph->SetMinimum(-0.2);
1506  final_Egraph->GetXaxis()->SetRangeUser(0, 48);
1507  if (do_plots) {
1508  final_Egraph->Draw("P0");
1509  line.Draw();
1510  }
1511 
1512  }
1513  }
1514 
1515  if (m_savePng) {
1516  Can->Print(TString(moduleName + "_amp_ratio.png"), "png");
1517  }
1518  if (m_savePs) {
1519  Can->Print(TString(moduleName + "_amp_ratio.ps"), "ps");
1520  }
1521  if (m_saveSvg) {
1522  Can->Print(TString(moduleName + "_amp_ratio.svg"), "svg");
1523  }
1524  if (do_plots) delete Can;
1525 
1526 // we have to remove TGraphAsymmErrors in 13.0.10, because THistSvc doesn't handle them well
1527  if (!m_storeGraph) {
1528  std::vector<TGraphAsymmErrors*>::const_iterator it = grapherrVec.begin();
1529  std::vector<TGraphAsymmErrors *>::const_iterator itend = grapherrVec.end();
1530  for (; it != itend; ++it) {
1531  if ((removeTObj(*it)).isFailure()) ATH_MSG_WARNING("Problems removing TObj");
1532  }
1533  }
1534 
1535  if (do_plots) {
1536  Can = new TCanvas("fit_time", "fit_time", 402 * maxgain, 588);
1537  Can->Divide(maxgain, 4);
1538  gStyle->SetOptStat(0);
1539  gStyle->SetTitleFontSize(0.1);
1540  }
1541 
1542  double maxy[2] = { 1.4, 15.0 };
1543  double miny[2] = { -0.1, -15.0 };
1544 
1545  for (int adc = 0; adc < maxgain; ++adc) {
1546  for (int cap = 0; cap < 2; ++cap) {
1547  for (int type = 0; type < 2; ++type) {
1548 
1549  TVirtualPad * pad;
1550  if (do_plots) {
1551  pad = Can->cd((type + cap * 2) * maxgain + adc + 1);
1552  pad->SetTopMargin(0.15);
1553  pad->SetGridx();
1554  }
1555 
1556  if (m_data->m_finalHist1[ros][drawer][adc][cap][type]->GetMaximum() < 0.9 * maxy[type])
1557  m_data->m_finalHist1[ros][drawer][adc][cap][type]->SetMaximum(maxy[type]);
1558  if (m_data->m_finalHist1[ros][drawer][adc][cap][type]->GetMinimum() > (miny[type] + 0.1 * TMath::Abs(miny[type])))
1559  m_data->m_finalHist1[ros][drawer][adc][cap][type]->SetMinimum(miny[type]);
1560 
1561  m_data->m_finalHist1[ros][drawer][adc][cap][type]->SetMarkerStyle(21);
1562  m_data->m_finalHist1[ros][drawer][adc][cap][type]->SetMarkerSize(ms);
1563  m_data->m_finalHist1[ros][drawer][adc][cap][type]->SetLabelSize(0.10, "X");
1564  m_data->m_finalHist1[ros][drawer][adc][cap][type]->SetLabelSize(0.10, "Y");
1565  if (do_plots) {
1566  m_data->m_finalHist1[ros][drawer][adc][cap][type]->Draw("P0");
1567 
1568  line.SetLineColor(3);
1569  line.Draw();
1570  }
1571  }
1572  }
1573  }
1574 
1575  if (m_savePng) {
1576  Can->Print(TString(moduleName + "_fit_time.png"), "png");
1577  }
1578  if (m_savePs) {
1579  Can->Print(TString(moduleName + "_fit_time.ps"), "ps");
1580  }
1581  if (m_saveSvg) {
1582  Can->Print(TString(moduleName + "_fit_time.svg"), "svg");
1583  }
1584  if (do_plots) delete Can;
1585 
1586  } else {
1587  if ((m_runType == LasRun) || (m_runType == LedRun)) { //same stuff but with Laser fancy colors
1588  LaserFancyPlotting(ros, drawer, maxgain, moduleName);
1589  } else {
1590 
1591  TCanvas * Can = NULL;
1592  if (do_plots) {
1593  Can = new TCanvas("fit_amp", "fit_amp", 402 * maxgain, 588);
1594  Can->Divide(maxgain, 3);
1595  gStyle->SetOptStat(0);
1596  gStyle->SetTitleFontSize(0.1);
1597  }
1598 
1599  double maxy[6] = { 1.0, 0.05, 1.0, 0.05, 25.0, 25.0 };
1600  double miny[6] = { -1.0, -0.05, 0.0, 0.0, -25.0, -25.0 };
1601 
1602  for (int adc = 0; adc < maxgain; ++adc) {
1603 
1604  double max0 = m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMaximum();
1605  double max1 = m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum();
1606  double max2 = m_data->m_finalHist1[ros][drawer][adc][0][2]->GetMaximum();
1607  double max3 = m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMaximum();
1608  double min0 = m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMinimum();
1609  double min1 = m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum();
1610  double min2 = m_data->m_finalHist1[ros][drawer][adc][0][2]->GetMinimum();
1611  double min3 = m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMinimum();
1612 
1613  TVirtualPad * pad;
1614  if (do_plots) {
1615  pad = Can->cd(adc + 1);
1616  pad->SetTopMargin(0.15);
1617  pad->SetGridx();
1618  }
1619 
1620  if (max0 < 0.9 * maxy[adc]) m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMaximum(maxy[adc]);
1621  if (min0 > (miny[adc] + 0.1 * TMath::Abs(miny[adc]))) m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMinimum(miny[adc]);
1622 
1623  m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMarkerStyle(21);
1624  m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMarkerSize(ms);
1625  m_data->m_finalHist1[ros][drawer][adc][0][0]->SetLabelSize(0.08, "X");
1626  m_data->m_finalHist1[ros][drawer][adc][0][0]->SetLabelSize(0.08, "Y");
1627  if (do_plots) {
1628  m_data->m_finalHist1[ros][drawer][adc][0][0]->Draw("E0");
1629  }
1630 
1631  if (do_plots) {
1632  pad = Can->cd(maxgain + adc + 1);
1633  pad->SetTopMargin(0.15);
1634  pad->SetGridx();
1635  }
1636 
1637  // if (max2 > 5 * max1) max2 = 2 * max1; // don't put crazy fit results on plot
1638  if (max1 < maxy[2 + adc]) {
1639  if (max2 < maxy[2 + adc])
1640  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(maxy[2 + adc]);
1641  else
1642  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(max2);
1643  } else {
1644  if (max1 < max2) m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(max2);
1645  }
1646 
1647  if (min1 > miny[2 + adc]) {
1648  if (min2 > miny[2 + adc])
1649  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(miny[2 + adc]);
1650  else
1651  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(min2);
1652  } else {
1653  if (min1 > min2) m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(min2);
1654  }
1655 
1656  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerStyle(21);
1657  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerSize(ms);
1658  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08, "X");
1659  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08, "Y");
1660  if (do_plots) {
1661  m_data->m_finalHist1[ros][drawer][adc][0][1]->Draw("P0");
1662  }
1663 
1664  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMaximum(m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum());
1665  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMinimum(m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum());
1666  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerStyle(25);
1667  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerSize(ms);
1668  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerColor(4);
1669  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08, "X");
1670  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08, "Y");
1671  if (do_plots) {
1672  m_data->m_finalHist1[ros][drawer][adc][0][2]->Draw("sameP0");
1673  }
1674 
1675  if (do_plots) {
1676  pad = Can->cd(2 * maxgain + adc + 1);
1677  pad->SetTopMargin(0.15);
1678  pad->SetGridx();
1679  }
1680 
1681  if (max3 < 0.9 * maxy[4 + adc]) m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMaximum(maxy[4 + adc]);
1682  if (min3 > (miny[4 + adc] + 0.1 * TMath::Abs(miny[4 + adc]))) m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMinimum(miny[4 + adc]);
1683 
1684  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerStyle(21);
1685  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerSize(ms);
1686  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08, "X");
1687  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08, "Y");
1688  if (do_plots) {
1689  m_data->m_finalHist1[ros][drawer][adc][0][3]->Draw("E0");
1690  }
1691 
1692  } //end of loop over gain
1693 
1694  if (m_savePng) {
1695  Can->Print(TString(moduleName + "_fit_amp.png"), "png");
1696  }
1697  if (m_savePs) {
1698  Can->Print(TString(moduleName + "_fit_amp.ps"), "ps");
1699  }
1700  if (m_saveSvg) {
1701  Can->Print(TString(moduleName + "_fit_amp.svg"), "svg");
1702  }
1703  if (do_plots) delete Can;
1704  }
1705  }
1706 }
1707 
1708 /*---------------------------------------------------------*/
1709 void TileRawChannelMonTool::drawDsp(int ros, int drawer, const std::string& moduleName)
1710 /*---------------------------------------------------------*/
1711 {
1712  MsgStream log(msgSvc(), name());
1713  int maxgain = (m_bigain) ? 2 : 1;
1714  double ms = (m_bigain) ? 0.75 : 1.0; // marker size
1715  bool do_plots = m_savePng || m_savePs || m_saveSvg;
1716 
1717  TCanvas * Can = NULL; // for -Wmaybe-uninitialized
1718  if (do_plots) {
1719  Can = new TCanvas("dsp_amp", "dsp_amp", 402 * maxgain, 588);
1720  Can->Divide(maxgain, 3);
1721  gStyle->SetOptStat(0);
1722  gStyle->SetTitleFontSize(0.1);
1723  }
1724 
1725  TLine line(0., 0., 48., 0.); //Draw a green line to guide the sight
1726  line.SetLineColor(3);
1727 
1728  double maxy[6] = { 0.05, 0.05, 0.5, 0.5, 10.0, 10.0 };
1729  double miny[6] = { -0.05, -0.05, -0.5, -0.5, -0.05, -0.05 };
1730  double norm[2] = { 1., 1 };
1731  for (int adc = 0; adc < maxgain; ++adc) {
1732 
1733  double maxEdsp = m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->GetMaximum();
1734  double minEdsp = m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->GetMinimum();
1735  double maxTdsp = m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->GetMaximum();
1736  double minTdsp = m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->GetMinimum();
1737  double maxchidsp = m_data->m_finalHistDsp2[ros][drawer][adc][0]->GetMaximum();
1738  double minchidsp = m_data->m_finalHistDsp2[ros][drawer][adc][0]->GetMinimum();
1739 
1740  TVirtualPad * pad;
1741  if (do_plots) {
1742  pad = Can->cd(adc + 1);
1743  pad->SetTopMargin(0.15);
1744  pad->SetGridx();
1745  }
1746 
1747  if (maxEdsp < 0.9 * maxy[adc]) m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->SetMaximum(maxy[adc]);
1748  if (minEdsp > miny[adc] + 0.1 * TMath::Abs(miny[adc])) m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->SetMinimum(miny[adc]);
1749 
1750  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->SetMarkerStyle(21);
1751  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->SetMarkerSize(ms);
1752  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->SetLabelSize(0.08, "X");
1753  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->SetLabelSize(0.08, "Y");
1754  if (do_plots) m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->Draw("");
1755 
1756  //Now we add the 1d histogram on the y-axis
1757  if (m_data->m_hBarDsp1[ros][drawer][adc][sumEdsp_fit]->GetMaximum() > 0.1) { //normalize the scale to get into the frame
1758  norm[sumEdsp_fit] = 47. / m_data->m_hBarDsp1[ros][drawer][adc][sumEdsp_fit]->GetMaximum();
1759  }
1760  m_data->m_hBarDsp1[ros][drawer][adc][sumEdsp_fit]->Scale(norm[sumEdsp_fit]);
1761  //hbardsp1[ros][drawer][adc][sumEdsp_fit]->SetFillStyle(3350);
1762  m_data->m_hBarDsp1[ros][drawer][adc][sumEdsp_fit]->SetFillColor(38);
1763  if (do_plots) {
1764  m_data->m_hBarDsp1[ros][drawer][adc][sumEdsp_fit]->Draw("hbar,same");
1765 
1766  m_data->m_finalHistDsp1[ros][drawer][adc][sumEdsp_fit]->Draw("E0,same");
1767 
1768  line.Draw();
1769 
1770  pad = Can->cd(maxgain + adc + 1);
1771  pad->SetTopMargin(0.15);
1772  pad->SetGridx();
1773  }
1774 
1775  if (maxTdsp < 0.9 * maxy[2 + adc]) m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->SetMaximum(maxy[2 + adc]);
1776  if (minTdsp > miny[2 + adc] + 0.1 * TMath::Abs(miny[2 + adc])) m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->SetMinimum(miny[2 + adc]);
1777 
1778  m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->SetMarkerStyle(21);
1779  m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->SetMarkerSize(ms);
1780  m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->SetLabelSize(0.08, "X");
1781  m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->SetLabelSize(0.08, "Y");
1782  if (do_plots) m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->Draw("");
1783 
1784  if (m_data->m_hBarDsp1[ros][drawer][adc][sumTdsp_fit]->GetMaximum() > 0.1) { //normalize the scale to get into the frame
1785  norm[sumTdsp_fit] = 47. / m_data->m_hBarDsp1[ros][drawer][adc][sumTdsp_fit]->GetMaximum();
1786  }
1787  m_data->m_hBarDsp1[ros][drawer][adc][sumTdsp_fit]->Scale(norm[sumTdsp_fit]);
1788  // hbardsp1[ros][drawer][adc][sumTdsp_fit]->SetFillStyle(3350);
1789  m_data->m_hBarDsp1[ros][drawer][adc][sumTdsp_fit]->SetFillColor(38);
1790  if (do_plots) {
1791  m_data->m_hBarDsp1[ros][drawer][adc][sumTdsp_fit]->Draw("hbar,same");
1792 
1793  m_data->m_finalHistDsp1[ros][drawer][adc][sumTdsp_fit]->Draw("E0,same");
1794 
1795  line.Draw();
1796 
1797  pad = Can->cd(2 * maxgain + adc + 1);
1798  pad->SetTopMargin(0.15);
1799  pad->SetGridx();
1800  pad->SetGridy();
1801  }
1802 
1803  if (maxchidsp < 0.9 * maxy[4 + adc]) m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetMaximum(maxy[4 + adc]);
1804  if (minchidsp > miny[4 + adc] + 0.1 * TMath::Abs(miny[4 + adc])) m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetMinimum(miny[4 + adc]);
1805 
1806  m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetLabelSize(0.08, "X");
1807  m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetLabelSize(0.08, "Y");
1808  if (do_plots) {
1809  gStyle->SetPalette(1);
1810  m_data->m_finalHistDsp2[ros][drawer][adc][0]->Draw("zcol");
1811  }
1812 
1813  } //end of loop over gain
1814 
1815  if (m_savePng) {
1816  Can->Print(TString(moduleName + "_dsp_amp.png"), "png");
1817  }
1818  if (m_savePs) {
1819  Can->Print(TString(moduleName + "_dsp_amp.ps"), "ps");
1820  }
1821  if (m_saveSvg) {
1822  Can->Print(TString(moduleName + "_dsp_amp.svg"), "svg");
1823  }
1824  if (do_plots) delete Can;
1825 
1826  for (int adc = 0; adc < maxgain; ++adc) {
1827  m_data->m_hBarDsp1[ros][drawer][adc][sumEdsp_fit]->Scale(1 / norm[sumEdsp_fit]); //back to normal
1828  m_data->m_hBarDsp1[ros][drawer][adc][sumTdsp_fit]->Scale(1 / norm[sumTdsp_fit]); //back to normal
1829  }
1830 }
1831 
1832 /*---------------------------------------------------------*/
1833 void TileRawChannelMonTool::rangeErrorBar(double& xmin, double& xmax, double mean) {
1834  /*---------------------------------------------------------*/
1841  if (m_DownLimit < mean && mean < m_UpLimit) {
1842  if (xmin > m_DownLimit) xmin = mean;
1843  if (xmax < m_UpLimit) xmax = mean;
1844  }
1845 
1846 }
1847 
1848 /*---------------------------------------------------------*/
1849 void TileRawChannelMonTool::ratioErrorBar(TH1S* hist, double& xmin, double& xmax, double mean) {
1850  /*---------------------------------------------------------*/
1861  if (m_DownLimit < mean && mean < m_UpLimit) {
1862 
1863  if (xmin > m_DownLimit) {
1864  xmin = mean;
1865  } else {
1866  int lo_thrbin = hist->FindBin(m_DownLimit); //
1867  double integral = hist->Integral(0, lo_thrbin); // we also want underflow, in case... Integral() is calculated including the contents of both limiting bins. As 0.7 falls in the middle of a bin, we are calculating the integral by excess
1868  double ratio = integral / (hist->GetEntries());
1869  if (ratio > m_hi_IntegralLimit) {
1870  xmin = mean - 1.05;
1871  } //larger error bar
1872  else if (ratio > m_med_IntegralLimit) {
1873  xmin = mean - 0.7;
1874  } //intermediate error bar
1875  else if (ratio > m_lo_IntegralLimit) {
1876  xmin = mean - 0.35;
1877  } //small error bar
1878  else {
1879  xmin = mean;
1880  }
1881  }
1882 
1883  if (xmax < m_UpLimit) {
1884  xmax = mean;
1885  } else {
1886  int hi_thrbin = hist->FindBin(m_UpLimit);
1887  double integral = hist->Integral(hi_thrbin, (hist->GetNbinsX() + 1)); //we also want overflow, in case... Integral() is calculated including the contents of both limiting bins. As 1.3 falls in the middle of a bin, we are calculating the integral by excess.
1888  double ratio = integral / (hist->GetEntries());
1889  if (ratio > m_hi_IntegralLimit) {
1890  xmax = mean + 1.05;
1891  } //larger error bar
1892  else if (ratio > m_med_IntegralLimit) {
1893  xmax = mean + 0.7;
1894  } //intermediate error bar
1895  else if (ratio > m_lo_IntegralLimit) {
1896  xmax = mean + 0.35;
1897  } //small error bar
1898  else {
1899  xmax = mean;
1900  }
1901  }
1902  }
1904 }
1905 
1908 /*---------------------------------------------------------*/
1910  /*---------------------------------------------------------*/
1911 //the TF1 pointer is created with new, please use a delete after the parameters have been extracted!
1912  if (hist2d) {
1913  TProfile* prof = hist2d->ProfileX();
1914 
1915  if (prof) {
1916  TH1S hist("hist", "TMP Histo", prof->GetNbinsX(), prof->GetBinLowEdge(1), prof->GetBinLowEdge(prof->GetNbinsX() + 1));
1917  float lastbin = -99.;
1918  float lasti = 0.;
1919  float shift = 0.;
1920  for (int i = 1; i < prof->GetNbinsX() + 1; i++) {
1921  if (prof->GetBinError(i) > 1e-7) {
1922  if ((shift < 1.) && ((prof->GetBinContent(i) - (lastbin + (i - lasti))) < -10.)) { //allow only 1 shift and only of negative sign
1923  shift = 25.;
1924  }
1925  lasti = i;
1926  lastbin = prof->GetBinContent(i);
1927  hist.SetBinContent(i, prof->GetBinContent(i) + shift);
1928  hist.SetBinError(i, prof->GetBinError(i));
1929  }
1930  } // end for loop on the histogram bins
1931  TF1* polfun = new TF1("polfun", "pol1", 0., 25.); //remember to delete!
1932  hist.Fit("polfun", "NQ");
1933 
1934  polfun->SetParameter(0, polfun->GetParameter(0) - 25.); // shift by -25 ns to be consistent with previous definition
1935  delete prof; //not needed, but these profiles appears in the root files, even if they are not booked
1936  return polfun; //rember to delete!
1937  }
1938  }
1939  return 0;
1940 }
1941 /*---------------------------------------------------------*/
1942 bool TileRawChannelMonTool::checkDmuHeader(std::vector<uint32_t>* headerVec, int dmu)
1943 /*---------------------------------------------------------*/
1944 {
1945  bool err = false;
1946 
1947  if (checkDmuHeaderFormat((*headerVec)[dmu])) {
1948  err = true;
1949 
1950  }
1951  if (checkDmuHeaderParity((*headerVec)[dmu])) {
1952  err = true;
1953 
1954  }
1955  if (((*headerVec)[dmu] >> 25) & 0x1) {
1956  //Memory Parity Error
1957  err = true;
1958 
1959  }
1960  if (((*headerVec)[dmu] >> 24) & 0x1) {
1961  //Single Strobe Error
1962  err = true;
1963 
1964  }
1965  if (((*headerVec)[dmu] >> 23) & 0x1) {
1966  //Double Strobe Error
1967  err = true;
1968 
1969  }
1970 
1971  return err;
1972 }
1973 /*---------------------------------------------------------*/
1974 void TileRawChannelMonTool::LaserFancyPlotting(int ros, int drawer, int maxgain, const std::string& moduleName) {
1975  /*---------------------------------------------------------*/
1976 
1977  ATH_MSG_DEBUG("in LaserFancyPlotting...");
1978 
1979  //TCanvas * Can = new TCanvas("fit_amp","fit_amp",402*maxgain,588);
1980  bool do_plots = m_savePng || m_savePs || m_saveSvg;
1981  TCanvas * Can = NULL;
1982  if (do_plots) {
1983  Can = new TCanvas("fit_amp", "fit_amp", 402 * maxgain, 735); //Lukas
1984  //Can->Divide(maxgain, 4);
1985  Can->Divide(maxgain, 5); //Lukas
1986  gStyle->SetOptStat(0);
1987  gStyle->SetTitleFontSize(0.1);
1988  }
1989  TLine *line = new TLine();
1990  line->SetLineWidth(2);
1991  line->SetLineStyle(7);
1992  line->SetLineColor(3);
1993 
1994  float ms = (m_bigain) ? 0.75 : 1.0; // marker size
1995 
1996  double maxy[6] = { 5.0, 0.5, 1.0, 0.05, 25.0, 25.0 };
1997  double miny[6] = { -5.0, -0.5, 0.0, 0.0, -25.0, -25.0 };
1998 
1999  // Mean value
2000  TH1F* final_empty[2]; //adc, type
2001  TH1F* final_odd[2]; //adc, type
2002  TH1F* final_even[2]; //adc, type
2003 
2004  // define TH1 that will contain the plots of variance/mean
2005  TH1F* pmtGain_empty[2];
2006  TH1F* pmtGain_odd[2];
2007  TH1F* pmtGain_even[2];
2008 
2009  for (int g = 0; g < 2; g++) {
2010 
2011  std::ostringstream hn;
2012  hn << "empty_" << g;
2013  final_empty[g] = new TH1F(hn.str().c_str(), m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2014  hn.str("");
2015  hn << "odd_" << g;
2016  final_odd[g] = new TH1F(hn.str().c_str(), m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2017  hn.str("");
2018  hn << "even_" << g;
2019  final_even[g] = new TH1F(hn.str().c_str(), m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2020 
2021  //---- Histograms for the ratio Var/Mean
2022  // titles...
2023  std::string title;
2024  const char* gain[2] = { "low", "high" };
2025  const char* moduleNames[5] = { "AUX", "LBA", "LBC", "EBA", "EBC" };
2026  if (drawer < 10)
2027  title = Form("%s0%i %s gain, Variance/Mean", moduleNames[ros], drawer + 1, gain[g]);
2028  else
2029  title = Form("%s%i %s gain, Variance/Mean", moduleNames[ros], drawer + 1, gain[g]);
2030 
2031  std::ostringstream sStr;
2032  std::string subDir = "Summary";
2033  sStr.str("");
2034  sStr << moduleNames[ros] << std::setfill('0') << std::setw(2) << drawer + 1 << std::setfill(' ') << gain[g] << "_pmtGain_empty";
2035  std::string histName = sStr.str();
2036  pmtGain_empty[g] = book1F(subDir, histName, title, 48, 0.0, 48.0);
2037  // pmtGain_empty[g]= new TH1F(Form("pmtGain_empty_%i", g),title.c_str(), 48,0,48);
2038 
2039  sStr.str("");
2040  sStr << moduleNames[ros] << std::setfill('0') << std::setw(2) << drawer + 1 << std::setfill(' ') << gain[g] << "_pmtGain_odd";
2041  histName = sStr.str();
2042  pmtGain_odd[g] = book1F(subDir, histName, title, 48, 0.0, 48.0);
2043  // pmtGain_odd[g] = new TH1F(Form("pmtGain_odd_%i", g), title.c_str(), 48,0,48);
2044 
2045  sStr.str("");
2046  sStr << moduleNames[ros] << std::setfill('0') << std::setw(2) << drawer + 1 << std::setfill(' ') << gain[g] << "_pmtGain_even";
2047  histName = sStr.str();
2048  pmtGain_even[g] = book1F(subDir, histName, title, 48, 0.0, 48.0);
2049  //pmtGain_even[g] = new TH1F(Form("pmtGain_even_%i", g), title.c_str(), 48,0,48);
2050  }
2051 
2052  // loop over the 2 gains values
2053  for (int adc = 0; adc < maxgain; ++adc) {
2054 
2055  double max0 = m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMaximum();
2056  //double max1 = final_hist1[ros][drawer][adc][0][1]->GetMaximum();
2057  //double max2 = final_hist1[ros][drawer][adc][0][2]->GetMaximum();
2058  double max3 = m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMaximum();
2059  double max4 = m_data->m_finalHist1[ros][drawer][adc][0][4]->GetMaximum(); //Lukas
2060  double min0 = m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMinimum();
2061  //double min1 = final_hist1[ros][drawer][adc][0][1]->GetMinimum();
2062  //double min2 = final_hist1[ros][drawer][adc][0][2]->GetMinimum();
2063  double min3 = m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMinimum();
2064  double min4 = m_data->m_finalHist1[ros][drawer][adc][0][4]->GetMinimum(); //Lukas
2065 
2066  if (max0 > 0.) {
2067  final_empty[adc]->SetMaximum(1.05 * max0);
2068  } else {
2069  final_empty[adc]->SetMaximum(0.);
2070  }
2071 
2072  if ((max0 - min0) > 0) {
2073  final_empty[adc]->SetMinimum(max0 - 1.05 * (max0 - min0));
2074  }
2075 
2076  // Select pad 1 and 2
2077  TVirtualPad * pad;
2078  if (do_plots) {
2079  pad = Can->cd(adc + 1);
2080  pad->SetTopMargin(0.15);
2081  pad->SetGridx();
2082  }
2083 
2084  // bin=1 corresponds to the first pmt (#0)
2085  double Kapa = 1.30e-3;
2086  for (int ch = 0; ch < 48; ++ch) {
2087  if (isDisconnected(ros, drawer, ch)) {
2088  final_empty[adc]->SetBinContent(ch + 1, m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.01);
2089  final_empty[adc]->SetBinError(ch + 1, m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.01);
2090  pmtGain_empty[adc]->SetBinContent(ch + 1, 0.01);
2091  pmtGain_empty[adc]->SetBinError(ch + 1, 0.01);
2092  }
2093  // connected channels
2094  else {
2095  double mean = m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1);
2096  double rms = m_data->m_finalHist1[ros][drawer][adc][0][1]->GetBinContent(ch + 1);
2097  double dmean = m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1);
2098  double drms = m_data->m_finalHist1[ros][drawer][adc][0][1]->GetBinError(ch + 1);
2099  // even pmts
2100  int pmt = abs(m_cabling->channel2hole(ros, ch)); //extra safe: abs should not be necessary, because channels are connected.
2101  if (pmt % 2 == 0) {
2102  final_even[adc]->SetBinContent(ch + 1, m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.001);
2103  final_even[adc]->SetBinError(ch + 1, m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.001);
2104 
2105  // if (bin!=0)
2106  // log<<MSG::DEBUG<<"["<<ros<<"]["<<drawer+1<<"]["<<adc<<"]["<< bin <<"] : mean="
2107  // << mean <<", var="<< rms*rms<<"\tVar/mean(corrected)="<< (rms*rms/mean) - Kapa*mean <<endreq;
2108  if (mean > 10e-3) {
2109  pmtGain_even[adc]->SetBinContent(ch + 1, (rms * rms / mean) - Kapa * mean);
2110  pmtGain_even[adc]->SetBinError(ch + 1, (rms * rms / mean) * sqrt((2 * drms / rms) * (2 * drms / rms) + (dmean / mean) * (dmean / mean)));
2111  } else {
2112  pmtGain_even[adc]->SetBinContent(ch + 1, -0.5);
2113  pmtGain_even[adc]->SetBinError(ch + 1, 0.001);
2114  }
2115  }
2116  // odd pmts
2117  else {
2118  final_odd[adc]->SetBinContent(ch + 1, m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.001);
2119  final_odd[adc]->SetBinError(ch + 1, m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.001);
2120 
2121  // log<<MSG::DEBUG<<"["<<ros<<"]["<<drawer+1<<"]["<<adc<<"]["<< bin <<"] : mean="
2122  // << mean <<", var="<< rms*rms<<"\tVar/mean(corrected)="<< (rms*rms/mean) - Kapa*mean <<endreq;
2123  if (mean > 10e-3) {
2124  pmtGain_odd[adc]->SetBinContent(ch + 1, (rms * rms / mean) - Kapa * mean);
2125  pmtGain_odd[adc]->SetBinError(ch + 1, (rms * rms / mean) * sqrt((2 * drms / rms) * (2 * drms / rms) + (dmean / mean) * (dmean / mean)));
2126  } else {
2127  pmtGain_odd[adc]->SetBinContent(ch + 1, -0.5);
2128  pmtGain_odd[adc]->SetBinError(ch + 1, 0.001);
2129  }
2130  }
2131  }
2132  }
2133 
2134  // we are in pads 1 and 2
2135  // retrieve the max and min of the plots
2136  double max = pmtGain_odd[adc]->GetMaximum();
2137  if (pmtGain_even[adc]->GetMaximum() > max) max = 1.05 * pmtGain_even[adc]->GetMaximum();
2138  double min = pmtGain_odd[adc]->GetMinimum();
2139  if (pmtGain_even[adc]->GetMinimum() < min) min = pmtGain_even[adc]->GetMinimum() - 0.05 * fabs(pmtGain_even[adc]->GetMinimum());
2140  if (max < 0.20) max = 0.20;
2141  if (min > -0.10) min = -0.10;
2142  //log<<MSG::INFO<<"Min and Max : "<< min <<"; "<< max <<enreq;
2143  pmtGain_empty[adc]->SetMarkerStyle(21);
2144  pmtGain_even[adc]->SetMarkerStyle(22);
2145  pmtGain_odd[adc]->SetMarkerStyle(23);
2146  pmtGain_empty[adc]->SetMarkerSize(ms);
2147  pmtGain_even[adc]->SetMarkerSize(ms);
2148  pmtGain_odd[adc]->SetMarkerSize(ms);
2149  pmtGain_empty[adc]->SetLabelSize(0.08, "X");
2150  pmtGain_empty[adc]->SetLabelSize(0.08, "Y");
2151  pmtGain_even[adc]->SetMarkerColor(2);
2152  pmtGain_odd[adc]->SetMarkerColor(4);
2153  pmtGain_empty[adc]->GetYaxis()->SetRangeUser(min, max);
2154  if (do_plots) {
2155  pmtGain_empty[adc]->Draw("e");
2156  pmtGain_even[adc]->Draw("same,e");
2157  pmtGain_odd[adc]->Draw("same,e");
2158  line->DrawLine(0, -0.01, 48, -0.01);
2159  line->DrawLine(0, 0.15, 48, 0.15);
2160 
2161  // Select pads 3 and 4
2162  pad = Can->cd(maxgain + adc + 1);
2163  pad->SetTopMargin(0.15);
2164  pad->SetGridx();
2165  }
2166 
2167  // Plot the evolution of the mean vs #pmt number (with different colours for odd and even pmts)
2168  if (max0 < 0.9 * maxy[adc]) final_empty[adc]->SetMaximum(maxy[adc]);
2169  if (min0 > miny[adc] + 0.1 * TMath::Abs(miny[adc])) final_empty[adc]->SetMinimum(miny[adc]);
2170 
2171  final_empty[adc]->SetMarkerStyle(21);
2172  final_even[adc]->SetMarkerStyle(22);
2173  final_odd[adc]->SetMarkerStyle(23);
2174  final_empty[adc]->SetMarkerSize(ms);
2175  final_even[adc]->SetMarkerSize(ms);
2176  final_odd[adc]->SetMarkerSize(ms);
2177  final_empty[adc]->SetLabelSize(0.08, "X");
2178  final_empty[adc]->SetLabelSize(0.08, "Y");
2179  final_even[adc]->SetMarkerColor(2);
2180  final_odd[adc]->SetMarkerColor(4);
2181  if (do_plots) {
2182  final_empty[adc]->Draw("e");
2183  final_even[adc]->Draw("same,e");
2184  final_odd[adc]->Draw("same,e");
2185 
2186  // Select pads 5 and 6 and plot the RMS for each pmt
2187  pad = Can->cd(2 * maxgain + adc + 1);
2188  pad->SetTopMargin(0.15);
2189  pad->SetGridx();
2190  }
2191 
2192  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerStyle(21);
2193  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerSize(ms);
2194  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08, "X");
2195  m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08, "Y");
2196  if (do_plots) m_data->m_finalHist1[ros][drawer][adc][0][1]->Draw("P0");
2197 
2198  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMaximum(m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum());
2199  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMinimum(m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum());
2200  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerStyle(25);
2201  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerSize(ms);
2202  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerColor(4);
2203  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08, "X");
2204  m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08, "Y");
2205  if (do_plots) m_data->m_finalHist1[ros][drawer][adc][0][2]->Draw("sameP0");
2206 
2207  // Select pads 7 and 8
2208  if (do_plots) {
2209  pad = Can->cd(3 * maxgain + adc + 1);
2210  pad->SetTopMargin(0.15);
2211  pad->SetGridx();
2212  }
2213 
2214  if (max3 < 0.9 * maxy[4 + adc]) m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMaximum(maxy[4 + adc]);
2215  if (min3 > miny[4 + adc] + 0.1 * TMath::Abs(miny[4 + adc])) m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMinimum(miny[4 + adc]);
2216 
2217  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerStyle(21);
2218  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerSize(ms);
2219  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08, "X");
2220  m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08, "Y");
2221  m_data->m_finalHist1[ros][drawer][adc][0][3]->Draw("E0");
2222 
2223  //Lukas
2224  // Select pads 9 and 10
2225  if (do_plots) {
2226  pad = Can->cd(4 * maxgain + adc + 1);
2227  pad->SetTopMargin(0.15);
2228  pad->SetGridx();
2229  }
2230 
2231  if (max4 < 0.9 * maxy[4 + adc]) m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMaximum(maxy[4 + adc]);
2232  if (min4 > miny[4 + adc] + 0.1 * TMath::Abs(miny[4 + adc])) m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMinimum(miny[4 + adc]);
2233 
2234  m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMarkerStyle(21);
2235  m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMarkerSize(ms);
2236  m_data->m_finalHist1[ros][drawer][adc][0][4]->SetLabelSize(0.08, "X");
2237  m_data->m_finalHist1[ros][drawer][adc][0][4]->SetLabelSize(0.08, "Y");
2238  if (do_plots) m_data->m_finalHist1[ros][drawer][adc][0][4]->Draw("E0");
2239  //Lukas
2240 
2241  } //end of loop over gain
2242 
2243  if (m_savePng) {
2244  Can->Print(TString(moduleName + "_fit_amp.png"), "png");
2245  }
2246  if (m_savePs) {
2247  Can->Print(TString(moduleName + "_fit_amp.ps"), "ps");
2248  }
2249  if (m_saveSvg) {
2250  Can->Print(TString(moduleName + "_fit_amp.svg"), "svg");
2251  }
2252  //Can->Print(TString(moduleName+"_fit_amp.cxx"),"cxx");
2253  if (do_plots) delete Can;
2254  delete line;
2255  for (int g = 0; g < 2; g++) {
2256  delete final_empty[g];
2257  delete final_odd[g];
2258  delete final_even[g];
2259  //delete pmtGain_empty[g];
2260  //delete pmtGain_odd[g];
2261  //delete pmtGain_even[g];
2262  }
2263 }
grepfile.info
info
Definition: grepfile.py:38
TileRawChannelMonTool::m_contNameDSP
std::string m_contNameDSP
Definition: TileRawChannelMonTool.h:74
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TileRawChannelMonTool::~TileRawChannelMonTool
virtual ~TileRawChannelMonTool()
Definition: TileRawChannelMonTool.cxx:87
TileRawChannelContainer
Definition: TileRawChannelContainer.h:13
TileRawChannelMonTool::m_med_IntegralLimit
double m_med_IntegralLimit
Definition: TileRawChannelMonTool.h:79
TilePaterMonTool::removeTObj
StatusCode removeTObj(TObject *obj)
Definition: TilePaterMonTool.cxx:468
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TileRawChannelUnit
Definition: TileRawChannelUnit.h:13
TilePaterMonTool::book1F
TH1F * book1F(std::string dir, std::string nam, std::string tit, int nx, double xmin, double xmax, Interval_t interval=run, MgmtAttr_t attribute=ATTRIB_MANAGED, std::string trigChain="", std::string mergeAlgo="")
Definition: TilePaterMonTool.cxx:175
TileRawChannelMonTool::m_tfitMap
std::map< int, std::vector< double > > m_tfitMap
Definition: TileRawChannelMonTool.h:86
TileRawChannelMonTool::checkDmuHeaderFormat
bool checkDmuHeaderFormat(uint32_t header)
Function to check that the DMU header format is correct bit_31 of the DMU header must be 1 and bit_17...
Definition: TileRawChannelMonTool.h:103
TileRawChannelMonTool::chi2dsp
@ chi2dsp
Definition: TileRawChannelMonTool.h:134
TileRawChannelMonTool::m_drawHists
bool m_drawHists
Definition: TileRawChannelMonTool.h:171
TileRawChannelMonTool::m_lo_IntegralLimit
double m_lo_IntegralLimit
Definition: TileRawChannelMonTool.h:78
TileRawChannelMonTool::checkDmuHeader
bool checkDmuHeader(std::vector< uint32_t > *headerVec, int dmu)
The following three functions are implemented to filter data corruption, copied from TileDigitsMonToo...
Definition: TileRawChannelMonTool.cxx:1942
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
ManagedMonitorToolBase::m_path
std::string m_path
Definition: ManagedMonitorToolBase.h:915
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
checkFileSG.line
line
Definition: checkFileSG.py:75
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
algorithm
std::string algorithm
Definition: hcg.cxx:82
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
TileDCSDataPlotter.max1
max1
Definition: TileDCSDataPlotter.py:884
max
#define max(a, b)
Definition: cfImp.cxx:41
TileRawChannelMonTool::NsumDsp
@ NsumDsp
Definition: TileRawChannelMonTool.h:138
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
TilePaterMonTool::initialize
virtual StatusCode initialize() override
Definition: TilePaterMonTool.cxx:106
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TileRawChannelMonTool::m_bigain
bool m_bigain
Definition: TileRawChannelMonTool.h:143
TileRawChannelMonTool::m_data
std::unique_ptr< Data > m_data
Definition: TileRawChannelMonTool.h:164
integral
double integral(TH1 *h)
Definition: computils.cxx:57
TilePaterMonTool::bookGraphAsymmErrors
TGraphAsymmErrors * bookGraphAsymmErrors(const std::string &dir, const std::string &nam, const std::string &tit, int N, float *X, float *Y, float *X_errors1, float *X_errors2, float *Y_errors1, float *Y_errors2)
Definition: TilePaterMonTool.cxx:515
TileRawChannelMonTool::bookHists
virtual StatusCode bookHists() override
Calls bookHists( true, true, true ) and initializes lumiBlock and run numbers.
Definition: TileRawChannelMonTool.cxx:123
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileRawChannelMonTool::m_runType
int m_runType
Definition: TileRawChannelMonTool.h:72
TilePaterMonTool::m_fragIDsDemonstrators
std::vector< int > m_fragIDsDemonstrators
Definition: TilePaterMonTool.h:233
index
Definition: index.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TilePaterMonTool::m_savePng
bool m_savePng
Definition: TilePaterMonTool.h:228
TileRawChannelMonTool::sumEdsp
@ sumEdsp
Definition: TileRawChannelMonTool.h:138
ReadBchFromCool.pmt
pmt
Definition: ReadBchFromCool.py:62
plotmaker.hist
hist
Definition: plotmaker.py:148
run_gep.alg_name
alg_name
Definition: run_gep.py:298
TilePaterMonTool::m_savePs
bool m_savePs
Definition: TilePaterMonTool.h:229
TileRawChannelMonTool::fillSummaryHistograms
StatusCode fillSummaryHistograms()
Definition: TileRawChannelMonTool.cxx:1038
TileRawChannelUnit::CesiumPicoCoulombs
@ CesiumPicoCoulombs
Definition: TileRawChannelUnit.h:19
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TileRawChannelMonTool::CisRun
@ CisRun
Definition: TileRawChannelMonTool.h:128
bin
Definition: BinsDiffFromStripMedian.h:43
TileRawChannelMonTool::m_bookAll
bool m_bookAll
Definition: TileRawChannelMonTool.h:69
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
TileInfo.h
TileRawChannelMonTool::drawDsp
void drawDsp(int ros, int drawer, const std::string &moduleName)
Definition: TileRawChannelMonTool.cxx:1709
TileCalibUtils.h
TileRawChannelMonTool::ratioErrorBar
void ratioErrorBar(TH1S *hist, double &xmin, double &xmax, double mean)
Definition: TileRawChannelMonTool.cxx:1849
TilePaterMonTool
Base class for tilecal calibration monitoring tools.
Definition: TilePaterMonTool.h:53
TileDigitsContainer
Definition: TileDigitsContainer.h:13
TileRawChannelMonTool::m_tileToolEmscale
ToolHandle< TileCondToolEmscale > m_tileToolEmscale
Definition: TileRawChannelMonTool.h:87
TileRawChannelMonTool::m_calibUnit
TileRawChannelUnit::UNIT m_calibUnit
Definition: TileRawChannelMonTool.h:166
TileRawChannelUnit::PicoCoulombs
@ PicoCoulombs
Definition: TileRawChannelUnit.h:18
TileRawData::adc_HWID
HWIdentifier adc_HWID(void) const
Definition: TileRawData.h:53
HWIdentifier
Definition: HWIdentifier.h:13
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
TileRawChannel::time
float time(int ind=0) const
Definition: TileRawChannel.h:103
TileRawChannelMonTool::fillHists
virtual StatusCode fillHists() override
Calls fillHists( bool, bool, bool ); if an eventBlock,lumiBlock, or run has turned over,...
Definition: TileRawChannelMonTool.cxx:510
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TilePaterMonTool::book2F
TH2F * book2F(std::string dir, std::string nam, std::string tit, int nx, double xmin, double xmax, int ny, double ymin, double ymax, Interval_t interval=run, MgmtAttr_t attribute=ATTRIB_MANAGED, std::string trigChain="", std::string mergeAlgo="")
Definition: TilePaterMonTool.cxx:244
TileRawChannelMonTool::m_cispar
const uint32_t * m_cispar
Definition: TileRawChannelMonTool.h:141
TH2S
Definition: rootspy.cxx:400
TileRawChannelMonTool::initialize
virtual StatusCode initialize() override
Definition: TileRawChannelMonTool.cxx:93
TileHWID::channel
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
Definition: TileHWID.h:189
TileRawChannelMonTool::m_doLaserSummaryVsPMT
bool m_doLaserSummaryVsPMT
Definition: TileRawChannelMonTool.h:170
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
TileRawChannelMonTool::bookSummaryHistograms
void bookSummaryHistograms(int ros, int drawer)
Definition: TileRawChannelMonTool.cxx:901
TileHWID::ros
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
Definition: TileHWID.h:167
AthExHiveOpts.Time
Time
Definition: AthExHiveOpts.py:63
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
TileRawChannelContainer.h
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
TileRawChannel::quality
float quality(int ind=0) const
Definition: TileRawChannel.h:105
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TileRawChannelMonTool::m_storeGraph
bool m_storeGraph
Definition: TileRawChannelMonTool.h:84
TileRawChannelMonTool::m_minAmpForCorrectedTime
float m_minAmpForCorrectedTime
Definition: TileRawChannelMonTool.h:172
WriteCellNoiseToCool.gn
gn
Definition: WriteCellNoiseToCool.py:531
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
TileRawChannelMonTool::m_plotDsp
bool m_plotDsp
Definition: TileRawChannelMonTool.h:83
TilePaterMonTool::m_saveSvg
bool m_saveSvg
Definition: TilePaterMonTool.h:230
TileDQstatus
Class that holds Data Quality fragment information and provides functions to extract the data quality...
Definition: TileDQstatus.h:49
TileRawChannelMonTool::checkDmuHeaderParity
bool checkDmuHeaderParity(uint32_t header)
Function to check that the DMU header parity is correct Parity of the DMU header should be odd Return...
Definition: TileRawChannelMonTool.h:113
TileHWID::adc
int adc(const HWIdentifier &id) const
extract adc field from HW identifier
Definition: TileHWID.h:193
TileRawChannelMonTool::GetTimeFitFunc
TF1 * GetTimeFitFunc(TH2S *hist2d)
Time Slope parameters for CIS runs.
Definition: TileRawChannelMonTool.cxx:1909
TileRawChannelMonTool::m_useratioerror
bool m_useratioerror
Definition: TileRawChannelMonTool.h:81
TileRawChannel::amplitude
float amplitude(int ind=0) const
Definition: TileRawChannel.h:101
TileRawChannelMonTool::m_intCalibUnit
int m_intCalibUnit
Definition: TileRawChannelMonTool.h:178
TileRawChannelMonTool::PhysRun
@ PhysRun
Definition: TileRawChannelMonTool.h:124
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
xmin
double xmin
Definition: listroot.cxx:60
TileCondToolEmscale.h
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
TileDigitsContainer.h
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
TileRawChannelMonTool::m_contName
std::string m_contName
Definition: TileRawChannelMonTool.h:73
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileRawDataContainer::get_bsflags
uint32_t get_bsflags() const
Definition: TileRawDataContainer.h:64
TilePaterMonTool::book2S
TH2S * book2S(std::string dir, std::string nam, std::string tit, int nx, double xmin, double xmax, int ny, double ymin, double ymax, Interval_t interval=run, MgmtAttr_t attribute=ATTRIB_MANAGED, std::string trigChain="", std::string mergeAlgo="")
Definition: TilePaterMonTool.cxx:279
TileRawChannelUnit::Invalid
@ Invalid
Definition: TileRawChannelUnit.h:26
TileRawChannelMonTool::m_dac2Charge
double m_dac2Charge[3]
Definition: TileRawChannelMonTool.h:179
covarianceTool.title
title
Definition: covarianceTool.py:542
TileRawChannelMonTool::m_tileInfo
const TileInfo * m_tileInfo
Definition: TileRawChannelMonTool.h:175
TileRawChannelMonTool::resetSummaryHistograms
void resetSummaryHistograms()
Definition: TileRawChannelMonTool.cxx:1012
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:522
TileRawChannel
Definition: TileRawChannel.h:35
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileRawChannelMonTool::m_UpLimit
double m_UpLimit
Definition: TileRawChannelMonTool.h:77
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
TileRawChannelMonTool::finalDsp
StatusCode finalDsp(int ros, int drawer)
Definition: TileRawChannelMonTool.cxx:1312
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
TH1F::SetBinContent
void SetBinContent(int, double)
Definition: rootspy.cxx:327
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
TileRawChannelMonTool::m_DQstatusKey
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
Definition: TileRawChannelMonTool.h:177
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileRawChannelUnit::UNIT
UNIT
Definition: TileRawChannelUnit.h:16
TileRawChannelMonTool::m_is12bit
bool m_is12bit
Definition: TileRawChannelMonTool.h:176
TileRawChannelMonTool::drawHists
void drawHists(int ros, int drawer, const std::string &moduleName)
Definition: TileRawChannelMonTool.cxx:1429
TileRawChannelMonTool::Edsp
@ Edsp
Definition: TileRawChannelMonTool.h:134
min
#define min(a, b)
Definition: cfImp.cxx:40
TileRawChannelMonTool::Tdsp
@ Tdsp
Definition: TileRawChannelMonTool.h:134
TileRawChannelMonTool::LaserFancyPlotting
void LaserFancyPlotting(int ros, int drawer, int maxgain, const std::string &moduleName)
Definition: TileRawChannelMonTool.cxx:1974
TileRawChannelMonTool::bookDsp
void bookDsp(int ros, int drawer)
Definition: TileRawChannelMonTool.cxx:360
TileRawChannelMonTool::Edsp_fit
@ Edsp_fit
Definition: TileRawChannelMonTool.h:134
TileRawChannelMonTool::m_summaryUpdateFrequency
int m_summaryUpdateFrequency
Definition: TileRawChannelMonTool.h:168
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TileRawChannelMonTool::sumTdsp_fit
@ sumTdsp_fit
Definition: TileRawChannelMonTool.h:138
charge
double charge(const T &p)
Definition: AtlasPID.h:494
TileRawChannelMonTool::m_book2D
bool m_book2D
Definition: TileRawChannelMonTool.h:70
TileRawChannelMonTool::Tdsp_fit
@ Tdsp_fit
Definition: TileRawChannelMonTool.h:134
TProfile
Definition: rootspy.cxx:515
TilePaterMonTool::m_fragIDsToIgnoreDMUerrors
std::vector< int > m_fragIDsToIgnoreDMUerrors
Definition: TilePaterMonTool.h:232
TileRawChannelMonTool::checkHists
virtual StatusCode checkHists(bool fromFinalize) override
This implementation does nothing; equivalent functionality may be provided by procHists(....
Definition: TileRawChannelMonTool.cxx:1419
TilePaterMonTool::book1S
TH1S * book1S(std::string dir, std::string nam, std::string tit, int nx, double xmin, double xmax, Interval_t interval=run, MgmtAttr_t attribute=ATTRIB_MANAGED, std::string trigChain="", std::string mergeAlgo="")
Definition: TilePaterMonTool.cxx:197
TileDQstatus::cispar
const uint32_t * cispar() const
CIS parameters.
Definition: TileDQstatus.h:152
TileRawChannelMonTool::m_efitThresh
double m_efitThresh
Definition: TileRawChannelMonTool.h:88
TilePaterMonTool::isDisconnected
bool isDisconnected(int ros, int drawer, int ch)
Definition: TilePaterMonTool.h:281
TileRawChannelMonTool::fillDsp
StatusCode fillDsp(std::map< int, std::vector< double > > &efitMap, std::map< int, std::vector< double > > &tfitMap)
Definition: TileRawChannelMonTool.cxx:797
TileCalibUtils::getDrawerString
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
Definition: TileCalibUtils.cxx:145
TileRawChannelMonTool::m_DownLimit
double m_DownLimit
Definition: TileRawChannelMonTool.h:76
TileRawChannelMonTool::LasRun
@ LasRun
Definition: TileRawChannelMonTool.h:125
TileRawChannelMonTool::m_overlaphists
bool m_overlaphists
Definition: TileRawChannelMonTool.h:71
DeMoScan.index
string index
Definition: DeMoScan.py:362
TilePaterMonTool::m_cabling
const TileCablingService * m_cabling
Definition: TilePaterMonTool.h:226
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
TileRawData::cell_ID_index
Identifier cell_ID_index(int &index, int &pmt) const
Definition: TileRawData.cxx:65
h
TileHWID::drawer
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
Definition: TileHWID.h:171
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
TH1F
Definition: rootspy.cxx:320
TH1S
Definition: rootspy.cxx:362
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
TileRawDataContainer::get_unit
UNIT get_unit() const
Definition: TileRawDataContainer.h:60
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileCablingService::channel2hole
static int channel2hole(int ros, int channel)
Definition: TileCablingService.cxx:1946
TileRawChannelMonTool::finalHists
virtual StatusCode finalHists() override
Calls procHists( true, true, true ).
Definition: TileRawChannelMonTool.cxx:1289
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
TileRawChannelMonTool::PedRun
@ PedRun
Definition: TileRawChannelMonTool.h:127
DiTauMassTools::HistInfoV2::RMS
@ RMS
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:31
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
xmax
double xmax
Definition: listroot.cxx:61
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1266
TileRawChannelMonTool::m_nEventsTileMon
int m_nEventsTileMon
Definition: TileRawChannelMonTool.h:144
TileRawChannelMonTool::sumEdsp_fit
@ sumEdsp_fit
Definition: TileRawChannelMonTool.h:138
TileRawChannelMonTool::m_infoName
std::string m_infoName
Definition: TileRawChannelMonTool.h:174
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
TileCalibUtils::getDrawerIdx
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
Definition: TileCalibUtils.cxx:60
TileRawChannelMonTool::m_corrup
bool m_corrup[5][64][2][16]
Definition: TileRawChannelMonTool.h:97
ReadHandle.h
Handle class for reading from StoreGate.
TilePaterMonTool::m_tileHWID
const TileHWID * m_tileHWID
Definition: TilePaterMonTool.h:224
TileRawChannelMonTool::rangeErrorBar
void rangeErrorBar(double &xmin, double &max, double mean)
Definition: TileRawChannelMonTool.cxx:1833
TileRawChannelMonTool::TileRawChannelMonTool
TileRawChannelMonTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TileRawChannelMonTool.cxx:43
TilePaterMonTool::book1Sx
TH1S * book1Sx(std::string dir, std::string nam, std::string tit, int nx, const Double_t *xlgbins, Interval_t interval=run, MgmtAttr_t attribute=ATTRIB_MANAGED, std::string trigChain="", std::string mergeAlgo="")
Definition: TilePaterMonTool.cxx:208
TileRawChannelMonTool::m_efitMap
std::map< int, std::vector< double > > m_efitMap
Definition: TileRawChannelMonTool.h:85
TileInfo::ADCmax
int ADCmax() const
Returns the maximum ADC output (10 bits --> 1023)
Definition: TileInfo.h:71
TileRawChannelMonTool::CisRamp
@ CisRamp
Definition: TileRawChannelMonTool.h:130
TileRawChannelMonTool::m_hi_IntegralLimit
double m_hi_IntegralLimit
Definition: TileRawChannelMonTool.h:80
TileRawChannelMonTool.h
fitman.k
k
Definition: fitman.py:528
TileRawChannelMonTool::m_resetAfterSummaryUpdate
bool m_resetAfterSummaryUpdate
Definition: TileRawChannelMonTool.h:169
TProfile::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:527
TileRawChannelMonTool::LedRun
@ LedRun
Definition: TileRawChannelMonTool.h:126