Example #1
0
void check_histos_equal(const Histogram & h1, const Histogram & h2){
    BOOST_REQUIRE(h1.get_nbins()==h2.get_nbins());
    BOOST_REQUIRE(h1.get_xmin()==h2.get_xmin());
    BOOST_REQUIRE(h1.get_xmax()==h2.get_xmax());
    //for the total weight, do not assume too much ...
    BOOST_REQUIRE(utils::close_to_relative(h1.get_sum_of_bincontents(),h2.get_sum_of_bincontents()));
    const size_t n = h1.get_nbins();
    for(size_t i=0; i<=n+1; i++){
        BOOST_CHECK(h1.get(i)==h2.get(i));
    }
}
Example #2
0
void theta::randomize_poisson(Histogram & h, Random & rnd){
    const size_t nbins = h.get_nbins();
    for(size_t bin=0; bin<=nbins+1; ++bin){
        double mu = h.get(bin);
        if(mu > 0.){
            h.set(bin, rnd.poisson(mu));
        }
    }
}