//Renata Kopecna

#ifndef PATHS_HH
#define PATHS_HH
#include <iostream>
#include <assert.h>

#include <options.hh>
#include <parse.hh>


//=====================================//
//         Main folder paths           //
//=====================================//

std::string datapath(); //Returns the path where the data is stored based on the server/user
std::string workpath(); //Returns the path where the program is executed based on the server/user

const std::string DATA_PATH = datapath();
const std::string FIT_RESULTS_PATH = workpath()+"fitResults/";
const std::string PLOTS_PATH       = workpath()+"plots/";
const std::string TOYS_PATH        = workpath()+"Toys/";
const std::string COEFFS_PATH      = workpath()+"Coeffs/";
const std::string LATEX_PATH       = workpath()+"LaTeXfiles/";

//=====================================//
//         Paths for datsets           //
//=====================================//

std::string getSelectedTuplePath(int dataset, int run, int year);
std::string get_theFCNCpath(int dataset, int run);
std::string get_finalToySamplePath(int nPDF, int job_id, bool fitReference);

//=====================================//
//  Paths for angular parametrization  //
//=====================================//

namespace fcnc { //Forward declaration, fully defined in options.hh
    class options;
}
std::string get_angCorrPath(bool test);
std::string coeffs_eff_phsp_4D(fcnc::options *opts);


//=====================================//
//    Paths for angular resolution     //
//=====================================//
std::string get_angResoPlot_path(std::string angle, int year, std::string format);

//=====================================//
//        Paths for fit results        //
//=====================================//

std::string get_MainFitPlot_path();
std::string get_MCfitPlot_path(bool Ref, bool PHSP);
std::string get_genLvlFitPlot_path(bool PHSP);
std::string get_MoMPlot_path();
std::string get_GenLvlPlot_path();
std::string get_PullPlot_path();
std::string get_ToysFitResult_path(basic_params params);
std::string get_MainFitResult_path();

std::string get_JpsiSimFit2D_path(int idx, bool pPrimes);
std::string get_SigMCSimFit2D_path(int idx, int bin);
std::string get_param_scan_path(std::string name, bool error);
//=====================================//
//          Fit result tags            //
//=====================================//
std::string tag_bin(int nBinsToFit);
std::string tag_bin(int nBinsToFit, int bin);
std::string tag_Run(int Run);
std::string tag_datasample(bool fitReference, bool fitMC, bool fitPHSP);
std::string tag_sample_blind(basic_params params);
std::string tag_sample_blind(bool FitOnlyRun1, bool FitOnlyRun2,
                             bool FitOnlyMagDown, bool FitOnlyMagUp);


std::string final_result_name(bool fitReference, bool fitSignalMC, basic_params params,
                              bool simFit, int nBinsToFit, int effRun,
                              bool FitFinalToySamples, double statFrac,
                              bool NP, int systematics);

std::string get_eps_label(bool fitReference, bool fitSignalMC, bool fitPHSP,
                          bool FitFinalToySamples,
                      int nBinsToFit, int bin,
                      int polarity,
                      bool SimultaneousFit, fcnc::options opts);

std::string get_eps_label(bool fitReference, bool fitSignalMC, bool fitPHSP,
                          bool FitFinalToySamples,
                      int nBinsToFit, int bin,
                      bool SimultaneousFit, basic_params params);

// if bin == -1, no specific bin number is printed
//--------------------------------------------------------------
std::string get_MCfit_label(bool fitReference, bool fitPHSP,
                                int nBinsToFit, int bin,
                                bool simFit,
                                basic_params params, int effRun,
                                bool onlyAng, bool onlyMass);

std::string finalResult_MCfit_txt(int nPDF, bool fitReference, bool fitPHSP,
                              int nBinsToFit, int bin,
                              bool simFit,
                              basic_params params, int effRun,
                                  bool onlyAng, bool onlyMass);
std::string final_result_name_MC(basic_params params, int nBins,
                                 bool fitReference, bool fitPHSP, bool simFit,
                                 bool onlyAng, bool onlyMass);

//--------------------------------------------------------------
std::string get_genLvlFit_label(bool fitPHSP,
                                int nBinsToFit, int bin,
                                basic_params params,
                                bool onlyAng, bool onlyMass);
std::string finalResult_genLvlMCfit_txt(bool fitPHSP,
                                    int nBinsToFit, int bin,
                                    basic_params params,
                                    bool onlyAng, bool onlyMass);
std::string final_result_name_genLvlMC(basic_params params, int nBins, bool fitPHSP,
                                       bool onlyAng, bool onlyMass);
//--------------------------------------------------------------
std::string get_bkgFitPlot_path();
std::string get_bkgFitResult_path();

std::string get_bkg_tag(int bin, int nBins,
                        bool fitReference,
                        bool lowMass, bool highMass,
                        bool fitKpi, basic_params params);
std::string get_bkgCorrPlot_path(std::string ang1, std::string ang2,
                                 int bin, int nBins,
                                 bool fitReference,
                                 bool lowMass, bool highMass,
                                 bool fitKpi, basic_params params);

std::string final_result_name_bkg(int nBins,
                                  bool fitReference,
                                  bool lowMass, bool highMass,
                                  bool fitKpi, basic_params params);


//--------------------------------------------------------------
std::string get_MassFitPlot_path();
std::string get_MassFitResult_path();
std::string get_MassFit_label(bool fitReference,
                              int bin, int nBins,
                              bool splitRuns, basic_params params,
                              int effRun);
std::string final_result_name_mass(bool fitReference, int nBins,
                                   bool splitRuns,
                                   basic_params params, int effRun);
//--------------------------------------------------------------

std::string get_ToysFitPlot_path(basic_params params);
std::string get_ToysFit_label(int jobID, bool fitReference,
                              int bin, int nBins,
                              bool simFit, basic_params params, int effRun,
                              bool onlyAng, bool onlyMass,
                              bool onlySig, bool onlyBkg,
                              bool lowMass, bool highMass);

std::string final_result_name_toys(int jobID, bool fitReference,
                                   int nBins, bool simFit,
                                   basic_params params, int effRun,
                                   bool onlyAng, bool onlyMass,
                                   bool onlySig, bool onlyBkg,
                                   bool lowMass, bool highMass);

std::string init_params_name_toys(int jobID, bool fitReference,
                                  int nBins, bool simFit,
                                  basic_params params, int effRun,
                                  bool onlyAng, bool onlyMass,
                                  bool onlySig, bool onlyBkg,
                                  bool lowMass, bool highMass);

std::string get_finalToys_file(bool fitReference, int nBins,
                               bool simFit,
                               basic_params params, int effRun);


std::string get_ToyPullPlot_folder( basic_params params);
std::string get_ToyPullPlot_tag(int bin, std::string varName, basic_params params, bool dist, bool pull);
//--------------------------------------------------------------


//=====================================//
//        Paths for Latex couts        //
//=====================================//

//File used for capturing latex output such as parameter tables
//The file is handled by function in helpers.cc
//Technically should be a class but I'm feeling lazy
std::string get_Latex_noteFile(std::string tag);

std::string latex_fitterFile(std::string index);
std::string latex_toyFile();
std::string latex_params();
std::string latex_paramScan();
std::string latex_bkgFit();
std::string latex_massFit();



#endif // PATHS_HH