31void compare(
const PedestalProcessorData& testobject,
const TProfile& refFECHG,
const TProfile& refFECLG,
const TProfile& refLEDMONHG,
const TProfile& refLEDMONLG,
bool testCount,
bool verbose)
33 const double PRECISION = FLT_EPSILON;
34 const double PRECISIONMEAN = FLT_EPSILON;
36 auto [meanHG, rmsHG] = testobject.
getValue(ichan,
false,
false);
37 auto [meanLG, rmsLG] = testobject.
getValue(ichan,
true,
false);
39 std::cout <<
"Channel " << ichan <<
", mean HG " << meanHG <<
", RMS HG " << std::sqrt(rmsHG) <<
", entries HG " << testobject.
getEntriesForChannel(ichan,
false,
false) <<
" ref(mean " << refFECHG.GetBinContent(ichan + 1) <<
", RMS " << refFECHG.GetBinError(ichan + 1) <<
", entries " << refFECHG.GetBinEntries(ichan + 1) <<
")" << std::endl;
40 std::cout <<
"Channel " << ichan <<
", mean LG " << meanLG <<
", RMS LG " << std::sqrt(rmsLG) <<
", entries LG " << testobject.
getEntriesForChannel(ichan,
true,
false) <<
" ref(mean " << refFECLG.GetBinContent(ichan + 1) <<
", RMS " << refFECLG.GetBinError(ichan + 1) <<
", entries " << refFECLG.GetBinEntries(ichan + 1) <<
")" << std::endl;
42 BOOST_CHECK_LE(std::abs(meanHG - refFECHG.GetBinContent(ichan + 1)), PRECISIONMEAN);
43 BOOST_CHECK_LE(std::abs(meanLG - refFECLG.GetBinContent(ichan + 1)), PRECISIONMEAN);
44 BOOST_CHECK_LE(std::abs(std::sqrt(rmsHG) - refFECHG.GetBinError(ichan + 1)), PRECISION);
45 BOOST_CHECK_LE(std::abs(std::sqrt(rmsLG) - refFECLG.GetBinError(ichan + 1)), PRECISION);
52 auto [meanHG, rmsHG] = testobject.
getValue(ichan,
false,
true);
53 auto [meanLG, rmsLG] = testobject.
getValue(ichan,
true,
true);
55 std::cout <<
"LEDMON " << ichan <<
", mean HG " << meanHG <<
", RMS HG " << std::sqrt(rmsHG) <<
", entries HG " << testobject.
getEntriesForChannel(ichan,
false,
true) <<
" ref(mean " << refLEDMONHG.GetBinContent(ichan + 1) <<
", RMS " << refLEDMONHG.GetBinError(ichan + 1) <<
", entries " << refLEDMONHG.GetBinEntries(ichan + 1) <<
")" << std::endl;
56 std::cout <<
"LEDMON " << ichan <<
", mean LG " << meanLG <<
", RMS LG " << std::sqrt(rmsLG) <<
", entries LG " << testobject.
getEntriesForChannel(ichan,
true,
true) <<
" ref(mean " << refLEDMONLG.GetBinContent(ichan + 1) <<
", RMS " << refLEDMONLG.GetBinError(ichan + 1) <<
", entries " << refLEDMONLG.GetBinEntries(ichan + 1) <<
")" << std::endl;
58 BOOST_CHECK_LE(std::abs(meanHG - refLEDMONHG.GetBinContent(ichan + 1)), PRECISIONMEAN);
59 BOOST_CHECK_LE(std::abs(meanLG - refLEDMONLG.GetBinContent(ichan + 1)), PRECISIONMEAN);
60 BOOST_CHECK_LE(std::abs(std::sqrt(rmsHG) - refLEDMONHG.GetBinError(ichan + 1)), PRECISION);
61 BOOST_CHECK_LE(std::abs(std::sqrt(rmsLG) - refLEDMONLG.GetBinError(ichan + 1)), PRECISION);
83 const int NUMBERALTROSAMPLES = 15;
84 for (
auto iev = 0; iev < 1000; iev++) {
86 for (
int isample = 0; isample < 15; isample++) {
89 auto raw_hg = gRandom->Gaus(40, 6),
90 raw_lg = gRandom->Gaus(36, 10);
91 unsigned short adc_hg =
static_cast<unsigned short>(raw_hg > 0 ? raw_hg : 0),
92 adc_lg =
static_cast<unsigned short>(raw_lg > 0 ? raw_lg : 0);
93 refFECHG.Fill(ichan, adc_hg);
94 refFECLG.Fill(ichan, adc_lg);
95 testobject.
fillADC(adc_hg, ichan,
false,
false);
96 testobject.
fillADC(adc_lg, ichan,
true,
false);
100 for (
auto iev = 0; iev < 1000; iev++) {
102 for (
int isample = 0; isample < 15; isample++) {
105 auto raw_hg = gRandom->Gaus(40, 6),
106 raw_lg = gRandom->Gaus(36, 10);
107 unsigned short adc_hg =
static_cast<unsigned short>(raw_hg > 0 ? raw_hg : 0),
108 adc_lg =
static_cast<unsigned short>(raw_lg > 0 ? raw_lg : 0);
109 refLEDMONHG.Fill(ichan, adc_hg);
110 refLEDMONLG.Fill(ichan, adc_lg);
111 testobject.
fillADC(adc_hg, ichan,
false,
true);
112 testobject.
fillADC(adc_lg, ichan,
true,
true);
118 compare(testobject, refFECHG, refFECLG, refLEDMONHG, refLEDMONLG,
true,
false);
121 auto testdoubled = testobject + testobject;
122 TProfile refFECHGdouble(refFECHG),
123 refFECLGdouble(refFECLG),
124 refLEDMONHGdouble(refLEDMONHG),
125 refLEDMONLGdouble(refLEDMONLG);
126 refFECHGdouble.Add(&refFECHG);
127 refFECLGdouble.Add(&refFECLG);
128 refLEDMONHGdouble.Add(&refLEDMONHG);
129 refLEDMONLGdouble.Add(&refLEDMONLG);
130 compare(testdoubled, refFECHGdouble, refFECLGdouble, refLEDMONHGdouble, refLEDMONLGdouble,
false,
false);
133 auto testreset = testobject;
136 auto [meanHG, rmsHG] = testreset.getValue(ichan,
false,
false);
137 auto [meanLG, rmsLG] = testreset.getValue(ichan,
true,
false);
144 auto [meanHG, rmsHG] = testreset.getValue(ichan,
false,
true);
145 auto [meanLG, rmsLG] = testreset.getValue(ichan,
true,
true);
void compare(const PedestalProcessorData &testobject, const TProfile &refFECHG, const TProfile &refFECLG, const TProfile &refLEDMONHG, const TProfile &refLEDMONLG, bool testCount, bool verbose)