ATLAS Offline Software
TileDigitsMonTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ********************************************************************
6 //
7 // NAME: TileDigitsMonTool.cxx
8 // PACKAGE:
9 //
10 // AUTHOR: Alexander Solodkov
11 // Luca.Fiorini@cern.ch
12 //
13 // ********************************************************************
14 
15 #include "TileDigitsMonTool.h"
16 
22 #include "StoreGate/ReadHandle.h"
23 
24 #include "TH1S.h"
25 #include "TH1F.h"
26 #include "TH2F.h"
27 #include "TH1D.h"
28 #include "TProfile.h"
29 #include "TVirtualPad.h"
30 #include "TCanvas.h"
31 #include "TStyle.h"
32 #include "TLine.h"
33 #include "TPaveLabel.h"
34 #include "TObjArray.h"
35 #include "TSpectrum.h"
36 #include "TText.h"
37 #include "TExec.h"
38 #include "TColor.h"
39 #include "TPaletteAxis.h"
40 #include "TList.h"
41 #include "TTree.h"
42 
43 #include <iostream>
44 #include <sstream>
45 #include <iomanip>
46 #include <cmath>
47 #include <algorithm>
48 
49 
50 /*---------------------------------------------------------*/
51 TileDigitsMonTool::TileDigitsMonTool(const std::string & type, const std::string & name, const IInterface* parent)
53  , m_tileToolNoiseSample("TileCondToolNoiseSample")
54  , m_cispar(0)
55  , m_nEventsTileMon(0)
56  , m_allHistsFilled(false)
57  //, hp(-1)
58  //, hb(-1)
59  , m_tileInfo(0)
60  , m_is12bit(false)
61  , m_shiftnbins(0)
62 /*---------------------------------------------------------*/
63 {
64  declareInterface<IMonitorToolBase>(this);
65  declareInterface<ITileStuckBitsProbsTool>(this);
66 
67  declareProperty("bookAllDrawers", m_bookAll = false);
68  declareProperty("book2D", m_book2D = false);
69 
70  // run type 1 - phys, 2 - las, 4 - ped, 8 - cis, 9- mono
71  declareProperty("runType", m_runType = 8);
72  declareProperty("bigain", m_bigain = true);
73  declareProperty("NSamples", m_nSamples = 7);
74  declareProperty("TileRawChannelContainerDSP", m_contNameDSP = "TileRawChannelCnt");
75  declareProperty("TileDigitsContainer", m_digitsContainerName = "TileDigitsCnt");
76  declareProperty("FillPedestalDifference", m_fillPedestalDifference = true);
77  declareProperty("TileInfoName", m_infoName = "TileInfo");
78  declareProperty("TileDQstatus", m_DQstatusKey = "TileDQstatus");
79  declareProperty("ZeroLimitHG", m_zeroLimitHG = 0);
80  declareProperty("SaturationLimitHG", m_saturationLimitHG = 1023);
81 
82  m_path = "/Tile/Digits"; //ROOT file directory
83 }
84 
85 /*---------------------------------------------------------*/
87 /*---------------------------------------------------------*/
88 {
89 }
90 
91 /*---------------------------------------------------------*/
93 /*---------------------------------------------------------*/
94 {
95  ATH_MSG_INFO("in initialize()");
96 
98 
99  m_nEventsTileMon = 0;
100  m_allHistsFilled = false;
101  m_data = std::make_unique<Data>();
102  memset(m_data->m_sumPed1, 0, sizeof(m_data->m_sumPed1));
103  memset(m_data->m_sumPed2, 0, sizeof(m_data->m_sumPed2));
104  memset(m_data->m_sumRms1, 0, sizeof(m_data->m_sumRms1));
105  memset(m_data->m_sumRms2, 0, sizeof(m_data->m_sumRms2));
106  memset(m_data->m_meanAmp, 0, sizeof(m_data->m_meanAmp));
107  memset(m_data->m_meanAmp_ij, 0, sizeof(m_data->m_meanAmp_ij));
108  memset(m_data->m_nEvents_i, 0, sizeof(m_data->m_nEvents_i));
109  memset(m_data->m_nEvents_ij, 0, sizeof(m_data->m_nEvents_ij));
110  memset(m_data->m_stuck_probs, 0, sizeof(m_data->m_stuck_probs));
111 
112  //For test stuck_bits_maker
113  //hp = 1;
114  //hb = -1;
115 
116  // TileInfo
120  m_ADCmaxMinusEps = m_i_ADCmax - 0.01;
121 
122  m_shiftnbins = 796;
123  if (m_i_ADCmax == 4095){
124  m_is12bit = true;
126  }
127 
129 
131 }
132 
133 /*---------------------------------------------------------*/
135 /*---------------------------------------------------------*/
136 {
137 
138  if (msgLvl(MSG::DEBUG)) {
139  msg(MSG::DEBUG) << "in bookHists()" << endmsg;
140  msg(MSG::DEBUG) << "Using base path " << m_path << endmsg;
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  }
149  }
150 
151  m_data->m_outInHighGain.push_back(book1D("Summary", "OverFlowInHighGain", "Injected charge with overflow in high gain", 10010, -0.5, 1000.5));
152 
153  //SetBookStatus(true);
154 
155  return StatusCode::SUCCESS;
156 }
157 
158 /*---------------------------------------------------------*/
160 /*---------------------------------------------------------*/
161 {
162  const char *part[5] = { "AUX", "LBA", "LBC", "EBA", "EBC" };
163  const char *gain[6] = { "_lo", "_hi", "", " low gain", " high gain", "" };
164 
174 
175  MsgStream log(msgSvc(), name());
176 
177  std::ostringstream sStr;
178  sStr << part[ros] << std::setfill('0') << std::setw(2) << drawer + 1 << std::setfill(' ');
179  std::string moduleName = sStr.str();
180  std::string subDir = moduleName;
181  std::string histName, histTitle;
182 
183  ATH_MSG_DEBUG("in bookHists() for module " << moduleName);
184 
187  int mingain = (m_bigain) ? 0 : 2;
188  int maxgain = (m_bigain) ? 2 : 3;
189 
190  for (int gn = mingain; gn < maxgain; ++gn) {
191  //Book DMU header errors histograms
192  int adc = gn & 1;
193 
194  sStr.str("");
195  sStr << moduleName << "_DMU_head_" << gain[gn] << "_err";
196  histName = sStr.str();
197 
198  sStr.str("");
199  sStr << moduleName << " DMU Header " << gain[3 + gn] << " errors";
200  histTitle = sStr.str();
201 
202  m_data->m_hist2[ros][drawer][adc].push_back(book2F(subDir, histName, histTitle, 16, 0., 16., 8, -0.5, 7.5));
203  }
204 
205  for (int ch = 0; ch < 48; ++ch) {
206 
207  // int pmt=m_cabling->channel2hole(ros,ch); // 1:48, negative for non-connected channels
208  // int pmt0 = ((pmt > 0)? pmt-1 : pmt+1); // 0:47, negaitve for non-connected channels
209  sStr.str("");
210  sStr << std::setfill('0') << std::setw(2) << ch << std::setfill(' ');
211  std::string sCh = sStr.str(); // 00:47, always positive
212 
213  for (int gn = mingain; gn < maxgain; ++gn) {
214 
215  int adc = gn & 1;
216 
217  // first sample
218  sStr.str("");
219  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_sample0";
220  histName = sStr.str();
221 
222  sStr.str("");
223  sStr << moduleName << " CH " << ch << gain[3 + gn] << " sample[0]";
224  histTitle = sStr.str();
225 
226  m_data->m_hist1[ros][drawer][ch][adc].push_back(book1S(subDir, histName, histTitle, 151, -0.5, 150.5));
227 
228  // RMS over samples in event
229  sStr.str("");
230  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_meanRMS";
231  histName = sStr.str();
232 
233  sStr.str("");
234  sStr << moduleName << " CH " << ch << gain[3 + gn] << " mean RMS in event";
235  histTitle = sStr.str();
236 
237  m_data->m_hist1[ros][drawer][ch][adc].push_back(book1S(subDir, histName, histTitle, 101, -0.05, 10.05));
238 
239  //all samples to find stuck bits
240  sStr.str("");
241  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_samples";
242  histName = sStr.str();
243 
244  sStr.str("");
245  sStr << moduleName << " CH " << ch << gain[3 + gn] << " all samples";
246  histTitle = sStr.str();
247 
248  m_data->m_hist1[ros][drawer][ch][adc].push_back(book1S(subDir, histName, histTitle, m_i_ADCmax + 1, -0.5, m_i_ADCmax + 0.5));
249 
250  //eventnumber % 32 for n/32 gain switch failure
251  sStr.str("");
252  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_evtn_mod32";
253  histName = sStr.str();
254 
255  sStr.str("");
256  sStr << moduleName << " CH " << ch << gain[3 + gn] << " event number % 32";
257  histTitle = sStr.str();
258 
259  m_data->m_histC[ros][drawer][ch][adc].push_back(book1C(subDir, histName, histTitle, 32, -0.5, 31.5));
260 
261  // average profile for a given channel/gain
262  sStr.str("");
263  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_prof";
264  histName = sStr.str();
265 
266  sStr.str("");
267  sStr << moduleName << " CH " << ch << gain[3 + gn] << " average profile";
268  histTitle = sStr.str();
269 
270  m_data->m_histP[ros][drawer][ch][adc].push_back(bookProfile(subDir, histName, histTitle, m_nSamples, 0.0, m_nSamples * 1.0, -0.5, m_i_ADCmax + 0.5));
271 
272  // shifted samples histograms
273 
274  double shiftxmin = 0.;
275  double shiftxmax = m_shiftnbins;
276  int shiftnbins = m_shiftnbins;
277 
278  sStr.str("");
279  sStr << moduleName << "_ch_" << sCh << gain[gn] << "_samples_shifted";
280  histName = sStr.str();
281 
282  sStr.str("");
283  sStr << moduleName << " CH " << ch << gain[3 + gn] << " all samples shifted";
284  histTitle = sStr.str();
285 
286  m_data->m_shifted_hist[ros][drawer][ch][adc] = book1S(subDir, histName, histTitle, shiftnbins, shiftxmin, shiftxmax);
287 
288  if (ch < 16) { // use first 16 channels to store BCID/CRC errors (one per TileDMU)
289 
290  sStr.str("");
291  sStr << std::setfill('0') << std::setw(2) << ch << std::setfill(' ');
292  std::string sDmu = sStr.str();
293 
294  sStr.str("");
295  sStr << moduleName << "_dmu_" << sDmu << gain[gn] << "_BCID";
296  histName = sStr.str();
297 
298  sStr.str("");
299  sStr << moduleName << " DMU0 " << ch << gain[3 + gn] << " BCID";
300  histTitle = sStr.str();
301 
302  m_data->m_hist1[ros][drawer][ch][adc].push_back(book1S(subDir, histName, histTitle, 100, 2050.5, 2150.5));
303 
304  sStr.str("");
305  sStr << moduleName << "_dmu_" << sDmu << gain[gn] << "_BCID_err";
306  histName = sStr.str();
307 
308  sStr.str("");
309  sStr << moduleName << " DMU0 " << ch << gain[3 + gn] << " BCID errors";
310  histTitle = sStr.str();
311 
312  m_data->m_hist_DMUerr[ros][drawer][ch][adc].push_back(book1I(subDir, histName, histTitle, 3, -0.5, 2.5));
313 
314  if (adc) continue; // don't book CRC for high gain
315 
316  sStr.str("");
317  sStr << moduleName << "_dmu_" << sDmu << "_CRC_err";
318  histName = sStr.str();
319 
320  sStr.str("");
321  sStr << moduleName << " DMU0 " << ch << " CRC errors";
322  histTitle = sStr.str();
323 
324  m_data->m_hist_DMUerr[ros][drawer][ch][0].push_back(book1I(subDir, histName, histTitle, 5, -0.5, 4.5));
325  }
326  }
327  }
328 
329 // and now global histograms for all channels in a drawer
330 
331  // global CRC
332  sStr.str("");
333  sStr << moduleName << "_CRC_global";
334  histName = sStr.str();
335 
336  sStr.str("");
337  sStr << moduleName << " global CRC errors";
338  histTitle = sStr.str();
339 
340  m_data->m_hist0[ros][drawer].push_back(book1S("Summary", histName, histTitle, 3, -0.5, 2.5));
341 
342 }
343 
344 /*---------------------------------------------------------*/
346 /*---------------------------------------------------------*/
347 {
348 // static counter = 0;
349 // bool extra = ((counter%m_updateCounter) == 0);
350 // ++counter;
351 
352  ATH_MSG_DEBUG("in fillHists()");
353 
354  const TileDQstatus* dqStatus = SG::makeHandle (m_DQstatusKey).get();
355 
356  // array of 16 CIS parameters
357  m_cispar = dqStatus->cispar();
359 
360  // std::cout << "Calib Mode=" << dqStatus->calibMode() << "\n";
361 
362  const TileDigitsContainer* digitsContainer;
363  CHECK(evtStore()->retrieve(digitsContainer, m_digitsContainerName));
364 
365  for (const TileDigitsCollection* digitsCollection : *digitsContainer) {
366 
367  if (digitsCollection->empty()) continue;
368 
369  HWIdentifier adc_id = digitsCollection->front()->adc_HWID();
370  int ros = m_tileHWID->ros(adc_id);
371  int drawer = m_tileHWID->drawer(adc_id);
372 
373  if (m_data->m_hist1[ros][drawer][0][0].size() == 0) {
374  m_bigain = true;
375  m_nSamples = digitsCollection->front()->NtimeSamples();
376  if (!m_bookAll) bookHists(ros, drawer);
377  }
378 
379  uint32_t status = digitsCollection->getFragStatus();
381  float bin = 99.;
382  if (status & (TileFragStatus::ALL_FF | TileFragStatus::ALL_00)) {
383  bin = 6.;
384  } else if (status & (TileFragStatus::NO_FRAG | TileFragStatus::NO_ROB)) {
385  bin = 7.;
386  }
387  for (int dmu = 0; dmu < 16; dmu++) {
388  m_data->m_corrup[ros][drawer][0][dmu] = true;
389  m_data->m_corrup[ros][drawer][1][dmu] = true;
390  m_data->m_hist2[ros][drawer][0][0]->Fill(dmu + 0.5, bin, 1.);
391  m_data->m_hist2[ros][drawer][1][0]->Fill(dmu + 0.5, bin, 1.);
392  }
393  continue;
394  }
395 
396  std::vector<uint32_t> headerVec = digitsCollection->getFragChipHeaderWords();
397 
398  int headsize = headerVec.size();
399  if (headsize > 16) {
400  ATH_MSG_ERROR("length of BCID vector " << headsize << " - greater than 16 !");
401  headsize = 16;
402  }
403 
404  for (int dmu = 0; dmu < headsize; dmu++) {
405  m_data->m_corrup[ros][drawer][0][dmu] = DMUheaderCheck(&headerVec, ros, drawer, 0, dmu); //tests and fills
406  m_data->m_corrup[ros][drawer][1][dmu] = DMUheaderCheck(&headerVec, ros, drawer, 1, dmu);
407  }
408 
409  for (int dmu = headsize; dmu < 16; dmu++) {
410  m_data->m_corrup[ros][drawer][0][dmu] = false;
411  m_data->m_corrup[ros][drawer][1][dmu] = false;
412  }
413  }
414 
415  for (const TileDigitsCollection* digitsCollection : *digitsContainer) {
416 
417  if (digitsCollection->empty()) continue;
418 
419  HWIdentifier adc_id = digitsCollection->front()->adc_HWID();
420  int ros = m_tileHWID->ros(adc_id);
421  int drawer = m_tileHWID->drawer(adc_id);
422 
423  if (m_data->m_hist1[ros][drawer][0][0].size() == 0) {
424  //m_bigain = (dqStatus->calibMode() == 1); // true if bi-gain run
425  // For the time being, we fill both high and low gain plots, as it was requiered by Tomas
426  m_bigain = true;
427  m_nSamples = digitsCollection->front()->NtimeSamples(); // number of samples
428  // bookHists(ros,drawer);
429  }
430 
431  std::vector<uint32_t> headerVec = digitsCollection->getFragChipHeaderWords();
432 
433  int headsize = headerVec.size();
434  //if (headsize > 16 ) {
435  // log << MSG::ERROR << "legth of BCID vector " << headsize << " - greater than 16 !" << endreq;
436  // headsize = 16;
437  //}
438 
439  double mean_tmp[48][2][16];
440  memset(mean_tmp, 0, sizeof(mean_tmp));
441 
442  // Below, the charge conversion for 12 bit is just an approximation;
443  // 4095. can be changed later to gain precision if needed.
444  double charge = 0;
445  if (m_is12bit){ // if 12 bit ADCs
446  charge = m_cispar[6] * m_cispar[7] * (2. * 4.096 / 4095.);
447  }
448  else{
449  charge = m_cispar[6] * m_cispar[7] * (2. * 4.096 / 1023.);
450  }
451 
452  for (const TileDigits* tileDigits : *digitsCollection) {
453 
454  adc_id = tileDigits->adc_HWID();
455  int chan = m_tileHWID->channel(adc_id);
456  int gain = (m_bigain) ? m_tileHWID->adc(adc_id) : 0; // ignore gain in monogain run
457 
458  m_data->m_histC[ros][drawer][chan][gain][0]->Fill(m_nEventsTileMon % 32, 1.0);
459 
460  std::vector<float> vdigits = tileDigits->samples();
461 
462  double meansamp = 0.0;
463  double rmssamp = 0.0;
464  unsigned int dsize = vdigits.size();
465  if (dsize > 16) {
466  ATH_MSG_ERROR("length of digits vector " << dsize << " - greater than 16 !");
467  dsize = 16;
468  }
469  //std::cout << "m_runType= "<< m_runType << "\n";
470  for (unsigned int i = 0; i < dsize; ++i) {
471  double dig = vdigits[i];
472  meansamp += dig;
473  rmssamp += dig * dig;
474  mean_tmp[chan][gain][i] = dig;
475 
476  if (!m_data->m_corrup[ros][drawer][gain][chan / 3]) {
477  if (m_runType != CisRun) {
478  m_data->m_histP[ros][drawer][chan][gain][0]->Fill(i + 0.1, dig, 1.0);
479  m_data->m_hist1[ros][drawer][chan][gain][2]->Fill(dig, 1.0);
480  } else if (m_cispar[6] > 0. && (dig > 0 || gain < 1 || charge < 12.)) { //LF If CIS run, Protection to avoid zero amplitudes due to 0 injected charge
481  m_data->m_histP[ros][drawer][chan][gain][0]->Fill(i + 0.1, dig, 1.0);
482  m_data->m_hist1[ros][drawer][chan][gain][2]->Fill(dig, 1.0);
483  }
484 
485  if (gain == 1 && dig > m_ADCmaxMinusEps) // overflow in high gain, find charge is it
486  m_data->m_outInHighGain[0]->Fill(charge);
487  }
488  }
489 
490  if (dsize > 0 && !m_data->m_corrup[ros][drawer][gain][chan / 3]) {
491  double ped = vdigits[0];
492  m_data->m_hist1[ros][drawer][chan][gain][0]->Fill(ped, 1.0);
493  m_data->m_sumPed1[ros][drawer][chan][gain] += ped;
494  m_data->m_sumPed2[ros][drawer][chan][gain] += ped * ped;
495  //if ( (chan==23)&&(ros==1)&&(drawer==18)&&(gain==0)) {
496  //std::cout << "ped=" << ped << "\tm_sumPed1=" << m_data->m_sumPed1[ros][drawer][chan][gain] << "\n";
497  //std::cout << "ped^2=" << ped*ped << "\tm_sumPed2=" << m_data->m_sumPed2[ros][drawer][chan][gain] << "\n";
498  //}
499  if (dsize > 1) {
500  meansamp /= dsize;
501  rmssamp = rmssamp / dsize - meansamp * meansamp;
502  rmssamp = (rmssamp > 0.0) ? sqrt(rmssamp * dsize / (dsize - 1)) : 0.0;
503  m_data->m_hist1[ros][drawer][chan][gain][1]->Fill(rmssamp, 1.0);
504  m_data->m_sumRms1[ros][drawer][chan][gain] += rmssamp;
505  m_data->m_sumRms2[ros][drawer][chan][gain] += rmssamp * rmssamp;
506  }
507  }
508  } // digits
509 
510  //For cor&cov
511  for (int sample = 0; sample < m_nSamples; ++sample) {
512  for (int gain = 0; gain < 2; ++gain) {
513  for (int ch_i = 0; ch_i < 48; ++ch_i)
514  if (!m_data->m_corrup[ros][drawer][gain][ch_i / 3]) {
515  m_data->m_nEvents_i[ros][drawer][gain][ch_i]++;
516  m_data->m_meanAmp[ros][drawer][gain][ch_i] += mean_tmp[ch_i][gain][sample];
517  for (int ch_j = 0; ch_j < 48; ++ch_j)
518  if (!m_data->m_corrup[ros][drawer][gain][ch_j / 3]) {
519  m_data->m_nEvents_ij[ros][drawer][gain][ch_i][ch_j]++;
520  m_data->m_meanAmp_ij[ros][drawer][gain][ch_i][ch_j] += mean_tmp[ch_i][gain][sample] * mean_tmp[ch_j][gain][sample];
521  }
522  }
523  }
524  }
525 
526  // BCID
527  uint32_t bcid = digitsCollection->getRODBCID();
528 
529  for (int ch = 0; ch < headsize; ++ch) {
530  uint32_t bcid_ch = (headerVec[ch] & 0xFFF);
531  m_data->m_hist1[ros][drawer][ch][0][3]->Fill(bcid_ch, 1.0);
532  if ((bcid_ch == bcid) || (bcid_ch == bcid - 1)) // Conservative condition to be consistent with both run before Feb07 and
533  m_data->m_hist_DMUerr[ros][drawer][ch][0][0]->Fill(1.0, 1.0); // runs after Feb07. Introducing a RunNum variable it could be more strict.
534  else if ((bcid == 0) && ((bcid_ch == 3563) || (bcid_ch == 3564))) // if bcid==0 then bcid_ch should be 3563 (0xDEB)
535  m_data->m_hist_DMUerr[ros][drawer][ch][0][0]->Fill(1.0, 1.0); // but sometimes 3564 (0xDEC) is observed.
536  // if (bcid_ch == bcid) // Now allow only exact bcid: ROD BCID = DMU BCID+1
537  // m_data->m_hist_DMUerr[ros][drawer][ch][0][0]->Fill(1.0,1.0); // Apr 2013
538  // else if (bcid_ch == 0)
539  // m_data->m_hist_DMUerr[ros][drawer][ch][0][0]->Fill(0.0,1.0);
540  // else
541  // m_data->m_hist_DMUerr[ros][drawer][ch][0][0]->Fill(2.0,1.0);
542  }
543 
544  //DMUheaderCheck(&headerVec,headsize,ros,drawer,0);
545 
546  if ((m_bigain) && ((digitsCollection->getFragChipHeaderWordsHigh()).size() > 0)) {// LF we need to avoid that headsize is set to zero in monogain runs
547 
548  headerVec = digitsCollection->getFragChipHeaderWordsHigh();
549  headsize = headerVec.size();
550  if (headsize > 16) {
551  ATH_MSG_ERROR("length of BCIDhigh vector " << headsize << " - greater than 16 !");
552  headsize = 16;
553  }
554  }
555  // if monogain run with m_bigain==1, we fill the BCID plots we the same info
556  for (int ch = 0; ch < headsize; ++ch) {
557  uint32_t bcid_ch = (headerVec[ch] & 0xFFF);
558  m_data->m_hist1[ros][drawer][ch][1][3]->Fill(bcid_ch, 1.0);
559  if ((bcid_ch == bcid) || (bcid_ch == bcid - 1)) // BCID from TileDMU should match BCID from ROD header or
560  m_data->m_hist_DMUerr[ros][drawer][ch][1][0]->Fill(1.0, 1.0); // bcid-1 for runs after Feb07.
561  else if ((bcid == 0) && ((bcid_ch == 3563) || (bcid_ch == 3564))) // if bcid==0 then bcid_ch should be 3563 (0xDEB)
562  m_data->m_hist_DMUerr[ros][drawer][ch][1][0]->Fill(1.0, 1.0); // but sometimes 3564 (0xDEC) is observed.
563  // if (bcid_ch == bcid) // Now allow only exact bcid
564  // m_data->m_hist_DMUerr[ros][drawer][ch][0][0]->Fill(1.0,1.0); // Apr 2013
565  // else if (bcid_ch == 0)
566  // m_data->m_hist_DMUerr[ros][drawer][ch][1][0]->Fill(0.0,1.0);
567  // else
568  // m_data->m_hist_DMUerr[ros][drawer][ch][1][0]->Fill(2.0,1.0);
569  }
570 
571  //DMUheaderCheck(&headerVec,headsize,ros,drawer,1);
572 
573  if (dqStatus->calibMode() == 1) {
574  // global and DMU CRC check
575  uint32_t crc32 = digitsCollection->getFragCRC();
576  uint32_t CRCmask = digitsCollection->getFragDMUMask();
577 
578  CRCcheck(dqStatus, crc32, CRCmask, headsize, ros, drawer);
579  }
580  } //loop over drawers
581  //
582 
583  if (dqStatus->calibMode() == 0) {
584  if (RODCRCcalc(dqStatus).isFailure()) ATH_MSG_WARNING("Not possible to check CRC from ROD");
585  }
586 
587  return StatusCode::SUCCESS;
588 }
589 
590 /*---------------------------------------------------------*/
592 /*---------------------------------------------------------*/
593 {
594 
595  ATH_MSG_INFO("in finalHists()");
596  if (m_allHistsFilled) return StatusCode::SUCCESS;
597  m_allHistsFilled = true;
598 
599  const EventContext &ctx = Gaudi::Hive::currentContext();
600 
601  const char *part[5] = { "AUX", "LBA", "LBC", "EBA", "EBC" };
602  const char *gain[6] = { "_lo", "_hi", "", " low gain", " high gain", "" };
603 
604  std::string pedestalTitile(" Pedestal[0]");
605  if (m_fillPedestalDifference) pedestalTitile += " - pedestal from DB";
606 
607  const char *HistName[8] = { "_ped", "_rms_lfr", "_rms_hfr", "_bits"
608  , pedestalTitile.c_str(), " RMS noise low frequency", " RMS noise high frequency", " Stuck bits and zero amp" };
609 
610  const char *ErrName[4] = { "_bcid", "_crc", " BCID errors", " CRC errors" };
611  const char *HistName2[4] = { "_covar", "_corr", " covariance", " correlation" };
612 
613  // for bigain run book 2 histograms per channel
614  // for monogain run book just one histogram per channel
615  int mingain = (m_bigain) ? 0 : 2;
616  int maxgain = (m_bigain) ? 2 : 3;
617 
618  for (unsigned int ros = 1; ros < TileCalibUtils::MAX_ROS; ++ros) {
619  for (unsigned int drawer = 0; drawer < TileCalibUtils::MAX_DRAWER ; ++drawer) {
620  if (m_data->m_hist1[ros][drawer][0][0].size() != 0) {
621  unsigned int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
622 
623  std::ostringstream sStr;
624  std::string moduleName = TileCalibUtils::getDrawerString(ros, drawer);
625  std::string subDir = "Summary";
626  std::string histName, histTitle;
627 
628  for (int gn = mingain; gn < maxgain; ++gn) {
629 
630  int adc = gn & 1;
631 
632  for (int type = 0; type < 4; ++type) {
633  sStr.str("");
634  sStr << moduleName << gain[gn] << HistName[type];
635  histName = sStr.str();
636  sStr.str("");
637  sStr << moduleName << gain[3 + gn] << HistName[4 + type];
638  histTitle = sStr.str();
639  m_data->m_final_hist1[ros][drawer][adc].push_back(book1F(subDir, histName, histTitle, 48, 0.0, 48.0));
640  }
641 
642  // stuck bits and saturations / 0s
643  sStr.str("");
644  sStr << moduleName << gain[gn] << "_stucks";
645  histName = sStr.str();
646  sStr.str("");
647  sStr << moduleName << gain[3 + gn] << " Stuck bits and saturation";
648  histTitle = sStr.str();
649  m_data->m_final_hist_stucks[ros][drawer][adc] = book2C(subDir, histName, histTitle, 48, 0.0, 48.0, 7, 0., 7.);
650  m_data->m_final_hist_stucks[ros][drawer][adc]->GetYaxis()->SetBinLabel(1, "SB 0");
651  m_data->m_final_hist_stucks[ros][drawer][adc]->GetYaxis()->SetBinLabel(2, "SB 1,2");
652  m_data->m_final_hist_stucks[ros][drawer][adc]->GetYaxis()->SetBinLabel(3, "SB 3,4");
653  m_data->m_final_hist_stucks[ros][drawer][adc]->GetYaxis()->SetBinLabel(4, "SB 5-9");
654  m_data->m_final_hist_stucks[ros][drawer][adc]->GetYaxis()->SetBinLabel(5, "zeros");
655  m_data->m_final_hist_stucks[ros][drawer][adc]->GetYaxis()->SetBinLabel(6, "saturation");
656  m_data->m_final_hist_stucks[ros][drawer][adc]->GetYaxis()->SetBinLabel(7, "n % 32");
657 
658  for (unsigned int channel = 0; channel < TileCalibUtils::MAX_CHAN; ++channel) {
659 
660  // int pmt = abs(m_cabling->channel2hole(ros,channel));
661 
662  double Ped = 0.0, PedRMS = 0.0, RMSHi = 0.0;
663 
664  int nevents = int(m_data->m_hist1[ros][drawer][channel][adc][0]->GetEntries()); //ROOT GetEntries return a Double_t.
665  bool fillPedAndRms = (nevents > 0);
666 
667  if ((nevents != 0) && (nevents != m_nEventsTileMon)) {
680  ATH_MSG_VERBOSE( "Number of entries in histo " << m_data->m_hist1[ros][drawer][channel][adc][0]->GetTitle()
681  << " doesnt match n. of events! Using the first one in mean and RMS calculation" );
682 
683  ATH_MSG_VERBOSE( "Number of entries in histo =" << nevents << "\tNumber of events= " << m_nEventsTileMon );
684 
685  } else { //all ok
687  }
688 
689  if (fillPedAndRms) {
690 
691  if (nevents > 0) {
692  Ped = m_data->m_sumPed1[ros][drawer][channel][adc] / nevents;
693  RMSHi = m_data->m_sumRms1[ros][drawer][channel][adc] / nevents;
694 
695  if (nevents > 1) {
696  PedRMS = m_data->m_sumPed2[ros][drawer][channel][adc] / nevents - Ped * Ped;
697  PedRMS = (PedRMS > 0.0) ? sqrt(PedRMS * nevents / (nevents - 1)) : 0.0;
698  }
699  }
700 
701  // if ( (pmt==24)&&(ros==1)&&(drawer==18)&&(adc==0)) {
702  //std::cout << "Evt = " << m_nEventsTileMon << "\t channel=" << channel << " pmt=" << pmt << "\n";
703  //std::cout << "Ped = " << Ped << "\n";
704  //std::cout << "E(x^2) = " << m_data->m_sumPed2[ros][drawer][channel][adc] << "\n";
705  //std::cout << "PedRMS = " << PedRMS << "\n";
706 
707  //}
708 
710 
711  if (!isDisconnected(ros, drawer, channel)) {
712  m_data->m_final_hist1[ros][drawer][adc][0]->SetBinContent(channel + 1, Ped - m_tileToolNoiseSample->getPed(drawerIdx, channel, adc, TileRawChannelUnit::ADCcounts, ctx));
713  m_data->m_final_hist1[ros][drawer][adc][0]->SetBinError(channel + 1, PedRMS);
714  }
715 
716  } else {
717  m_data->m_final_hist1[ros][drawer][adc][0]->SetBinContent(channel + 1, Ped);
718  m_data->m_final_hist1[ros][drawer][adc][0]->SetBinError(channel + 1, PedRMS);
719  }
720 
721  m_data->m_final_hist1[ros][drawer][adc][1]->SetBinContent(channel + 1, PedRMS);
722  m_data->m_final_hist1[ros][drawer][adc][2]->SetBinContent(channel + 1, RMSHi);
723 
724  }
725 
726  // For tests
727  //stuckBits_maker(m_data->m_hist1[ros][drawer][channel][adc][2]);
728 
729  TH1S * hist = m_data->m_hist1[ros][drawer][channel][adc][2];
730  double weight = 0.0;
731  for (int i = 2; i < m_i_ADCmax + 2; ++i) { // first bin is excluded
732  weight += hist->GetBinContent(i);
733  }
734  // if we have weight=0 after the loop, then there is no non-zero amplitudes
735  if (weight > 0.0) {
736  if (hist->GetBinContent(1) > 0) {
737  weight = 0.5; // sometimes zeros
738  } else {
739  weight = 1.0; // assume that all OK
740  }
741 
742  int stuck_bit = stuckBits(hist, adc);
743  if (stuck_bit > 0) {
744  weight += 1.0; // some stuck bits
745  }
746  }
747  m_data->m_final_hist1[ros][drawer][adc][3]->SetBinContent(channel + 1, weight);
748  stuckBits_Amp2(hist, m_data->m_histC[ros][drawer][channel][adc][0], adc,
749  m_data->m_final_hist_stucks[ros][drawer][adc], channel,
750  m_data->m_stuck_probs[ros][drawer][channel][adc]);
751  } // end of loop over channels
752 
753  // BCID
754  sStr.str("");
755  sStr << moduleName << gain[gn] << ErrName[0];
756  histName = sStr.str();
757  sStr.str("");
758  sStr << moduleName << gain[3 + gn] << ErrName[2];
759  histTitle = sStr.str();
760  m_data->m_final_hist1[ros][drawer][adc].push_back(book1F(subDir, histName, histTitle, 16, 0.0, 16.0));
761 
762  // CRC only for one gain
763  if (adc == 0) {
764  sStr.str("");
765  sStr << moduleName << ErrName[1];
766  histName = sStr.str();
767  sStr.str("");
768  sStr << moduleName << ErrName[3];
769  histTitle = sStr.str();
770  m_data->m_final_hist1[ros][drawer][adc].push_back(book1F(subDir, histName, histTitle, 16, 0.0, 16.0));
771  }
772 
773  for (int ch = 0; ch < 16; ++ch) {
774 
775  int dmu = ch + 1;
776 
777  // BCID and CRC errors
778  for (int id = 0; id < 2; ++id) {
779  int bin0 = lround(m_data->m_hist_DMUerr[ros][drawer][ch][adc][id]->GetBinContent(0));
780  int bin1 = lround(m_data->m_hist_DMUerr[ros][drawer][ch][adc][id]->GetBinContent(1));
781  int bin2 = lround(m_data->m_hist_DMUerr[ros][drawer][ch][adc][id]->GetBinContent(2));
782  int bin3 = lround(m_data->m_hist_DMUerr[ros][drawer][ch][adc][id]->GetBinContent(3));
783  int bin4 = lround(m_data->m_hist_DMUerr[ros][drawer][ch][adc][id]->GetBinContent(4));
784  int bin5 = lround(m_data->m_hist_DMUerr[ros][drawer][ch][adc][id]->GetBinContent(5));
785  double weight = -1.0;
786 
787  if (bin0 + bin3 + bin4 + bin5 > 0) {
788  if ((bin4 == 0) && (bin5 == 0)) {
789  weight = 2.0; // BCID: all other errors; CRC: FE only errors
790  } else if ((bin3 == 0) && (bin5 == 0)) {
791  weight = 3.0; // CRC only: ROD only errors
792  } else { // if there are ROD and FE errors (not necessary at the same time),
793  //weight is 2.5
794  weight = 2.5; // CRC only: ROD and FE errors
795  }
796  } else {
797  if (bin2 == 0) {
798  weight = 0.0; // all zeros
799  } else if (bin1 == 0) {
800  weight = 1.0; // all OK
801  } else {
802  weight = 1.0 - (double) bin1 / m_nEventsTileMon; // percentage of good events
803  if (weight > 0.8) weight = 0.8; // to see clearly even one event with zeros
804  }
805  }
806  m_data->m_final_hist1[ros][drawer][adc][id + 4]->SetBinContent(dmu, weight);
807 
808  if (adc) break; // no CRC histogram in high gain
809  }
810  } // end of loop over 16 DMU
811 
812  //Correlation and Covariance
813  if (m_runType == PedRun) {
814 
815  for (int type = 0; type < 2; ++type) {
816  sStr.str("");
817  sStr << moduleName << gain[gn] << HistName2[type];
818  histName = sStr.str();
819  sStr.str("");
820  sStr << moduleName << gain[3 + gn] << HistName2[2 + type];
821  histTitle = sStr.str();
822  m_data->m_final_hist2[ros][drawer][adc].push_back(book2F(subDir, histName, histTitle, 48, 0.0, 48.0, 48, 0.0, 48.0));
823  }
824 
825  if (m_nEventsTileMon * m_nSamples > 0) {
826 
827  for (int ch_i = 0; ch_i < 48; ++ch_i) {
828  if (m_data->m_nEvents_i[ros][drawer][adc][ch_i] > 0)
829  m_data->m_meanAmp[ros][drawer][adc][ch_i] /= m_data->m_nEvents_i[ros][drawer][adc][ch_i];
830  for (int ch_j = 0; ch_j < 48; ++ch_j)
831  if (m_data->m_nEvents_ij[ros][drawer][adc][ch_i][ch_j] > 0)
832  m_data->m_meanAmp_ij[ros][drawer][adc][ch_i][ch_j] /= m_data->m_nEvents_ij[ros][drawer][adc][ch_i][ch_j];
833  }
834 
835  double covar[48][48];
836  double corr[48][48];
837  double mean_rms[48];
838  double mean_cov_ii = 0.; // mean values of covar in diag terms
839  double mean_cov_ij = 0.; // mean values of covar in off diag terms
840 
841  for (int ch_i = 0; ch_i < 48; ++ch_i) {
842  // int pmt_i = abs(m_cabling->channel2hole(ros,ch_i))-1;
843  for (int ch_j = 0; ch_j < 48; ++ch_j) {
844  // int pmt_j = abs(m_cabling->channel2hole(ros,ch_j))-1;
845  covar[ch_i][ch_j] = m_data->m_meanAmp_ij[ros][drawer][adc][ch_i][ch_j] - m_data->m_meanAmp[ros][drawer][adc][ch_i] * m_data->m_meanAmp[ros][drawer][adc][ch_j];
846 
847  if (ch_j < ch_i) {
848  mean_cov_ij += covar[ch_i][ch_j]; //LF: we take C_ij with its sign
849  }
850  }
851 
852  mean_cov_ii += covar[ch_i][ch_i];
853 
854  if (covar[ch_i][ch_i] != 0.0)
855  mean_rms[ch_i] = covar[ch_i][ch_i] / sqrt(TMath::Abs(covar[ch_i][ch_i]));
856  else
857  mean_rms[ch_i] = 0.;
858  }
859 
860  if (mean_cov_ii != 0.) {
861  m_data->m_cov_ratio[ros][drawer][adc] = (2. * mean_cov_ij) / (mean_cov_ii * 47.); //(2*cov_ij/(48*47))/(cov_ii/48)
862  } else {
863  m_data->m_cov_ratio[ros][drawer][adc] = 0.;
864  }
865  // std::cout << "m_cov_ratio["<<adc<<"]= " << m_data->m_cov_ratio[ros][drawer][adc] << "\n";
866 
867  for (int i = 0; i < 48; ++i) {
868  for (int j = 0; j < 48; ++j) {
869  if ((mean_rms[i] == 0.) || (mean_rms[j] == 0.)) {
870  corr[i][j] = 0.;
871  } else {
872  corr[i][j] = covar[i][j] / mean_rms[i] / mean_rms[j];
873  }
874  m_data->m_final_hist2[ros][drawer][adc][0]->SetBinContent(i + 1, j + 1, covar[i][j]);
875  m_data->m_final_hist2[ros][drawer][adc][1]->SetBinContent(i + 1, j + 1, corr[i][j]);
876  }
877  }
878  } // end if m_nEventsTileMon > 0
879 
880  } // end if PedRun
881  } // end of loop over gn
882 
883  drawHists(ros, drawer, moduleName);
884 
885  //if RunType is Cis, the Kolmogorov test of the sample distribution is performed
886  if (m_runType == CisRun) {
887 
888  for (int gn = mingain; gn < maxgain; ++gn) {
889  for (int i = 0; i < 48; ++i) {
890  TH1S *h = (TH1S*) m_data->m_hist1[ros][drawer][i][gn][2]->Clone("temphist");
891  h->SetDirectory(0);
892  shiftHisto(h, ros, drawer, i, gn);
893  delete h;
894  }
895  double shiftxmin = 0.;
896  double shiftxmax = m_shiftnbins;
897  int shiftnbins = m_shiftnbins;
898 
899  std::ostringstream s;
900  s << part[ros] << std::setfill('0') << std::setw(2) << drawer + 1 << std::setfill(' ');
901  std::string moduleName = s.str();
902  std::string subDir = moduleName;
903 
904  s.str("");
905  s << moduleName << gain[gn] << "_samples_ref";
906  std::string histName = s.str();
907 
908  s.str("");
909  s << moduleName << gain[3 + gn] << " all samples reference";
910  std::string histTitle = s.str();
911 
912  m_data->m_shifted_hist[ros][drawer][48][gn] = book1S(subDir, histName, histTitle, shiftnbins, shiftxmin, shiftxmax);
913 
915  } // if runTYpe==CisRun
916  }
917  }
918 
919  } //loop over drawer
920  } //loop over ros
921 
922 
923  return StatusCode::SUCCESS;
924 }
925 
926 /*---------------------------------------------------------*/
927 const uint8_t * TileDigitsMonTool::stuckBitProb (int ros, int module, int channel, int gain) const
928 /*---------------------------------------------------------*/
929 {
930  return m_data->m_stuck_probs[ros][module][channel][gain];
931 }
932 
933 
934 /*---------------------------------------------------------*/
936 /*---------------------------------------------------------*/
937 {
938 
939  ATH_MSG_INFO("in checkHists()");
940 
941  return StatusCode::SUCCESS;
942 }
943 
944 /*---------------------------------------------------------*/
946  /*---------------------------------------------------------*/
947  Float_t alpha = 1.; // 0- transparent, 1- opaque
948  Int_t ind;
949  // set Deep Sea Blue palette (dark to light)
950  if (ncolors == 51 && colors == 0) {
951  TColor::InitializeColors();
952  const int nRGBs = 5;
953  Double_t stops[nRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
954  Double_t red[nRGBs] = { 0.00, 0.09, 0.18, 0.09, 0.00 };
955  Double_t green[nRGBs] = { 0.01, 0.02, 0.39, 0.68, 0.97 };
956  Double_t blue[nRGBs] = { 0.17, 0.39, 0.62, 0.79, 0.97 };
957  ind = TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, m_NCont, alpha);
958  }
959 
960  // set Grey Scale palette (light to dark)
961  else if (ncolors == 52 && colors == 0) {
962  TColor::InitializeColors();
963  const int nRGBs = 3;
964  Double_t stops[nRGBs] = { 0.00, 0.50, 1.00 };
965  Double_t red[nRGBs] = { 0.90, 0.50, 0.10 };
966  Double_t green[nRGBs] = { 0.90, 0.50, 0.10 };
967  Double_t blue[nRGBs] = { 0.90, 0.50, 0.10 };
968  ind = TColor::CreateGradientColorTable(nRGBs, stops, red, green, blue, m_NCont, alpha);
969  } else
970  return -1;
971  return ind;
972 }
973 
974 /*---------------------------------------------------------*/
975 void TileDigitsMonTool::drawHists(int ros, int drawer, const std::string& moduleName)
976 /*---------------------------------------------------------*/
977 {
978 
979  ATH_MSG_VERBOSE("in drawHists()");
980 
981  int maxgain = (m_bigain) ? 2 : 1;
982  double ms = (m_bigain) ? 0.75 : 1.0; // marker size
983 
984  static bool palette_init_done = false;
985  static int pal51[m_NCont];
986  static int pal52[m_NCont];
987  static TExec *ex_pal51;
988  static TExec *ex_pal52;
989  bool do_plots = m_savePng || m_savePs || m_saveSvg;
990 
991  if (palette_init_done == false) {
992  palette_init_done = true;
993  int i;
994  int ind = define_palette(51);
995  if (ind < 0) ind = 0; // fall-back colours
996  for (i = 0; i < m_NCont; i++)
997  pal51[i] = ind + i;
998  ind = define_palette(52);
999  if (ind < 0) ind = 0; // fall-back colours
1000  for (i = 0; i < m_NCont; i++)
1001  pal52[i] = ind + i;
1002  TString s;
1003  s.Form("gStyle->SetPalette(%d,(int*)%ld);", m_NCont, (long) pal51);
1004  ex_pal51 = new TExec("ex_pal51", s.Data());
1005  s.Form("gStyle->SetPalette(%d,(int*)%ld);", m_NCont, (long) pal52);
1006  ex_pal52 = new TExec("ex_pal52", s.Data());
1007  }
1008 
1009  TLine * maxline[4];
1010  double line[8] = { 1.2, 2.5, 1.0, 1.0, 48.0, 48.0, 48.0, 16.0 };
1011  double miny[12] = { 20.0, 20.0, 0.0, 0.0, 0.0, 0.0, -0.1, -0.1, -0.1, -0.1, -0.1, -0.1 };
1012  double maxy[12] = { 80.0, 80.0, 1.5, 3.0, 1.5, 3.0, 2.2, 2.2, 2.2, 2.2, 3.2, 2.2 };
1013  // ? , ? , ? , ? , ? , ? , ? , ? , BC hi,BC lo, CRC , ?
1015  miny[0] = miny[1] = -5.0;
1016  maxy[0] = maxy[1] = 5.0;
1017  }
1018 
1019  TText *t = new TText();
1020  t->SetTextAlign(32);
1021  t->SetTextSize(0.06);
1022  t->SetTextFont(72);
1023 
1024  if (maxgain == 1) {
1025  line[0] = line[1];
1026  for (int ind = 0; ind < 12; ind += 2) {
1027  miny[ind] = miny[ind + 1] = std::min(miny[ind], miny[ind + 1]);
1028  maxy[ind] = maxy[ind + 1] = std::max(maxy[ind], maxy[ind + 1]);
1029  }
1030  }
1031 
1032  for (int type = 0; type < 4; ++type) {
1033  maxline[type] = new TLine(0.0, line[type], line[4 + type], line[type]);
1034  maxline[type]->SetLineColor(2 + type / 2);
1035  }
1036 
1037  TCanvas * Can = NULL;
1038  if (do_plots) {
1039  Can = new TCanvas("dig_noise", "dig_noise", 402 * maxgain, 588);
1040  Can->Divide(maxgain, 3);
1041  gStyle->SetOptStat(0);
1042  gStyle->SetTitleFontSize(0.1);
1043  }
1044 
1045  for (int gain = 0; gain < maxgain; ++gain) {
1046  for (int type = 0; type < 3; ++type) {
1047 
1048  if (do_plots) {
1049  TVirtualPad * pad = Can->cd(type * maxgain + gain + 1);
1050  pad->SetTopMargin(0.15);
1051  pad->SetGridx();
1052  }
1053  int ind = type * 2 + gain;
1054 
1055  if (m_data->m_final_hist1[ros][drawer][gain][type]->GetMaximum() < 0.9 * maxy[ind]) //if maximum is below reasonable limit use a default scale
1056  m_data->m_final_hist1[ros][drawer][gain][type]->SetMaximum(maxy[ind]);
1057  if (m_data->m_final_hist1[ros][drawer][gain][type]->GetMinimum() > (miny[ind] + 0.1 * TMath::Abs(miny[ind]))) // if minimum is above reasonable limit
1058  m_data->m_final_hist1[ros][drawer][gain][type]->SetMinimum(miny[ind]); // use a default scale
1059 
1060  m_data->m_final_hist1[ros][drawer][gain][type]->SetMarkerStyle(21);
1061  m_data->m_final_hist1[ros][drawer][gain][type]->SetMarkerSize(ms);
1062  m_data->m_final_hist1[ros][drawer][gain][type]->SetLabelSize(0.08, "X");
1063  m_data->m_final_hist1[ros][drawer][gain][type]->SetLabelSize(0.08, "Y");
1064  if (do_plots) {
1065  m_data->m_final_hist1[ros][drawer][gain][type]->Draw("P0");
1066  if (type > 0) maxline[gain]->Draw();
1067  }
1068  }
1069  }
1070 
1071  if (m_savePng) {
1072  Can->Print(TString(moduleName + "_dig_noise.png"), "png");
1073  }
1074  if (m_savePs) {
1075  Can->Print(TString(moduleName + "_dig_noise.ps"), "ps");
1076  }
1077  if (m_saveSvg) {
1078  Can->Print(TString(moduleName + "_dig_noise.svg"), "svg");
1079  }
1080  if (do_plots) {
1081  delete Can;
1082 
1083  Can = new TCanvas("dig_errors", "dig_errors", 402 * maxgain, 588);
1084  Can->Divide(maxgain, 4);
1085  gStyle->SetOptStat(1);
1086  gStyle->SetTitleFontSize(0.1);
1087  }
1088 
1089  for (int gain = 0; gain < maxgain; ++gain) {
1090  for (int type = 3; type < 6; ++type) {
1091 
1092  TVirtualPad * pad = NULL;
1093  if (do_plots) {
1094  pad = Can->cd((type - 3) * maxgain + gain + 1);
1095  pad->SetTopMargin(0.15);
1096  }
1097  int ind = type * 2 + gain;
1098 
1099  if (type == 5 && gain == 1) {
1100  if (do_plots) pad->SetLogy();
1101 
1102  m_data->m_hist0[ros][drawer][0]->SetStats(kFALSE);
1103  gStyle->SetStatFontSize(0.1);
1104  m_data->m_hist0[ros][drawer][0]->SetStats(kTRUE);
1105  m_data->m_hist0[ros][drawer][0]->SetLabelSize(0.08, "X");
1106  m_data->m_hist0[ros][drawer][0]->SetLabelSize(0.08, "Y");
1107  if (do_plots) m_data->m_hist0[ros][drawer][0]->Draw(); // global CRC in bottom right corner
1108 
1109  } else {
1110  if (do_plots) pad->SetGridx();
1111 
1112  if (m_data->m_final_hist1[ros][drawer][gain][type]->GetMaximum() < 0.9 * maxy[ind]) //if maximum is below reasonable limit use a default scale
1113  m_data->m_final_hist1[ros][drawer][gain][type]->SetMaximum(maxy[ind]);
1114  if (m_data->m_final_hist1[ros][drawer][gain][type]->GetMinimum() > (miny[ind] + 0.1 * TMath::Abs(miny[ind]))) // if minimum is above reasonable limit
1115  m_data->m_final_hist1[ros][drawer][gain][type]->SetMinimum(miny[ind]); // use a default scale
1116 
1117  m_data->m_final_hist1[ros][drawer][gain][type]->SetMarkerStyle(21);
1118  m_data->m_final_hist1[ros][drawer][gain][type]->SetMarkerSize(ms);
1119  m_data->m_final_hist1[ros][drawer][gain][type]->SetStats(kFALSE);
1120  m_data->m_final_hist1[ros][drawer][gain][type]->SetLabelSize(0.08, "X");
1121  m_data->m_final_hist1[ros][drawer][gain][type]->SetLabelSize(0.08, "Y");
1122  if (type != 3) {
1123  if (do_plots) m_data->m_final_hist1[ros][drawer][gain][type]->Draw("P0");
1124  } else {
1125  m_data->m_final_hist_stucks[ros][drawer][gain]->SetStats(kFALSE);
1126  m_data->m_final_hist_stucks[ros][drawer][gain]->SetMarkerSize(3.);
1127  m_data->m_final_hist_stucks[ros][drawer][gain]->SetMarkerColor(4);
1128  m_data->m_final_hist_stucks[ros][drawer][gain]->SetLabelSize(0.08, "X");
1129  m_data->m_final_hist_stucks[ros][drawer][gain]->SetLabelSize(0.1, "Y");
1130  gStyle->SetNumberContours(m_NCont);
1131  if (do_plots) {
1132  m_data->m_final_hist_stucks[ros][drawer][gain]->Draw("textzcol");
1133  ex_pal52->Draw();
1134  m_data->m_final_hist_stucks[ros][drawer][gain]->Draw("textcolzsame");
1135  pad->Update();
1136  TPaletteAxis *palette = (TPaletteAxis*) m_data->m_final_hist_stucks[ros][drawer][gain]->GetListOfFunctions()->FindObject("palette");
1137  if (palette != NULL) palette->SetLabelSize(0.07);
1138  pad->Modified();
1139  }
1140  }
1141  if (type == 4 || (type == 5 && gain == 0)) {
1142  m_data->m_final_hist1[ros][drawer][gain][type]->GetYaxis()->SetLabelOffset(-0.85); // do not draw default lables
1143  if (do_plots) {
1144  t->DrawText(-0.2, 1., "all OK");
1145  t->DrawText(-0.2, .0, "wrong");
1146  if (type == 4)
1147  t->DrawText(-0.2, 2., "mismatch");
1148  else {
1149  t->DrawText(-0.2, 2., "FE fail");
1150  t->DrawText(-0.2, 2.5, "FE+ROD fail");
1151  t->DrawText(-0.2, 3., "ROD fail");
1152  }
1153  }
1154  }
1155  /* if (type == 3)
1156  maxline[2]->Draw();
1157  else */
1158  if (type != 3) if (do_plots) maxline[3]->Draw();
1159  }
1160  }
1161  //LF Now plot DMU Header Errors histograms
1162  TVirtualPad * pad = NULL;
1163  if (do_plots) {
1164  pad = Can->cd(6 + gain + 1);
1165  pad->SetTopMargin(0.15);
1166  pad->SetGridx();
1167  }
1168  m_data->m_hist2[ros][drawer][gain][0]->SetMarkerSize(3.);
1169  m_data->m_hist2[ros][drawer][gain][0]->SetMarkerColor(2);
1170  m_data->m_hist2[ros][drawer][gain][0]->SetLabelSize(0.11, "Y");
1171  m_data->m_hist2[ros][drawer][gain][0]->SetLabelSize(0.08, "X");
1172  m_data->m_hist2[ros][drawer][gain][0]->SetStats(kFALSE);
1173  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetBinLabel(1, "OK ");
1174  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetBinLabel(2, "Format");
1175  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetBinLabel(3, "Parity");
1176  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetBinLabel(4, "Memory");
1177  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetBinLabel(5, "SingleStr");
1178  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetBinLabel(6, "DbleStr");
1179  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetBinLabel(7, "DummyFrag");
1180  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetBinLabel(8, "NoDataFrag");
1181  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetTickLength(0.01);
1182  m_data->m_hist2[ros][drawer][gain][0]->GetYaxis()->SetLabelOffset(0.001);
1183  if (do_plots) {
1184  gStyle->SetNumberContours(m_NCont);
1185  m_data->m_hist2[ros][drawer][gain][0]->Draw("textzcol");
1186  ex_pal51->Draw();
1187  m_data->m_hist2[ros][drawer][gain][0]->Draw("textzcolsame");
1188  pad->Update();
1189  TPaletteAxis *palette = (TPaletteAxis*) m_data->m_hist2[ros][drawer][gain][0]->GetListOfFunctions()->FindObject("palette");
1190  if (palette != NULL) palette->SetLabelSize(0.07);
1191  pad->Modified();
1192  }
1193 
1194  }
1195 
1196  if (m_savePng) {
1197  Can->Print(TString(moduleName + "_dig_errors.png"), "png");
1198  }
1199  if (m_savePs) {
1200  Can->Print(TString(moduleName + "_dig_errors.ps"), "ps");
1201  }
1202  if (m_saveSvg) {
1203  Can->Print(TString(moduleName + "_dig_errors.svg"), "svg");
1204  }
1205  if (do_plots) delete Can;
1206 
1207  for (int type = 0; type < 4; ++type) {
1208  delete maxline[type];
1209  }
1210 
1211  delete t;
1212 
1213  if (m_runType == PedRun) {
1214 
1215  if (do_plots) {
1216  Can = new TCanvas("correlation", "correlation", 402 * maxgain, 588);
1217  Can->Divide(maxgain, 2);
1218  gStyle->SetOptStat(0);
1219  gStyle->SetPalette(1);
1220  gStyle->SetTitleFontSize(0.1);
1221  }
1222 
1223  TPaveLabel covar_label[2];
1224  covar_label[0] = TPaveLabel(37., 49., 54., 56., "");
1225  covar_label[1] = TPaveLabel(37., 49., 54., 56., "");
1226 
1227  for (int gain = 0; gain < maxgain; ++gain) {
1228  for (int type = 0; type < 2; ++type) {
1229  if (do_plots) {
1230  TVirtualPad * pad = Can->cd(type * maxgain + gain + 1);
1231  pad->SetTopMargin(0.15);
1232  }
1233  m_data->m_final_hist2[ros][drawer][gain][type]->SetLabelSize(0.06, "X");
1234  m_data->m_final_hist2[ros][drawer][gain][type]->SetLabelSize(0.06, "Y");
1235  if (do_plots) {
1236  m_data->m_final_hist2[ros][drawer][gain][type]->Draw("COLZ");
1237  if (type == 0) {
1238  std::ostringstream label_text;
1239  label_text << "<C_ij>/<C_ii>= " << std::setprecision(4) << m_data->m_cov_ratio[ros][drawer][gain] << std::setprecision(4);
1240  covar_label[gain].SetLabel(label_text.str().c_str());
1241  covar_label[gain].SetTextSize(0.4);
1242  covar_label[gain].Draw();
1243  }
1244  }
1245  }
1246  }
1247 
1248  if (m_savePng) {
1249  Can->Print(TString(moduleName + "_correlation.png"), "png");
1250  }
1251  if (m_savePs) {
1252  Can->Print(TString(moduleName + "_correlation.ps"), "ps");
1253  }
1254  if (do_plots) delete Can;
1255  }
1256 
1257  gStyle->SetOptStat(1111);
1258 }
1259 
1261  // function returns number of stuck bits
1262  int NSB = 0;
1263 
1264  // If all bins at given hypothetical stuck_position (0,1) and stuck_bit (0,...,9)
1265  // are empty then this bin is stuck in this position. Do this procedure only for
1266  // bins between the first and the last non-zeroth one.
1267 
1268  // Find first/last non-zero bin in the histogram
1269  int MinBin = 1;
1270  for (; MinBin < m_i_ADCmax + 2; ++MinBin) {
1271  if (hist->GetBinContent(MinBin) > 0) {
1272  break;
1273  }
1274  }
1275  if (MinBin == m_i_ADCmax + 2) return 0; // empty histogram, nothing to do
1276 
1277  int MaxBin = m_i_ADCmax + 1;
1278  for (; MaxBin > 0; --MaxBin) {
1279  if (hist->GetBinContent(MaxBin) > 0) {
1280  break;
1281  }
1282  }
1283 
1284  // bins in hist are counted from 1 to m_i_ADCmax + 1, but actual X value for those bins are 0-m_i_ADCmax
1285 
1286  // if there is nothing in first half of histogram
1287  // or there is nothing in second half and there is a sharp edge at 512
1288  // it can be that upper most bit is stuck in 0 or 1
1289  if (MinBin == (m_i_ADCmax + 1) / 2 + 1 || (MaxBin == (m_i_ADCmax + 1) / 2 && hist->GetBinContent(MaxBin) > 3)) {
1290  ++NSB;
1291  // std::cout << "Bit 9 is stuck" << std::endl;
1292  }
1293 
1294  --MinBin; // shift to zero bin
1295  ++MaxBin; // shift to zero bin
1296 
1297  for (int hyp_pos = 0; hyp_pos < 2; ++hyp_pos) { // bit stuck at value 0 or 1
1298  for (int hyp_bit = 0; hyp_bit < 10; ++hyp_bit) { // which bit is stuck
1299  double sum = 0;
1300  int bin_counter = 0;
1301 
1302  int win_length = (1 << hyp_bit); // length of one interval with all zeros if bit is stuck
1303  int BeginBin = (1 - hyp_pos) * win_length; // beginning of first interval to check
1304 
1305  while (BeginBin + 1 < MaxBin) {
1306  int EndBin = BeginBin + win_length; // end of interval to check
1307 
1308  if (EndBin > MinBin) {
1309  for (int bin = BeginBin; bin < EndBin; ++bin) {
1310  //bin is from 0 to m_i_ADCmax here - must be changed in GetBinConent to (bin+1)
1311  if (MinBin < (bin + 1) && (bin + 1) < MaxBin) {
1312  sum += hist->GetBinContent(bin + 1);
1313  ++bin_counter;
1314  }
1315  }
1316  }
1317  BeginBin = EndBin + win_length; // beginning of next interval
1318  }
1319  if (sum == 0 && bin_counter > 0) {
1320  // std::cout << "Bit "<<hyp_bit<<" is stuck at "<< hyp_pos << std::endl;
1321  ++NSB;
1322  }
1323  }
1324  }
1325 
1326  if ((NSB == 0) && ((m_runType == CisRun) || (m_runType == CisRamp))) {
1327 
1328  NSB = stuckBits_Amp(hist, adc); // if no stuck bits found, lets try another crude procedure
1329  }
1330 
1331  return NSB;
1332 }
1333 
1334 /* not used
1335  int TileDigitsMonTool::stuckBits_maker(TH1S * hist)
1336  {
1337 
1338  // If all bins at given hypothetical stuck_position and stuck_bit are empty then
1339  // this bin is stuck in this position. Do this procedure only for
1340  // bins less last bin
1341  hp = 1 - hp;
1342  ++hb;
1343  if (hb > 15) hb = 0;
1344  // Stuck bits maker
1345  hist->SetBinContent(1,0);
1346  if (hb < 9) {
1347  int hyp_pos = hp;
1348  int hyp_bit = hb;
1349  int max_Nsample = (m_i_ADCmax + 1)/(1<<(hyp_bit+1));
1350  for (int bin_sample = 0; bin_sample < max_Nsample; ++bin_sample) {
1351  //beginning of sample in histogram
1352  int BeginBin = (1 - hyp_pos)*(1<<hyp_bit)+bin_sample*(1<<(hyp_bit+1));
1353  //end of sample in histogram
1354  int EndBin = BeginBin + (1<<hyp_bit);
1355  for (int bin = BeginBin; bin < EndBin; ++bin) {
1356  //variable bin from 0 to m_i_ADCmax - must be changed in GetBunConent to (bin+1)
1357  if ((bin+1) < m_i_ADCmax + 2) hist->SetBinContent(bin+1,0);
1358  }
1359  }
1360  }
1361  return -1;
1362  }
1363  */
1364 
1365 // New function by Tibor Zenis
1366 // It checks how many bit flips happen compared to the expected ones
1367 // Only works for CIS and Laser because the adc range is not sufficiently excersized
1368 // in the other run types.
1370  int i, b, c, cc = 2;
1371  int bc[10], bv[10];
1372  double bs[10];
1373  int f; // flip-flop of non-zero contents of previous bin
1374  int cm, cp; // previous and next bin contents
1375  double prob; // probability
1376  for (b = 0; b < 10; b++) {
1377  bc[b] = 0;
1378  bs[b] = 0.;
1379  bv[b] = 1 << b;
1380  }
1381  cp = hist->GetBinContent(1);
1382  f = !!cp;
1383  for (i = 1; i < m_i_ADCmax + 1; i++) {
1384  cm = cc;
1385  c = cc = cp;
1386  cp = (i < m_i_ADCmax) ? hist->GetBinContent(i + 2) : 0;
1387  prob = 1.;
1388  if (c > 0 && c < 0.125 * (cp + cm - std::sqrt((double) cp) - std::sqrt((double) cm))) {
1389  prob = 1. - (double) c / (0.125 * (cp + cm - std::sqrt((double) cp) - std::sqrt((double) cm)));
1390  c = 0;
1391  }
1392  if (c || f) // count bit flips (bc[b]) in bins with non-zero contents and adjacent bins
1393  for (b = 0; b < 10; b++) {
1394  if ((i & bv[b]) != ((i - 1) & bv[b]))
1395  bc[b]++;
1396  else
1397  break; // higher bit can flip only of the previous one does
1398  }
1399  if (f > 0 && c > 0) continue;
1400  if (f == 0 && c == 0) continue;
1401  if (c || f) // bin content flips (zero - non-zero)
1402  for (b = 0; b < 10; b++) { // count bits flipped at this position
1403  if ((i & bv[b]) != ((i - 1) & bv[b]))
1404  bs[b] += (i & bv[b]) ? (c ? prob : -prob) : (c ? -prob : prob);
1405  else
1406  break;
1407  }
1408  f = !f;
1409  }
1410 
1411  int NSB = 0;
1412  for (b = 0; b < 10; b++)
1413  // if (bc[b] > 2 && abs(bs[b]) * 2 > bc[b])
1414  if (((bc[b] > 2) && (std::abs(bs[b]) == bc[b])) || ((std::abs(bs[b]) > 7) && (std::abs(bs[b]) * 3 > bc[b]))) {
1415  NSB++;
1416  }
1417 
1418  return NSB;
1419 
1420 }
1421 
1422 /* version 2. */
1423 int TileDigitsMonTool::stuckBits_Amp2(TH1S * hist, TH1C *modhist, int gain, TH2C *outhist, int ch, uint8_t *stuck_probs) {
1424 
1425  if (hist->GetEntries() < 1000) return 0; /* too few events (1000 / N_samples) in histogram, ignore */
1426 
1427  int i, b, c, cc = 0; /* bin counter, but position, bin content */
1428  double cont;
1429  int last_non0, first_non0 = -1;
1430  int bc[10] = { 0 }, bv[10] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }; // bit flips at signal regions, bit values
1431  double bs[10] = { 0. }; // bit flips at signal edges
1432  int bac[10] = { 0 }, ba0[10] = { 0 }, ba1[10] = { 0 }, bas[10] = { 0 }; // for stuck bits between first_non0, last_non0 using old technique
1433  int f; // flip-flop of non-zero contents of previous bin
1434  int cm, cp; // previous and next bin contents
1435  double prob; // probability
1436  int zero_limit, saturation_limit;
1437  zero_limit = gain ? m_zeroLimitHG : 0;
1438  saturation_limit = gain ? m_saturationLimitHG : m_i_ADCmax;
1439  cp = hist->GetBinContent(1);
1440  f = !!cp;
1441  if (f) first_non0 = 0;
1442  for (last_non0 = m_i_ADCmax; last_non0 >= 0; last_non0--)
1443  if (hist->GetBinContent(last_non0 + 1) > 0) break;
1444  if (last_non0 < 0) // empty histogram
1445  return 0;
1446  for (i = 1; i <= last_non0; i++) {
1447  cm = cc;
1448  c = cc = cp;
1449  cp = (i < m_i_ADCmax) ? hist->GetBinContent(i + 2) : 0;
1450  if (first_non0 < 0) {
1451  if (cc > 0)
1452  first_non0 = i;
1453  else
1454  continue;
1455  }
1456  for (b = 0; b < 10; b++) { // count bits flipped at this position
1457  if ((i & bv[b]) != ((i - 1) & bv[b])) {
1458  bac[b]++;
1459  if (bas[b] > 0) {
1460  if ((i - 1) & bv[b])
1461  ba1[b]++;
1462  else
1463  ba0[b]++;
1464  bas[b] = 0;
1465  }
1466  }
1467  if (cc > 0) bas[b]++;
1468  }
1469  prob = 1.;
1470  cont = sqrt((double) (c + cm));
1471  if ((c == 0 || cm == 0) && (c > 0 || cm > 0)) {
1472  prob = erf((cont - sqrt(cont)) / sqrt(2 * cont));
1473  }
1474  /* bin content is lower than usual */
1475  if (c > 0 && c < 0.25 * (cp + cm - std::sqrt((double) cp) - std::sqrt((double) cm))) {
1476  prob = 1. - (double) c / (0.25 * (cp + cm - std::sqrt((double) cp) - std::sqrt((double) cm)));
1477  c = 0;
1478  }
1479  if (c || f) // count bit flips (bc[b]) in bins with non-zero contents or adjacent bins
1480  for (b = 0; b < 10; b++) {
1481  if ((i & bv[b]) != ((i - 1) & bv[b]))
1482  bc[b]++;
1483  else
1484  break; // a higher bit can flip only of the lower one does
1485  }
1486  if (f > 0 && c > 0) continue;
1487  if (f == 0 && c == 0) continue;
1488  if (c || f) // bin content flips (zero - non-zero)
1489  for (b = 0; b < 10; b++) { // count bits flipped at this position
1490  if ((i & bv[b]) != ((i - 1) & bv[b]))
1491  bs[b] += (i & bv[b]) ? (c ? prob : -prob) : (c ? -prob : prob);
1492  else
1493  break;
1494  }
1495  f = !f;
1496  }
1497 
1498  for (b = 0; b < 10; b++) // count bits flipped at this position
1499  if ((i & bv[b]) != ((i - 1) & bv[b])) {
1500  bac[b]++;
1501  if (bas[b] > 0) {
1502  if ((i - 1) & bv[b])
1503  ba1[b]++;
1504  else
1505  ba0[b]++;
1506  }
1507  }
1508 
1509  int is_stack = 0;
1510  double sb_prob[4] = {0., 0., 0., 0.};
1511  static const int sb_map[10] = {0, 1, 1, 2, 2, 3, 3, 3, 3, 3}; // mapping of SB to histogram rows
1512  for (b = 0; b < 10; b++) {
1513  if ((ba0[b] == 0 || ba1[b] == 0) && bac[b] > 2 && (ba0[b] + ba1[b] >= bac[b] / 2 || ba0[b] + ba1[b] > 2)) {
1514  is_stack = 1;
1515  if (outhist != NULL) {
1516  sb_prob[sb_map[b]] = 1.;
1517  }
1518  if (stuck_probs != NULL)
1519  stuck_probs[b] = ba0[b] == 0 ? 100u : 200u;
1520  continue;
1521  }
1522  double bs1 = std::fabs(bs[b]) - sqrt(std::fabs(bs[b]));
1523  if (bs1 < 0.) bs1 = 0.;
1524  if ((bs1 > 0.5 * bc[b]) || (bc[b] > 7 && bs1 * 3 > bc[b])) is_stack = 1;
1525  if (outhist != NULL && bc[b] > 0) {
1526  // if (sb_prob[sb_map[b]] < 100. * bs1 / bc[b]) sb_prob[sb_map[b]] = 100. * bs1 / bc[b];
1527  sb_prob[sb_map[b]] = 1. - (1. - sb_prob[sb_map[b]]) * (1. - 1. * bs1 / bc[b]); // prod of probs. of not-stuck
1528  }
1529  if (stuck_probs != NULL)
1530  {
1531  stuck_probs[b] = (uint8_t) (100. * bs1 / bc[b]);
1532  if (bs[b] > 0)
1533  {
1534  stuck_probs[b] += 100u;
1535  if (stuck_probs[b] == 100u)
1536  stuck_probs[b] = 0u;
1537  }
1538  }
1539  }
1540  if ((first_non0 >= (m_i_ADCmax + 1) / 2 && first_non0 < m_i_ADCmax)
1541  || (last_non0 == (m_i_ADCmax + 1) / 2 - 1 && hist->GetBinContent(last_non0) > 3)) {
1542  is_stack = 1;
1543 
1544  sb_prob[3] = 1.;
1545  if (stuck_probs != NULL)
1546  stuck_probs[9] = first_non0 >= 512 ? 200u : 100u;
1547  }
1548  if (outhist != NULL) {
1549  outhist->Fill((double) ch, 0., 100. * sb_prob[0]);
1550  outhist->Fill((double) ch, 1., 100. * sb_prob[1]);
1551  outhist->Fill((double) ch, 2., 100. * sb_prob[2]);
1552  outhist->Fill((double) ch, 3., 100. * sb_prob[3]);
1553 
1554  if (first_non0 >= saturation_limit)
1555  outhist->Fill((double) ch, 5., 100.);
1556  else if (last_non0 >= saturation_limit) {
1557  double frac;
1558  int saturation_entries = 0;
1559  int maxADC = m_i_ADCmax + 1;
1560  for (i = saturation_limit + 1; i <= maxADC; ++i)
1561  saturation_entries += hist->GetBinContent(i);
1562  frac = 100. * (double) saturation_entries / hist->GetEntries();
1563  if (frac > 0. && frac < 1.) frac = 1.;
1564  if (frac > 99. && frac < 100.) frac = 99.;
1565  outhist->Fill((double) ch, 5., frac);
1566  }
1567  if (last_non0 <= zero_limit)
1568  outhist->Fill((double) ch, 4., 100.);
1569  else if (first_non0 <= zero_limit) {
1570  double frac;
1571  int zero_entries = 0;
1572  for (i = 1; i <= zero_limit + 1; ++i)
1573  zero_entries += hist->GetBinContent(i);
1574  frac = 100. * (double) zero_entries / hist->GetEntries();
1575  if (frac > 0. && frac < 1.) frac = 1.;
1576  if (frac > 99. && frac < 100.) frac = 99.;
1577  outhist->Fill((double) ch, 4., frac);
1578  }
1579  double entries, empty_cut, full_cut;
1580  int mod32empty = 0;
1581  int mod32full = 0;
1582  bool enough = false;
1583  entries = modhist -> GetEntries();
1584  empty_cut = entries < 4096. ? entries / (32 * 4) : 32.;
1585  full_cut = entries / 32.;
1586  if (full_cut > 126.)
1587  full_cut = 126.;
1588  if (full_cut - empty_cut < 1.)
1589  full_cut = empty_cut + 1.;
1590 
1591  for (i = 1; i <= 32; ++i) {
1592  if (modhist->GetBinContent(i) <= empty_cut)
1593  ++mod32empty;
1594  else if (modhist->GetBinContent(i) > full_cut)
1595  ++mod32full;
1596  if (modhist->GetBinContent(i) > 64)
1597  enough = true;
1598  }
1599  if (mod32empty + mod32full == 32 || enough) //skip in the case of small number of events
1600  if (mod32empty != 0 && mod32full != 0) //some but not all n%32 positions have events
1601  outhist->Fill((double) ch, 6., mod32empty);
1602 
1603  outhist->SetMaximum(100.);
1604  }
1605  return is_stack;
1606 }
1607 
1608 
1610  uint32_t crc32, uint32_t crcMask, int headsize, int ros, int drawer) {
1620 
1621  // protection against non-exisitng histograms
1622  if (m_data->m_hist0[ros][drawer].size() == 0) return;
1623 
1624  //LF CRC check
1625  //std::string ros_name[2] = {"LBA","LBC"};
1626  //std::cout << "Module= " << ros_name[ros-1] << drawer+1 << " CRCmask= 0x" << std::setfill('0') << std::setw(8) << std::hex << crcMask << std::setfill(' ') << std::dec <<"\n";
1627 
1628  //END CRC check
1629  // array to adjust order of DMU's of EB* FE CRC status in DMU chip mask word
1630  // this is needed because FE and ROD fill DMU mask word in different order
1631  int chFE_ext[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 8, 9, 10, 11, 14, 15 };
1632  int chFE_sp[16] = { 11, 0, 1, 2, 3, 4, 5, 6, 12, 13, 7, 8, 9, 10, 14, 15 };
1633  // global CRC
1634  // uint32_t crc32 = (*collItr)->getFragCRC();
1635  uint32_t crc0 = crc32 & 0xFFFF;
1636  uint32_t crc1 = crc32 >> 16;
1637  if (crc32 == 0)
1638  m_data->m_hist0[ros][drawer][0]->Fill(0.0, 1.0);
1639  else if (crc0 == crc1) // two half-words should match
1640  m_data->m_hist0[ros][drawer][0]->Fill(1.0, 1.0);
1641  else
1642  m_data->m_hist0[ros][drawer][0]->Fill(2.0, 1.0);
1643 
1644  // CRC per TileDMU.For mono gain we have it from ROD and FE.
1645  // In bi gain, it is just a placeholder with global CRC information.
1646 
1647  if (headsize < 16) { // How to handle EB? All bits are filled anyway or not?
1648  }
1649 
1650  if (dqStatus->calibMode() == 1) {
1651  for (int ch = 0; ch < headsize; ++ch) {
1652  if (crc32 == 0)
1653  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(0.0, 1.0);
1654  else if (crc0 == crc1)
1655  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(1.0, 1.0);
1656  else
1657  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(2.0, 1.0);
1658 
1659  }
1660  } else {
1661  if (crc32 == 0) { //std::cout << "Global crc is zero\n";
1667  for (int ch = 0; ch < headsize; ++ch) {
1668  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(0.0, 1.0);
1669  }
1670  } else if (crcMask == 0xFFFFFFFF) {
1671  for (int ch = 0; ch < headsize; ++ch) {
1672  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(1.0, 1.0);
1673  }
1674  } else {
1675  uint32_t fe_crc = crcMask & 0xFFFF;
1676  uint32_t rod_crc = crcMask >> 16;
1677  for (int ch = 0; ch < headsize; ++ch) {
1678  int flag = 0;
1679  if (ros == 1 || ros == 2) // LB* use simple FECRC map
1680  {
1681  if ((fe_crc >> ch & 0x1) == 0x0) flag++;
1682  } else if (ros == 3 || ros == 4) // EB* use different FECRC map
1683  {
1684  if ((ros == 3 && drawer == 14) || (ros == 4 && drawer == 17)) // Special Check for EBA15,EBC18
1685  {
1686  if ((fe_crc >> chFE_sp[ch] & 0x1) == 0x0) flag++;
1687  } else {
1688  if ((fe_crc >> chFE_ext[ch] & 0x1) == 0x0) flag++;
1689  }
1690  }
1691  if ((rod_crc >> ch & 0x1) == 0x0) flag += 2;
1692 
1693  //std::cout << "flag for chan "<< ch << "=" << flag << "\n";
1694 
1695  switch (flag) {
1696  case 0: //TileDMU is fine
1697  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(1.0, 1.0);
1698  break;
1699  case 1: //fe error only
1700  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(2.0, 1.0);
1701  break;
1702  case 2: // rod errors
1703  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(3.0, 1.0);
1704  break;
1705  default: // fe+rod errors
1706  m_data->m_hist_DMUerr[ros][drawer][ch][0][1]->Fill(4.0, 1.0);
1707  } // end switch case
1708 
1709  } // end loop on chips
1710 
1711  } // end if on crcMask
1712 
1713  } // end if on runtype
1714 }
1715 
1734 //}
1735 //New Method to check for header errors. Checks per channel and returns True for data corrupted, or False for data not corrupted.
1736 
1737 /*-------------------------------------------------------*/
1738 bool TileDigitsMonTool::DMUheaderCheck(std::vector<uint32_t>* headerVec, int ros, int drawer, int gain, int dmu)
1739 /*-------------------------------------------------------*/
1740 {
1741  bool err = false;
1742 
1743  if (DMUheaderFormatCheck((*headerVec)[dmu])) {
1744  m_data->m_hist2[ros][drawer][gain][0]->Fill(dmu + 0.5, 1., 1.);
1745  err = true;
1746  return err;
1747  }
1748  if (DMUheaderParityCheck((*headerVec)[dmu])) {
1749  m_data->m_hist2[ros][drawer][gain][0]->Fill(dmu + 0.5, 2., 1.);
1750  err = true;
1751  return err;
1752  }
1753  if (((*headerVec)[dmu] >> 25) & 0x1) {
1754  //Memory Parity Error
1755  m_data->m_hist2[ros][drawer][gain][0]->Fill(dmu + 0.5, 3., 1.);
1756  err = true;
1757  }
1758  if (((*headerVec)[dmu] >> 24) & 0x1) {
1759  //Single Strobe Error
1760  m_data->m_hist2[ros][drawer][gain][0]->Fill(dmu + 0.5, 4., 1.);
1761  err = true;
1762  }
1763  if (((*headerVec)[dmu] >> 23) & 0x1) {
1764  //Double Strobe Error
1765  m_data->m_hist2[ros][drawer][gain][0]->Fill(dmu + 0.5, 5., 1.);
1766  err = true;
1767  }
1768 
1769  if (!err) m_data->m_hist2[ros][drawer][gain][0]->Fill(dmu + 0.5, 0., 1.);
1770 
1771  int fragId = m_tileHWID->frag(ros, drawer);
1772  if (std::binary_search(m_fragIDsToIgnoreDMUerrors.begin(), m_fragIDsToIgnoreDMUerrors.end(), fragId)) {
1773  err = false;
1774  }
1775 
1776  return err;
1777 }
1778 
1790 
1793 
1794  for (const TileRawChannelCollection* rawChannelCollection : *rawChannelContainer) {
1795 
1796  if (rawChannelCollection->empty()) continue;
1797 
1798  HWIdentifier hwid = rawChannelCollection->front()->adc_HWID(); //take the first channel in the drawer
1799  int ros = m_tileHWID->ros(hwid); //take the ros and drawer from the first channel
1800  int drawer = m_tileHWID->drawer(hwid);
1801 
1802  uint32_t crc32 = rawChannelCollection->getFragGlobalCRC() & 1;
1803 
1804  if (crc32 == 0) {
1805  crc32 = 0xFFFFFFFF;
1806  } else { // means OK CRC match
1807  crc32 = 0xFFFF;
1808  } //means NOT OK, CRC mismatch
1809 
1810  uint32_t CRCmask = rawChannelCollection->getFragRODChipMask();
1811  CRCmask = CRCmask << 16; // ROD mask is stored in the 16 most significant bits ce
1812  CRCmask += rawChannelCollection->getFragFEChipMask();
1813 
1814  CRCcheck(dqStatus, crc32, CRCmask, 16, ros, drawer); //reuse the same funcion used for digits
1815 
1816  }
1817 
1818  return StatusCode::SUCCESS;
1819 }
1820 
1821 /*---------------------------------------------------------*/
1823 /*---------------------------------------------------------*/
1824 {
1825 
1826  hist->GetXaxis()->SetRange(5, 100);
1827 
1828  TSpectrum s(8, 1.);
1829 
1830  s.Search(hist, 2, "goff");
1831  int shift = int(s.GetPositionX()[0]);
1832  if (shift > 0) {
1833  int factor = m_is12bit ? 4 : 1;
1834  int xmax = std::max(1025 * factor, 846 * factor + shift);
1835  int xmin = std::max(1, shift + 50 * factor);
1836  for (int bin = xmin; bin < xmax; ++bin) {
1837  double c = hist->GetBinContent(bin);
1838  if (c > 0) m_data->m_shifted_hist[ros][drawer][ch][gain]->SetBinContent(bin - shift - 50 * factor, c);
1839  }
1840  }
1841 }
1842 
1843 /*---------------------------------------------------------*/
1845 /*---------------------------------------------------------*/
1846 
1847 {
1848  std::vector<TH1S*> refbld;
1849  std::vector<TH1S*> newrefbld;
1850  TH1F *ref = new TH1F("ref", "ref", m_shiftnbins, 0., m_shiftnbins);
1851  ref->SetDirectory(0);
1852  TH1F *ref1 = new TH1F("ref1", "ref1", m_shiftnbins, 0., m_shiftnbins);
1853  ref1->SetDirectory(0);
1854 
1855  for (int i = 0; i < 48; i++) {
1856 
1857  TH1S *h = m_data->m_shifted_hist[ros][drawer][i][gain];
1858  float integ = h->Integral(200, 600);
1859  if (integ > 0) {
1860  refbld.push_back(h);
1861  }
1862 
1863  }
1864 
1865  int entr = refbld.size();
1866  const double inv_entr = (entr > 0 ? 1. / static_cast<double>(entr) : 1);
1867  for (int i = 0; i < entr; i++) {
1868  TH1S *h = refbld.at(i);
1869  ref->Add(h, inv_entr);
1870  }
1871 
1872  // refbld.push_back(ref);
1873  TH1S *obj = 0;
1874 
1875  for (int i = 0; i < entr; i++) {
1876  obj = (TH1S*) refbld.at(i);
1877  float kol = obj->KolmogorovTest(ref);
1878  //std::cout<<"The value of the Kolmogorov test for "<< ros << drawer << gain << " pmt:" << i << " is "<< kol << std::endl;
1879  if (kol > 0.5) {
1880  newrefbld.push_back(obj);
1881  }
1882  }
1883 
1884  int ent = newrefbld.size();
1885  const double inv_ent = (ent > 0 ? 1. / static_cast<double>(ent) : 1);
1886  for (int i = 0; i < ent; i++) {
1887  obj = (TH1S*) newrefbld.at(i);
1888  ref1->Add(obj, inv_ent);
1889  }
1890 
1891  // newrefbld->Add(ref1);
1892 
1893  if (ent > 6)
1894  m_data->m_shifted_hist[ros][drawer][48][gain]->Add(ref1, 1.);
1895  else
1896  m_data->m_shifted_hist[ros][drawer][48][gain]->Add(ref, 1.);
1897 
1898  delete ref;
1899  delete ref1;
1900 
1901 }
1902 
1903 
1905 
1906  tree->Branch("StuckBitsProb", m_data->m_stuck_probs, "StuckBitsProb[5][64][48][2][10]/b");
1907 }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileRawChannelContainer
Definition: TileRawChannelContainer.h:13
TileDigitsMonTool::m_f_ADCmax
float m_f_ADCmax
Definition: TileDigitsMonTool.h:173
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TileDigitsMonTool::~TileDigitsMonTool
virtual ~TileDigitsMonTool()
Definition: TileDigitsMonTool.cxx:86
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
TileDigitsMonTool::m_fillPedestalDifference
bool m_fillPedestalDifference
Definition: TileDigitsMonTool.h:166
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
ManagedMonitorToolBase::m_path
std::string m_path
Definition: ManagedMonitorToolBase.h:915
TileDigitsMonTool::bookHists
virtual StatusCode bookHists() override
Calls bookHists( true, true, true ) and initializes lumiBlock and run numbers.
Definition: TileDigitsMonTool.cxx:134
checkFileSG.line
line
Definition: checkFileSG.py:75
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
TileDigitsMonTool::m_zeroLimitHG
int m_zeroLimitHG
Definition: TileDigitsMonTool.h:179
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
max
#define max(a, b)
Definition: cfImp.cxx:41
TileDigitsMonTool::m_allHistsFilled
bool m_allHistsFilled
Definition: TileDigitsMonTool.h:161
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
TilePaterMonTool::initialize
virtual StatusCode initialize() override
Definition: TilePaterMonTool.cxx:106
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.ExitCodes.ALL_OK
int ALL_OK
successful run
Definition: ExitCodes.py:10
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TileDigitsMonTool::statTestHistos
void statTestHistos(int ros, int drawer, int gain)
Definition: TileDigitsMonTool.cxx:1844
TileDigitsMonTool::finalHists
virtual StatusCode finalHists() override
Calls procHists( true, true, true ).
Definition: TileDigitsMonTool.cxx:591
TileDigitsMonTool::m_tileInfo
const TileInfo * m_tileInfo
Definition: TileDigitsMonTool.h:171
TileDigitsMonTool::m_contNameDSP
std::string m_contNameDSP
Definition: TileDigitsMonTool.h:107
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
m_data
std::vector< T > m_data
Definition: TrackTruthMatchingBaseAlg.cxx:660
TilePaterMonTool::m_savePng
bool m_savePng
Definition: TilePaterMonTool.h:228
TileDigitsMonTool::initialize
virtual StatusCode initialize() override
Definition: TileDigitsMonTool.cxx:92
plotmaker.hist
hist
Definition: plotmaker.py:148
TilePaterMonTool::m_savePs
bool m_savePs
Definition: TilePaterMonTool.h:229
TileDQstatus::calibMode
uint32_t calibMode() const
Calibration mode.
Definition: TileDQstatus.h:148
tree
TChain * tree
Definition: tile_monitor.h:30
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
TileDigitsMonTool::m_NCont
static const int m_NCont
Definition: TileDigitsMonTool.h:76
TileDigitsMonTool::m_cispar
const uint32_t * m_cispar
Definition: TileDigitsMonTool.h:122
bin
Definition: BinsDiffFromStripMedian.h:43
TileDigitsMonTool::m_shiftnbins
int m_shiftnbins
Definition: TileDigitsMonTool.h:177
TileDigitsMonTool::stuckBits
int stuckBits(TH1S *hist, int adc)
Method to find stuckbits in Read-Out ADC channel.
Definition: TileDigitsMonTool.cxx:1260
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
TileHWID::frag
int frag(const HWIdentifier &id) const
extract frag field from HW identifier
Definition: TileHWID.h:181
TileInfo.h
TileDigitsMonTool::m_saturationLimitHG
int m_saturationLimitHG
Definition: TileDigitsMonTool.h:180
TileDigitsMonTool::m_runType
int m_runType
Definition: TileDigitsMonTool.h:106
TileCalibUtils.h
TilePaterMonTool
Base class for tilecal calibration monitoring tools.
Definition: TilePaterMonTool.h:53
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TileDigitsMonTool::CRCcheck
void CRCcheck(const TileDQstatus *dqStatus, uint32_t crc32, uint32_t crcMask, int headsize, int ros, int drawer)
Method to check global CRC and DMU CRC.
Definition: TileDigitsMonTool.cxx:1609
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
TileDigitsContainer
Definition: TileDigitsContainer.h:13
HWIdentifier
Definition: HWIdentifier.h:13
covarianceTool.prob
prob
Definition: covarianceTool.py:678
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
TileDigitsMonTool::DMUheaderFormatCheck
bool DMUheaderFormatCheck(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: TileDigitsMonTool.h:85
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
TileHWID::channel
int channel(const HWIdentifier &id) const
extract channel field from HW identifier
Definition: TileHWID.h:189
TileDigitsMonTool::stuckBits_Amp2
int stuckBits_Amp2(TH1S *hist, TH1C *modhist, int adc, TH2C *outhist=NULL, int ch=0, uint8_t *stuck_probs=NULL)
Definition: TileDigitsMonTool.cxx:1423
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
TileCalibUtils::MAX_DRAWER
static const unsigned int MAX_DRAWER
Number of drawers in ROS 1-4.
Definition: TileCalibUtils.h:139
TileHWID::ros
int ros(const HWIdentifier &id) const
extract ros field from HW identifier
Definition: TileHWID.h:167
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
TileDigitsMonTool::DMUheaderCheck
bool DMUheaderCheck(std::vector< uint32_t > *headerVec, int ros, int drawer, int gain, int dmu)
DMU header format as defined in http://www.sysf.physto.se/~klere/tile-dmu/header.html Bits: 1pllllesd...
Definition: TileDigitsMonTool.cxx:1738
TileRawChannelContainer.h
TileDigitsMonTool::m_tileToolNoiseSample
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
tool which provided noise values
Definition: TileDigitsMonTool.h:120
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
python.PyAthena.module
module
Definition: PyAthena.py:134
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
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
TileHWID::adc
int adc(const HWIdentifier &id) const
extract adc field from HW identifier
Definition: TileHWID.h:193
TileDigitsMonTool::saveStuckBitsProbabilities
virtual void saveStuckBitsProbabilities(TTree *tree) override
Definition: TileDigitsMonTool.cxx:1904
TH1C
Definition: rootspy.cxx:352
TileCondToolNoiseSample.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TileDigitsMonTool::m_nEventsTileMon
int m_nEventsTileMon
Definition: TileDigitsMonTool.h:125
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
PURW_create_actual_mu_profile.outhist
outhist
Definition: PURW_create_actual_mu_profile.py:58
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
perfmonmt-plotter.colors
dictionary colors
Definition: perfmonmt-plotter.py:21
lumiFormat.i
int i
Definition: lumiFormat.py:92
xmin
double xmin
Definition: listroot.cxx:60
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
TileDigitsMonTool::fillHists
virtual StatusCode fillHists() override
Calls fillHists( bool, bool, bool ); if an eventBlock,lumiBlock, or run has turned over,...
Definition: TileDigitsMonTool.cxx:345
python.LArBadChannelDBAlg.xFFFFFFFF
xFFFFFFFF
Definition: LArBadChannelDBAlg.py:73
TileDigitsContainer.h
TileDigitsMonTool::stuckBitProb
virtual const uint8_t * stuckBitProb(int ros, int module, int channel, int gain) const override
Definition: TileDigitsMonTool.cxx:927
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
extractSporadic.h
list h
Definition: extractSporadic.py:97
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
checkxAOD.frac
frac
Definition: Tools/PyUtils/bin/checkxAOD.py:256
TileDigitsMonTool::m_bigain
bool m_bigain
Definition: TileDigitsMonTool.h:124
master.flag
bool flag
Definition: master.py:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TilePaterMonTool::book2C
TH2C * book2C(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:290
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
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
TileCalibUtils::MAX_ROS
static const unsigned int MAX_ROS
Number of ROSs
Definition: TileCalibUtils.h:138
TileDigitsMonTool::TileDigitsMonTool
TileDigitsMonTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TileDigitsMonTool.cxx:51
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileDigitsMonTool::stuckBits_Amp
int stuckBits_Amp(TH1S *hist, int adc)
A crude method to check Read-Out ADC channel stuckbits.
Definition: TileDigitsMonTool.cxx:1369
bin2
Definition: KillBinsByStrip.h:34
TilePaterMonTool::book1I
TH1I * book1I(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:219
TileDigitsMonTool::shiftHisto
void shiftHisto(TH1S *hist, int ros, int drawer, int ch, int gain)
Definition: TileDigitsMonTool.cxx:1822
TileDigitsMonTool::m_digitsContainerName
std::string m_digitsContainerName
Definition: TileDigitsMonTool.h:167
min
#define min(a, b)
Definition: cfImp.cxx:40
TileDigitsMonTool::m_ADCmaxMinusEps
float m_ADCmaxMinusEps
Definition: TileDigitsMonTool.h:174
TileDigitsMonTool::m_DQstatusKey
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
Definition: TileDigitsMonTool.h:182
TileDigitsCollection
Definition: TileDigitsCollection.h:18
TileDigitsMonTool::checkHists
virtual StatusCode checkHists(bool fromFinalize) override
This implementation does nothing; equivalent functionality may be provided by procHists(....
Definition: TileDigitsMonTool.cxx:935
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
TileDigitsMonTool::m_i_ADCmax
int m_i_ADCmax
Definition: TileDigitsMonTool.h:172
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TileDigits
Definition: TileDigits.h:30
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TileDigitsMonTool::define_palette
int define_palette(int ncolors, int *colors=NULL)
Definition: TileDigitsMonTool.cxx:945
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
TileDigitsMonTool::m_book2D
bool m_book2D
Definition: TileDigitsMonTool.h:105
TileRawChannelCollection
Definition: TileRawChannelCollection.h:12
charge
double charge(const T &p)
Definition: AtlasPID.h:494
TilePaterMonTool::bookProfile
TProfile * bookProfile(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:301
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
TilePaterMonTool::m_fragIDsToIgnoreDMUerrors
std::vector< int > m_fragIDsToIgnoreDMUerrors
Definition: TilePaterMonTool.h:232
green
@ green
Definition: BinsDiffFromStripMedian.h:18
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:175
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
TileDigitsMonTool::m_is12bit
bool m_is12bit
Definition: TileDigitsMonTool.h:176
TH1C::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:357
Example_ReadSampleNoise.ped
ped
Definition: Example_ReadSampleNoise.py:45
TileDigitsMonTool.h
TilePaterMonTool::isDisconnected
bool isDisconnected(int ros, int drawer, int ch)
Definition: TilePaterMonTool.h:281
TrackingGeometryValidation.stops
stops
Definition: TrackingGeometryValidation.py:30
dqt_zlumi_pandas.bin4
bin4
Definition: dqt_zlumi_pandas.py:345
TileCalibUtils::getDrawerString
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
Definition: TileCalibUtils.cxx:145
TileDigitsMonTool::DMUheaderParityCheck
bool DMUheaderParityCheck(uint32_t header)
Function to check that the DMU header parity is correct Parity of the DMU header should be odd Return...
Definition: TileDigitsMonTool.h:95
TileDigitsMonTool::CisRamp
@ CisRamp
Definition: TileDigitsMonTool.h:117
dqt_zlumi_pandas.bin1
bin1
Definition: dqt_zlumi_pandas.py:329
h
TileHWID::drawer
int drawer(const HWIdentifier &id) const
extract drawer field from HW identifier
Definition: TileHWID.h:171
TH1F
Definition: rootspy.cxx:320
TileDigitsMonTool::m_data
std::unique_ptr< Data > m_data
Definition: TileDigitsMonTool.h:160
TH2C
Definition: rootspy.cxx:390
TH1S
Definition: rootspy.cxx:362
ReadFloatFromCool.adc
adc
Definition: ReadFloatFromCool.py:48
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ref
const boost::regex ref(r_ef)
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
generate::GetEntries
double GetEntries(TH1D *h, int ilow, int ihi)
Definition: rmsFrac.cxx:20
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
TilePaterMonTool::book1D
TH1D * book1D(const std::string &nam, const std::string &tit, int nx, double xmin, double xmax)
Implicit version of book1D.
Definition: TilePaterMonTool.h:69
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
xmax
double xmax
Definition: listroot.cxx:61
bin3
Definition: BinsOutOfRange.h:33
entries
double entries
Definition: listroot.cxx:49
TileDigitsMonTool::m_infoName
std::string m_infoName
Definition: TileDigitsMonTool.h:170
LArG4GenerateShowerLib.nevents
nevents
Definition: LArG4GenerateShowerLib.py:19
merge.status
status
Definition: merge.py:17
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
TileAANtupleConfig.rawChannelContainer
rawChannelContainer
Definition: TileAANtupleConfig.py:120
TileDigitsMonTool::drawHists
void drawHists(int ros, int drawer, const std::string &moduleName)
Definition: TileDigitsMonTool.cxx:975
ReadHandle.h
Handle class for reading from StoreGate.
TileDigitsMonTool::PedRun
@ PedRun
Definition: TileDigitsMonTool.h:114
TilePaterMonTool::book1C
TH1C * book1C(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:186
TileCalibUtils::MAX_CHAN
static const unsigned int MAX_CHAN
Number of channels in drawer.
Definition: TileCalibUtils.h:141
TilePaterMonTool::m_tileHWID
const TileHWID * m_tileHWID
Definition: TilePaterMonTool.h:224
python.PyAthena.obj
obj
Definition: PyAthena.py:135
python.compressB64.c
def c
Definition: compressB64.py:93
red
@ red
Definition: BinsDiffFromStripMedian.h:18
TileDigitsMonTool::RODCRCcalc
StatusCode RODCRCcalc(const TileDQstatus *dqStatus)
Definition: TileDigitsMonTool.cxx:1779
TileInfo::ADCmax
int ADCmax() const
Returns the maximum ADC output (10 bits --> 1023)
Definition: TileInfo.h:71
TrackingGeometryValidation.blue
blue
Definition: TrackingGeometryValidation.py:33
TileDigitsMonTool::CisRun
@ CisRun
Definition: TileDigitsMonTool.h:115
checkFileSG.ind
list ind
Definition: checkFileSG.py:118
TileRawChannelUnit::ADCcounts
@ ADCcounts
Definition: TileRawChannelUnit.h:17
python.handimod.cc
int cc
Definition: handimod.py:523
TileDigitsMonTool::m_bookAll
bool m_bookAll
Definition: TileDigitsMonTool.h:104
TileDigitsMonTool::m_nSamples
int m_nSamples
Definition: TileDigitsMonTool.h:126