#ifndef FITCONF_H
#define FITCONF_H

#include "Rtypes.h"
#include <string>
#include <vector>
#include <stdlib.h>
#include <iostream>
#include <fstream>

class FitConf 
{
 public:
  
  ~FitConf();
  
  int GetNpar()   {return zbmPar.size()+zflPar.size()+detPar.size()-nFix;}
  int GetNbeams() {return beamType.size();}
  std::vector<std::string> GetMinuitCommand() {return minCom;}

  std::vector<int>    GetBeamType()         {return beamType;}
  std::vector<double> GetZflukPar()         {return zflPar;}
  std::vector<double> GetZflukParMin()      {return zflMin;}
  std::vector<double> GetZflukParMax()      {return zflMax;}
  std::vector<int>    IsZflukParFixed()     {return zflFix;}
  std::vector<double> GetZbeamPar()         {return zbmPar;}
  std::vector<double> GetZbeamParMin()      {return zbmMin;}
  std::vector<double> GetZbeamParMax()      {return zbmMax;}
  std::vector<double> GetZbeamParPenalty()  {return zbmPen;}
  std::vector<int>    IsZbeamParFixed()     {return zbmFix;}
  std::vector<double> GetDetPar()           {return detPar;}
  std::vector<double> GetDetParMin()        {return detMin;}
  std::vector<double> GetDetParMax()        {return detMax;}
  std::vector<double> GetDetParPenalty()    {return detPen;}
  std::vector<int>    IsDetParFixed()       {return detFix;}
  
  std::vector<std::string> GetMCpath() {return mcPATH;}
  std::vector<std::string> GetMCname() {return mcNAME;}

  std::vector<std::string> GetDataPath() {return dataPATH;}
  std::vector<std::string> GetDataName() {return dataNAME;}

  std::vector<double> GetMCPOT() {return mcPOT;}
  std::vector<double> GetDataPOT() {return dataPOT;}

  double GetPIDcut() {return pidcut;}
  bool DoNeugen() {return neugen;}
  std::string GetNeugenConfName() {return neugen_conf_name;}
  int GetNeugenConfNumber() {return neugen_conf_no;}
  bool DoCutLowY() {return cutlowy;}
  bool DoInuke() {return doinuke;}
  bool DoXSecRW() {return xsecrw;}
  double GetMAQE() {return maqe;}
  double GetMARES() {return mares;}
  double GetKNO() {return kno;}
  double GetPiPlusPTpenalty() {return piPlusPTpenalty;}
  double GetPiMinusPTpenalty() {return piMinusPTpenalty;}
  std::string GetNueMRCCFile() {return nuemrccfile;}
  std::string GetNueMRCCHistName() {return nuemrcchist;}

  bool DoSmooth() {if(smooth_width!=0.0) return true; else return false;}
  double GetSmoothWidth() {return smooth_width;}

  static FitConf* GetInstance();
  void ResetVectors();
  void ReadInput(const char* inputFile);
 private:

  FitConf();
  static FitConf* instance;

  int nFix;
  double pidcut;
  bool neugen,cutlowy,doinuke,xsecrw;
  std::string neugen_conf_name;
  std::string nuemrccfile;
  std::string nuemrcchist;
  int neugen_conf_no;
  double maqe,mares, kno;

  double smooth_width;
  
  std::vector<std::string> minCom;
  std::vector<int> beamType;
  std::vector<double> mcPOT;
  std::vector<double> dataPOT;
  std::vector<std::string> dataPATH;
  std::vector<std::string> dataNAME;
  std::vector<std::string> mcPATH;
  std::vector<std::string> mcNAME;
  std::vector<double> zflPar, zflMin, zflMax;
  std::vector<int> zflFix, zbmFix, detFix;
  double piPlusPTpenalty, piMinusPTpenalty;
  std::vector<double> zbmPar, zbmMin, zbmMax, zbmPen;
  std::vector<double> detPar, detMin, detMax, detPen;
  std::vector<std::vector<std::string> > vars;
};

#endif
