183 const std::array<std::string, 6> gain{
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
185 std::ostringstream sStr;
187 std::string subDir = moduleName;
188 std::string histName, histTitle;
197 for (
int ch = 0; ch < 48; ++ch) {
202 sStr << std::setfill(
'0') << std::setw(2) << ch << std::setfill(
' ');
204 std::string sCh = sStr.str();
206 for (
int gn = mingain; gn < maxgain; ++gn) {
210 std::string HistName[4] = {
"_amp_ratio_100",
"_amp_ratio_5",
"_time_100",
"_time_5" };
211 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" };
215 sStr << moduleName <<
"_ch_" << sCh << gain[gn] << HistName[
type];
216 histName = sStr.str();
219 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookHists");
220 sStr << moduleName <<
" CH " << ch << gain[3 + gn] << HistTitle[
type];
221 histTitle = sStr.str();
224 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 101, -0.01, 2.01));
226 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 101, -101.0, 101.0));
230 std::string Hist2DName[4] = {
"_amp_vs_q_100",
"_amp_vs_q_5",
"_time_vs_time_100",
"_time_vs_time_5" };
231 std::string Hist2DTitle[4] = {
" amp vs charge 100 pF",
" amp vs charge 5 pF",
" time vs time 100 pF",
" time vs time 5 pF" };
232 float factor_charge =
m_is12bit ? 2. : 1.;
235 float LowX_low2D[4] = { -4., -0.5, -0.25, -0.25 };
236 float HighX_low2D[4] = { 804., 50.5, 25.25, 25.25 };
237 float LowX_hi2D[4] = {
static_cast<float>(-0.0625 * factor_charge),
static_cast<float>(-0.0625 * factor_charge), -0.25, -0.25 };
238 float HighX_hi2D[4] = {
static_cast<float>(12.5625 * factor_charge),
static_cast<float>(12.5625 * factor_charge), 25.25, 25.25 };
239 float LowY_low2D[4] = { -25., -5.3125, -64.0, -64.0 };
240 float HighY_low2D[4] = { 1025., 60.3125, 32.0, 32.0 };
241 float LowY_hi2D[4] = {
static_cast<float>(-25. * factor_adc),
static_cast<float>(-25. * factor_adc), -64.0, -64.0 };
242 float HighY_hi2D[4] = {
static_cast<float>(1025. * factor_adc),
static_cast<float>(1025. * factor_adc), 32.0, 32.0 };
243 float LowY_hi2D_pC[4] = {
static_cast<float>(-.391 * factor_adc),
static_cast<float>(-.391 * factor_adc), -64.0, -64.0 };
244 float HighY_hi2D_pC[4] = {
static_cast<float>(16.02 * factor_adc),
static_cast<float>(16.02 * factor_adc), 32.0, 32.0 };
249 sStr << moduleName <<
"_ch_" << sCh << gain[gn] << Hist2DName[
type];
250 histName = sStr.str();
253 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookHists");
254 sStr << moduleName <<
" CH " << ch << gain[3 + gn] << Hist2DTitle[
type];
255 histTitle = sStr.str();
259 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
260 book2S(subDir, histName, histTitle, 51, LowX_low2D[
type], HighX_low2D[
type], 160, LowY_low2D[
type], HighY_low2D[
type]));
264 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
265 book2S(subDir, histName, histTitle, 51, LowX_hi2D[
type], HighX_hi2D[
type], 160, LowY_hi2D_pC[
type], HighY_hi2D_pC[
type]));
267 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
268 book2S(subDir, histName, histTitle, 51, LowX_hi2D[
type], HighX_hi2D[
type], 160, LowY_hi2D[
type], HighY_hi2D[
type]));
272 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
273 book2S(subDir, histName, histTitle, 51, LowX_hi2D[
type], HighX_hi2D[
type], 160, LowY_hi2D_pC[
type], HighY_hi2D_pC[
type]));
275 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
276 book2S(subDir, histName, histTitle, 51, LowX_hi2D[
type], HighX_hi2D[
type], 160, LowY_hi2D[
type], HighY_hi2D[
type]));
284 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_amp";
285 histName = sStr.str();
288 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookHists");
289 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" amp";
290 histTitle = sStr.str();
295 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 101, -10.1, 10.1));
298 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 101, -0.404, 0.404));
301 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 101, -10.1, 10.1));
307 const Int_t nlg1 = 49;
308 const Int_t nlg2 = 500;
309 const Int_t nlg3 = 1027;
310 std::vector<Double_t> xlgbin(nlg1 + nlg2 + nlg3 + 1);
311 for(Int_t i = 0; i <= nlg1; ++i)
312 xlgbin[i] = -50.5+1.0*i;
313 for(Int_t i = 1; i <= nlg2; ++i)
314 xlgbin[i + nlg1] = -1.5 + 0.05 * i;
315 for(Int_t i = 1; i <= nlg3; ++i)
316 xlgbin[i + nlg1 + nlg2] = 23.5 + 1.0 * i;
317 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1Sx(subDir, histName, histTitle, nlg1 + nlg2 + nlg3, xlgbin.data()));
319 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 1101, -50.5, 1050.5));
324 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 500, -1.5, 23.5));
326 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 826, -1.01, 15.51));
330 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 206, -0.55, 20.05));
332 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 801, -0.5, 800.5));
338 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_time";
339 histName = sStr.str();
342 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookHists");
343 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" time";
344 histTitle = sStr.str();
346 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 201, -100.5, 100.5));
349 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_time_corr";
350 histName = sStr.str();
353 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" time_corr";
354 histTitle = sStr.str();
356 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 201, -100.5, 100.5));
369 const std::array<std::string, 6> gain{
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
372 std::ostringstream sStr;
375 std::string subDir = moduleName;
376 std::string histName, histTitle;
385 for (
int gn = mingain; gn < maxgain; ++gn) {
386 std::string finalsubDir =
"Summary";
388 sStr << moduleName << gain[gn] <<
"_summary_chi2_amp";
389 std::string finalhistName = sStr.str();
392 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookDsp");
393 sStr << moduleName << gain[3 + gn] <<
" Summary chi2 versus amp";
394 std::string finalhistTitle = sStr.str();
398 m_data->m_finalHistDsp2[ros][drawer][gn].push_back(
book2F(finalsubDir, finalhistName, finalhistTitle, 200, -45.1, 855.1, 16, 0., 16.));
401 m_data->m_finalHistDsp2[ros][drawer][gn].push_back(
book2F(finalsubDir, finalhistName, finalhistTitle, 150, -7.0, 12.0, 16, 0., 16.));
405 m_data->m_finalHistDsp2[ros][drawer][gn & 1].push_back(
book2F(subDir, finalhistName, finalhistTitle, 150, -7.005, 7.005, 16, 0., 16.));
408 m_data->m_finalHistDsp2[ros][drawer][gn & 1].push_back(
book2F(subDir, finalhistName, finalhistTitle, 200, -45.1, 855.1, 16, 0., 16.));
414 for (
int ch = 0; ch < 48; ++ch) {
420 sStr << std::setfill(
'0') << std::setw(2) << ch << std::setfill(
' ');
421 std::string sCh = sStr.str();
423 for (
int gn = mingain; gn < maxgain; ++gn) {
426 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp_amp";
427 histName = sStr.str();
430 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookDsp");
431 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp Amp";
432 histTitle = sStr.str();
436 m_data->m_histDsp1[ros][drawer][ch][gn].push_back(
book1F(subDir, histName, histTitle, 491, -50.5, 1049.34));
439 m_data->m_histDsp1[ros][drawer][ch][gn].push_back(
book1F(subDir, histName, histTitle, 413, -1.01, 15.51));
443 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 100, -0.55, 20.05));
445 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 200, -0.5, 800.5));
450 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp_time";
451 histName = sStr.str();
454 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp Time";
455 histTitle = sStr.str();
457 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 101, -100.5, 100.5));
460 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp_chi2";
461 histName = sStr.str();
464 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp Chi2";
465 histTitle = sStr.str();
467 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 16, -0.5, 15.5));
470 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp-fit_amp_diff";
471 histName = sStr.str();
474 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp-OF Amp difference";
475 histTitle = sStr.str();
477 auto ix = (gn < 2) ? gn : (gn & 1);
478 m_data->m_histDsp1[ros][drawer][ch][ix].push_back(
book1F(subDir, histName, histTitle, 404, -1.01, 1.01));
481 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp-fit_time_diff";
482 histName = sStr.str();
485 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp-OF Time diff";
486 histTitle = sStr.str();
488 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 101, -2.02, 2.02));
491 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_chi2_amp";
492 histName = sStr.str();
495 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp Chi2 versus Amp";
496 histTitle = sStr.str();
500 m_data->m_histDsp2[ros][drawer][ch][gn].push_back(
book2F(subDir, histName, histTitle, 200, -45.1, 855.1, 16, 0., 16.));
503 m_data->m_histDsp2[ros][drawer][ch][gn].push_back(
book2F(subDir, histName, histTitle, 150, -7.0, 12.0, 16, 0., 16.));
507 m_data->m_histDsp2[ros][drawer][ch][gn & 1].push_back(
book2F(subDir, histName, histTitle, 150, -7.005, 7.005, 16, 0., 16.));
509 m_data->m_histDsp2[ros][drawer][ch][gn & 1].push_back(
book2F(subDir, histName, histTitle, 200, -45.1, 855.1, 16, 0., 16.));
532 if (
evtStore()->retrieve(eventInfo).isSuccess()) {
546 for (; collItr2 != lastColl2; ++collItr2) {
550 if (digitsItr != lastDigits) {
555 std::vector<uint32_t> headerVec = (*collItr2)->getFragChipHeaderWords();
556 int headsize = headerVec.size();
557 if (headsize > 16) headsize = 16;
559 int fragId = (*collItr2)->identify();
562 for (
int dmu = 0; dmu < headsize; dmu++) {
568 for (
int dmu = 0; dmu < headsize; dmu++) {
569 m_corrup[ros][drawer][0][dmu] =
false;
570 m_corrup[ros][drawer][1][dmu] =
false;
574 for (
int dmu = headsize; dmu < 16; dmu++) {
575 m_corrup[ros][drawer][0][dmu] =
false;
576 m_corrup[ros][drawer][1][dmu] =
false;
591 double avgTimePerPart[5], sumTimeCh[5];
593 for (
int iros = 0; iros < 5; iros++) {
594 avgTimePerPart[iros] = 0;
600 for (
int k = 0; k < 2; k++) {
605 for (; collItr != lastColl; ++collItr) {
607 int cap = (
m_cispar[7] > 10) ? 0 : 1;
610 double hg_small_charge = 1.;
611 double lg_small_charge = (cap) ? 10. : 15.;
612 double hg_charge_cut = 11.5;
613 double lg_charge_cut = 750.;
615 int fragId = (*collItr)->identify();
618 if (runNum <= 494800 || runNum >= 555555) {
619 hg_small_charge *= 2.;
625 double timeInj =
m_cispar[5] * 0.104;
630 if (chItr != lastCh) {
637 if (
m_data->m_hist1[ros][drawer][0][0].size() == 0) {
644 std::vector<double> efitVec(
m_bigain ? 96 : 48, 0.), tfitVec(
m_bigain ? 96 : 48, 0.);
646 for (; chItr != lastCh; ++chItr) {
651 unsigned int chan =
m_tileHWID->channel(adc_id);
685 efitVec[chan + gain * 48] = amp;
686 double time = rch->
time();
688 tfitVec[chan + gain * 48] = time;
690 if (!
m_corrup[ros][drawer][gain][chan / 3]) {
695 m_data->m_hist2[ros][drawer][chan][gain][cap]->Fill(
charge, amp);
699 if ( ( (adc == 1) && (
charge < hg_charge_cut) && (
charge > hg_small_charge) ) ||
700 ( (adc == 0) && (
charge < lg_charge_cut) && (
charge > lg_small_charge) ) ) {
702 double ratio = amp /
charge;
704 m_data->m_hist1[ros][drawer][chan][gain][0 + cap]->Fill(ratio);
705 m_data->m_hist1[ros][drawer][chan][gain][2 + cap]->Fill(time);
707 m_data->m_hist2[ros][drawer][chan][gain][cap + 2]->Fill(timeInj, time);
715 ++
m_data->m_timeCov[ros][drawer][chan][gain][cap][5];
720 m_data->m_hist1[ros][drawer][chan][gain][0]->Fill(amp, 1.0);
723 m_data->m_hist1[ros][drawer][chan][gain][1]->Fill(time, 1.0);
726 m_data->m_timeCov[ros][drawer][chan][gain][0][0] += amp;
727 m_data->m_timeCov[ros][drawer][chan][gain][0][1] += amp * amp;
728 m_data->m_timeCov[ros][drawer][chan][gain][0][2] += time;
729 m_data->m_timeCov[ros][drawer][chan][gain][0][3] += time * time;
731 ++
m_data->m_timeCov[ros][drawer][chan][gain][0][5];
744 if ((ros == 3 || ros == 4)
745 && (chan == 0 || chan == 1 || chan == 2 || chan == 3 || chan == 4 || chan == 5 || chan == 12 || chan == 13 || chan == 18
748 sumTimeCh[ros] += time;
757 timeCorr = time - avgTimePerPart[ros];
758 m_data->m_hist1[ros][drawer][chan][gain][2]->Fill(timeCorr, 1.0);
760 m_data->m_timeCovCorr[ros][drawer][chan][gain][0][0] += timeCorr;
761 m_data->m_timeCovCorr[ros][drawer][chan][gain][0][1] += timeCorr * timeCorr;
762 ++
m_data->m_timeCovCorr[ros][drawer][chan][gain][0][2];
774 m_efitMap.insert(make_pair(ros * 100 + drawer, efitVec));
775 m_tfitMap.insert(make_pair(ros * 100 + drawer, tfitVec));
782 for (
int iros = 0; iros < 5; iros++) {
783 if (nCh[iros] != 0) {
784 avgTimePerPart[iros] = sumTimeCh[iros] / nCh[iros];
786 avgTimePerPart[iros] = 0;
809 return StatusCode::SUCCESS;
827 for (; collItr != lastColl; ++collItr) {
832 if (chItr != lastCh) {
838 if (
m_data->m_histDsp1[ros][drawer][0][0].size() == 0) {
843 for (; chItr != lastCh; ++chItr) {
848 unsigned int chan =
m_tileHWID->channel(adc_id);
854 && !
m_corrup[ros][drawer][gain][chan / 3]) {
880 double time = rch->
time();
883 m_data->m_histDsp1[ros][drawer][chan][gain][
Edsp]->Fill(amp, 1.0);
884 m_data->m_histDsp1[ros][drawer][chan][gain][
Tdsp]->Fill(time, 1.0);
886 m_data->m_histDsp2[ros][drawer][chan][gain][0]->Fill(amp,
chi2, 1.0);
887 m_data->m_finalHistDsp2[ros][drawer][gain][0]->Fill(amp,
chi2, 1.0);
889 std::map<int, std::vector<double> >
::iterator it = efitMap.find(ros * 100 + drawer);
890 if (it != efitMap.end()) {
891 double efit = (*it).second.at(chan + gain * 48);
892 it = tfitMap.find(ros * 100 + drawer);
893 if (it != tfitMap.end()) {
894 double tfit = (*it).second.at(chan + gain * 48);
897 m_data->m_histDsp1[ros][drawer][chan][gain][
Edsp_fit]->Fill((amp - efit) / efit, 1.0);
901 m_data->m_histDsp1[ros][drawer][chan][gain][
Tdsp_fit]->Fill((time - tfit), 1.0);
912 return StatusCode::SUCCESS;
924 const std::array<std::string, 6> gain = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
931 std::ostringstream sStr;
935 const char *HistName[6] = {
"_tslope",
"_toffset",
"_qratio",
" Time slope",
" Time offset",
" Amp/Q ratio" };
936 const char *CapName[4] = {
"_100",
"_5",
" 100 pF",
" 5 pF" };
940 std::string subDir =
"Summary";
941 std::string histName, histTitle;
943 for (
int gn = mingain; gn < maxgain; ++gn) {
945 for (
int cap = 0; cap < 2; ++cap) {
949 sStr << moduleName << gain[gn] << HistName[
type] << CapName[cap];
950 histName = sStr.str();
952 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookSummaryHistograms");
953 sStr << moduleName << gain[3 + gn] << HistName[3 +
type] << CapName[2 + cap];
954 histTitle = sStr.str();
955 m_data->m_finalHist1[ros][drawer][adc][cap].push_back(
book1F(subDir, histName, histTitle, 48, 0, 48));
961 const char *HistName[10] = {
"_amp",
"_rms",
"_sigma",
"_time",
"_time_corr",
" Amplitude",
" RMS of amplitude",
" Sigma amp from Gaussian fit",
962 " Average time and RMS",
" Average time corr. and RMS" };
966 std::string subDir =
"Summary";
967 std::string histName, histTitle;
969 for (
int gn = mingain; gn < maxgain; ++gn) {
977 sStr << moduleName << gain[gn] << HistName[
type];
978 histName = sStr.str();
980 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookSummaryHistograms");
981 sStr << moduleName << gain[3 + gn] << HistName[5 +
type];
982 histTitle = sStr.str();
983 m_data->m_finalHist1[ros][drawer][adc][0].push_back(
book1F(subDir, histName, histTitle, 48, 0.0, 48.0));
985 std::string hTitle(histTitle);
989 hTitle +=
" (Even PMTs)";
990 m_data->m_summaryPmts[ros][drawer][adc][0].push_back(
book1F(subDir +
"/pmt", histName +
"_pmt_even", hTitle, 49, -0.5, 48.5));
991 m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerStyle(22);
992 m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerColor(2);
993 m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerSize(0.75);
996 hTitle +=
" (Odd PMTs)";
997 m_data->m_summaryPmts[ros][drawer][adc][1].push_back(
book1F(subDir +
"/pmt", histName +
"_pmt_odd", hTitle, 49, -0.5, 48.5));
998 m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerStyle(23);
999 m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerColor(4);
1000 m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerSize(0.75);
1002 if (ros < 3 && m_data->m_summaryPmts[0][drawer][adc][0].size() < (
unsigned int)(
type + 1)) {
1004 histName.replace(histName.begin(), histName.begin() + 3,
"LB");
1005 histTitle.replace(histTitle.begin(), histTitle.begin() + 3,
"LB");
1008 hTitle +=
" (LBA even PMTs + LBC odd PMTs: negative)";
1009 m_data->m_summaryPmts[0][drawer][adc][0].push_back(
book1F(subDir +
"/pmt", histName +
"_pmt_LBA-even_LBC-odd", hTitle, 97, -48.5, 48.5));
1010 m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerStyle(22);
1011 m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerColor(2);
1012 m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerSize(0.75);
1015 hTitle +=
" (LBA odd PMTs + LBC even PMTs: negative)";
1016 m_data->m_summaryPmts[0][drawer][adc][1].push_back(
book1F(subDir +
"/pmt", histName +
"_pmt_LBA-odd_LBC-even", hTitle, 97, -48.5, 48.5));
1017 m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerStyle(23);
1018 m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerColor(4);
1019 m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerSize(0.75);
1065 TF1 * fit_gaus =
new TF1(
"g",
"gaus");
1073 for (
int ros = 1; ros < 5; ++ros) {
1074 for (
int drawer = 0; drawer < 64; ++drawer) {
1075 if (
m_data->m_hist1[ros][drawer][0][0].size() != 0) {
1076 for (
int gn = mingain; gn < maxgain; ++gn) {
1079 for (
int cap = 0; cap < 2; ++cap) {
1080 for (
int ch = 0; ch < 48; ++ch) {
1087 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinContent(ch + 1, polyfunc->GetParameter(1));
1088 if (polyfunc->GetParError(1) > 5) {
1089 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, 5.);
1091 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, polyfunc->GetParError(1));
1093 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinContent(ch + 1, polyfunc->GetParameter(0));
1094 if (polyfunc->GetParError(0) > 5) {
1095 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, 5.);
1097 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, polyfunc->GetParError(0));
1104 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinContent(ch + 1, 0.);
1105 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, 0.);
1106 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinContent(ch + 1, 0.);
1107 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, 0.);
1110 TH1S * hist =
m_data->m_hist1[ros][drawer][ch][adc][cap];
1111 int nbins = hist->GetNbinsX();
1113 for (; minbin < nbins; ++minbin) {
1114 if (hist->GetBinContent(minbin) > 0.0) {
1119 for (; maxbin > 1; --maxbin) {
1120 if (hist->GetBinContent(maxbin) > 0.0) {
1125 double mean = hist->GetMean();
1126 double xmin = hist->GetBinCenter(minbin);
1127 double xmax = hist->GetBinCenter(maxbin);
1141 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetBinContent(ch + 1,
mean);
1156 for (
int ros = 1; ros < 5; ++ros) {
1157 for (
int drawer = 0; drawer < 64; ++drawer) {
1158 if (
m_data->m_hist1[ros][drawer][0][0].size() != 0) {
1159 for (
int gn = mingain; gn < maxgain; ++gn) {
1162 for (
int ch = 0; ch < 48; ++ch) {
1166 double Amp = 0.0, ErrA = 0.0, RMS = 0.0, ErrR = 0.0;
1167 double Time = 0.0, RMST = 0.0, Sigma = 0.0, ErrS = 0.0;
1168 double NEvents =
m_data->m_timeCov[ros][drawer][ch][adc][0][5];
1170 double TimeCorr = 0.0, RMSTCorr = 0.0;
1171 double NEventsCorr =
m_data->m_timeCovCorr[ros][drawer][ch][adc][0][2];
1173 if (NEvents > 0.0) {
1175 Amp =
m_data->m_timeCov[ros][drawer][ch][adc][0][0] / NEvents;
1176 RMS =
m_data->m_timeCov[ros][drawer][ch][adc][0][1] / NEvents - Amp * Amp;
1179 ErrA = RMS / sqrt(NEvents);
1180 ErrR = RMS / sqrt(2 * NEvents);
1185 Time =
m_data->m_timeCov[ros][drawer][ch][adc][0][2] / NEvents;
1186 RMST =
m_data->m_timeCov[ros][drawer][ch][adc][0][3] / NEvents - Time * Time;
1195 if (NEventsCorr > 0.0) {
1196 TimeCorr =
m_data->m_timeCovCorr[ros][drawer][ch][adc][0][0] / NEventsCorr;
1197 RMSTCorr =
m_data->m_timeCovCorr[ros][drawer][ch][adc][0][1] / NEventsCorr - TimeCorr * TimeCorr;
1198 if (RMSTCorr > 0.0) {
1199 RMSTCorr = sqrt(RMSTCorr);
1206 if (
m_data->m_hist1[ros][drawer][ch][adc][0]->GetEntries() > 0) {
1208 TH1S *h4fit=
new TH1S(*(
m_data->m_hist1[ros][drawer][ch][adc][0]));
1209 h4fit->Scale(1,
"width");
1210 h4fit->Fit(
"g",
"NQ");
1213 m_data->m_hist1[ros][drawer][ch][adc][0]->Fit(
"g",
"NQ");
1215 Sigma = fit_gaus->GetParameter(2);
1216 ErrS = fit_gaus->GetParError(2);
1219 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetBinContent(ch + 1, Amp);
1220 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetBinError(ch + 1, ErrA);
1221 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetBinContent(ch + 1, RMS);
1222 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetBinError(ch + 1, ErrR);
1223 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetBinContent(ch + 1, Sigma);
1224 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetBinError(ch + 1, ErrS);
1225 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetBinContent(ch + 1, Time);
1226 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetBinError(ch + 1, RMST);
1227 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetBinContent(ch + 1, TimeCorr);
1228 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetBinError(ch + 1, RMSTCorr);
1232 int pmt =
m_cabling->channel2hole(ros, ch);
1233 if (pmt < 0)
continue;
1235 int fiber = (pmt % 2);
1237 m_data->m_summaryPmts[ros][drawer][adc][fiber][0]->SetBinContent(pmt + 1, Amp);
1238 m_data->m_summaryPmts[ros][drawer][adc][fiber][0]->SetBinError(pmt + 1, ErrA);
1239 m_data->m_summaryPmts[ros][drawer][adc][fiber][1]->SetBinContent(pmt + 1, RMS);
1240 m_data->m_summaryPmts[ros][drawer][adc][fiber][1]->SetBinError(pmt + 1, ErrR);
1241 m_data->m_summaryPmts[ros][drawer][adc][fiber][2]->SetBinContent(pmt + 1, Sigma);
1242 m_data->m_summaryPmts[ros][drawer][adc][fiber][2]->SetBinError(pmt + 1, ErrS);
1243 m_data->m_summaryPmts[ros][drawer][adc][fiber][3]->SetBinContent(pmt + 1, Time);
1244 m_data->m_summaryPmts[ros][drawer][adc][fiber][3]->SetBinError(pmt + 1, RMST);
1245 m_data->m_summaryPmts[ros][drawer][adc][fiber][4]->SetBinContent(pmt + 1, TimeCorr);
1246 m_data->m_summaryPmts[ros][drawer][adc][fiber][4]->SetBinError(pmt + 1, RMSTCorr);
1250 int bin =
m_data->m_summaryPmts[0][drawer][adc][fiber][0]->FindBin(pmt);
1252 m_data->m_summaryPmts[0][drawer][adc][fiber][0]->SetBinContent(
bin, Amp);
1253 m_data->m_summaryPmts[0][drawer][adc][fiber][0]->SetBinError(
bin, ErrA);
1254 m_data->m_summaryPmts[0][drawer][adc][fiber][1]->SetBinContent(
bin, RMS);
1255 m_data->m_summaryPmts[0][drawer][adc][fiber][1]->SetBinError(
bin, ErrR);
1256 m_data->m_summaryPmts[0][drawer][adc][fiber][2]->SetBinContent(
bin, Sigma);
1257 m_data->m_summaryPmts[0][drawer][adc][fiber][2]->SetBinError(
bin, ErrS);
1258 m_data->m_summaryPmts[0][drawer][adc][fiber][3]->SetBinContent(
bin, Time);
1259 m_data->m_summaryPmts[0][drawer][adc][fiber][3]->SetBinError(
bin, RMST);
1260 m_data->m_summaryPmts[0][drawer][adc][fiber][4]->SetBinContent(
bin, TimeCorr);
1261 m_data->m_summaryPmts[0][drawer][adc][fiber][4]->SetBinError(
bin, RMSTCorr);
1267 int bin =
m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->FindBin(-pmt);
1269 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->SetBinContent(
bin, Amp);
1270 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->SetBinError(
bin, ErrA);
1271 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][1]->SetBinContent(
bin, RMS);
1272 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][1]->SetBinError(
bin, ErrR);
1273 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][2]->SetBinContent(
bin, Sigma);
1274 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][2]->SetBinError(
bin, ErrS);
1275 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][3]->SetBinContent(
bin, Time);
1276 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][3]->SetBinError(
bin, RMST);
1277 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][4]->SetBinContent(
bin, TimeCorr);
1278 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][4]->SetBinError(
bin, RMSTCorr);
1301 return StatusCode::SUCCESS;
1335 if (
m_data->m_histDsp1[ros][drawer][0][0].size() != 0) {
1340 unsigned int iteration = 0u;
1343 uint32_t info = RawChannelCntDsp->
get_bsflags() >> 24u;
1344 iteration = info & 3u;
1351 const char *alg_name[2] = {
"OF1",
"OF2" };
1352 const char * iter_name[4] = {
"NI",
"I1",
"I2",
"I3" };
1354 const char *part[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
1355 const char *gain[4] = {
"_lo",
"_hi",
" low gain",
" high gain" };
1363 const char *HistName[9] = {
"_dspfit_ampdiff",
"_dspfit_timediff",
"_dspamp",
" Avg. (DSP-",
" Average DSP-",
" Average DSP-",
1364 " - OFF-OF2-I) / OFF Amplitudes and RMS",
" - OFF-OF2-I Time and RMS",
" Amplitudes and RMS" };
1366 std::ostringstream sStr;
1367 sStr << part[ros] << std::setfill(
'0') << std::setw(2) << drawer + 1 << std::setfill(
' ');
1368 std::string moduleName = sStr.str();
1369 std::string subDir =
"Summary";
1370 std::string histName, histTitle;
1372 for (
int gn = mingain; gn < maxgain; ++gn) {
1378 sStr << moduleName << gain[gn] << HistName[
type];
1379 histName = sStr.str();
1381 sStr << moduleName << gain[2 + gn] << HistName[3 +
type] << alg_name[
algorithm] <<
"-" << iter_name[iteration] << HistName[6 +
type];
1382 histTitle = sStr.str();
1383 m_data->m_finalHistDsp1[ros][drawer][adc].push_back(
book1F(subDir, histName, histTitle, 48, 0.0, 48.0));
1388 sStr << moduleName << gain[gn] <<
"_dspfit_amphbar";
1389 histName = sStr.str();
1391 sStr << moduleName << gain[2 + gn] <<
" (DSP-" << alg_name[
algorithm] <<
"-" << iter_name[iteration]
1392 <<
" - OFF-OF2-I) divided by OFF Amplitudes for all chans";
1393 histTitle = sStr.str();
1394 m_data->m_hBarDsp1[ros][drawer][adc].push_back(
book1F(subDir, histName, histTitle, 404, -1.01, 1.01));
1397 sStr << moduleName << gain[gn] <<
"_dspfit_timehbar";
1398 histName = sStr.str();
1400 sStr << moduleName << gain[2 + gn] <<
" (DSP-" << alg_name[
algorithm] <<
"-" << iter_name[iteration] <<
" - OFF-OF2-I) Time for all chans";
1401 histTitle = sStr.str();
1402 m_data->m_hBarDsp1[ros][drawer][adc].push_back(
book1F(subDir, histName, histTitle, 101, -2.02, 2.02));
1404 for (
int ch = 0; ch < 48; ++ch) {
1407 if (
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp_fit]->GetEntries() > 0) {
1408 double dspmean =
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp]->GetMean();
1409 double dsprms =
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp]->GetRMS();
1410 double emean =
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp_fit]->GetMean();
1411 double erms =
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp_fit]->GetRMS();
1412 double tmean =
m_data->m_histDsp1[ros][drawer][ch][adc][
Tdsp_fit]->GetMean();
1413 double trms =
m_data->m_histDsp1[ros][drawer][ch][adc][
Tdsp_fit]->GetRMS();
1415 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp]->SetBinContent(ch + 1, dspmean);
1416 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp]->SetBinError(ch + 1, dsprms);
1417 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetBinContent(ch + 1, emean);
1418 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetBinError(ch + 1, erms);
1419 m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetBinContent(ch + 1, tmean);
1420 m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetBinError(ch + 1, trms);
1430 drawDsp(ros, drawer, moduleName);
1434 return StatusCode::SUCCESS;
1455 double ms = (
m_bigain) ? 0.75 : 1.0;
1463 for (
int i = 0; i < 48; i++) {
1464 X_axis[i] = i + 0.5;
1468 const char *gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
1469 const char *CapName[4] = {
"_100",
"_5",
" 100 pF",
" 5 pF" };
1470 if (maxgain == 1) gain[0] = gain[1] = gain[2] = gain[3] = gain[4] = gain[5];
1477 TCanvas * Can = NULL;
1479 Can =
new TCanvas(
"amp_ratio",
"amp_ratio", 402 * maxgain, 588);
1480 Can->Divide(maxgain, 2);
1481 gStyle->SetOptStat(0);
1482 gStyle->SetTitleFontSize(0.1);
1485 TLine line(0., 1., 48., 1.);
1486 line.SetLineColor(3);
1488 std::string subDir =
"Summary";
1489 std::vector<TGraphAsymmErrors*> grapherrVec;
1491 for (
int adc = 0; adc < maxgain; ++adc) {
1492 for (
int cap = 0; cap < 2; ++cap) {
1494 std::ostringstream sStr;
1495 sStr << moduleName << gain[adc] <<
"_tails" << CapName[cap];
1496 std::string graphName = sStr.str();
1498 sStr << moduleName << gain[adc + 3] <<
" Mean Amp/Q ratio and up/down tails " << CapName[2 + cap];
1499 std::string graphTitle = sStr.str();
1503 pad = Can->cd(cap * maxgain + adc + 1);
1504 pad->SetTopMargin(0.15);
1508 TGraphAsymmErrors * final_Egraph =
bookGraphAsymmErrors(subDir, graphName, graphTitle, 48, X_axis,
m_data->m_rangeQ[adc][cap][0], X_errors, X_errors,
1509 m_data->m_rangeQ[adc][cap][1],
m_data->m_rangeQ[adc][cap][2]);
1510 grapherrVec.push_back(final_Egraph);
1512 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetStats(kFALSE);
1513 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMarkerStyle(21);
1514 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMarkerSize(ms);
1515 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetLabelSize(0.06,
"X");
1516 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetLabelSize(0.06,
"Y");
1517 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMaximum(2.2);
1518 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMinimum(-0.2);
1519 if (do_plots)
m_data->m_finalHist1[ros][drawer][adc][cap][2]->Draw(
"P0");
1521 final_Egraph->SetMarkerStyle(21);
1522 final_Egraph->SetMarkerSize(ms);
1523 final_Egraph->SetMaximum(2.2);
1524 final_Egraph->SetMinimum(-0.2);
1525 final_Egraph->GetXaxis()->SetRangeUser(0, 48);
1527 final_Egraph->Draw(
"P0");
1535 Can->Print(TString(moduleName +
"_amp_ratio.png"),
"png");
1538 Can->Print(TString(moduleName +
"_amp_ratio.ps"),
"ps");
1541 Can->Print(TString(moduleName +
"_amp_ratio.svg"),
"svg");
1543 if (do_plots)
delete Can;
1547 std::vector<TGraphAsymmErrors*>::const_iterator it = grapherrVec.begin();
1548 std::vector<TGraphAsymmErrors *>::const_iterator itend = grapherrVec.end();
1549 for (; it != itend; ++it) {
1555 Can =
new TCanvas(
"fit_time",
"fit_time", 402 * maxgain, 588);
1556 Can->Divide(maxgain, 4);
1557 gStyle->SetOptStat(0);
1558 gStyle->SetTitleFontSize(0.1);
1561 double maxy[2] = { 1.4, 15.0 };
1562 double miny[2] = { -0.1, -15.0 };
1564 for (
int adc = 0; adc < maxgain; ++adc) {
1565 for (
int cap = 0; cap < 2; ++cap) {
1570 pad = Can->cd((
type + cap * 2) * maxgain + adc + 1);
1571 pad->SetTopMargin(0.15);
1575 if (
m_data->m_finalHist1[ros][drawer][adc][cap][
type]->GetMaximum() < 0.9 * maxy[
type])
1576 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetMaximum(maxy[
type]);
1577 if (
m_data->m_finalHist1[ros][drawer][adc][cap][
type]->GetMinimum() > (miny[
type] + 0.1 * TMath::Abs(miny[
type])))
1578 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetMinimum(miny[
type]);
1580 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetMarkerStyle(21);
1581 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetMarkerSize(ms);
1582 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetLabelSize(0.10,
"X");
1583 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetLabelSize(0.10,
"Y");
1585 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->Draw(
"P0");
1587 line.SetLineColor(3);
1595 Can->Print(TString(moduleName +
"_fit_time.png"),
"png");
1598 Can->Print(TString(moduleName +
"_fit_time.ps"),
"ps");
1601 Can->Print(TString(moduleName +
"_fit_time.svg"),
"svg");
1603 if (do_plots)
delete Can;
1610 TCanvas * Can = NULL;
1612 Can =
new TCanvas(
"fit_amp",
"fit_amp", 402 * maxgain, 588);
1613 Can->Divide(maxgain, 3);
1614 gStyle->SetOptStat(0);
1615 gStyle->SetTitleFontSize(0.1);
1618 double maxy[6] = { 1.0, 0.05, 1.0, 0.05, 25.0, 25.0 };
1619 double miny[6] = { -1.0, -0.05, 0.0, 0.0, -25.0, -25.0 };
1621 for (
int adc = 0; adc < maxgain; ++adc) {
1623 double max0 =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMaximum();
1624 double max1 =
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum();
1625 double max2 =
m_data->m_finalHist1[ros][drawer][adc][0][2]->GetMaximum();
1626 double max3 =
m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMaximum();
1627 double min0 =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMinimum();
1628 double min1 =
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum();
1629 double min2 =
m_data->m_finalHist1[ros][drawer][adc][0][2]->GetMinimum();
1630 double min3 =
m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMinimum();
1634 pad = Can->cd(adc + 1);
1635 pad->SetTopMargin(0.15);
1639 if (max0 < 0.9 * maxy[adc])
m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMaximum(maxy[adc]);
1640 if (min0 > (miny[adc] + 0.1 * TMath::Abs(miny[adc])))
m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMinimum(miny[adc]);
1642 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMarkerStyle(21);
1643 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMarkerSize(ms);
1644 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetLabelSize(0.08,
"X");
1645 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetLabelSize(0.08,
"Y");
1647 m_data->m_finalHist1[ros][drawer][adc][0][0]->Draw(
"E0");
1651 pad = Can->cd(maxgain + adc + 1);
1652 pad->SetTopMargin(0.15);
1657 if (max1 < maxy[2 + adc]) {
1658 if (max2 < maxy[2 + adc])
1659 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(maxy[2 + adc]);
1661 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(max2);
1663 if (max1 < max2)
m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(max2);
1666 if (min1 > miny[2 + adc]) {
1667 if (min2 > miny[2 + adc])
1668 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(miny[2 + adc]);
1670 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(min2);
1672 if (min1 > min2)
m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(min2);
1675 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerStyle(21);
1676 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerSize(ms);
1677 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08,
"X");
1678 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08,
"Y");
1680 m_data->m_finalHist1[ros][drawer][adc][0][1]->Draw(
"P0");
1683 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMaximum(
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum());
1684 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMinimum(
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum());
1685 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerStyle(25);
1686 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerSize(ms);
1687 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerColor(4);
1688 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08,
"X");
1689 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08,
"Y");
1691 m_data->m_finalHist1[ros][drawer][adc][0][2]->Draw(
"sameP0");
1695 pad = Can->cd(2 * maxgain + adc + 1);
1696 pad->SetTopMargin(0.15);
1700 if (max3 < 0.9 * maxy[4 + adc])
m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMaximum(maxy[4 + adc]);
1701 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 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerStyle(21);
1704 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerSize(ms);
1705 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08,
"X");
1706 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08,
"Y");
1708 m_data->m_finalHist1[ros][drawer][adc][0][3]->Draw(
"E0");
1714 Can->Print(TString(moduleName +
"_fit_amp.png"),
"png");
1717 Can->Print(TString(moduleName +
"_fit_amp.ps"),
"ps");
1720 Can->Print(TString(moduleName +
"_fit_amp.svg"),
"svg");
1722 if (do_plots)
delete Can;
1731 MsgStream log(msgSvc(), name());
1733 double ms = (
m_bigain) ? 0.75 : 1.0;
1736 TCanvas * Can = NULL;
1738 Can =
new TCanvas(
"dsp_amp",
"dsp_amp", 402 * maxgain, 588);
1739 Can->Divide(maxgain, 3);
1740 gStyle->SetOptStat(0);
1741 gStyle->SetTitleFontSize(0.1);
1744 TLine line(0., 0., 48., 0.);
1745 line.SetLineColor(3);
1747 double maxy[6] = { 0.05, 0.05, 0.5, 0.5, 10.0, 10.0 };
1748 double miny[6] = { -0.05, -0.05, -0.5, -0.5, -0.05, -0.05 };
1749 double norm[2] = { 1., 1 };
1750 for (
int adc = 0; adc < maxgain; ++adc) {
1752 double maxEdsp =
m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->GetMaximum();
1753 double minEdsp =
m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->GetMinimum();
1754 double maxTdsp =
m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->GetMaximum();
1755 double minTdsp =
m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->GetMinimum();
1756 double maxchidsp =
m_data->m_finalHistDsp2[ros][drawer][adc][0]->GetMaximum();
1757 double minchidsp =
m_data->m_finalHistDsp2[ros][drawer][adc][0]->GetMinimum();
1761 pad = Can->cd(adc + 1);
1762 pad->SetTopMargin(0.15);
1766 if (maxEdsp < 0.9 * maxy[adc])
m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetMaximum(maxy[adc]);
1767 if (minEdsp > miny[adc] + 0.1 * TMath::Abs(miny[adc]))
m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetMinimum(miny[adc]);
1771 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetLabelSize(0.08,
"X");
1772 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetLabelSize(0.08,
"Y");
1789 pad = Can->cd(maxgain + adc + 1);
1790 pad->SetTopMargin(0.15);
1794 if (maxTdsp < 0.9 * maxy[2 + adc])
m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetMaximum(maxy[2 + adc]);
1795 if (minTdsp > miny[2 + adc] + 0.1 * TMath::Abs(miny[2 + adc]))
m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetMinimum(miny[2 + adc]);
1799 m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetLabelSize(0.08,
"X");
1800 m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetLabelSize(0.08,
"Y");
1816 pad = Can->cd(2 * maxgain + adc + 1);
1817 pad->SetTopMargin(0.15);
1822 if (maxchidsp < 0.9 * maxy[4 + adc])
m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetMaximum(maxy[4 + adc]);
1823 if (minchidsp > miny[4 + adc] + 0.1 * TMath::Abs(miny[4 + adc]))
m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetMinimum(miny[4 + adc]);
1825 m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetLabelSize(0.08,
"X");
1826 m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetLabelSize(0.08,
"Y");
1828 gStyle->SetPalette(1);
1829 m_data->m_finalHistDsp2[ros][drawer][adc][0]->Draw(
"zcol");
1835 Can->Print(TString(moduleName +
"_dsp_amp.png"),
"png");
1838 Can->Print(TString(moduleName +
"_dsp_amp.ps"),
"ps");
1841 Can->Print(TString(moduleName +
"_dsp_amp.svg"),
"svg");
1843 if (do_plots)
delete Can;
1845 for (
int adc = 0; adc < maxgain; ++adc) {
2000 TCanvas * Can = NULL;
2002 Can =
new TCanvas(
"fit_amp",
"fit_amp", 402 * maxgain, 735);
2004 Can->Divide(maxgain, 5);
2005 gStyle->SetOptStat(0);
2006 gStyle->SetTitleFontSize(0.1);
2008 TLine *line =
new TLine();
2009 line->SetLineWidth(2);
2010 line->SetLineStyle(7);
2011 line->SetLineColor(3);
2013 float ms = (
m_bigain) ? 0.75 : 1.0;
2015 double maxy[6] = { 5.0, 0.5, 1.0, 0.05, 25.0, 25.0 };
2016 double miny[6] = { -5.0, -0.5, 0.0, 0.0, -25.0, -25.0 };
2019 TH1F* final_empty[2];
2021 TH1F* final_even[2];
2024 TH1F* pmtGain_empty[2];
2025 TH1F* pmtGain_odd[2];
2026 TH1F* pmtGain_even[2];
2028 for (
int g = 0; g < 2; g++) {
2030 std::ostringstream hn;
2031 hn <<
"empty_" << g;
2032 final_empty[g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2035 final_odd[g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2038 final_even[g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2043 const char* gain[2] = {
"low",
"high" };
2044 const char* moduleNames[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
2046 title = Form(
"%s0%i %s gain, Variance/Mean", moduleNames[ros], drawer + 1, gain[g]);
2048 title = Form(
"%s%i %s gain, Variance/Mean", moduleNames[ros], drawer + 1, gain[g]);
2050 std::ostringstream sStr;
2051 std::string subDir =
"Summary";
2053 sStr << moduleNames[ros] << std::setfill(
'0') << std::setw(2) << drawer + 1 << std::setfill(
' ') << gain[g] <<
"_pmtGain_empty";
2054 std::string histName = sStr.str();
2055 pmtGain_empty[g] =
book1F(subDir, histName, title, 48, 0.0, 48.0);
2059 sStr << moduleNames[ros] << std::setfill(
'0') << std::setw(2) << drawer + 1 << std::setfill(
' ') << gain[g] <<
"_pmtGain_odd";
2060 histName = sStr.str();
2061 pmtGain_odd[g] =
book1F(subDir, histName, title, 48, 0.0, 48.0);
2065 sStr << moduleNames[ros] << std::setfill(
'0') << std::setw(2) << drawer + 1 << std::setfill(
' ') << gain[g] <<
"_pmtGain_even";
2066 histName = sStr.str();
2067 pmtGain_even[g] =
book1F(subDir, histName, title, 48, 0.0, 48.0);
2072 for (
int adc = 0; adc < maxgain; ++adc) {
2074 double max0 =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMaximum();
2077 double max3 =
m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMaximum();
2078 double max4 =
m_data->m_finalHist1[ros][drawer][adc][0][4]->GetMaximum();
2079 double min0 =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMinimum();
2082 double min3 =
m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMinimum();
2083 double min4 =
m_data->m_finalHist1[ros][drawer][adc][0][4]->GetMinimum();
2086 final_empty[adc]->SetMaximum(1.05 * max0);
2088 final_empty[adc]->SetMaximum(0.);
2091 if ((max0 - min0) > 0) {
2092 final_empty[adc]->SetMinimum(max0 - 1.05 * (max0 - min0));
2098 pad = Can->cd(adc + 1);
2099 pad->SetTopMargin(0.15);
2104 double Kapa = 1.30e-3;
2105 for (
int ch = 0; ch < 48; ++ch) {
2107 final_empty[adc]->SetBinContent(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.01);
2108 final_empty[adc]->SetBinError(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.01);
2109 pmtGain_empty[adc]->SetBinContent(ch + 1, 0.01);
2110 pmtGain_empty[adc]->SetBinError(ch + 1, 0.01);
2114 double mean =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1);
2115 double rms =
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetBinContent(ch + 1);
2116 double dmean =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1);
2117 double drms =
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetBinError(ch + 1);
2119 int pmt = abs(
m_cabling->channel2hole(ros, ch));
2121 final_even[adc]->SetBinContent(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.001);
2122 final_even[adc]->SetBinError(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.001);
2128 pmtGain_even[adc]->SetBinContent(ch + 1, (rms * rms /
mean) - Kapa *
mean);
2129 pmtGain_even[adc]->SetBinError(ch + 1, (rms * rms /
mean) * sqrt((2 * drms / rms) * (2 * drms / rms) + (dmean /
mean) * (dmean /
mean)));
2131 pmtGain_even[adc]->SetBinContent(ch + 1, -0.5);
2132 pmtGain_even[adc]->SetBinError(ch + 1, 0.001);
2137 final_odd[adc]->SetBinContent(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.001);
2138 final_odd[adc]->SetBinError(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.001);
2143 pmtGain_odd[adc]->SetBinContent(ch + 1, (rms * rms /
mean) - Kapa *
mean);
2144 pmtGain_odd[adc]->SetBinError(ch + 1, (rms * rms /
mean) * sqrt((2 * drms / rms) * (2 * drms / rms) + (dmean /
mean) * (dmean /
mean)));
2146 pmtGain_odd[adc]->SetBinContent(ch + 1, -0.5);
2147 pmtGain_odd[adc]->SetBinError(ch + 1, 0.001);
2155 double max = pmtGain_odd[adc]->GetMaximum();
2156 if (pmtGain_even[adc]->GetMaximum() >
max)
max = 1.05 * pmtGain_even[adc]->GetMaximum();
2157 double min = pmtGain_odd[adc]->GetMinimum();
2158 if (pmtGain_even[adc]->GetMinimum() <
min)
min = pmtGain_even[adc]->GetMinimum() - 0.05 * fabs(pmtGain_even[adc]->GetMinimum());
2159 if (
max < 0.20)
max = 0.20;
2160 if (
min > -0.10)
min = -0.10;
2162 pmtGain_empty[adc]->SetMarkerStyle(21);
2163 pmtGain_even[adc]->SetMarkerStyle(22);
2164 pmtGain_odd[adc]->SetMarkerStyle(23);
2165 pmtGain_empty[adc]->SetMarkerSize(ms);
2166 pmtGain_even[adc]->SetMarkerSize(ms);
2167 pmtGain_odd[adc]->SetMarkerSize(ms);
2168 pmtGain_empty[adc]->SetLabelSize(0.08,
"X");
2169 pmtGain_empty[adc]->SetLabelSize(0.08,
"Y");
2170 pmtGain_even[adc]->SetMarkerColor(2);
2171 pmtGain_odd[adc]->SetMarkerColor(4);
2172 pmtGain_empty[adc]->GetYaxis()->SetRangeUser(
min,
max);
2174 pmtGain_empty[adc]->Draw(
"e");
2175 pmtGain_even[adc]->Draw(
"same,e");
2176 pmtGain_odd[adc]->Draw(
"same,e");
2177 line->DrawLine(0, -0.01, 48, -0.01);
2178 line->DrawLine(0, 0.15, 48, 0.15);
2181 pad = Can->cd(maxgain + adc + 1);
2182 pad->SetTopMargin(0.15);
2187 if (max0 < 0.9 * maxy[adc]) final_empty[adc]->SetMaximum(maxy[adc]);
2188 if (min0 > miny[adc] + 0.1 * TMath::Abs(miny[adc])) final_empty[adc]->SetMinimum(miny[adc]);
2190 final_empty[adc]->SetMarkerStyle(21);
2191 final_even[adc]->SetMarkerStyle(22);
2192 final_odd[adc]->SetMarkerStyle(23);
2193 final_empty[adc]->SetMarkerSize(ms);
2194 final_even[adc]->SetMarkerSize(ms);
2195 final_odd[adc]->SetMarkerSize(ms);
2196 final_empty[adc]->SetLabelSize(0.08,
"X");
2197 final_empty[adc]->SetLabelSize(0.08,
"Y");
2198 final_even[adc]->SetMarkerColor(2);
2199 final_odd[adc]->SetMarkerColor(4);
2201 final_empty[adc]->Draw(
"e");
2202 final_even[adc]->Draw(
"same,e");
2203 final_odd[adc]->Draw(
"same,e");
2206 pad = Can->cd(2 * maxgain + adc + 1);
2207 pad->SetTopMargin(0.15);
2211 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerStyle(21);
2212 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerSize(ms);
2213 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08,
"X");
2214 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08,
"Y");
2215 if (do_plots)
m_data->m_finalHist1[ros][drawer][adc][0][1]->Draw(
"P0");
2217 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMaximum(
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum());
2218 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMinimum(
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum());
2219 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerStyle(25);
2220 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerSize(ms);
2221 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerColor(4);
2222 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08,
"X");
2223 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08,
"Y");
2224 if (do_plots)
m_data->m_finalHist1[ros][drawer][adc][0][2]->Draw(
"sameP0");
2228 pad = Can->cd(3 * maxgain + adc + 1);
2229 pad->SetTopMargin(0.15);
2233 if (max3 < 0.9 * maxy[4 + adc])
m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMaximum(maxy[4 + adc]);
2234 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]);
2236 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerStyle(21);
2237 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerSize(ms);
2238 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08,
"X");
2239 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08,
"Y");
2240 m_data->m_finalHist1[ros][drawer][adc][0][3]->Draw(
"E0");
2245 pad = Can->cd(4 * maxgain + adc + 1);
2246 pad->SetTopMargin(0.15);
2250 if (max4 < 0.9 * maxy[4 + adc])
m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMaximum(maxy[4 + adc]);
2251 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]);
2253 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMarkerStyle(21);
2254 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMarkerSize(ms);
2255 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetLabelSize(0.08,
"X");
2256 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetLabelSize(0.08,
"Y");
2257 if (do_plots)
m_data->m_finalHist1[ros][drawer][adc][0][4]->Draw(
"E0");
2263 Can->Print(TString(moduleName +
"_fit_amp.png"),
"png");
2266 Can->Print(TString(moduleName +
"_fit_amp.ps"),
"ps");
2269 Can->Print(TString(moduleName +
"_fit_amp.svg"),
"svg");
2272 if (do_plots)
delete Can;
2274 for (
int g = 0; g < 2; g++) {
2275 delete final_empty[g];
2276 delete final_odd[g];
2277 delete final_even[g];