182 const std::array<std::string, 6> gain{
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
184 std::ostringstream sStr;
186 std::string subDir = moduleName;
187 std::string histName, histTitle;
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];
215 histName = sStr.str();
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();
223 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 101, -0.01, 2.01));
225 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 101, -101.0, 101.0));
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];
249 histName = sStr.str();
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();
258 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
259 book2S(subDir, histName, histTitle, 51, LowX_low2D[
type], HighX_low2D[
type], 160, LowY_low2D[
type], HighY_low2D[
type]));
263 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
264 book2S(subDir, histName, histTitle, 51, LowX_hi2D[
type], HighX_hi2D[
type], 160, LowY_hi2D_pC[
type], HighY_hi2D_pC[
type]));
266 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
267 book2S(subDir, histName, histTitle, 51, LowX_hi2D[
type], HighX_hi2D[
type], 160, LowY_hi2D[
type], HighY_hi2D[
type]));
271 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
272 book2S(subDir, histName, histTitle, 51, LowX_hi2D[
type], HighX_hi2D[
type], 160, LowY_hi2D_pC[
type], HighY_hi2D_pC[
type]));
274 m_data->m_hist2[ros][drawer][ch][gn & 1].push_back(
275 book2S(subDir, histName, histTitle, 51, LowX_hi2D[
type], HighX_hi2D[
type], 160, LowY_hi2D[
type], HighY_hi2D[
type]));
283 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_amp";
284 histName = sStr.str();
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();
294 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 101, -10.1, 10.1));
297 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 101, -0.404, 0.404));
300 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 101, -10.1, 10.1));
306 const Int_t nlg1 = 49;
307 const Int_t nlg2 = 500;
308 const Int_t nlg3 = 1027;
309 std::vector<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;
316 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1Sx(subDir, histName, histTitle, nlg1 + nlg2 + nlg3, xlgbin.data()));
318 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 1101, -50.5, 1050.5));
323 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 500, -1.5, 23.5));
325 m_data->m_hist1[ros][drawer][ch][gn].push_back(
book1S(subDir, histName, histTitle, 826, -1.01, 15.51));
329 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 206, -0.55, 20.05));
331 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 801, -0.5, 800.5));
337 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_time";
338 histName = sStr.str();
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();
345 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 201, -100.5, 100.5));
348 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_time_corr";
349 histName = sStr.str();
352 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" time_corr";
353 histTitle = sStr.str();
355 m_data->m_hist1[ros][drawer][ch][gn & 1].push_back(
book1S(subDir, histName, histTitle, 201, -100.5, 100.5));
368 const std::array<std::string, 6> gain{
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
371 std::ostringstream sStr;
374 std::string subDir = moduleName;
375 std::string histName, histTitle;
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";
426 histName = sStr.str();
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();
435 m_data->m_histDsp1[ros][drawer][ch][gn].push_back(
book1F(subDir, histName, histTitle, 491, -50.5, 1049.34));
438 m_data->m_histDsp1[ros][drawer][ch][gn].push_back(
book1F(subDir, histName, histTitle, 413, -1.01, 15.51));
442 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 100, -0.55, 20.05));
444 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 200, -0.5, 800.5));
449 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp_time";
450 histName = sStr.str();
453 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp Time";
454 histTitle = sStr.str();
456 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 101, -100.5, 100.5));
459 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp_chi2";
460 histName = sStr.str();
463 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp Chi2";
464 histTitle = sStr.str();
466 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 16, -0.5, 15.5));
469 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp-fit_amp_diff";
470 histName = sStr.str();
473 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp-OF Amp difference";
474 histTitle = sStr.str();
476 auto ix = (gn < 2) ? gn : (gn & 1);
477 m_data->m_histDsp1[ros][drawer][ch][ix].push_back(
book1F(subDir, histName, histTitle, 404, -1.01, 1.01));
480 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_dsp-fit_time_diff";
481 histName = sStr.str();
484 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp-OF Time diff";
485 histTitle = sStr.str();
487 m_data->m_histDsp1[ros][drawer][ch][gn & 1].push_back(
book1F(subDir, histName, histTitle, 101, -2.02, 2.02));
490 sStr << moduleName <<
"_ch_" << sCh << gain[gn] <<
"_chi2_amp";
491 histName = sStr.str();
494 sStr << moduleName <<
" CH " << ch << gain[3 + gn] <<
" Dsp Chi2 versus Amp";
495 histTitle = sStr.str();
499 m_data->m_histDsp2[ros][drawer][ch][gn].push_back(
book2F(subDir, histName, histTitle, 200, -45.1, 855.1, 16, 0., 16.));
502 m_data->m_histDsp2[ros][drawer][ch][gn].push_back(
book2F(subDir, histName, histTitle, 150, -7.0, 12.0, 16, 0., 16.));
506 m_data->m_histDsp2[ros][drawer][ch][gn & 1].push_back(
book2F(subDir, histName, histTitle, 150, -7.005, 7.005, 16, 0., 16.));
508 m_data->m_histDsp2[ros][drawer][ch][gn & 1].push_back(
book2F(subDir, histName, histTitle, 200, -45.1, 855.1, 16, 0., 16.));
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++) {
562 m_corrup[ros][drawer][0][dmu] =
false;
563 m_corrup[ros][drawer][1][dmu] =
false;
567 for (
int dmu = headsize; dmu < 16; dmu++) {
568 m_corrup[ros][drawer][0][dmu] =
false;
569 m_corrup[ros][drawer][1][dmu] =
false;
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) {
628 if (
m_data->m_hist1[ros][drawer][0][0].size() == 0) {
635 std::vector<double> efitVec(
m_bigain ? 96 : 48, 0.), tfitVec(
m_bigain ? 96 : 48, 0.);
637 for (; chItr != lastCh; ++chItr) {
642 unsigned int chan =
m_tileHWID->channel(adc_id);
676 efitVec[chan + gain * 48] = amp;
677 double time = rch->
time();
679 tfitVec[chan + gain * 48] = time;
681 if (!
m_corrup[ros][drawer][gain][chan / 3]) {
686 m_data->m_hist2[ros][drawer][chan][gain][cap]->Fill(
charge, amp);
690 if ( ( (adc == 1) && (
charge < hg_charge_cut) && (
charge > hg_small_charge) ) ||
691 ( (adc == 0) && (
charge < lg_charge_cut) && (
charge > lg_small_charge) ) ) {
693 double ratio = amp /
charge;
695 m_data->m_hist1[ros][drawer][chan][gain][0 + cap]->Fill(ratio);
696 m_data->m_hist1[ros][drawer][chan][gain][2 + cap]->Fill(time);
698 m_data->m_hist2[ros][drawer][chan][gain][cap + 2]->Fill(timeInj, time);
706 ++
m_data->m_timeCov[ros][drawer][chan][gain][cap][5];
711 m_data->m_hist1[ros][drawer][chan][gain][0]->Fill(amp, 1.0);
714 m_data->m_hist1[ros][drawer][chan][gain][1]->Fill(time, 1.0);
717 m_data->m_timeCov[ros][drawer][chan][gain][0][0] += amp;
718 m_data->m_timeCov[ros][drawer][chan][gain][0][1] += amp * amp;
719 m_data->m_timeCov[ros][drawer][chan][gain][0][2] += time;
720 m_data->m_timeCov[ros][drawer][chan][gain][0][3] += time * time;
722 ++
m_data->m_timeCov[ros][drawer][chan][gain][0][5];
735 if ((ros == 3 || ros == 4)
736 && (chan == 0 || chan == 1 || chan == 2 || chan == 3 || chan == 4 || chan == 5 || chan == 12 || chan == 13 || chan == 18
739 sumTimeCh[ros] += time;
748 timeCorr = time - avgTimePerPart[ros];
749 m_data->m_hist1[ros][drawer][chan][gain][2]->Fill(timeCorr, 1.0);
751 m_data->m_timeCovCorr[ros][drawer][chan][gain][0][0] += timeCorr;
752 m_data->m_timeCovCorr[ros][drawer][chan][gain][0][1] += timeCorr * timeCorr;
753 ++
m_data->m_timeCovCorr[ros][drawer][chan][gain][0][2];
765 m_efitMap.insert(make_pair(ros * 100 + drawer, efitVec));
766 m_tfitMap.insert(make_pair(ros * 100 + drawer, tfitVec));
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) {
829 if (
m_data->m_histDsp1[ros][drawer][0][0].size() == 0) {
834 for (; chItr != lastCh; ++chItr) {
839 unsigned int chan =
m_tileHWID->channel(adc_id);
845 && !
m_corrup[ros][drawer][gain][chan / 3]) {
871 double time = rch->
time();
874 m_data->m_histDsp1[ros][drawer][chan][gain][
Edsp]->Fill(amp, 1.0);
875 m_data->m_histDsp1[ros][drawer][chan][gain][
Tdsp]->Fill(time, 1.0);
877 m_data->m_histDsp2[ros][drawer][chan][gain][0]->Fill(amp,
chi2, 1.0);
878 m_data->m_finalHistDsp2[ros][drawer][gain][0]->Fill(amp,
chi2, 1.0);
880 std::map<int, std::vector<double> >
::iterator it = efitMap.find(ros * 100 + drawer);
881 if (it != efitMap.end()) {
882 double efit = (*it).second.at(chan + gain * 48);
883 it = tfitMap.find(ros * 100 + drawer);
884 if (it != tfitMap.end()) {
885 double tfit = (*it).second.at(chan + gain * 48);
888 m_data->m_histDsp1[ros][drawer][chan][gain][
Edsp_fit]->Fill((amp - efit) / efit, 1.0);
892 m_data->m_histDsp1[ros][drawer][chan][gain][
Tdsp_fit]->Fill((time - tfit), 1.0);
903 return StatusCode::SUCCESS;
915 const std::array<std::string, 6> gain = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
922 std::ostringstream sStr;
926 const char *HistName[6] = {
"_tslope",
"_toffset",
"_qratio",
" Time slope",
" Time offset",
" Amp/Q ratio" };
927 const char *CapName[4] = {
"_100",
"_5",
" 100 pF",
" 5 pF" };
931 std::string subDir =
"Summary";
932 std::string histName, histTitle;
934 for (
int gn = mingain; gn < maxgain; ++gn) {
936 for (
int cap = 0; cap < 2; ++cap) {
940 sStr << moduleName << gain[gn] << HistName[
type] << CapName[cap];
941 histName = sStr.str();
943 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookSummaryHistograms");
944 sStr << moduleName << gain[3 + gn] << HistName[3 +
type] << CapName[2 + cap];
945 histTitle = sStr.str();
946 m_data->m_finalHist1[ros][drawer][adc][cap].push_back(
book1F(subDir, histName, histTitle, 48, 0, 48));
952 const char *HistName[10] = {
"_amp",
"_rms",
"_sigma",
"_time",
"_time_corr",
" Amplitude",
" RMS of amplitude",
" Sigma amp from Gaussian fit",
953 " Average time and RMS",
" Average time corr. and RMS" };
957 std::string subDir =
"Summary";
958 std::string histName, histTitle;
960 for (
int gn = mingain; gn < maxgain; ++gn) {
968 sStr << moduleName << gain[gn] << HistName[
type];
969 histName = sStr.str();
971 if (gn+3 >= std::ssize(gain))
throw std::out_of_range(
"Index out of range in TileRawChannelMonTool::bookSummaryHistograms");
972 sStr << moduleName << gain[3 + gn] << HistName[5 +
type];
973 histTitle = sStr.str();
974 m_data->m_finalHist1[ros][drawer][adc][0].push_back(
book1F(subDir, histName, histTitle, 48, 0.0, 48.0));
976 std::string hTitle(histTitle);
980 hTitle +=
" (Even PMTs)";
981 m_data->m_summaryPmts[ros][drawer][adc][0].push_back(
book1F(subDir +
"/pmt", histName +
"_pmt_even", hTitle, 49, -0.5, 48.5));
982 m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerStyle(22);
983 m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerColor(2);
984 m_data->m_summaryPmts[ros][drawer][adc][0].back()->SetMarkerSize(0.75);
987 hTitle +=
" (Odd PMTs)";
988 m_data->m_summaryPmts[ros][drawer][adc][1].push_back(
book1F(subDir +
"/pmt", histName +
"_pmt_odd", hTitle, 49, -0.5, 48.5));
989 m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerStyle(23);
990 m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerColor(4);
991 m_data->m_summaryPmts[ros][drawer][adc][1].back()->SetMarkerSize(0.75);
993 if (ros < 3 && m_data->m_summaryPmts[0][drawer][adc][0].size() < (
unsigned int)(
type + 1)) {
995 histName.replace(histName.begin(), histName.begin() + 3,
"LB");
996 histTitle.replace(histTitle.begin(), histTitle.begin() + 3,
"LB");
999 hTitle +=
" (LBA even PMTs + LBC odd PMTs: negative)";
1000 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));
1001 m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerStyle(22);
1002 m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerColor(2);
1003 m_data->m_summaryPmts[0][drawer][adc][0].back()->SetMarkerSize(0.75);
1006 hTitle +=
" (LBA odd PMTs + LBC even PMTs: negative)";
1007 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));
1008 m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerStyle(23);
1009 m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerColor(4);
1010 m_data->m_summaryPmts[0][drawer][adc][1].back()->SetMarkerSize(0.75);
1056 TF1 * fit_gaus =
new TF1(
"g",
"gaus");
1064 for (
int ros = 1; ros < 5; ++ros) {
1065 for (
int drawer = 0; drawer < 64; ++drawer) {
1066 if (
m_data->m_hist1[ros][drawer][0][0].size() != 0) {
1067 for (
int gn = mingain; gn < maxgain; ++gn) {
1070 for (
int cap = 0; cap < 2; ++cap) {
1071 for (
int ch = 0; ch < 48; ++ch) {
1078 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinContent(ch + 1, polyfunc->GetParameter(1));
1079 if (polyfunc->GetParError(1) > 5) {
1080 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, 5.);
1082 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, polyfunc->GetParError(1));
1084 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinContent(ch + 1, polyfunc->GetParameter(0));
1085 if (polyfunc->GetParError(0) > 5) {
1086 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, 5.);
1088 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, polyfunc->GetParError(0));
1095 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinContent(ch + 1, 0.);
1096 m_data->m_finalHist1[ros][drawer][adc][cap][0]->SetBinError(ch + 1, 0.);
1097 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinContent(ch + 1, 0.);
1098 m_data->m_finalHist1[ros][drawer][adc][cap][1]->SetBinError(ch + 1, 0.);
1101 TH1S * hist =
m_data->m_hist1[ros][drawer][ch][adc][cap];
1102 int nbins = hist->GetNbinsX();
1104 for (; minbin < nbins; ++minbin) {
1105 if (hist->GetBinContent(minbin) > 0.0) {
1110 for (; maxbin > 1; --maxbin) {
1111 if (hist->GetBinContent(maxbin) > 0.0) {
1116 double mean = hist->GetMean();
1117 double xmin = hist->GetBinCenter(minbin);
1118 double xmax = hist->GetBinCenter(maxbin);
1132 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetBinContent(ch + 1,
mean);
1147 for (
int ros = 1; ros < 5; ++ros) {
1148 for (
int drawer = 0; drawer < 64; ++drawer) {
1149 if (
m_data->m_hist1[ros][drawer][0][0].size() != 0) {
1150 for (
int gn = mingain; gn < maxgain; ++gn) {
1153 for (
int ch = 0; ch < 48; ++ch) {
1157 double Amp = 0.0, ErrA = 0.0, RMS = 0.0, ErrR = 0.0;
1158 double Time = 0.0, RMST = 0.0, Sigma = 0.0, ErrS = 0.0;
1159 double NEvents =
m_data->m_timeCov[ros][drawer][ch][adc][0][5];
1161 double TimeCorr = 0.0, RMSTCorr = 0.0;
1162 double NEventsCorr =
m_data->m_timeCovCorr[ros][drawer][ch][adc][0][2];
1164 if (NEvents > 0.0) {
1166 Amp =
m_data->m_timeCov[ros][drawer][ch][adc][0][0] / NEvents;
1167 RMS =
m_data->m_timeCov[ros][drawer][ch][adc][0][1] / NEvents - Amp * Amp;
1170 ErrA = RMS / sqrt(NEvents);
1171 ErrR = RMS / sqrt(2 * NEvents);
1176 Time =
m_data->m_timeCov[ros][drawer][ch][adc][0][2] / NEvents;
1177 RMST =
m_data->m_timeCov[ros][drawer][ch][adc][0][3] / NEvents - Time * Time;
1186 if (NEventsCorr > 0.0) {
1187 TimeCorr =
m_data->m_timeCovCorr[ros][drawer][ch][adc][0][0] / NEventsCorr;
1188 RMSTCorr =
m_data->m_timeCovCorr[ros][drawer][ch][adc][0][1] / NEventsCorr - TimeCorr * TimeCorr;
1189 if (RMSTCorr > 0.0) {
1190 RMSTCorr = sqrt(RMSTCorr);
1197 if (
m_data->m_hist1[ros][drawer][ch][adc][0]->GetEntries() > 0) {
1199 TH1S *h4fit=
new TH1S(*(
m_data->m_hist1[ros][drawer][ch][adc][0]));
1200 h4fit->Scale(1,
"width");
1201 h4fit->Fit(
"g",
"NQ");
1204 m_data->m_hist1[ros][drawer][ch][adc][0]->Fit(
"g",
"NQ");
1206 Sigma = fit_gaus->GetParameter(2);
1207 ErrS = fit_gaus->GetParError(2);
1210 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetBinContent(ch + 1, Amp);
1211 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetBinError(ch + 1, ErrA);
1212 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetBinContent(ch + 1, RMS);
1213 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetBinError(ch + 1, ErrR);
1214 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetBinContent(ch + 1, Sigma);
1215 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetBinError(ch + 1, ErrS);
1216 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetBinContent(ch + 1, Time);
1217 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetBinError(ch + 1, RMST);
1218 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetBinContent(ch + 1, TimeCorr);
1219 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetBinError(ch + 1, RMSTCorr);
1223 int pmt =
m_cabling->channel2hole(ros, ch);
1224 if (pmt < 0)
continue;
1226 int fiber = (pmt % 2);
1228 m_data->m_summaryPmts[ros][drawer][adc][fiber][0]->SetBinContent(pmt + 1, Amp);
1229 m_data->m_summaryPmts[ros][drawer][adc][fiber][0]->SetBinError(pmt + 1, ErrA);
1230 m_data->m_summaryPmts[ros][drawer][adc][fiber][1]->SetBinContent(pmt + 1, RMS);
1231 m_data->m_summaryPmts[ros][drawer][adc][fiber][1]->SetBinError(pmt + 1, ErrR);
1232 m_data->m_summaryPmts[ros][drawer][adc][fiber][2]->SetBinContent(pmt + 1, Sigma);
1233 m_data->m_summaryPmts[ros][drawer][adc][fiber][2]->SetBinError(pmt + 1, ErrS);
1234 m_data->m_summaryPmts[ros][drawer][adc][fiber][3]->SetBinContent(pmt + 1, Time);
1235 m_data->m_summaryPmts[ros][drawer][adc][fiber][3]->SetBinError(pmt + 1, RMST);
1236 m_data->m_summaryPmts[ros][drawer][adc][fiber][4]->SetBinContent(pmt + 1, TimeCorr);
1237 m_data->m_summaryPmts[ros][drawer][adc][fiber][4]->SetBinError(pmt + 1, RMSTCorr);
1241 int bin =
m_data->m_summaryPmts[0][drawer][adc][fiber][0]->FindBin(pmt);
1243 m_data->m_summaryPmts[0][drawer][adc][fiber][0]->SetBinContent(
bin, Amp);
1244 m_data->m_summaryPmts[0][drawer][adc][fiber][0]->SetBinError(
bin, ErrA);
1245 m_data->m_summaryPmts[0][drawer][adc][fiber][1]->SetBinContent(
bin, RMS);
1246 m_data->m_summaryPmts[0][drawer][adc][fiber][1]->SetBinError(
bin, ErrR);
1247 m_data->m_summaryPmts[0][drawer][adc][fiber][2]->SetBinContent(
bin, Sigma);
1248 m_data->m_summaryPmts[0][drawer][adc][fiber][2]->SetBinError(
bin, ErrS);
1249 m_data->m_summaryPmts[0][drawer][adc][fiber][3]->SetBinContent(
bin, Time);
1250 m_data->m_summaryPmts[0][drawer][adc][fiber][3]->SetBinError(
bin, RMST);
1251 m_data->m_summaryPmts[0][drawer][adc][fiber][4]->SetBinContent(
bin, TimeCorr);
1252 m_data->m_summaryPmts[0][drawer][adc][fiber][4]->SetBinError(
bin, RMSTCorr);
1258 int bin =
m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->FindBin(-pmt);
1260 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->SetBinContent(
bin, Amp);
1261 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][0]->SetBinError(
bin, ErrA);
1262 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][1]->SetBinContent(
bin, RMS);
1263 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][1]->SetBinError(
bin, ErrR);
1264 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][2]->SetBinContent(
bin, Sigma);
1265 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][2]->SetBinError(
bin, ErrS);
1266 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][3]->SetBinContent(
bin, Time);
1267 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][3]->SetBinError(
bin, RMST);
1268 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][4]->SetBinContent(
bin, TimeCorr);
1269 m_data->m_summaryPmts[0][drawer][adc][1 - fiber][4]->SetBinError(
bin, RMSTCorr);
1292 return StatusCode::SUCCESS;
1326 if (
m_data->m_histDsp1[ros][drawer][0][0].size() != 0) {
1331 unsigned int iteration = 0u;
1334 uint32_t info = RawChannelCntDsp->
get_bsflags() >> 24u;
1335 iteration = info & 3u;
1342 const char *alg_name[2] = {
"OF1",
"OF2" };
1343 const char * iter_name[4] = {
"NI",
"I1",
"I2",
"I3" };
1345 const char *part[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
1346 const char *gain[4] = {
"_lo",
"_hi",
" low gain",
" high gain" };
1354 const char *HistName[9] = {
"_dspfit_ampdiff",
"_dspfit_timediff",
"_dspamp",
" Avg. (DSP-",
" Average DSP-",
" Average DSP-",
1355 " - OFF-OF2-I) / OFF Amplitudes and RMS",
" - OFF-OF2-I Time and RMS",
" Amplitudes and RMS" };
1357 std::ostringstream sStr;
1358 sStr << part[ros] << std::setfill(
'0') << std::setw(2) << drawer + 1 << std::setfill(
' ');
1359 std::string moduleName = sStr.str();
1360 std::string subDir =
"Summary";
1361 std::string histName, histTitle;
1363 for (
int gn = mingain; gn < maxgain; ++gn) {
1369 sStr << moduleName << gain[gn] << HistName[
type];
1370 histName = sStr.str();
1372 sStr << moduleName << gain[2 + gn] << HistName[3 +
type] << alg_name[
algorithm] <<
"-" << iter_name[iteration] << HistName[6 +
type];
1373 histTitle = sStr.str();
1374 m_data->m_finalHistDsp1[ros][drawer][adc].push_back(
book1F(subDir, histName, histTitle, 48, 0.0, 48.0));
1379 sStr << moduleName << gain[gn] <<
"_dspfit_amphbar";
1380 histName = sStr.str();
1382 sStr << moduleName << gain[2 + gn] <<
" (DSP-" << alg_name[
algorithm] <<
"-" << iter_name[iteration]
1383 <<
" - OFF-OF2-I) divided by OFF Amplitudes for all chans";
1384 histTitle = sStr.str();
1385 m_data->m_hBarDsp1[ros][drawer][adc].push_back(
book1F(subDir, histName, histTitle, 404, -1.01, 1.01));
1388 sStr << moduleName << gain[gn] <<
"_dspfit_timehbar";
1389 histName = sStr.str();
1391 sStr << moduleName << gain[2 + gn] <<
" (DSP-" << alg_name[
algorithm] <<
"-" << iter_name[iteration] <<
" - OFF-OF2-I) Time for all chans";
1392 histTitle = sStr.str();
1393 m_data->m_hBarDsp1[ros][drawer][adc].push_back(
book1F(subDir, histName, histTitle, 101, -2.02, 2.02));
1395 for (
int ch = 0; ch < 48; ++ch) {
1398 if (
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp_fit]->GetEntries() > 0) {
1399 double dspmean =
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp]->GetMean();
1400 double dsprms =
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp]->GetRMS();
1401 double emean =
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp_fit]->GetMean();
1402 double erms =
m_data->m_histDsp1[ros][drawer][ch][adc][
Edsp_fit]->GetRMS();
1403 double tmean =
m_data->m_histDsp1[ros][drawer][ch][adc][
Tdsp_fit]->GetMean();
1404 double trms =
m_data->m_histDsp1[ros][drawer][ch][adc][
Tdsp_fit]->GetRMS();
1406 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp]->SetBinContent(ch + 1, dspmean);
1407 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp]->SetBinError(ch + 1, dsprms);
1408 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetBinContent(ch + 1, emean);
1409 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetBinError(ch + 1, erms);
1410 m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetBinContent(ch + 1, tmean);
1411 m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetBinError(ch + 1, trms);
1421 drawDsp(ros, drawer, moduleName);
1425 return StatusCode::SUCCESS;
1446 double ms = (
m_bigain) ? 0.75 : 1.0;
1454 for (
int i = 0; i < 48; i++) {
1455 X_axis[i] = i + 0.5;
1459 const char *gain[6] = {
"_lo",
"_hi",
"",
" low gain",
" high gain",
"" };
1460 const char *CapName[4] = {
"_100",
"_5",
" 100 pF",
" 5 pF" };
1461 if (maxgain == 1) gain[0] = gain[1] = gain[2] = gain[3] = gain[4] = gain[5];
1468 TCanvas * Can = NULL;
1470 Can =
new TCanvas(
"amp_ratio",
"amp_ratio", 402 * maxgain, 588);
1471 Can->Divide(maxgain, 2);
1472 gStyle->SetOptStat(0);
1473 gStyle->SetTitleFontSize(0.1);
1476 TLine line(0., 1., 48., 1.);
1477 line.SetLineColor(3);
1479 std::string subDir =
"Summary";
1480 std::vector<TGraphAsymmErrors*> grapherrVec;
1482 for (
int adc = 0; adc < maxgain; ++adc) {
1483 for (
int cap = 0; cap < 2; ++cap) {
1485 std::ostringstream sStr;
1486 sStr << moduleName << gain[adc] <<
"_tails" << CapName[cap];
1487 std::string graphName = sStr.str();
1489 sStr << moduleName << gain[adc + 3] <<
" Mean Amp/Q ratio and up/down tails " << CapName[2 + cap];
1490 std::string graphTitle = sStr.str();
1494 pad = Can->cd(cap * maxgain + adc + 1);
1495 pad->SetTopMargin(0.15);
1499 TGraphAsymmErrors * final_Egraph =
bookGraphAsymmErrors(subDir, graphName, graphTitle, 48, X_axis,
m_data->m_rangeQ[adc][cap][0], X_errors, X_errors,
1500 m_data->m_rangeQ[adc][cap][1],
m_data->m_rangeQ[adc][cap][2]);
1501 grapherrVec.push_back(final_Egraph);
1503 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetStats(kFALSE);
1504 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMarkerStyle(21);
1505 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMarkerSize(ms);
1506 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetLabelSize(0.06,
"X");
1507 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetLabelSize(0.06,
"Y");
1508 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMaximum(2.2);
1509 m_data->m_finalHist1[ros][drawer][adc][cap][2]->SetMinimum(-0.2);
1510 if (do_plots)
m_data->m_finalHist1[ros][drawer][adc][cap][2]->Draw(
"P0");
1512 final_Egraph->SetMarkerStyle(21);
1513 final_Egraph->SetMarkerSize(ms);
1514 final_Egraph->SetMaximum(2.2);
1515 final_Egraph->SetMinimum(-0.2);
1516 final_Egraph->GetXaxis()->SetRangeUser(0, 48);
1518 final_Egraph->Draw(
"P0");
1526 Can->Print(TString(moduleName +
"_amp_ratio.png"),
"png");
1529 Can->Print(TString(moduleName +
"_amp_ratio.ps"),
"ps");
1532 Can->Print(TString(moduleName +
"_amp_ratio.svg"),
"svg");
1534 if (do_plots)
delete Can;
1538 std::vector<TGraphAsymmErrors*>::const_iterator it = grapherrVec.begin();
1539 std::vector<TGraphAsymmErrors *>::const_iterator itend = grapherrVec.end();
1540 for (; it != itend; ++it) {
1546 Can =
new TCanvas(
"fit_time",
"fit_time", 402 * maxgain, 588);
1547 Can->Divide(maxgain, 4);
1548 gStyle->SetOptStat(0);
1549 gStyle->SetTitleFontSize(0.1);
1552 double maxy[2] = { 1.4, 15.0 };
1553 double miny[2] = { -0.1, -15.0 };
1555 for (
int adc = 0; adc < maxgain; ++adc) {
1556 for (
int cap = 0; cap < 2; ++cap) {
1561 pad = Can->cd((
type + cap * 2) * maxgain + adc + 1);
1562 pad->SetTopMargin(0.15);
1566 if (
m_data->m_finalHist1[ros][drawer][adc][cap][
type]->GetMaximum() < 0.9 * maxy[
type])
1567 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetMaximum(maxy[
type]);
1568 if (
m_data->m_finalHist1[ros][drawer][adc][cap][
type]->GetMinimum() > (miny[
type] + 0.1 * TMath::Abs(miny[
type])))
1569 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetMinimum(miny[
type]);
1571 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetMarkerStyle(21);
1572 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetMarkerSize(ms);
1573 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetLabelSize(0.10,
"X");
1574 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->SetLabelSize(0.10,
"Y");
1576 m_data->m_finalHist1[ros][drawer][adc][cap][
type]->Draw(
"P0");
1578 line.SetLineColor(3);
1586 Can->Print(TString(moduleName +
"_fit_time.png"),
"png");
1589 Can->Print(TString(moduleName +
"_fit_time.ps"),
"ps");
1592 Can->Print(TString(moduleName +
"_fit_time.svg"),
"svg");
1594 if (do_plots)
delete Can;
1601 TCanvas * Can = NULL;
1603 Can =
new TCanvas(
"fit_amp",
"fit_amp", 402 * maxgain, 588);
1604 Can->Divide(maxgain, 3);
1605 gStyle->SetOptStat(0);
1606 gStyle->SetTitleFontSize(0.1);
1609 double maxy[6] = { 1.0, 0.05, 1.0, 0.05, 25.0, 25.0 };
1610 double miny[6] = { -1.0, -0.05, 0.0, 0.0, -25.0, -25.0 };
1612 for (
int adc = 0; adc < maxgain; ++adc) {
1614 double max0 =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMaximum();
1615 double max1 =
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum();
1616 double max2 =
m_data->m_finalHist1[ros][drawer][adc][0][2]->GetMaximum();
1617 double max3 =
m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMaximum();
1618 double min0 =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMinimum();
1619 double min1 =
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum();
1620 double min2 =
m_data->m_finalHist1[ros][drawer][adc][0][2]->GetMinimum();
1621 double min3 =
m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMinimum();
1625 pad = Can->cd(adc + 1);
1626 pad->SetTopMargin(0.15);
1630 if (max0 < 0.9 * maxy[adc])
m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMaximum(maxy[adc]);
1631 if (min0 > (miny[adc] + 0.1 * TMath::Abs(miny[adc])))
m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMinimum(miny[adc]);
1633 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMarkerStyle(21);
1634 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetMarkerSize(ms);
1635 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetLabelSize(0.08,
"X");
1636 m_data->m_finalHist1[ros][drawer][adc][0][0]->SetLabelSize(0.08,
"Y");
1638 m_data->m_finalHist1[ros][drawer][adc][0][0]->Draw(
"E0");
1642 pad = Can->cd(maxgain + adc + 1);
1643 pad->SetTopMargin(0.15);
1648 if (max1 < maxy[2 + adc]) {
1649 if (max2 < maxy[2 + adc])
1650 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(maxy[2 + adc]);
1652 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(max2);
1654 if (max1 < max2)
m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMaximum(max2);
1657 if (min1 > miny[2 + adc]) {
1658 if (min2 > miny[2 + adc])
1659 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(miny[2 + adc]);
1661 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(min2);
1663 if (min1 > min2)
m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMinimum(min2);
1666 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerStyle(21);
1667 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerSize(ms);
1668 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08,
"X");
1669 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08,
"Y");
1671 m_data->m_finalHist1[ros][drawer][adc][0][1]->Draw(
"P0");
1674 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMaximum(
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum());
1675 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMinimum(
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum());
1676 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerStyle(25);
1677 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerSize(ms);
1678 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerColor(4);
1679 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08,
"X");
1680 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08,
"Y");
1682 m_data->m_finalHist1[ros][drawer][adc][0][2]->Draw(
"sameP0");
1686 pad = Can->cd(2 * maxgain + adc + 1);
1687 pad->SetTopMargin(0.15);
1691 if (max3 < 0.9 * maxy[4 + adc])
m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMaximum(maxy[4 + adc]);
1692 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]);
1694 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerStyle(21);
1695 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerSize(ms);
1696 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08,
"X");
1697 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08,
"Y");
1699 m_data->m_finalHist1[ros][drawer][adc][0][3]->Draw(
"E0");
1705 Can->Print(TString(moduleName +
"_fit_amp.png"),
"png");
1708 Can->Print(TString(moduleName +
"_fit_amp.ps"),
"ps");
1711 Can->Print(TString(moduleName +
"_fit_amp.svg"),
"svg");
1713 if (do_plots)
delete Can;
1722 MsgStream log(msgSvc(), name());
1724 double ms = (
m_bigain) ? 0.75 : 1.0;
1727 TCanvas * Can = NULL;
1729 Can =
new TCanvas(
"dsp_amp",
"dsp_amp", 402 * maxgain, 588);
1730 Can->Divide(maxgain, 3);
1731 gStyle->SetOptStat(0);
1732 gStyle->SetTitleFontSize(0.1);
1735 TLine line(0., 0., 48., 0.);
1736 line.SetLineColor(3);
1738 double maxy[6] = { 0.05, 0.05, 0.5, 0.5, 10.0, 10.0 };
1739 double miny[6] = { -0.05, -0.05, -0.5, -0.5, -0.05, -0.05 };
1740 double norm[2] = { 1., 1 };
1741 for (
int adc = 0; adc < maxgain; ++adc) {
1743 double maxEdsp =
m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->GetMaximum();
1744 double minEdsp =
m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->GetMinimum();
1745 double maxTdsp =
m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->GetMaximum();
1746 double minTdsp =
m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->GetMinimum();
1747 double maxchidsp =
m_data->m_finalHistDsp2[ros][drawer][adc][0]->GetMaximum();
1748 double minchidsp =
m_data->m_finalHistDsp2[ros][drawer][adc][0]->GetMinimum();
1752 pad = Can->cd(adc + 1);
1753 pad->SetTopMargin(0.15);
1757 if (maxEdsp < 0.9 * maxy[adc])
m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetMaximum(maxy[adc]);
1758 if (minEdsp > miny[adc] + 0.1 * TMath::Abs(miny[adc]))
m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetMinimum(miny[adc]);
1762 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetLabelSize(0.08,
"X");
1763 m_data->m_finalHistDsp1[ros][drawer][adc][
sumEdsp_fit]->SetLabelSize(0.08,
"Y");
1780 pad = Can->cd(maxgain + adc + 1);
1781 pad->SetTopMargin(0.15);
1785 if (maxTdsp < 0.9 * maxy[2 + adc])
m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetMaximum(maxy[2 + adc]);
1786 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]);
1790 m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetLabelSize(0.08,
"X");
1791 m_data->m_finalHistDsp1[ros][drawer][adc][
sumTdsp_fit]->SetLabelSize(0.08,
"Y");
1807 pad = Can->cd(2 * maxgain + adc + 1);
1808 pad->SetTopMargin(0.15);
1813 if (maxchidsp < 0.9 * maxy[4 + adc])
m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetMaximum(maxy[4 + adc]);
1814 if (minchidsp > miny[4 + adc] + 0.1 * TMath::Abs(miny[4 + adc]))
m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetMinimum(miny[4 + adc]);
1816 m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetLabelSize(0.08,
"X");
1817 m_data->m_finalHistDsp2[ros][drawer][adc][0]->SetLabelSize(0.08,
"Y");
1819 gStyle->SetPalette(1);
1820 m_data->m_finalHistDsp2[ros][drawer][adc][0]->Draw(
"zcol");
1826 Can->Print(TString(moduleName +
"_dsp_amp.png"),
"png");
1829 Can->Print(TString(moduleName +
"_dsp_amp.ps"),
"ps");
1832 Can->Print(TString(moduleName +
"_dsp_amp.svg"),
"svg");
1834 if (do_plots)
delete Can;
1836 for (
int adc = 0; adc < maxgain; ++adc) {
1991 TCanvas * Can = NULL;
1993 Can =
new TCanvas(
"fit_amp",
"fit_amp", 402 * maxgain, 735);
1995 Can->Divide(maxgain, 5);
1996 gStyle->SetOptStat(0);
1997 gStyle->SetTitleFontSize(0.1);
1999 TLine *line =
new TLine();
2000 line->SetLineWidth(2);
2001 line->SetLineStyle(7);
2002 line->SetLineColor(3);
2004 float ms = (
m_bigain) ? 0.75 : 1.0;
2006 double maxy[6] = { 5.0, 0.5, 1.0, 0.05, 25.0, 25.0 };
2007 double miny[6] = { -5.0, -0.5, 0.0, 0.0, -25.0, -25.0 };
2010 TH1F* final_empty[2];
2012 TH1F* final_even[2];
2015 TH1F* pmtGain_empty[2];
2016 TH1F* pmtGain_odd[2];
2017 TH1F* pmtGain_even[2];
2019 for (
int g = 0; g < 2; g++) {
2021 std::ostringstream hn;
2022 hn <<
"empty_" << g;
2023 final_empty[g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2026 final_odd[g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2029 final_even[g] =
new TH1F(hn.str().c_str(),
m_data->m_finalHist1[ros][drawer][g][0][0]->GetTitle(), 48, 0, 48);
2034 const char* gain[2] = {
"low",
"high" };
2035 const char* moduleNames[5] = {
"AUX",
"LBA",
"LBC",
"EBA",
"EBC" };
2037 title = Form(
"%s0%i %s gain, Variance/Mean", moduleNames[ros], drawer + 1, gain[g]);
2039 title = Form(
"%s%i %s gain, Variance/Mean", moduleNames[ros], drawer + 1, gain[g]);
2041 std::ostringstream sStr;
2042 std::string subDir =
"Summary";
2044 sStr << moduleNames[ros] << std::setfill(
'0') << std::setw(2) << drawer + 1 << std::setfill(
' ') << gain[g] <<
"_pmtGain_empty";
2045 std::string histName = sStr.str();
2046 pmtGain_empty[g] =
book1F(subDir, histName, title, 48, 0.0, 48.0);
2050 sStr << moduleNames[ros] << std::setfill(
'0') << std::setw(2) << drawer + 1 << std::setfill(
' ') << gain[g] <<
"_pmtGain_odd";
2051 histName = sStr.str();
2052 pmtGain_odd[g] =
book1F(subDir, histName, title, 48, 0.0, 48.0);
2056 sStr << moduleNames[ros] << std::setfill(
'0') << std::setw(2) << drawer + 1 << std::setfill(
' ') << gain[g] <<
"_pmtGain_even";
2057 histName = sStr.str();
2058 pmtGain_even[g] =
book1F(subDir, histName, title, 48, 0.0, 48.0);
2063 for (
int adc = 0; adc < maxgain; ++adc) {
2065 double max0 =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMaximum();
2068 double max3 =
m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMaximum();
2069 double max4 =
m_data->m_finalHist1[ros][drawer][adc][0][4]->GetMaximum();
2070 double min0 =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetMinimum();
2073 double min3 =
m_data->m_finalHist1[ros][drawer][adc][0][3]->GetMinimum();
2074 double min4 =
m_data->m_finalHist1[ros][drawer][adc][0][4]->GetMinimum();
2077 final_empty[adc]->SetMaximum(1.05 * max0);
2079 final_empty[adc]->SetMaximum(0.);
2082 if ((max0 - min0) > 0) {
2083 final_empty[adc]->SetMinimum(max0 - 1.05 * (max0 - min0));
2089 pad = Can->cd(adc + 1);
2090 pad->SetTopMargin(0.15);
2095 double Kapa = 1.30e-3;
2096 for (
int ch = 0; ch < 48; ++ch) {
2098 final_empty[adc]->SetBinContent(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.01);
2099 final_empty[adc]->SetBinError(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.01);
2100 pmtGain_empty[adc]->SetBinContent(ch + 1, 0.01);
2101 pmtGain_empty[adc]->SetBinError(ch + 1, 0.01);
2105 double mean =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1);
2106 double rms =
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetBinContent(ch + 1);
2107 double dmean =
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1);
2108 double drms =
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetBinError(ch + 1);
2110 int pmt = abs(
m_cabling->channel2hole(ros, ch));
2112 final_even[adc]->SetBinContent(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.001);
2113 final_even[adc]->SetBinError(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.001);
2119 pmtGain_even[adc]->SetBinContent(ch + 1, (rms * rms /
mean) - Kapa *
mean);
2120 pmtGain_even[adc]->SetBinError(ch + 1, (rms * rms /
mean) * sqrt((2 * drms / rms) * (2 * drms / rms) + (dmean /
mean) * (dmean /
mean)));
2122 pmtGain_even[adc]->SetBinContent(ch + 1, -0.5);
2123 pmtGain_even[adc]->SetBinError(ch + 1, 0.001);
2128 final_odd[adc]->SetBinContent(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinContent(ch + 1) + 0.001);
2129 final_odd[adc]->SetBinError(ch + 1,
m_data->m_finalHist1[ros][drawer][adc][0][0]->GetBinError(ch + 1) + 0.001);
2134 pmtGain_odd[adc]->SetBinContent(ch + 1, (rms * rms /
mean) - Kapa *
mean);
2135 pmtGain_odd[adc]->SetBinError(ch + 1, (rms * rms /
mean) * sqrt((2 * drms / rms) * (2 * drms / rms) + (dmean /
mean) * (dmean /
mean)));
2137 pmtGain_odd[adc]->SetBinContent(ch + 1, -0.5);
2138 pmtGain_odd[adc]->SetBinError(ch + 1, 0.001);
2146 double max = pmtGain_odd[adc]->GetMaximum();
2147 if (pmtGain_even[adc]->GetMaximum() >
max)
max = 1.05 * pmtGain_even[adc]->GetMaximum();
2148 double min = pmtGain_odd[adc]->GetMinimum();
2149 if (pmtGain_even[adc]->GetMinimum() <
min)
min = pmtGain_even[adc]->GetMinimum() - 0.05 * fabs(pmtGain_even[adc]->GetMinimum());
2150 if (
max < 0.20)
max = 0.20;
2151 if (
min > -0.10)
min = -0.10;
2153 pmtGain_empty[adc]->SetMarkerStyle(21);
2154 pmtGain_even[adc]->SetMarkerStyle(22);
2155 pmtGain_odd[adc]->SetMarkerStyle(23);
2156 pmtGain_empty[adc]->SetMarkerSize(ms);
2157 pmtGain_even[adc]->SetMarkerSize(ms);
2158 pmtGain_odd[adc]->SetMarkerSize(ms);
2159 pmtGain_empty[adc]->SetLabelSize(0.08,
"X");
2160 pmtGain_empty[adc]->SetLabelSize(0.08,
"Y");
2161 pmtGain_even[adc]->SetMarkerColor(2);
2162 pmtGain_odd[adc]->SetMarkerColor(4);
2163 pmtGain_empty[adc]->GetYaxis()->SetRangeUser(
min,
max);
2165 pmtGain_empty[adc]->Draw(
"e");
2166 pmtGain_even[adc]->Draw(
"same,e");
2167 pmtGain_odd[adc]->Draw(
"same,e");
2168 line->DrawLine(0, -0.01, 48, -0.01);
2169 line->DrawLine(0, 0.15, 48, 0.15);
2172 pad = Can->cd(maxgain + adc + 1);
2173 pad->SetTopMargin(0.15);
2178 if (max0 < 0.9 * maxy[adc]) final_empty[adc]->SetMaximum(maxy[adc]);
2179 if (min0 > miny[adc] + 0.1 * TMath::Abs(miny[adc])) final_empty[adc]->SetMinimum(miny[adc]);
2181 final_empty[adc]->SetMarkerStyle(21);
2182 final_even[adc]->SetMarkerStyle(22);
2183 final_odd[adc]->SetMarkerStyle(23);
2184 final_empty[adc]->SetMarkerSize(ms);
2185 final_even[adc]->SetMarkerSize(ms);
2186 final_odd[adc]->SetMarkerSize(ms);
2187 final_empty[adc]->SetLabelSize(0.08,
"X");
2188 final_empty[adc]->SetLabelSize(0.08,
"Y");
2189 final_even[adc]->SetMarkerColor(2);
2190 final_odd[adc]->SetMarkerColor(4);
2192 final_empty[adc]->Draw(
"e");
2193 final_even[adc]->Draw(
"same,e");
2194 final_odd[adc]->Draw(
"same,e");
2197 pad = Can->cd(2 * maxgain + adc + 1);
2198 pad->SetTopMargin(0.15);
2202 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerStyle(21);
2203 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetMarkerSize(ms);
2204 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08,
"X");
2205 m_data->m_finalHist1[ros][drawer][adc][0][1]->SetLabelSize(0.08,
"Y");
2206 if (do_plots)
m_data->m_finalHist1[ros][drawer][adc][0][1]->Draw(
"P0");
2208 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMaximum(
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMaximum());
2209 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMinimum(
m_data->m_finalHist1[ros][drawer][adc][0][1]->GetMinimum());
2210 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerStyle(25);
2211 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerSize(ms);
2212 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetMarkerColor(4);
2213 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08,
"X");
2214 m_data->m_finalHist1[ros][drawer][adc][0][2]->SetLabelSize(0.08,
"Y");
2215 if (do_plots)
m_data->m_finalHist1[ros][drawer][adc][0][2]->Draw(
"sameP0");
2219 pad = Can->cd(3 * maxgain + adc + 1);
2220 pad->SetTopMargin(0.15);
2224 if (max3 < 0.9 * maxy[4 + adc])
m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMaximum(maxy[4 + adc]);
2225 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]);
2227 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerStyle(21);
2228 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetMarkerSize(ms);
2229 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08,
"X");
2230 m_data->m_finalHist1[ros][drawer][adc][0][3]->SetLabelSize(0.08,
"Y");
2231 m_data->m_finalHist1[ros][drawer][adc][0][3]->Draw(
"E0");
2236 pad = Can->cd(4 * maxgain + adc + 1);
2237 pad->SetTopMargin(0.15);
2241 if (max4 < 0.9 * maxy[4 + adc])
m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMaximum(maxy[4 + adc]);
2242 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 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMarkerStyle(21);
2245 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetMarkerSize(ms);
2246 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetLabelSize(0.08,
"X");
2247 m_data->m_finalHist1[ros][drawer][adc][0][4]->SetLabelSize(0.08,
"Y");
2248 if (do_plots)
m_data->m_finalHist1[ros][drawer][adc][0][4]->Draw(
"E0");
2254 Can->Print(TString(moduleName +
"_fit_amp.png"),
"png");
2257 Can->Print(TString(moduleName +
"_fit_amp.ps"),
"ps");
2260 Can->Print(TString(moduleName +
"_fit_amp.svg"),
"svg");
2263 if (do_plots)
delete Can;
2265 for (
int g = 0; g < 2; g++) {
2266 delete final_empty[g];
2267 delete final_odd[g];
2268 delete final_even[g];