28 #include "TGraphAsymmErrors.h"
29 #include "TVirtualPad.h"
46 , m_tileToolEmscale(
"TileCondToolEmscale")
55 declareInterface<IMonitorToolBase>(
this);
75 m_path =
"/Tile/RawChannel";
100 m_data = std::make_unique<Data>();
106 memset(
m_data->m_timeCov, 0,
sizeof(
m_data->m_timeCov));
107 memset(
m_data->m_timeCovCorr, 0,
sizeof(
m_data->m_timeCovCorr));
120 return StatusCode::SUCCESS;
174 return StatusCode::SUCCESS;
182 const std::array<std::string, 6>
gain{
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
184 std::ostringstream sStr;
186 std::string subDir = moduleName;
196 for (
int ch = 0;
ch < 48; ++
ch) {
201 sStr << std::setfill(
'0') << std::setw(2) <<
ch << std::setfill(
' ');
203 std::string sCh = sStr.str();
205 for (
int gn = mingain;
gn < maxgain; ++
gn) {
209 std::string HistName[4] = {
"_amp_ratio_100",
"_amp_ratio_5",
"_time_100",
"_time_5" };
210 std::string HistTitle[4] = {
" amp to charge ratio for 100 pF",
" amp to charge ratio for 5 pF",
" time for 100 pF",
" time for 5 pF" };
214 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] << HistName[
type];
218 if (
gn+3 >= std::ssize(
gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookHists");
219 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] << HistTitle[
type];
220 histTitle = sStr.str();
229 std::string Hist2DName[4] = {
"_amp_vs_q_100",
"_amp_vs_q_5",
"_time_vs_time_100",
"_time_vs_time_5" };
230 std::string Hist2DTitle[4] = {
" amp vs charge 100 pF",
" amp vs charge 5 pF",
" time vs time 100 pF",
" time vs time 5 pF" };
231 float factor_charge =
m_is12bit ? 2. : 1.;
234 float LowX_low2D[4] = { -4., -0.5, -0.25, -0.25 };
235 float HighX_low2D[4] = { 804., 50.5, 25.25, 25.25 };
236 float LowX_hi2D[4] = {
static_cast<float>(-0.0625 * factor_charge),
static_cast<float>(-0.0625 * factor_charge), -0.25, -0.25 };
237 float HighX_hi2D[4] = {
static_cast<float>(12.5625 * factor_charge),
static_cast<float>(12.5625 * factor_charge), 25.25, 25.25 };
238 float LowY_low2D[4] = { -25., -5.3125, -64.0, -64.0 };
239 float HighY_low2D[4] = { 1025., 60.3125, 32.0, 32.0 };
240 float LowY_hi2D[4] = {
static_cast<float>(-25. * factor_adc),
static_cast<float>(-25. * factor_adc), -64.0, -64.0 };
241 float HighY_hi2D[4] = {
static_cast<float>(1025. * factor_adc),
static_cast<float>(1025. * factor_adc), 32.0, 32.0 };
242 float LowY_hi2D_pC[4] = {
static_cast<float>(-.391 * factor_adc),
static_cast<float>(-.391 * factor_adc), -64.0, -64.0 };
243 float HighY_hi2D_pC[4] = {
static_cast<float>(16.02 * factor_adc),
static_cast<float>(16.02 * factor_adc), 32.0, 32.0 };
248 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] << Hist2DName[
type];
252 if (
gn+3 >= std::ssize(
gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookHists");
253 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] << Hist2DTitle[
type];
254 histTitle = sStr.str();
283 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_amp";
287 if (
gn+3 >= std::ssize(
gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookHists");
288 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" amp";
289 histTitle = sStr.str();
306 const Int_t nlg1 = 49;
307 const Int_t nlg2 = 500;
308 const Int_t nlg3 = 1027;
309 Double_t xlgbin[nlg1 + nlg2 + nlg3 + 1];
310 for(Int_t
i = 0;
i <= nlg1; ++
i)
311 xlgbin[
i] = -50.5+1.0*
i;
312 for(Int_t
i = 1;
i <= nlg2; ++
i)
313 xlgbin[
i + nlg1] = -1.5 + 0.05 *
i;
314 for(Int_t
i = 1;
i <= nlg3; ++
i)
315 xlgbin[
i + nlg1 + nlg2] = 23.5 + 1.0 *
i;
337 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_time";
341 if (
gn+3 >= std::ssize(
gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookHists");
342 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" time";
343 histTitle = sStr.str();
348 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_time_corr";
352 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" time_corr";
353 histTitle = sStr.str();
368 const std::array<std::string, 6>
gain{
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
371 std::ostringstream sStr;
374 std::string subDir = moduleName;
384 for (
int gn = mingain;
gn < maxgain; ++
gn) {
385 std::string finalsubDir =
"Summary";
387 sStr << moduleName <<
gain[
gn] <<
"_summary_chi2_amp";
388 std::string finalhistName = sStr.str();
391 if (
gn+3 >= std::ssize(
gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookDsp");
392 sStr << moduleName <<
gain[3 +
gn] <<
" Summary chi2 versus amp";
393 std::string finalhistTitle = sStr.str();
397 m_data->m_finalHistDsp2[
ros][
drawer][
gn].push_back(
book2F(finalsubDir, finalhistName, finalhistTitle, 200, -45.1, 855.1, 16, 0., 16.));
400 m_data->m_finalHistDsp2[
ros][
drawer][
gn].push_back(
book2F(finalsubDir, finalhistName, finalhistTitle, 150, -7.0, 12.0, 16, 0., 16.));
404 m_data->m_finalHistDsp2[
ros][
drawer][
gn & 1].push_back(
book2F(subDir, finalhistName, finalhistTitle, 150, -7.005, 7.005, 16, 0., 16.));
407 m_data->m_finalHistDsp2[
ros][
drawer][
gn & 1].push_back(
book2F(subDir, finalhistName, finalhistTitle, 200, -45.1, 855.1, 16, 0., 16.));
413 for (
int ch = 0;
ch < 48; ++
ch) {
419 sStr << std::setfill(
'0') << std::setw(2) <<
ch << std::setfill(
' ');
420 std::string sCh = sStr.str();
422 for (
int gn = mingain;
gn < maxgain; ++
gn) {
425 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp_amp";
429 if (
gn+3 >= std::ssize(
gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookDsp");
430 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp Amp";
431 histTitle = sStr.str();
449 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp_time";
453 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp Time";
454 histTitle = sStr.str();
459 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp_chi2";
463 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp Chi2";
464 histTitle = sStr.str();
469 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp-fit_amp_diff";
473 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp-OF Amp difference";
474 histTitle = sStr.str();
476 auto ix = (
gn < 2) ?
gn : (
gn & 1);
480 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp-fit_time_diff";
484 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp-OF Time diff";
485 histTitle = sStr.str();
490 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_chi2_amp";
494 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp Chi2 versus Amp";
495 histTitle = sStr.str();
539 for (; collItr2 != lastColl2; ++collItr2) {
543 if (digitsItr != lastDigits) {
548 std::vector<uint32_t> headerVec = (*collItr2)->getFragChipHeaderWords();
549 int headsize = headerVec.size();
550 if (headsize > 16) headsize = 16;
552 int fragId = (*collItr2)->identify();
555 for (
int dmu = 0; dmu < headsize; dmu++) {
561 for (
int dmu = 0; dmu < headsize; dmu++) {
567 for (
int dmu = headsize; dmu < 16; dmu++) {
584 double avgTimePerPart[5], sumTimeCh[5];
586 for (
int iros = 0; iros < 5; iros++) {
587 avgTimePerPart[iros] = 0;
593 for (
int k = 0;
k < 2;
k++) {
598 for (; collItr != lastColl; ++collItr) {
600 int cap = (
m_cispar[7] > 10) ? 0 : 1;
603 double hg_small_charge = 1.;
604 double lg_small_charge = (cap) ? 10. : 15.;
605 double hg_charge_cut = 11.5;
606 double lg_charge_cut = 750.;
608 int fragId = (*collItr)->identify();
611 hg_small_charge *= 2.;
616 double timeInj =
m_cispar[5] * 0.104;
621 if (chItr != lastCh) {
635 std::vector<double> efitVec(
m_bigain ? 96 : 48, 0.), tfitVec(
m_bigain ? 96 : 48, 0.);
637 for (; chItr != lastCh; ++chItr) {
690 if ( ( (
adc == 1) && (
charge < hg_charge_cut) && (
charge > hg_small_charge) ) ||
691 ( (
adc == 0) && (
charge < lg_charge_cut) && (
charge > lg_small_charge) ) ) {
735 if ((
ros == 3 ||
ros == 4)
748 timeCorr =
time - avgTimePerPart[
ros];
773 for (
int iros = 0; iros < 5; iros++) {
774 if (nCh[iros] != 0) {
775 avgTimePerPart[iros] = sumTimeCh[iros] / nCh[iros];
777 avgTimePerPart[iros] = 0;
800 return StatusCode::SUCCESS;
818 for (; collItr != lastColl; ++collItr) {
823 if (chItr != lastCh) {
834 for (; chItr != lastCh; ++chItr) {
881 if (
it != efitMap.end()) {
882 double efit = (*it).second.at(
chan +
gain * 48);
884 double tfit = (*it).second.at(
chan +
gain * 48);
901 return StatusCode::SUCCESS;
913 const std::array<std::string, 6>
gain = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
920 std::ostringstream sStr;
924 const char *HistName[6] = {
"_tslope",
"_toffset",
"_qratio",
" Time slope",
" Time offset",
" Amp/Q ratio" };
925 const char *CapName[4] = {
"_100",
"_5",
" 100 pF",
" 5 pF" };
929 std::string subDir =
"Summary";
932 for (
int gn = mingain;
gn < maxgain; ++
gn) {
934 for (
int cap = 0; cap < 2; ++cap) {
938 sStr << moduleName <<
gain[
gn] << HistName[
type] << CapName[cap];
941 if (
gn+3 >= std::ssize(
gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookSummaryHistograms");
942 sStr << moduleName <<
gain[3 +
gn] << HistName[3 +
type] << CapName[2 + cap];
943 histTitle = sStr.str();
950 const char *HistName[10] = {
"_amp",
"_rms",
"_sigma",
"_time",
"_time_corr",
" Amplitude",
" RMS of amplitude",
" Sigma amp from Gaussian fit",
951 " Average time and RMS",
" Average time corr. and RMS" };
955 std::string subDir =
"Summary";
958 for (
int gn = mingain;
gn < maxgain; ++
gn) {
966 sStr << moduleName <<
gain[
gn] << HistName[
type];
969 if (
gn+3 >= std::ssize(
gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookSummaryHistograms");
970 sStr << moduleName <<
gain[3 +
gn] << HistName[5 +
type];
971 histTitle = sStr.str();
974 std::string hTitle(histTitle);
978 hTitle +=
" (Even PMTs)";
985 hTitle +=
" (Odd PMTs)";
991 if (ros < 3 && m_data->m_summaryPmts[0][
drawer][
adc][0].
size() < (
unsigned int)(
type + 1)) {
994 histTitle.replace(histTitle.begin(), histTitle.begin() + 3,
"LB");
997 hTitle +=
" (LBA even PMTs + LBC odd PMTs: negative)";
1004 hTitle +=
" (LBA odd PMTs + LBC even PMTs: negative)";
1024 memset(
m_data->m_timeCov, 0,
sizeof(
m_data->m_timeCov));
1025 memset(
m_data->m_timeCovCorr, 0,
sizeof(
m_data->m_timeCovCorr));
1033 for (
int ch = 0;
ch < 48; ++
ch) {
1034 for (
int gn = mingain;
gn < maxgain; ++
gn) {
1054 TF1 * fit_gaus =
new TF1(
"g",
"gaus");
1065 for (
int gn = mingain;
gn < maxgain; ++
gn) {
1068 for (
int cap = 0; cap < 2; ++cap) {
1069 for (
int ch = 0;
ch < 48; ++
ch) {
1076 m_data->m_finalHist1[
ros][
drawer][
adc][cap][0]->SetBinContent(
ch + 1, polyfunc->GetParameter(1));
1077 if (polyfunc->GetParError(1) > 5) {
1082 m_data->m_finalHist1[
ros][
drawer][
adc][cap][1]->SetBinContent(
ch + 1, polyfunc->GetParameter(0));
1083 if (polyfunc->GetParError(0) > 5) {
1102 for (; minbin <
nbins; ++minbin) {
1103 if (
hist->GetBinContent(minbin) > 0.0) {
1108 for (; maxbin > 1; --maxbin) {
1109 if (
hist->GetBinContent(maxbin) > 0.0) {
1115 double xmin =
hist->GetBinCenter(minbin);
1116 double xmax =
hist->GetBinCenter(maxbin);
1148 for (
int gn = mingain;
gn < maxgain; ++
gn) {
1151 for (
int ch = 0;
ch < 48; ++
ch) {
1155 double Amp = 0.0, ErrA = 0.0,
RMS = 0.0, ErrR = 0.0;
1156 double Time = 0.0, RMST = 0.0, Sigma = 0.0, ErrS = 0.0;
1159 double TimeCorr = 0.0, RMSTCorr = 0.0;
1162 if (NEvents > 0.0) {
1168 ErrA =
RMS / sqrt(NEvents);
1169 ErrR =
RMS / sqrt(2 * NEvents);
1184 if (NEventsCorr > 0.0) {
1186 RMSTCorr =
m_data->m_timeCovCorr[
ros][
drawer][
ch][
adc][0][1] / NEventsCorr - TimeCorr * TimeCorr;
1187 if (RMSTCorr > 0.0) {
1188 RMSTCorr = sqrt(RMSTCorr);
1198 h4fit->Scale(1,
"width");
1199 h4fit->Fit(
"g",
"NQ");
1204 Sigma = fit_gaus->GetParameter(2);
1205 ErrS = fit_gaus->GetParError(2);
1222 if (
pmt < 0)
continue;
1224 int fiber = (
pmt % 2);
1290 return StatusCode::SUCCESS;
1316 return StatusCode::SUCCESS;
1329 unsigned int iteration = 0
u;
1333 iteration =
info & 3
u;
1340 const char *
alg_name[2] = {
"OF1",
"OF2" };
1341 const char * iter_name[4] = {
"NI",
"I1",
"I2",
"I3" };
1343 const char *
part[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
1344 const char *
gain[4] = {
"_lo",
"_hi",
" low gain",
" high gain" };
1352 const char *HistName[9] = {
"_dspfit_ampdiff",
"_dspfit_timediff",
"_dspamp",
" Avg. (DSP-",
" Average DSP-",
" Average DSP-",
1353 " - OFF-OF2-I) / OFF Amplitudes and RMS",
" - OFF-OF2-I Time and RMS",
" Amplitudes and RMS" };
1355 std::ostringstream sStr;
1356 sStr <<
part[
ros] << std::setfill(
'0') << std::setw(2) <<
drawer + 1 << std::setfill(
' ');
1357 std::string moduleName = sStr.str();
1358 std::string subDir =
"Summary";
1361 for (
int gn = mingain;
gn < maxgain; ++
gn) {
1367 sStr << moduleName <<
gain[
gn] << HistName[
type];
1371 histTitle = sStr.str();
1377 sStr << moduleName <<
gain[
gn] <<
"_dspfit_amphbar";
1381 <<
" - OFF-OF2-I) divided by OFF Amplitudes for all chans";
1382 histTitle = sStr.str();
1386 sStr << moduleName <<
gain[
gn] <<
"_dspfit_timehbar";
1389 sStr << moduleName <<
gain[2 +
gn] <<
" (DSP-" <<
alg_name[
algorithm] <<
"-" << iter_name[iteration] <<
" - OFF-OF2-I) Time for all chans";
1390 histTitle = sStr.str();
1393 for (
int ch = 0;
ch < 48; ++
ch) {
1423 return StatusCode::SUCCESS;
1433 return StatusCode::SUCCESS;
1452 for (
int i = 0;
i < 48;
i++) {
1453 X_axis[
i] =
i + 0.5;
1457 const char *
gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
1458 const char *CapName[4] = {
"_100",
"_5",
" 100 pF",
" 5 pF" };
1466 TCanvas * Can = NULL;
1468 Can =
new TCanvas(
"amp_ratio",
"amp_ratio", 402 * maxgain, 588);
1469 Can->Divide(maxgain, 2);
1470 gStyle->SetOptStat(0);
1471 gStyle->SetTitleFontSize(0.1);
1474 TLine
line(0., 1., 48., 1.);
1475 line.SetLineColor(3);
1477 std::string subDir =
"Summary";
1478 std::vector<TGraphAsymmErrors*> grapherrVec;
1480 for (
int adc = 0;
adc < maxgain; ++
adc) {
1481 for (
int cap = 0; cap < 2; ++cap) {
1483 std::ostringstream sStr;
1484 sStr << moduleName <<
gain[
adc] <<
"_tails" << CapName[cap];
1485 std::string graphName = sStr.str();
1487 sStr << moduleName <<
gain[
adc + 3] <<
" Mean Amp/Q ratio and up/down tails " << CapName[2 + cap];
1488 std::string graphTitle = sStr.str();
1492 pad = Can->cd(cap * maxgain +
adc + 1);
1493 pad->SetTopMargin(0.15);
1497 TGraphAsymmErrors * final_Egraph =
bookGraphAsymmErrors(subDir, graphName, graphTitle, 48, X_axis,
m_data->m_rangeQ[
adc][cap][0], X_errors, X_errors,
1499 grapherrVec.push_back(final_Egraph);
1510 final_Egraph->SetMarkerStyle(21);
1511 final_Egraph->SetMarkerSize(
ms);
1512 final_Egraph->SetMaximum(2.2);
1513 final_Egraph->SetMinimum(-0.2);
1514 final_Egraph->GetXaxis()->SetRangeUser(0, 48);
1516 final_Egraph->Draw(
"P0");
1524 Can->Print(TString(moduleName +
"_amp_ratio.png"),
"png");
1527 Can->Print(TString(moduleName +
"_amp_ratio.ps"),
"ps");
1530 Can->Print(TString(moduleName +
"_amp_ratio.svg"),
"svg");
1532 if (do_plots)
delete Can;
1536 std::vector<TGraphAsymmErrors*>::const_iterator
it = grapherrVec.begin();
1537 std::vector<TGraphAsymmErrors *>::const_iterator itend = grapherrVec.end();
1538 for (;
it != itend; ++
it) {
1544 Can =
new TCanvas(
"fit_time",
"fit_time", 402 * maxgain, 588);
1545 Can->Divide(maxgain, 4);
1546 gStyle->SetOptStat(0);
1547 gStyle->SetTitleFontSize(0.1);
1550 double maxy[2] = { 1.4, 15.0 };
1551 double miny[2] = { -0.1, -15.0 };
1553 for (
int adc = 0;
adc < maxgain; ++
adc) {
1554 for (
int cap = 0; cap < 2; ++cap) {
1559 pad = Can->cd((
type + cap * 2) * maxgain +
adc + 1);
1560 pad->SetTopMargin(0.15);
1576 line.SetLineColor(3);
1584 Can->Print(TString(moduleName +
"_fit_time.png"),
"png");
1587 Can->Print(TString(moduleName +
"_fit_time.ps"),
"ps");
1590 Can->Print(TString(moduleName +
"_fit_time.svg"),
"svg");
1592 if (do_plots)
delete Can;
1599 TCanvas * Can = NULL;
1601 Can =
new TCanvas(
"fit_amp",
"fit_amp", 402 * maxgain, 588);
1602 Can->Divide(maxgain, 3);
1603 gStyle->SetOptStat(0);
1604 gStyle->SetTitleFontSize(0.1);
1607 double maxy[6] = { 1.0, 0.05, 1.0, 0.05, 25.0, 25.0 };
1608 double miny[6] = { -1.0, -0.05, 0.0, 0.0, -25.0, -25.0 };
1610 for (
int adc = 0;
adc < maxgain; ++
adc) {
1623 pad = Can->cd(
adc + 1);
1624 pad->SetTopMargin(0.15);
1640 pad = Can->cd(maxgain +
adc + 1);
1641 pad->SetTopMargin(0.15);
1647 if (max2 < maxy[2 +
adc])
1655 if (min1 > miny[2 +
adc]) {
1656 if (min2 > miny[2 +
adc])
1684 pad = Can->cd(2 * maxgain +
adc + 1);
1685 pad->SetTopMargin(0.15);
1690 if (min3 > (miny[4 +
adc] + 0.1 * TMath::Abs(miny[4 +
adc])))
m_data->m_finalHist1[
ros][
drawer][
adc][0][3]->SetMinimum(miny[4 +
adc]);
1703 Can->Print(TString(moduleName +
"_fit_amp.png"),
"png");
1706 Can->Print(TString(moduleName +
"_fit_amp.ps"),
"ps");
1709 Can->Print(TString(moduleName +
"_fit_amp.svg"),
"svg");
1711 if (do_plots)
delete Can;
1725 TCanvas * Can = NULL;
1727 Can =
new TCanvas(
"dsp_amp",
"dsp_amp", 402 * maxgain, 588);
1728 Can->Divide(maxgain, 3);
1729 gStyle->SetOptStat(0);
1730 gStyle->SetTitleFontSize(0.1);
1733 TLine
line(0., 0., 48., 0.);
1734 line.SetLineColor(3);
1736 double maxy[6] = { 0.05, 0.05, 0.5, 0.5, 10.0, 10.0 };
1737 double miny[6] = { -0.05, -0.05, -0.5, -0.5, -0.05, -0.05 };
1738 double norm[2] = { 1., 1 };
1739 for (
int adc = 0;
adc < maxgain; ++
adc) {
1750 pad = Can->cd(
adc + 1);
1751 pad->SetTopMargin(0.15);
1778 pad = Can->cd(maxgain +
adc + 1);
1779 pad->SetTopMargin(0.15);
1805 pad = Can->cd(2 * maxgain +
adc + 1);
1806 pad->SetTopMargin(0.15);
1812 if (minchidsp > miny[4 +
adc] + 0.1 * TMath::Abs(miny[4 +
adc]))
m_data->m_finalHistDsp2[
ros][
drawer][
adc][0]->SetMinimum(miny[4 +
adc]);
1817 gStyle->SetPalette(1);
1824 Can->Print(TString(moduleName +
"_dsp_amp.png"),
"png");
1827 Can->Print(TString(moduleName +
"_dsp_amp.ps"),
"ps");
1830 Can->Print(TString(moduleName +
"_dsp_amp.svg"),
"svg");
1832 if (do_plots)
delete Can;
1834 for (
int adc = 0;
adc < maxgain; ++
adc) {
1921 TProfile* prof = hist2d->ProfileX();
1924 TH1S
hist(
"hist",
"TMP Histo", prof->GetNbinsX(), prof->GetBinLowEdge(1), prof->GetBinLowEdge(prof->GetNbinsX() + 1));
1925 float lastbin = -99.;
1928 for (
int i = 1;
i < prof->GetNbinsX() + 1;
i++) {
1929 if (prof->GetBinError(
i) > 1
e-7) {
1930 if ((shift < 1.) && ((prof->GetBinContent(
i) - (lastbin + (
i - lasti))) < -10.)) {
1934 lastbin = prof->GetBinContent(
i);
1935 hist.SetBinContent(
i, prof->GetBinContent(
i) + shift);
1936 hist.SetBinError(
i, prof->GetBinError(
i));
1939 TF1* polfun =
new TF1(
"polfun",
"pol1", 0., 25.);
1940 hist.Fit(
"polfun",
"NQ");
1942 polfun->SetParameter(0, polfun->GetParameter(0) - 25.);
1963 if (((*headerVec)[dmu] >> 25) & 0
x1) {
1968 if (((*headerVec)[dmu] >> 24) & 0
x1) {
1973 if (((*headerVec)[dmu] >> 23) & 0
x1) {
1989 TCanvas * Can = NULL;
1991 Can =
new TCanvas(
"fit_amp",
"fit_amp", 402 * maxgain, 735);
1993 Can->Divide(maxgain, 5);
1994 gStyle->SetOptStat(0);
1995 gStyle->SetTitleFontSize(0.1);
1997 TLine *
line =
new TLine();
1998 line->SetLineWidth(2);
1999 line->SetLineStyle(7);
2000 line->SetLineColor(3);
2004 double maxy[6] = { 5.0, 0.5, 1.0, 0.05, 25.0, 25.0 };
2005 double miny[6] = { -5.0, -0.5, 0.0, 0.0, -25.0, -25.0 };
2008 TH1F* final_empty[2];
2010 TH1F* final_even[2];
2013 TH1F* pmtGain_empty[2];
2014 TH1F* pmtGain_odd[2];
2015 TH1F* pmtGain_even[2];
2017 for (
int g = 0;
g < 2;
g++) {
2019 std::ostringstream hn;
2020 hn <<
"empty_" <<
g;
2021 final_empty[
g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[
ros][
drawer][
g][0][0]->GetTitle(), 48, 0, 48);
2024 final_odd[
g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[
ros][
drawer][
g][0][0]->GetTitle(), 48, 0, 48);
2027 final_even[
g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[
ros][
drawer][
g][0][0]->GetTitle(), 48, 0, 48);
2032 const char*
gain[2] = {
"low",
"high" };
2033 const char* moduleNames[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
2039 std::ostringstream sStr;
2040 std::string subDir =
"Summary";
2042 sStr << moduleNames[
ros] << std::setfill(
'0') << std::setw(2) <<
drawer + 1 << std::setfill(
' ') <<
gain[
g] <<
"_pmtGain_empty";
2048 sStr << moduleNames[
ros] << std::setfill(
'0') << std::setw(2) <<
drawer + 1 << std::setfill(
' ') <<
gain[
g] <<
"_pmtGain_odd";
2054 sStr << moduleNames[
ros] << std::setfill(
'0') << std::setw(2) <<
drawer + 1 << std::setfill(
' ') <<
gain[
g] <<
"_pmtGain_even";
2061 for (
int adc = 0;
adc < maxgain; ++
adc) {
2075 final_empty[
adc]->SetMaximum(1.05 * max0);
2077 final_empty[
adc]->SetMaximum(0.);
2080 if ((max0 - min0) > 0) {
2081 final_empty[
adc]->SetMinimum(max0 - 1.05 * (max0 - min0));
2087 pad = Can->cd(
adc + 1);
2088 pad->SetTopMargin(0.15);
2093 double Kapa = 1.30e-3;
2094 for (
int ch = 0;
ch < 48; ++
ch) {
2098 pmtGain_empty[
adc]->SetBinContent(
ch + 1, 0.01);
2099 pmtGain_empty[
adc]->SetBinError(
ch + 1, 0.01);
2120 pmtGain_even[
adc]->SetBinContent(
ch + 1, -0.5);
2121 pmtGain_even[
adc]->SetBinError(
ch + 1, 0.001);
2135 pmtGain_odd[
adc]->SetBinContent(
ch + 1, -0.5);
2136 pmtGain_odd[
adc]->SetBinError(
ch + 1, 0.001);
2144 double max = pmtGain_odd[
adc]->GetMaximum();
2145 if (pmtGain_even[
adc]->GetMaximum() >
max)
max = 1.05 * pmtGain_even[
adc]->GetMaximum();
2146 double min = pmtGain_odd[
adc]->GetMinimum();
2147 if (pmtGain_even[
adc]->GetMinimum() <
min)
min = pmtGain_even[
adc]->GetMinimum() - 0.05 * fabs(pmtGain_even[
adc]->GetMinimum());
2148 if (
max < 0.20)
max = 0.20;
2149 if (
min > -0.10)
min = -0.10;
2151 pmtGain_empty[
adc]->SetMarkerStyle(21);
2152 pmtGain_even[
adc]->SetMarkerStyle(22);
2153 pmtGain_odd[
adc]->SetMarkerStyle(23);
2154 pmtGain_empty[
adc]->SetMarkerSize(
ms);
2155 pmtGain_even[
adc]->SetMarkerSize(
ms);
2156 pmtGain_odd[
adc]->SetMarkerSize(
ms);
2157 pmtGain_empty[
adc]->SetLabelSize(0.08,
"X");
2158 pmtGain_empty[
adc]->SetLabelSize(0.08,
"Y");
2159 pmtGain_even[
adc]->SetMarkerColor(2);
2160 pmtGain_odd[
adc]->SetMarkerColor(4);
2161 pmtGain_empty[
adc]->GetYaxis()->SetRangeUser(
min,
max);
2163 pmtGain_empty[
adc]->Draw(
"e");
2164 pmtGain_even[
adc]->Draw(
"same,e");
2165 pmtGain_odd[
adc]->Draw(
"same,e");
2166 line->DrawLine(0, -0.01, 48, -0.01);
2167 line->DrawLine(0, 0.15, 48, 0.15);
2170 pad = Can->cd(maxgain +
adc + 1);
2171 pad->SetTopMargin(0.15);
2176 if (max0 < 0.9 * maxy[
adc]) final_empty[
adc]->SetMaximum(maxy[
adc]);
2177 if (min0 > miny[
adc] + 0.1 * TMath::Abs(miny[
adc])) final_empty[
adc]->SetMinimum(miny[
adc]);
2179 final_empty[
adc]->SetMarkerStyle(21);
2180 final_even[
adc]->SetMarkerStyle(22);
2181 final_odd[
adc]->SetMarkerStyle(23);
2182 final_empty[
adc]->SetMarkerSize(
ms);
2183 final_even[
adc]->SetMarkerSize(
ms);
2184 final_odd[
adc]->SetMarkerSize(
ms);
2185 final_empty[
adc]->SetLabelSize(0.08,
"X");
2186 final_empty[
adc]->SetLabelSize(0.08,
"Y");
2187 final_even[
adc]->SetMarkerColor(2);
2188 final_odd[
adc]->SetMarkerColor(4);
2190 final_empty[
adc]->Draw(
"e");
2191 final_even[
adc]->Draw(
"same,e");
2192 final_odd[
adc]->Draw(
"same,e");
2195 pad = Can->cd(2 * maxgain +
adc + 1);
2196 pad->SetTopMargin(0.15);
2217 pad = Can->cd(3 * maxgain +
adc + 1);
2218 pad->SetTopMargin(0.15);
2223 if (min3 > miny[4 +
adc] + 0.1 * TMath::Abs(miny[4 +
adc]))
m_data->m_finalHist1[
ros][
drawer][
adc][0][3]->SetMinimum(miny[4 +
adc]);
2234 pad = Can->cd(4 * maxgain +
adc + 1);
2235 pad->SetTopMargin(0.15);
2240 if (min4 > miny[4 +
adc] + 0.1 * TMath::Abs(miny[4 +
adc]))
m_data->m_finalHist1[
ros][
drawer][
adc][0][4]->SetMinimum(miny[4 +
adc]);
2252 Can->Print(TString(moduleName +
"_fit_amp.png"),
"png");
2255 Can->Print(TString(moduleName +
"_fit_amp.ps"),
"ps");
2258 Can->Print(TString(moduleName +
"_fit_amp.svg"),
"svg");
2261 if (do_plots)
delete Can;
2263 for (
int g = 0;
g < 2;
g++) {
2264 delete final_empty[
g];
2265 delete final_odd[
g];
2266 delete final_even[
g];