//Renata Kopecna
/**
 * @file multifit.hh
 * @author Christoph Langenbruch
 * @date 2009-03-18
 *
 */

#ifndef MULTIFIT_H
#define MULTIFIT_H

#include <string>
#include <vector>
#include <funcs.hh>
#include <TFile.h>

namespace fcnc {
    //Forward declaration
    class parameter;


///base class for analysis classes which do multiple fits, e.g. toystudy
class multifit {
protected:
  ///set of options
  options* opts;
  ///constructor
  multifit(options* o);
  ///destructor
  virtual ~multifit();
  ///unbinned likelihood fit of gaussian
  void fit_gaussian(std::vector<double>& values, double& gauss_mean, double& sigma_gauss_mean, double& gauss_width, double& sigma_gauss_width, double& chi_squared) const;
  ///fits a gaussian to the pull values 
  void update_pull(parameter* p, std::vector<double>& values, std::vector<double>& errors, double& gauss_mean, double& sigma_gauss_mean, double& gauss_width, double& sigma_gauss_width, double& chi_squared, std::string appendix="") const;
  ///fits a gaussian to the values 
  void update_value(parameter* p, std::vector<double>& values, std::vector<double>& errors, double& gauss_mean, double& sigma_gauss_mean, double& gauss_width, double& sigma_gauss_width, double& chi_squared, std::string appendix="") const;
  ///fits a gaussian to the errors 
  void update_error(parameter* p, std::vector<double>& values, std::vector<double>& errors, double& gauss_mean, double& sigma_gauss_mean, double& gauss_width, double& sigma_gauss_width, double& chi_squared, std::string appendix="") const;
  TFile* output;
};

}

#endif
