void TemplateParameters::readReweightingParameters(const Json::Value& reweighting, PostProcessing& postproc)
/*****************************************************************/
{
    vector<unsigned int> axes;
    const Json::Value ax = reweighting["axes"];
    if(!ax.isNull())
    {
        for(unsigned int index = 0; index < ax.size(); ++index)
        {
            unsigned int axis = ax[index].asUInt();
            axes.push_back(axis);
        }
    }
    vector< vector<double> > binss;
    const Json::Value binnings = reweighting["rebinning"];
    if(!binnings.isNull())
    {
        for(unsigned int index = 0; index < binnings.size(); ++index)
        {
            vector< double > bins;
            const Json::Value binning = binnings[index];
            for(unsigned int b = 0; b < binning.size(); ++b)
            {
                double boundary = binning[b].asDouble();
                bins.push_back(boundary);
            }
            binss.push_back(bins);
        }
    }
    postproc.addParameter("axes", axes);
    postproc.addParameter("rebinning", binss);
}
void TemplateParameters::readMirrorParameters(const Json::Value& mirror, PostProcessing& postproc)
/*****************************************************************/
{
    bool antiMirror = mirror.get("antisymmetric", false).asBool();
    unsigned int axis = mirror.get("axis", 1).asUInt();
    postproc.addParameter("antisymmetric", antiMirror);
    postproc.addParameter("axis", axis);
}
void TemplateParameters::readSmoothingParameters(const Json::Value& smooth, PostProcessing& postproc)
/*****************************************************************/
{
    unsigned int entriesPerBin = smooth.get("entriesperbin", 200).asUInt();
    double rescaleWidth = smooth.get("rescalewidth", 1.).asDouble();
    string kernel = smooth.get("kernel", "adaptive").asString();
    if(kernel!="adaptive" && kernel!="k5b")
    {
        stringstream error;
        error << "TemplateParameters::readSmoothingParameters(): Unknown smoothing kernel '"<<kernel<<"'";
        throw runtime_error(error.str());
    }
    postproc.addParameter("kernel", kernel);
    postproc.addParameter("entriesperbin", entriesPerBin);
    postproc.addParameter("rescalewidth", rescaleWidth);
}
void TemplateParameters::readRescalingParameters(const Json::Value& rescaling, PostProcessing& postproc)
/*****************************************************************/
{
    double factor = rescaling.get("factor", 1.).asDouble();
    postproc.addParameter("factor", factor);
}