16 logLinearBinning(
const unsigned int nBins,
const double absXmin,
const double absXmax,
const bool symmetriseAroundZero){
18 if (absXmin <=0 or absXmax <=0){
19 throw std::range_error(
"absXmin or absXmax argument to logLinearBinning is out of range");
20 }
else if (nBins ==0){
21 throw std::range_error(
"nBins argument to logLinearBinning is zero");
24 const unsigned int asymVecSize = nBins + 1;
25 std::vector<double> theBinning(asymVecSize,0.);
27 const double logStart = std::log(absXmin);
28 const double logDist = std::log(absXmax) - logStart;
29 const double logStep = logDist / (double) nBins;
31 double thisLog{logStart};
32 for (
auto & thisBin:theBinning){
33 thisBin=std::exp(thisLog);
41 if (symmetriseAroundZero){
42 std::vector<double> aux_negative;
43 aux_negative.reserve(nBins+1);
45 std::transform(theBinning.begin(),theBinning.end(), std::back_inserter(aux_negative),
46 [](
double & val){return -1. * val;});
50 aux_negative.push_back(0.);
52 theBinning.insert(theBinning.begin(), aux_negative.begin(), aux_negative.end());