//Renata Kopecna

#ifndef SCRIPTHELPERS_HH
#define SCRIPTHELPERS_HH

#include <string>
#include <TGraphAsymmErrors.h>
#include <TH1D.h>


const std::vector<std::string> ANG_OBS        = {"Fl","S3","S4","S5","Afb","S7","S8","S9"}; //lenght=8
const std::vector<std::string> ANG_OBS_TLaTeX = {"F_{L}", "S_{3}","S_{4}", "S_{5}", "A_{FB}","S_{7}", "S_{8}","S_{9}"};

const std::vector<std::string> P_OBS        = {"Fl", "P1", "P2", "P3", "P4", "P5", "P6", "P8"};
const std::vector<std::string> P_OBS_TLaTeX = {"F_{L}", "P_{1}", "P_{2}", "P_{3}", "P_{4}^{\\prime}", "P_{5}^{\\prime}", "P_{6}^{\\prime}", "P_{8}^{\\prime}"};

const std::vector<std::string> MASS_OBS        = {"m_b","m_sigma_1","alpha_1","alpha_2","n_1","n_2"};
const std::vector<std::string> MASS_OBS_TLaTeX = {"m_{B^{+}}", "\\sigma_{1}", "\\alpha_{1}", "\\alpha_{2}", "n_{1}", "n_{2}"};

//TODO: make it based on the order of the polynomial //TODO: change according to the final order
const std::vector<std::string> BKG_OBS        = {"cbkgctk1", "cbkgctk2", "cbkgctk3", "cbkgctk4", "cbkgctk5",
                                                 "cbkgctl1", "cbkgctl2",
                                                 "m_lambda","f_sig"};//lenght=9
const std::vector<std::string> BKG_OBS_TLaTeX = {"c_{bkg}^{1}(cos\\Theta_{K})", "c_{bkg}^{2}(cos\\Theta_{K})", "c_{bkg}^{3}(cos\\Theta_{K})", "c_{bkg}^{4}(cos\\Theta_{K})", "c_{bkg}^{5}(cos\\Theta_{K})",
                                                 "c_{bkg}^{1}(cos\\Theta_{L})", "c_{bkg}^{2}(cos\\Theta_{L})",
                                                 "\\lambda_\\mathrm{m}","f_{sig}"};

const std::vector<std::string> SWAVE = {"FS","SS1","SS2","SS3","SS4","SS5"};//lenght=6
const std::vector<std::string> SWAVE_TLaTeX = {"F_{S}","S_{S1}","S_{S2}","S_{S3}","S_{S4}","S_{S5}"};


struct valErr{ //For easier saving of David's, Belle's, BaBar's and B0's analysis
    double val = 0.0;
    double err = 0.0;
    //Constructor
    valErr(double v, double err):
        val(v), err(err){};
    //assignment operator:
    valErr operator=(const valErr ve){
        val = ve.val;
        err = ve.err;
        return *this;
    }
};

//Takes two valErr and returns the difference ins sigmas
double sigmaAway(valErr a, valErr b);

//Returns true if the observable is measured in certain folding
bool plotObsv(int folding, std::string obs);

std::vector<double> obsv_range(std::string parName);

void designTGraph(TGraphAsymmErrors *g, int markerStyle, int color);

//Returns and empty histogram so the axes are plotted
TH1D *emptyHist(std::string observable, double min, double max, int nBins);
TH1D *emptyHist(std::string observable);

TGraphAsymmErrors* get_TGraphFromFile(std::string fileName, std::string observable, bool isRef);

TH1D* hist_graphDiff(TGraphAsymmErrors* graph_a, TGraphAsymmErrors* graph_b,
                     double range, std::string title);
#endif // SCRIPTHELPERS_HH
