24 int main(
int argc,
char **argv)
38 JParser<> zap(
"Example program to check background calculation.");
49 catch(
const exception &error) {
50 FATAL(error.what() << endl);
53 gRandom->SetSeed(seed);
55 NOTICE(
"K40 rates (original) " << rates_Hz << endl);
57 JK40Rates corrected_rates_Hz = rates_Hz;
59 corrected_rates_Hz.correct(QE);
61 NOTICE(
"K40 rates (corrected) " << corrected_rates_Hz << endl);
63 if (livetime_s > 0.0) {
67 buffer.resize(corrected_rates_Hz.getUpperL1Multiplicity() + 1);
69 const double W = 1.0 / livetime_s;
71 for (
size_t M = corrected_rates_Hz.getLowerL1Multiplicity(); M <= corrected_rates_Hz.getUpperL1Multiplicity(); ++M) {
73 const int numberOfEvents = (int) (livetime_s * corrected_rates_Hz.getMultiplesRate(M));
75 for (
int number_of_events = 0; number_of_events != numberOfEvents; ++number_of_events) {
79 for (
size_t i = 0; i != M; ++i) {
80 if (gRandom->Rndm() <= QE) {
89 NOTICE(
"simulated" << endl);
91 for (
size_t M = corrected_rates_Hz.getLowerL1Multiplicity(); M <= corrected_rates_Hz.getUpperL1Multiplicity(); ++M) {
92 NOTICE(setw(2) << M <<
' ' <<
FIXED(8,4) << buffer[M] << endl);
97 for (
size_t M = rates_Hz.getLowerL1Multiplicity(); M <= rates_Hz.getUpperL1Multiplicity(); ++M) {
98 if (fabs(buffer[M] - rates_Hz.getMultiplesRate(M)) > precision * rates_Hz.getMultiplesRate(M)) {
99 FATAL(
"R[" << setw(2) << M <<
"] [Hz] " <<
FIXED(8,4) << buffer[M] <<
" != " << rates_Hz.getMultiplesRate(M) << endl);