29 #include "TVirtualPad.h"
33 #include "TPaveLabel.h"
34 #include "TObjArray.h"
35 #include "TSpectrum.h"
39 #include "TPaletteAxis.h"
53 , m_tileToolNoiseSample(
"TileCondToolNoiseSample")
56 , m_allHistsFilled(false)
64 declareInterface<IMonitorToolBase>(
this);
65 declareInterface<ITileStuckBitsProbsTool>(
this);
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));
151 m_data->m_outInHighGain.push_back(
book1D(
"Summary",
"OverFlowInHighGain",
"Injected charge with overflow in high gain", 10010, -0.5, 1000.5));
155 return StatusCode::SUCCESS;
162 const char *
part[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
163 const char *
gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
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;
190 for (
int gn = mingain;
gn < maxgain; ++
gn) {
195 sStr << moduleName <<
"_DMU_head_" <<
gain[
gn] <<
"_err";
199 sStr << moduleName <<
" DMU Header " <<
gain[3 +
gn] <<
" errors";
200 histTitle = sStr.str();
205 for (
int ch = 0;
ch < 48; ++
ch) {
210 sStr << std::setfill(
'0') << std::setw(2) <<
ch << std::setfill(
' ');
211 std::string sCh = sStr.str();
213 for (
int gn = mingain;
gn < maxgain; ++
gn) {
219 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_sample0";
223 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" sample[0]";
224 histTitle = sStr.str();
230 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_meanRMS";
234 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" mean RMS in event";
235 histTitle = sStr.str();
241 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_samples";
245 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" all samples";
246 histTitle = sStr.str();
252 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_evtn_mod32";
256 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" event number % 32";
257 histTitle = sStr.str();
263 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_prof";
267 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" average profile";
268 histTitle = sStr.str();
274 double shiftxmin = 0.;
279 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_samples_shifted";
283 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" all samples shifted";
284 histTitle = sStr.str();
291 sStr << std::setfill(
'0') << std::setw(2) <<
ch << std::setfill(
' ');
292 std::string sDmu = sStr.str();
295 sStr << moduleName <<
"_dmu_" << sDmu <<
gain[
gn] <<
"_BCID";
299 sStr << moduleName <<
" DMU0 " <<
ch <<
gain[3 +
gn] <<
" BCID";
300 histTitle = sStr.str();
305 sStr << moduleName <<
"_dmu_" << sDmu <<
gain[
gn] <<
"_BCID_err";
309 sStr << moduleName <<
" DMU0 " <<
ch <<
gain[3 +
gn] <<
" BCID errors";
310 histTitle = sStr.str();
317 sStr << moduleName <<
"_dmu_" << sDmu <<
"_CRC_err";
321 sStr << moduleName <<
" DMU0 " <<
ch <<
" CRC errors";
322 histTitle = sStr.str();
333 sStr << moduleName <<
"_CRC_global";
337 sStr << moduleName <<
" global CRC errors";
338 histTitle = sStr.str();
367 if (digitsCollection->empty())
continue;
369 HWIdentifier adc_id = digitsCollection->front()->adc_HWID();
375 m_nSamples = digitsCollection->front()->NtimeSamples();
382 if (
status & (TileFragStatus::ALL_FF | TileFragStatus::ALL_00)) {
384 }
else if (
status & (TileFragStatus::NO_FRAG | TileFragStatus::NO_ROB)) {
387 for (
int dmu = 0; dmu < 16; dmu++) {
396 std::vector<uint32_t> headerVec = digitsCollection->getFragChipHeaderWords();
398 int headsize = headerVec.size();
400 ATH_MSG_ERROR(
"length of BCID vector " << headsize <<
" - greater than 16 !");
404 for (
int dmu = 0; dmu < headsize; dmu++) {
409 for (
int dmu = headsize; dmu < 16; dmu++) {
417 if (digitsCollection->empty())
continue;
419 HWIdentifier adc_id = digitsCollection->front()->adc_HWID();
427 m_nSamples = digitsCollection->front()->NtimeSamples();
431 std::vector<uint32_t> headerVec = digitsCollection->getFragChipHeaderWords();
433 int headsize = headerVec.size();
439 double mean_tmp[48][2][16];
440 memset(mean_tmp, 0,
sizeof(mean_tmp));
452 for (
const TileDigits* tileDigits : *digitsCollection) {
454 adc_id = tileDigits->adc_HWID();
460 std::vector<float> vdigits = tileDigits->samples();
462 double meansamp = 0.0;
463 double rmssamp = 0.0;
464 unsigned int dsize = vdigits.size();
466 ATH_MSG_ERROR(
"length of digits vector " << dsize <<
" - greater than 16 !");
470 for (
unsigned int i = 0;
i < dsize; ++
i) {
471 double dig = vdigits[
i];
473 rmssamp += dig * dig;
491 double ped = vdigits[0];
501 rmssamp = rmssamp / dsize - meansamp * meansamp;
502 rmssamp = (rmssamp > 0.0) ? sqrt(rmssamp * dsize / (dsize - 1)) : 0.0;
513 for (
int ch_i = 0; ch_i < 48; ++ch_i)
517 for (
int ch_j = 0; ch_j < 48; ++ch_j)
529 for (
int ch = 0;
ch < headsize; ++
ch) {
532 if ((bcid_ch ==
bcid) || (bcid_ch ==
bcid - 1))
534 else if ((
bcid == 0) && ((bcid_ch == 3563) || (bcid_ch == 3564)))
546 if ((
m_bigain) && ((digitsCollection->getFragChipHeaderWordsHigh()).
size() > 0)) {
548 headerVec = digitsCollection->getFragChipHeaderWordsHigh();
549 headsize = headerVec.size();
551 ATH_MSG_ERROR(
"length of BCIDhigh vector " << headsize <<
" - greater than 16 !");
556 for (
int ch = 0;
ch < headsize; ++
ch) {
559 if ((bcid_ch ==
bcid) || (bcid_ch ==
bcid - 1))
561 else if ((
bcid == 0) && ((bcid_ch == 3563) || (bcid_ch == 3564)))
575 uint32_t crc32 = digitsCollection->getFragCRC();
576 uint32_t CRCmask = digitsCollection->getFragDMUMask();
587 return StatusCode::SUCCESS;
599 const EventContext &ctx = Gaudi::Hive::currentContext();
601 const char *
part[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
602 const char *
gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
604 std::string pedestalTitile(
" Pedestal[0]");
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" };
610 const char *ErrName[4] = {
"_bcid",
"_crc",
" BCID errors",
" CRC errors" };
611 const char *HistName2[4] = {
"_covar",
"_corr",
" covariance",
" correlation" };
623 std::ostringstream sStr;
625 std::string subDir =
"Summary";
628 for (
int gn = mingain;
gn < maxgain; ++
gn) {
634 sStr << moduleName <<
gain[
gn] << HistName[
type];
637 sStr << moduleName <<
gain[3 +
gn] << HistName[4 +
type];
638 histTitle = sStr.str();
644 sStr << moduleName <<
gain[
gn] <<
"_stucks";
647 sStr << moduleName <<
gain[3 +
gn] <<
" Stuck bits and saturation";
648 histTitle = sStr.str();
655 m_data->m_final_hist_stucks[
ros][
drawer][
adc]->GetYaxis()->SetBinLabel(6,
"saturation");
662 double Ped = 0.0, PedRMS = 0.0, RMSHi = 0.0;
665 bool fillPedAndRms = (
nevents > 0);
681 <<
" doesnt match n. of events! Using the first one in mean and RMS calculation" );
697 PedRMS = (PedRMS > 0.0) ? sqrt(PedRMS *
nevents / (
nevents - 1)) : 0.0;
736 if (
hist->GetBinContent(1) > 0) {
755 sStr << moduleName <<
gain[
gn] << ErrName[0];
758 sStr << moduleName <<
gain[3 +
gn] << ErrName[2];
759 histTitle = sStr.str();
765 sStr << moduleName << ErrName[1];
768 sStr << moduleName << ErrName[3];
769 histTitle = sStr.str();
773 for (
int ch = 0;
ch < 16; ++
ch) {
778 for (
int id = 0;
id < 2; ++
id) {
787 if (bin0 +
bin3 +
bin4 + bin5 > 0) {
788 if ((
bin4 == 0) && (bin5 == 0)) {
790 }
else if ((
bin3 == 0) && (bin5 == 0)) {
799 }
else if (
bin1 == 0) {
817 sStr << moduleName <<
gain[
gn] << HistName2[
type];
820 sStr << moduleName <<
gain[3 +
gn] << HistName2[2 +
type];
821 histTitle = sStr.str();
827 for (
int ch_i = 0; ch_i < 48; ++ch_i) {
830 for (
int ch_j = 0; ch_j < 48; ++ch_j)
835 double covar[48][48];
838 double mean_cov_ii = 0.;
839 double mean_cov_ij = 0.;
841 for (
int ch_i = 0; ch_i < 48; ++ch_i) {
843 for (
int ch_j = 0; ch_j < 48; ++ch_j) {
848 mean_cov_ij += covar[ch_i][ch_j];
852 mean_cov_ii += covar[ch_i][ch_i];
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]));
860 if (mean_cov_ii != 0.) {
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.)) {
872 corr[
i][j] = covar[
i][j] / mean_rms[
i] / mean_rms[j];
888 for (
int gn = mingain;
gn < maxgain; ++
gn) {
889 for (
int i = 0;
i < 48; ++
i) {
895 double shiftxmin = 0.;
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;
905 s << moduleName <<
gain[
gn] <<
"_samples_ref";
909 s << moduleName <<
gain[3 +
gn] <<
" all samples reference";
910 std::string histTitle =
s.str();
923 return StatusCode::SUCCESS;
941 return StatusCode::SUCCESS;
950 if (ncolors == 51 &&
colors == 0) {
951 TColor::InitializeColors();
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 };
961 else if (ncolors == 52 &&
colors == 0) {
962 TColor::InitializeColors();
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 };
984 static bool palette_init_done =
false;
987 static TExec *ex_pal51;
988 static TExec *ex_pal52;
991 if (palette_init_done ==
false) {
992 palette_init_done =
true;
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());
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 };
1015 miny[0] = miny[1] = -5.0;
1016 maxy[0] = maxy[1] = 5.0;
1019 TText *
t =
new TText();
1020 t->SetTextAlign(32);
1021 t->SetTextSize(0.06);
1034 maxline[
type]->SetLineColor(2 +
type / 2);
1037 TCanvas * Can = NULL;
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);
1049 TVirtualPad * pad = Can->cd(
type * maxgain +
gain + 1);
1050 pad->SetTopMargin(0.15);
1066 if (
type > 0) maxline[
gain]->Draw();
1072 Can->Print(TString(moduleName +
"_dig_noise.png"),
"png");
1075 Can->Print(TString(moduleName +
"_dig_noise.ps"),
"ps");
1078 Can->Print(TString(moduleName +
"_dig_noise.svg"),
"svg");
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);
1092 TVirtualPad * pad = NULL;
1094 pad = Can->cd((
type - 3) * maxgain +
gain + 1);
1095 pad->SetTopMargin(0.15);
1100 if (do_plots) pad->SetLogy();
1103 gStyle->SetStatFontSize(0.1);
1110 if (do_plots) pad->SetGridx();
1130 gStyle->SetNumberContours(
m_NCont);
1136 TPaletteAxis *palette = (TPaletteAxis*)
m_data->m_final_hist_stucks[
ros][
drawer][
gain]->GetListOfFunctions()->FindObject(
"palette");
1137 if (palette != NULL) palette->SetLabelSize(0.07);
1144 t->DrawText(-0.2, 1.,
"all OK");
1145 t->DrawText(-0.2, .0,
"wrong");
1147 t->DrawText(-0.2, 2.,
"mismatch");
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");
1158 if (
type != 3)
if (do_plots) maxline[3]->Draw();
1162 TVirtualPad * pad = NULL;
1164 pad = Can->cd(6 +
gain + 1);
1165 pad->SetTopMargin(0.15);
1184 gStyle->SetNumberContours(
m_NCont);
1189 TPaletteAxis *palette = (TPaletteAxis*)
m_data->m_hist2[
ros][
drawer][
gain][0]->GetListOfFunctions()->FindObject(
"palette");
1190 if (palette != NULL) palette->SetLabelSize(0.07);
1197 Can->Print(TString(moduleName +
"_dig_errors.png"),
"png");
1200 Can->Print(TString(moduleName +
"_dig_errors.ps"),
"ps");
1203 Can->Print(TString(moduleName +
"_dig_errors.svg"),
"svg");
1205 if (do_plots)
delete Can;
1208 delete maxline[
type];
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);
1223 TPaveLabel covar_label[2];
1224 covar_label[0] = TPaveLabel(37., 49., 54., 56.,
"");
1225 covar_label[1] = TPaveLabel(37., 49., 54., 56.,
"");
1230 TVirtualPad * pad = Can->cd(
type * maxgain +
gain + 1);
1231 pad->SetTopMargin(0.15);
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();
1249 Can->Print(TString(moduleName +
"_correlation.png"),
"png");
1252 Can->Print(TString(moduleName +
"_correlation.ps"),
"ps");
1254 if (do_plots)
delete Can;
1257 gStyle->SetOptStat(1111);
1271 if (
hist->GetBinContent(MinBin) > 0) {
1278 for (; MaxBin > 0; --MaxBin) {
1279 if (
hist->GetBinContent(MaxBin) > 0) {
1297 for (
int hyp_pos = 0; hyp_pos < 2; ++hyp_pos) {
1298 for (
int hyp_bit = 0; hyp_bit < 10; ++hyp_bit) {
1300 int bin_counter = 0;
1302 int win_length = (1 << hyp_bit);
1303 int BeginBin = (1 - hyp_pos) * win_length;
1305 while (BeginBin + 1 < MaxBin) {
1306 int EndBin = BeginBin + win_length;
1308 if (EndBin > MinBin) {
1309 for (
int bin = BeginBin;
bin < EndBin; ++
bin) {
1311 if (MinBin < (
bin + 1) && (
bin + 1) < MaxBin) {
1317 BeginBin = EndBin + win_length;
1319 if (
sum == 0 && bin_counter > 0) {
1370 int i,
b,
c,
cc = 2;
1376 for (
b = 0;
b < 10;
b++) {
1381 cp =
hist->GetBinContent(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)));
1393 for (
b = 0;
b < 10;
b++) {
1394 if ((
i & bv[
b]) != ((
i - 1) & bv[
b]))
1399 if (
f > 0 &&
c > 0)
continue;
1400 if (
f == 0 &&
c == 0)
continue;
1402 for (
b = 0;
b < 10;
b++) {
1403 if ((
i & bv[
b]) != ((
i - 1) & bv[
b]))
1412 for (
b = 0;
b < 10;
b++)
1414 if (((bc[
b] > 2) && (std::abs(bs[
b]) == bc[
b])) || ((std::abs(bs[
b]) > 7) && (std::abs(bs[
b]) * 3 > bc[
b]))) {
1425 if (
hist->GetEntries() < 1000)
return 0;
1427 int i,
b,
c,
cc = 0;
1429 int last_non0, first_non0 = -1;
1430 int bc[10] = { 0 }, bv[10] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
1431 double bs[10] = { 0. };
1432 int bac[10] = { 0 }, ba0[10] = { 0 }, ba1[10] = { 0 }, bas[10] = { 0 };
1436 int zero_limit, saturation_limit;
1439 cp =
hist->GetBinContent(1);
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;
1446 for (
i = 1;
i <= last_non0;
i++) {
1450 if (first_non0 < 0) {
1456 for (
b = 0;
b < 10;
b++) {
1457 if ((
i & bv[
b]) != ((
i - 1) & bv[
b])) {
1460 if ((
i - 1) & bv[
b])
1467 if (
cc > 0) bas[
b]++;
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));
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)));
1480 for (
b = 0;
b < 10;
b++) {
1481 if ((
i & bv[
b]) != ((
i - 1) & bv[
b]))
1486 if (
f > 0 &&
c > 0)
continue;
1487 if (
f == 0 &&
c == 0)
continue;
1489 for (
b = 0;
b < 10;
b++) {
1490 if ((
i & bv[
b]) != ((
i - 1) & bv[
b]))
1498 for (
b = 0;
b < 10;
b++)
1499 if ((
i & bv[
b]) != ((
i - 1) & bv[
b])) {
1502 if ((
i - 1) & bv[
b])
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};
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)) {
1516 sb_prob[sb_map[
b]] = 1.;
1518 if (stuck_probs != NULL)
1519 stuck_probs[
b] = ba0[
b] == 0 ? 100
u : 200
u;
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) {
1527 sb_prob[sb_map[
b]] = 1. - (1. - sb_prob[sb_map[
b]]) * (1. - 1. * bs1 / bc[
b]);
1529 if (stuck_probs != NULL)
1531 stuck_probs[
b] = (
uint8_t) (100. * bs1 / bc[
b]);
1534 stuck_probs[
b] += 100
u;
1535 if (stuck_probs[
b] == 100
u)
1536 stuck_probs[
b] = 0
u;
1541 || (last_non0 == (
m_i_ADCmax + 1) / 2 - 1 &&
hist->GetBinContent(last_non0) > 3)) {
1545 if (stuck_probs != NULL)
1546 stuck_probs[9] = first_non0 >= 512 ? 200
u : 100
u;
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]);
1554 if (first_non0 >= saturation_limit)
1556 else if (last_non0 >= saturation_limit) {
1558 int saturation_entries = 0;
1560 for (
i = saturation_limit + 1;
i <= maxADC; ++
i)
1561 saturation_entries +=
hist->GetBinContent(
i);
1567 if (last_non0 <= zero_limit)
1569 else if (first_non0 <= zero_limit) {
1571 int zero_entries = 0;
1572 for (
i = 1;
i <= zero_limit + 1; ++
i)
1573 zero_entries +=
hist->GetBinContent(
i);
1579 double entries, empty_cut, full_cut;
1582 bool enough =
false;
1586 if (full_cut > 126.)
1588 if (full_cut - empty_cut < 1.)
1589 full_cut = empty_cut + 1.;
1591 for (
i = 1;
i <= 32; ++
i) {
1592 if (modhist->GetBinContent(
i) <= empty_cut)
1594 else if (modhist->GetBinContent(
i) > full_cut)
1596 if (modhist->GetBinContent(
i) > 64)
1599 if (mod32empty + mod32full == 32 || enough)
1600 if (mod32empty != 0 && mod32full != 0)
1601 outhist->Fill((
double)
ch, 6., mod32empty);
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 };
1639 else if (crc0 == crc1)
1647 if (headsize < 16) {
1651 for (
int ch = 0;
ch < headsize; ++
ch) {
1654 else if (crc0 == crc1)
1667 for (
int ch = 0;
ch < headsize; ++
ch) {
1671 for (
int ch = 0;
ch < headsize; ++
ch) {
1675 uint32_t fe_crc = crcMask & 0xFFFF;
1677 for (
int ch = 0;
ch < headsize; ++
ch) {
1679 if (
ros == 1 ||
ros == 2)
1681 if ((fe_crc >>
ch & 0
x1) == 0x0)
flag++;
1682 }
else if (
ros == 3 ||
ros == 4)
1686 if ((fe_crc >> chFE_sp[
ch] & 0
x1) == 0x0)
flag++;
1688 if ((fe_crc >> chFE_ext[
ch] & 0
x1) == 0x0)
flag++;
1691 if ((rod_crc >>
ch & 0
x1) == 0x0)
flag += 2;
1753 if (((*headerVec)[dmu] >> 25) & 0
x1) {
1758 if (((*headerVec)[dmu] >> 24) & 0
x1) {
1763 if (((*headerVec)[dmu] >> 23) & 0
x1) {
1796 if (rawChannelCollection->empty())
continue;
1798 HWIdentifier hwid = rawChannelCollection->front()->adc_HWID();
1802 uint32_t crc32 = rawChannelCollection->getFragGlobalCRC() & 1;
1810 uint32_t CRCmask = rawChannelCollection->getFragRODChipMask();
1811 CRCmask = CRCmask << 16;
1812 CRCmask += rawChannelCollection->getFragFEChipMask();
1818 return StatusCode::SUCCESS;
1826 hist->GetXaxis()->SetRange(5, 100);
1830 s.Search(
hist, 2,
"goff");
1831 int shift =
int(
s.GetPositionX()[0]);
1834 int xmax =
std::max(1025 * factor, 846 * factor + shift);
1837 double c =
hist->GetBinContent(
bin);
1848 std::vector<TH1S*> refbld;
1849 std::vector<TH1S*> newrefbld;
1851 ref->SetDirectory(0);
1853 ref1->SetDirectory(0);
1855 for (
int i = 0;
i < 48;
i++) {
1858 float integ =
h->Integral(200, 600);
1860 refbld.push_back(
h);
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);
1875 for (
int i = 0;
i < entr;
i++) {
1876 obj = (TH1S*) refbld.at(
i);
1877 float kol =
obj->KolmogorovTest(
ref);
1880 newrefbld.push_back(
obj);
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);
1906 tree->Branch(
"StuckBitsProb",
m_data->m_stuck_probs,
"StuckBitsProb[5][64][48][2][10]/b");