Beispiel #1
0
void 
AxisCollection::AddAxis(const PdfAxis& axis_){
    if (HasAxis(axis_.GetName())){
        throw DimensionError("Can't add axis " + axis_.GetName() + " already exists!"); 
    }
        
    fAxes.push_back(axis_);
    fAxisNbins.push_back(axis_.GetNBins());
    fNDimensions++;
    CountBins();
}
Beispiel #2
0
#include <catch.hpp>
#include <PdfAxis.h>
#include <iostream>

TEST_CASE("Bin Finding For Uniform Binning 1000 bins 0-100", "[PdfAxis]"){
    PdfAxis uniform("uniform axis", 0 , 100, 1000);
    
    SECTION("Last bin behaviour"){
        REQUIRE(uniform.FindBin(100) == 999);
        REQUIRE(uniform.FindBin(102) == 999);
        REQUIRE(uniform.GetNBins() == 1000);
    }


    SECTION("First bin behaviour"){
        REQUIRE(uniform.FindBin(0)   == 0);
        REQUIRE(uniform.FindBin(-20) == 0);
        REQUIRE(uniform.GetNBins()   == 1000);
    }

}

TEST_CASE("Bin Finding For Custom Binning 1000 bins 0-1001", "[PdfAxis]"){

    std::vector<double> lowEdges(1000);
    std::vector<double> highEdges(1000);

    for(size_t i = 0; i < lowEdges.size(); i++){
        lowEdges[i] = i;
        highEdges[i] = i+1;
    }