28 #include "TGraphAsymmErrors.h"
29 #include "TVirtualPad.h"
45 , m_tileToolEmscale(
"TileCondToolEmscale")
54 declareInterface<IMonitorToolBase>(
this);
74 m_path =
"/Tile/RawChannel";
99 m_data = std::make_unique<Data>();
105 memset(
m_data->m_timeCov, 0,
sizeof(
m_data->m_timeCov));
106 memset(
m_data->m_timeCovCorr, 0,
sizeof(
m_data->m_timeCovCorr));
119 return StatusCode::SUCCESS;
173 return StatusCode::SUCCESS;
181 const char *
gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
183 std::ostringstream sStr;
185 std::string subDir = moduleName;
195 for (
int ch = 0;
ch < 48; ++
ch) {
200 sStr << std::setfill(
'0') << std::setw(2) <<
ch << std::setfill(
' ');
202 std::string sCh = sStr.str();
204 for (
int gn = mingain;
gn < maxgain; ++
gn) {
208 std::string HistName[4] = {
"_amp_ratio_100",
"_amp_ratio_5",
"_time_100",
"_time_5" };
209 std::string HistTitle[4] = {
" amp to charge ratio for 100 pF",
" amp to charge ratio for 5 pF",
" time for 100 pF",
" time for 5 pF" };
213 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] << HistName[
type];
217 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] << HistTitle[
type];
218 histTitle = sStr.str();
227 std::string Hist2DName[4] = {
"_amp_vs_q_100",
"_amp_vs_q_5",
"_time_vs_time_100",
"_time_vs_time_5" };
228 std::string Hist2DTitle[4] = {
" amp vs charge 100 pF",
" amp vs charge 5 pF",
" time vs time 100 pF",
" time vs time 5 pF" };
229 float factor_charge =
m_is12bit ? 2. : 1.;
232 float LowX_low2D[4] = { -4., -0.5, -0.25, -0.25 };
233 float HighX_low2D[4] = { 804., 50.5, 25.25, 25.25 };
234 float LowX_hi2D[4] = {
static_cast<float>(-0.0625 * factor_charge),
static_cast<float>(-0.0625 * factor_charge), -0.25, -0.25 };
235 float HighX_hi2D[4] = {
static_cast<float>(12.5625 * factor_charge),
static_cast<float>(12.5625 * factor_charge), 25.25, 25.25 };
236 float LowY_low2D[4] = { -25., -5.3125, -64.0, -64.0 };
237 float HighY_low2D[4] = { 1025., 60.3125, 32.0, 32.0 };
238 float LowY_hi2D[4] = {
static_cast<float>(-25. * factor_adc),
static_cast<float>(-25. * factor_adc), -64.0, -64.0 };
239 float HighY_hi2D[4] = {
static_cast<float>(1025. * factor_adc),
static_cast<float>(1025. * factor_adc), 32.0, 32.0 };
240 float LowY_hi2D_pC[4] = {
static_cast<float>(-.391 * factor_adc),
static_cast<float>(-.391 * factor_adc), -64.0, -64.0 };
241 float HighY_hi2D_pC[4] = {
static_cast<float>(16.02 * factor_adc),
static_cast<float>(16.02 * factor_adc), 32.0, 32.0 };
246 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] << Hist2DName[
type];
250 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] << Hist2DTitle[
type];
251 histTitle = sStr.str();
280 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_amp";
284 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" amp";
285 histTitle = sStr.str();
302 const Int_t nlg1 = 49;
303 const Int_t nlg2 = 500;
304 const Int_t nlg3 = 1027;
305 Double_t xlgbin[nlg1 + nlg2 + nlg3 + 1];
306 for(Int_t
i = 0;
i <= nlg1; ++
i)
307 xlgbin[
i] = -50.5+1.0*
i;
308 for(Int_t
i = 1;
i <= nlg2; ++
i)
309 xlgbin[
i + nlg1] = -1.5 + 0.05 *
i;
310 for(Int_t
i = 1;
i <= nlg3; ++
i)
311 xlgbin[
i + nlg1 + nlg2] = 23.5 + 1.0 *
i;
333 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_time";
337 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" time";
338 histTitle = sStr.str();
343 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_time_corr";
347 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" time_corr";
348 histTitle = sStr.str();
363 const char *
gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
366 std::ostringstream sStr;
369 std::string subDir = moduleName;
379 for (
int gn = mingain;
gn < maxgain; ++
gn) {
380 std::string finalsubDir =
"Summary";
382 sStr << moduleName <<
gain[
gn] <<
"_summary_chi2_amp";
383 std::string finalhistName = sStr.str();
386 sStr << moduleName <<
gain[3 +
gn] <<
" Summary chi2 versus amp";
387 std::string finalhistTitle = sStr.str();
391 m_data->m_finalHistDsp2[
ros][
drawer][
gn].push_back(
book2F(finalsubDir, finalhistName, finalhistTitle, 200, -45.1, 855.1, 16, 0., 16.));
394 m_data->m_finalHistDsp2[
ros][
drawer][
gn].push_back(
book2F(finalsubDir, finalhistName, finalhistTitle, 150, -7.0, 12.0, 16, 0., 16.));
398 m_data->m_finalHistDsp2[
ros][
drawer][
gn & 1].push_back(
book2F(subDir, finalhistName, finalhistTitle, 150, -7.005, 7.005, 16, 0., 16.));
401 m_data->m_finalHistDsp2[
ros][
drawer][
gn & 1].push_back(
book2F(subDir, finalhistName, finalhistTitle, 200, -45.1, 855.1, 16, 0., 16.));
407 for (
int ch = 0;
ch < 48; ++
ch) {
413 sStr << std::setfill(
'0') << std::setw(2) <<
ch << std::setfill(
' ');
414 std::string sCh = sStr.str();
416 for (
int gn = mingain;
gn < maxgain; ++
gn) {
419 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp_amp";
423 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp Amp";
424 histTitle = sStr.str();
442 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp_time";
446 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp Time";
447 histTitle = sStr.str();
452 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp_chi2";
456 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp Chi2";
457 histTitle = sStr.str();
462 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp-fit_amp_diff";
466 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp-OF Amp difference";
467 histTitle = sStr.str();
469 auto ix = (
gn < 2) ?
gn : (
gn & 1);
473 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_dsp-fit_time_diff";
477 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp-OF Time diff";
478 histTitle = sStr.str();
483 sStr << moduleName <<
"_ch_" << sCh <<
gain[
gn] <<
"_chi2_amp";
487 sStr << moduleName <<
" CH " <<
ch <<
gain[3 +
gn] <<
" Dsp Chi2 versus Amp";
488 histTitle = sStr.str();
532 for (; collItr2 != lastColl2; ++collItr2) {
536 if (digitsItr != lastDigits) {
541 std::vector<uint32_t> headerVec = (*collItr2)->getFragChipHeaderWords();
542 int headsize = headerVec.size();
543 if (headsize > 16) headsize = 16;
545 int fragId = (*collItr2)->identify();
548 for (
int dmu = 0; dmu < headsize; dmu++) {
554 for (
int dmu = 0; dmu < headsize; dmu++) {
560 for (
int dmu = headsize; dmu < 16; dmu++) {
577 double avgTimePerPart[5], sumTimeCh[5];
579 for (
int iros = 0; iros < 5; iros++) {
580 avgTimePerPart[iros] = 0;
586 for (
int k = 0;
k < 2;
k++) {
591 for (; collItr != lastColl; ++collItr) {
593 int cap = (
m_cispar[7] > 10) ? 0 : 1;
596 double hg_small_charge = 1.;
597 double lg_small_charge = (cap) ? 10. : 15.;
598 double hg_charge_cut = 11.5;
599 double lg_charge_cut = 750.;
601 int fragId = (*collItr)->identify();
604 hg_small_charge *= 2.;
609 double timeInj =
m_cispar[5] * 0.104;
614 if (chItr != lastCh) {
628 std::vector<double> efitVec(
m_bigain ? 96 : 48, 0.), tfitVec(
m_bigain ? 96 : 48, 0.);
630 for (; chItr != lastCh; ++chItr) {
683 if ( ( (
adc == 1) && (
charge < hg_charge_cut) && (
charge > hg_small_charge) ) ||
684 ( (
adc == 0) && (
charge < lg_charge_cut) && (
charge > lg_small_charge) ) ) {
728 if ((
ros == 3 ||
ros == 4)
741 timeCorr =
time - avgTimePerPart[
ros];
766 for (
int iros = 0; iros < 5; iros++) {
767 if (nCh[iros] != 0) {
768 avgTimePerPart[iros] = sumTimeCh[iros] / nCh[iros];
770 avgTimePerPart[iros] = 0;
793 return StatusCode::SUCCESS;
811 for (; collItr != lastColl; ++collItr) {
816 if (chItr != lastCh) {
827 for (; chItr != lastCh; ++chItr) {
874 if (
it != efitMap.end()) {
875 double efit = (*it).second.at(
chan +
gain * 48);
877 double tfit = (*it).second.at(
chan +
gain * 48);
894 return StatusCode::SUCCESS;
906 const char *
gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
913 std::ostringstream sStr;
917 const char *HistName[6] = {
"_tslope",
"_toffset",
"_qratio",
" Time slope",
" Time offset",
" Amp/Q ratio" };
918 const char *CapName[4] = {
"_100",
"_5",
" 100 pF",
" 5 pF" };
922 std::string subDir =
"Summary";
925 for (
int gn = mingain;
gn < maxgain; ++
gn) {
927 for (
int cap = 0; cap < 2; ++cap) {
931 sStr << moduleName <<
gain[
gn] << HistName[
type] << CapName[cap];
934 sStr << moduleName <<
gain[3 +
gn] << HistName[3 +
type] << CapName[2 + cap];
935 histTitle = sStr.str();
942 const char *HistName[10] = {
"_amp",
"_rms",
"_sigma",
"_time",
"_time_corr",
" Amplitude",
" RMS of amplitude",
" Sigma amp from Gaussian fit",
943 " Average time and RMS",
" Average time corr. and RMS" };
947 std::string subDir =
"Summary";
950 for (
int gn = mingain;
gn < maxgain; ++
gn) {
958 sStr << moduleName <<
gain[
gn] << HistName[
type];
962 sStr << moduleName <<
gain[3 +
gn] << HistName[5 +
type];
963 histTitle = sStr.str();
966 std::string hTitle(histTitle);
970 hTitle +=
" (Even PMTs)";
977 hTitle +=
" (Odd PMTs)";
983 if (ros < 3 && m_data->m_summaryPmts[0][
drawer][
adc][0].
size() < (
unsigned int)(
type + 1)) {
986 histTitle.replace(histTitle.begin(), histTitle.begin() + 3,
"LB");
989 hTitle +=
" (LBA even PMTs + LBC odd PMTs: negative)";
996 hTitle +=
" (LBA odd PMTs + LBC even PMTs: negative)";
1016 memset(
m_data->m_timeCov, 0,
sizeof(
m_data->m_timeCov));
1017 memset(
m_data->m_timeCovCorr, 0,
sizeof(
m_data->m_timeCovCorr));
1025 for (
int ch = 0;
ch < 48; ++
ch) {
1026 for (
int gn = mingain;
gn < maxgain; ++
gn) {
1046 TF1 * fit_gaus =
new TF1(
"g",
"gaus");
1057 for (
int gn = mingain;
gn < maxgain; ++
gn) {
1060 for (
int cap = 0; cap < 2; ++cap) {
1061 for (
int ch = 0;
ch < 48; ++
ch) {
1068 m_data->m_finalHist1[
ros][
drawer][
adc][cap][0]->SetBinContent(
ch + 1, polyfunc->GetParameter(1));
1069 if (polyfunc->GetParError(1) > 5) {
1074 m_data->m_finalHist1[
ros][
drawer][
adc][cap][1]->SetBinContent(
ch + 1, polyfunc->GetParameter(0));
1075 if (polyfunc->GetParError(0) > 5) {
1094 for (; minbin <
nbins; ++minbin) {
1095 if (
hist->GetBinContent(minbin) > 0.0) {
1100 for (; maxbin > 1; --maxbin) {
1101 if (
hist->GetBinContent(maxbin) > 0.0) {
1107 double xmin =
hist->GetBinCenter(minbin);
1108 double xmax =
hist->GetBinCenter(maxbin);
1140 for (
int gn = mingain;
gn < maxgain; ++
gn) {
1143 for (
int ch = 0;
ch < 48; ++
ch) {
1147 double Amp = 0.0, ErrA = 0.0,
RMS = 0.0, ErrR = 0.0;
1148 double Time = 0.0, RMST = 0.0, Sigma = 0.0, ErrS = 0.0;
1151 double TimeCorr = 0.0, RMSTCorr = 0.0;
1154 if (NEvents > 0.0) {
1160 ErrA =
RMS / sqrt(NEvents);
1161 ErrR =
RMS / sqrt(2 * NEvents);
1176 if (NEventsCorr > 0.0) {
1178 RMSTCorr =
m_data->m_timeCovCorr[
ros][
drawer][
ch][
adc][0][1] / NEventsCorr - TimeCorr * TimeCorr;
1179 if (RMSTCorr > 0.0) {
1180 RMSTCorr = sqrt(RMSTCorr);
1190 h4fit->Scale(1,
"width");
1191 h4fit->Fit(
"g",
"NQ");
1196 Sigma = fit_gaus->GetParameter(2);
1197 ErrS = fit_gaus->GetParError(2);
1214 if (
pmt < 0)
continue;
1216 int fiber = (
pmt % 2);
1282 return StatusCode::SUCCESS;
1308 return StatusCode::SUCCESS;
1321 unsigned int iteration = 0
u;
1325 iteration =
info & 3
u;
1332 const char *
alg_name[2] = {
"OF1",
"OF2" };
1333 const char * iter_name[4] = {
"NI",
"I1",
"I2",
"I3" };
1335 const char *
part[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
1336 const char *
gain[4] = {
"_lo",
"_hi",
" low gain",
" high gain" };
1344 const char *HistName[9] = {
"_dspfit_ampdiff",
"_dspfit_timediff",
"_dspamp",
" Avg. (DSP-",
" Average DSP-",
" Average DSP-",
1345 " - OFF-OF2-I) / OFF Amplitudes and RMS",
" - OFF-OF2-I Time and RMS",
" Amplitudes and RMS" };
1347 std::ostringstream sStr;
1348 sStr <<
part[
ros] << std::setfill(
'0') << std::setw(2) <<
drawer + 1 << std::setfill(
' ');
1349 std::string moduleName = sStr.str();
1350 std::string subDir =
"Summary";
1353 for (
int gn = mingain;
gn < maxgain; ++
gn) {
1359 sStr << moduleName <<
gain[
gn] << HistName[
type];
1363 histTitle = sStr.str();
1369 sStr << moduleName <<
gain[
gn] <<
"_dspfit_amphbar";
1373 <<
" - OFF-OF2-I) divided by OFF Amplitudes for all chans";
1374 histTitle = sStr.str();
1378 sStr << moduleName <<
gain[
gn] <<
"_dspfit_timehbar";
1381 sStr << moduleName <<
gain[2 +
gn] <<
" (DSP-" <<
alg_name[
algorithm] <<
"-" << iter_name[iteration] <<
" - OFF-OF2-I) Time for all chans";
1382 histTitle = sStr.str();
1385 for (
int ch = 0;
ch < 48; ++
ch) {
1415 return StatusCode::SUCCESS;
1425 return StatusCode::SUCCESS;
1444 for (
int i = 0;
i < 48;
i++) {
1445 X_axis[
i] =
i + 0.5;
1449 const char *
gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
1450 const char *CapName[4] = {
"_100",
"_5",
" 100 pF",
" 5 pF" };
1458 TCanvas * Can = NULL;
1460 Can =
new TCanvas(
"amp_ratio",
"amp_ratio", 402 * maxgain, 588);
1461 Can->Divide(maxgain, 2);
1462 gStyle->SetOptStat(0);
1463 gStyle->SetTitleFontSize(0.1);
1466 TLine
line(0., 1., 48., 1.);
1467 line.SetLineColor(3);
1469 std::string subDir =
"Summary";
1470 std::vector<TGraphAsymmErrors*> grapherrVec;
1472 for (
int adc = 0;
adc < maxgain; ++
adc) {
1473 for (
int cap = 0; cap < 2; ++cap) {
1475 std::ostringstream sStr;
1476 sStr << moduleName <<
gain[
adc] <<
"_tails" << CapName[cap];
1477 std::string graphName = sStr.str();
1479 sStr << moduleName <<
gain[
adc + 3] <<
" Mean Amp/Q ratio and up/down tails " << CapName[2 + cap];
1480 std::string graphTitle = sStr.str();
1484 pad = Can->cd(cap * maxgain +
adc + 1);
1485 pad->SetTopMargin(0.15);
1489 TGraphAsymmErrors * final_Egraph =
bookGraphAsymmErrors(subDir, graphName, graphTitle, 48, X_axis,
m_data->m_rangeQ[
adc][cap][0], X_errors, X_errors,
1491 grapherrVec.push_back(final_Egraph);
1502 final_Egraph->SetMarkerStyle(21);
1503 final_Egraph->SetMarkerSize(
ms);
1504 final_Egraph->SetMaximum(2.2);
1505 final_Egraph->SetMinimum(-0.2);
1506 final_Egraph->GetXaxis()->SetRangeUser(0, 48);
1508 final_Egraph->Draw(
"P0");
1516 Can->Print(TString(moduleName +
"_amp_ratio.png"),
"png");
1519 Can->Print(TString(moduleName +
"_amp_ratio.ps"),
"ps");
1522 Can->Print(TString(moduleName +
"_amp_ratio.svg"),
"svg");
1524 if (do_plots)
delete Can;
1528 std::vector<TGraphAsymmErrors*>::const_iterator
it = grapherrVec.begin();
1529 std::vector<TGraphAsymmErrors *>::const_iterator itend = grapherrVec.end();
1530 for (;
it != itend; ++
it) {
1536 Can =
new TCanvas(
"fit_time",
"fit_time", 402 * maxgain, 588);
1537 Can->Divide(maxgain, 4);
1538 gStyle->SetOptStat(0);
1539 gStyle->SetTitleFontSize(0.1);
1542 double maxy[2] = { 1.4, 15.0 };
1543 double miny[2] = { -0.1, -15.0 };
1545 for (
int adc = 0;
adc < maxgain; ++
adc) {
1546 for (
int cap = 0; cap < 2; ++cap) {
1551 pad = Can->cd((
type + cap * 2) * maxgain +
adc + 1);
1552 pad->SetTopMargin(0.15);
1568 line.SetLineColor(3);
1576 Can->Print(TString(moduleName +
"_fit_time.png"),
"png");
1579 Can->Print(TString(moduleName +
"_fit_time.ps"),
"ps");
1582 Can->Print(TString(moduleName +
"_fit_time.svg"),
"svg");
1584 if (do_plots)
delete Can;
1591 TCanvas * Can = NULL;
1593 Can =
new TCanvas(
"fit_amp",
"fit_amp", 402 * maxgain, 588);
1594 Can->Divide(maxgain, 3);
1595 gStyle->SetOptStat(0);
1596 gStyle->SetTitleFontSize(0.1);
1599 double maxy[6] = { 1.0, 0.05, 1.0, 0.05, 25.0, 25.0 };
1600 double miny[6] = { -1.0, -0.05, 0.0, 0.0, -25.0, -25.0 };
1602 for (
int adc = 0;
adc < maxgain; ++
adc) {
1615 pad = Can->cd(
adc + 1);
1616 pad->SetTopMargin(0.15);
1632 pad = Can->cd(maxgain +
adc + 1);
1633 pad->SetTopMargin(0.15);
1639 if (max2 < maxy[2 +
adc])
1647 if (min1 > miny[2 +
adc]) {
1648 if (min2 > miny[2 +
adc])
1676 pad = Can->cd(2 * maxgain +
adc + 1);
1677 pad->SetTopMargin(0.15);
1682 if (min3 > (miny[4 +
adc] + 0.1 * TMath::Abs(miny[4 +
adc])))
m_data->m_finalHist1[
ros][
drawer][
adc][0][3]->SetMinimum(miny[4 +
adc]);
1695 Can->Print(TString(moduleName +
"_fit_amp.png"),
"png");
1698 Can->Print(TString(moduleName +
"_fit_amp.ps"),
"ps");
1701 Can->Print(TString(moduleName +
"_fit_amp.svg"),
"svg");
1703 if (do_plots)
delete Can;
1717 TCanvas * Can = NULL;
1719 Can =
new TCanvas(
"dsp_amp",
"dsp_amp", 402 * maxgain, 588);
1720 Can->Divide(maxgain, 3);
1721 gStyle->SetOptStat(0);
1722 gStyle->SetTitleFontSize(0.1);
1725 TLine
line(0., 0., 48., 0.);
1726 line.SetLineColor(3);
1728 double maxy[6] = { 0.05, 0.05, 0.5, 0.5, 10.0, 10.0 };
1729 double miny[6] = { -0.05, -0.05, -0.5, -0.5, -0.05, -0.05 };
1730 double norm[2] = { 1., 1 };
1731 for (
int adc = 0;
adc < maxgain; ++
adc) {
1742 pad = Can->cd(
adc + 1);
1743 pad->SetTopMargin(0.15);
1770 pad = Can->cd(maxgain +
adc + 1);
1771 pad->SetTopMargin(0.15);
1797 pad = Can->cd(2 * maxgain +
adc + 1);
1798 pad->SetTopMargin(0.15);
1804 if (minchidsp > miny[4 +
adc] + 0.1 * TMath::Abs(miny[4 +
adc]))
m_data->m_finalHistDsp2[
ros][
drawer][
adc][0]->SetMinimum(miny[4 +
adc]);
1809 gStyle->SetPalette(1);
1816 Can->Print(TString(moduleName +
"_dsp_amp.png"),
"png");
1819 Can->Print(TString(moduleName +
"_dsp_amp.ps"),
"ps");
1822 Can->Print(TString(moduleName +
"_dsp_amp.svg"),
"svg");
1824 if (do_plots)
delete Can;
1826 for (
int adc = 0;
adc < maxgain; ++
adc) {
1913 TProfile* prof = hist2d->ProfileX();
1916 TH1S hist(
"hist",
"TMP Histo", prof->GetNbinsX(), prof->GetBinLowEdge(1), prof->GetBinLowEdge(prof->GetNbinsX() + 1));
1917 float lastbin = -99.;
1920 for (
int i = 1;
i < prof->GetNbinsX() + 1;
i++) {
1921 if (prof->GetBinError(
i) > 1
e-7) {
1922 if ((shift < 1.) && ((prof->
GetBinContent(
i) - (lastbin + (
i - lasti))) < -10.)) {
1928 hist.SetBinError(
i, prof->GetBinError(
i));
1931 TF1* polfun =
new TF1(
"polfun",
"pol1", 0., 25.);
1932 hist.Fit(
"polfun",
"NQ");
1934 polfun->SetParameter(0, polfun->GetParameter(0) - 25.);
1955 if (((*headerVec)[dmu] >> 25) & 0
x1) {
1960 if (((*headerVec)[dmu] >> 24) & 0
x1) {
1965 if (((*headerVec)[dmu] >> 23) & 0
x1) {
1981 TCanvas * Can = NULL;
1983 Can =
new TCanvas(
"fit_amp",
"fit_amp", 402 * maxgain, 735);
1985 Can->Divide(maxgain, 5);
1986 gStyle->SetOptStat(0);
1987 gStyle->SetTitleFontSize(0.1);
1989 TLine *
line =
new TLine();
1990 line->SetLineWidth(2);
1991 line->SetLineStyle(7);
1992 line->SetLineColor(3);
1996 double maxy[6] = { 5.0, 0.5, 1.0, 0.05, 25.0, 25.0 };
1997 double miny[6] = { -5.0, -0.5, 0.0, 0.0, -25.0, -25.0 };
2000 TH1F* final_empty[2];
2002 TH1F* final_even[2];
2005 TH1F* pmtGain_empty[2];
2006 TH1F* pmtGain_odd[2];
2007 TH1F* pmtGain_even[2];
2009 for (
int g = 0;
g < 2;
g++) {
2011 std::ostringstream hn;
2012 hn <<
"empty_" <<
g;
2013 final_empty[
g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[
ros][
drawer][
g][0][0]->GetTitle(), 48, 0, 48);
2016 final_odd[
g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[
ros][
drawer][
g][0][0]->GetTitle(), 48, 0, 48);
2019 final_even[
g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[
ros][
drawer][
g][0][0]->GetTitle(), 48, 0, 48);
2024 const char*
gain[2] = {
"low",
"high" };
2025 const char* moduleNames[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
2031 std::ostringstream sStr;
2032 std::string subDir =
"Summary";
2034 sStr << moduleNames[
ros] << std::setfill(
'0') << std::setw(2) <<
drawer + 1 << std::setfill(
' ') <<
gain[
g] <<
"_pmtGain_empty";
2040 sStr << moduleNames[
ros] << std::setfill(
'0') << std::setw(2) <<
drawer + 1 << std::setfill(
' ') <<
gain[
g] <<
"_pmtGain_odd";
2046 sStr << moduleNames[
ros] << std::setfill(
'0') << std::setw(2) <<
drawer + 1 << std::setfill(
' ') <<
gain[
g] <<
"_pmtGain_even";
2053 for (
int adc = 0;
adc < maxgain; ++
adc) {
2067 final_empty[
adc]->SetMaximum(1.05 * max0);
2069 final_empty[
adc]->SetMaximum(0.);
2072 if ((max0 - min0) > 0) {
2073 final_empty[
adc]->SetMinimum(max0 - 1.05 * (max0 - min0));
2079 pad = Can->cd(
adc + 1);
2080 pad->SetTopMargin(0.15);
2085 double Kapa = 1.30e-3;
2086 for (
int ch = 0;
ch < 48; ++
ch) {
2091 pmtGain_empty[
adc]->SetBinError(
ch + 1, 0.01);
2113 pmtGain_even[
adc]->SetBinError(
ch + 1, 0.001);
2128 pmtGain_odd[
adc]->SetBinError(
ch + 1, 0.001);
2136 double max = pmtGain_odd[
adc]->GetMaximum();
2137 if (pmtGain_even[
adc]->GetMaximum() >
max)
max = 1.05 * pmtGain_even[
adc]->GetMaximum();
2138 double min = pmtGain_odd[
adc]->GetMinimum();
2139 if (pmtGain_even[
adc]->GetMinimum() <
min)
min = pmtGain_even[
adc]->GetMinimum() - 0.05 * fabs(pmtGain_even[
adc]->GetMinimum());
2140 if (
max < 0.20)
max = 0.20;
2141 if (
min > -0.10)
min = -0.10;
2143 pmtGain_empty[
adc]->SetMarkerStyle(21);
2144 pmtGain_even[
adc]->SetMarkerStyle(22);
2145 pmtGain_odd[
adc]->SetMarkerStyle(23);
2146 pmtGain_empty[
adc]->SetMarkerSize(
ms);
2147 pmtGain_even[
adc]->SetMarkerSize(
ms);
2148 pmtGain_odd[
adc]->SetMarkerSize(
ms);
2149 pmtGain_empty[
adc]->SetLabelSize(0.08,
"X");
2150 pmtGain_empty[
adc]->SetLabelSize(0.08,
"Y");
2151 pmtGain_even[
adc]->SetMarkerColor(2);
2152 pmtGain_odd[
adc]->SetMarkerColor(4);
2153 pmtGain_empty[
adc]->GetYaxis()->SetRangeUser(
min,
max);
2155 pmtGain_empty[
adc]->Draw(
"e");
2156 pmtGain_even[
adc]->Draw(
"same,e");
2157 pmtGain_odd[
adc]->Draw(
"same,e");
2158 line->DrawLine(0, -0.01, 48, -0.01);
2159 line->DrawLine(0, 0.15, 48, 0.15);
2162 pad = Can->cd(maxgain +
adc + 1);
2163 pad->SetTopMargin(0.15);
2168 if (max0 < 0.9 * maxy[
adc]) final_empty[
adc]->SetMaximum(maxy[
adc]);
2169 if (min0 > miny[
adc] + 0.1 * TMath::Abs(miny[
adc])) final_empty[
adc]->SetMinimum(miny[
adc]);
2171 final_empty[
adc]->SetMarkerStyle(21);
2172 final_even[
adc]->SetMarkerStyle(22);
2173 final_odd[
adc]->SetMarkerStyle(23);
2174 final_empty[
adc]->SetMarkerSize(
ms);
2175 final_even[
adc]->SetMarkerSize(
ms);
2176 final_odd[
adc]->SetMarkerSize(
ms);
2177 final_empty[
adc]->SetLabelSize(0.08,
"X");
2178 final_empty[
adc]->SetLabelSize(0.08,
"Y");
2179 final_even[
adc]->SetMarkerColor(2);
2180 final_odd[
adc]->SetMarkerColor(4);
2182 final_empty[
adc]->Draw(
"e");
2183 final_even[
adc]->Draw(
"same,e");
2184 final_odd[
adc]->Draw(
"same,e");
2187 pad = Can->cd(2 * maxgain +
adc + 1);
2188 pad->SetTopMargin(0.15);
2209 pad = Can->cd(3 * maxgain +
adc + 1);
2210 pad->SetTopMargin(0.15);
2215 if (min3 > miny[4 +
adc] + 0.1 * TMath::Abs(miny[4 +
adc]))
m_data->m_finalHist1[
ros][
drawer][
adc][0][3]->SetMinimum(miny[4 +
adc]);
2226 pad = Can->cd(4 * maxgain +
adc + 1);
2227 pad->SetTopMargin(0.15);
2232 if (min4 > miny[4 +
adc] + 0.1 * TMath::Abs(miny[4 +
adc]))
m_data->m_finalHist1[
ros][
drawer][
adc][0][4]->SetMinimum(miny[4 +
adc]);
2244 Can->Print(TString(moduleName +
"_fit_amp.png"),
"png");
2247 Can->Print(TString(moduleName +
"_fit_amp.ps"),
"ps");
2250 Can->Print(TString(moduleName +
"_fit_amp.svg"),
"svg");
2253 if (do_plots)
delete Can;
2255 for (
int g = 0;
g < 2;
g++) {
2256 delete final_empty[
g];
2257 delete final_odd[
g];
2258 delete final_even[
g];