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

#ifndef PARAMETERSCAN_H
#define PARAMETERSCAN_H

#include <string>
#include <vector>
#include <multifit.hh>

//TODO: move to /Run/!

namespace fcnc {
    class options;
    class generator;
    class parameters;
    class pdf;

///class to perform repeated fits while changing a parameter value, e.g. background fraction
class parameterscan: public multifit {
private:
  ///common parameters in different parameter sets
  std::vector< std::string > common_params;  
public:
  ///constructor
  parameterscan(options* o);
  /**
   * perform a parameter scan
   * @param param_name the name of the parameter which will be varied in the scan
   * @param min the start value for the varied parameter
   * @param max the stop value for the varied parameter
   * @param nsteps the number of steps in which to vary the parameter
   * @param nevents the number of events used per fit of the toy data
   * @param reruns the number of repeats for a single value of the parameter
   * @param prob pointer to the pdf to use in the likelihood fit
   * @param params pointer to parameterset to use in the likelihood fit
   * @param gen pointer to the toy data generator to use
   * @param only_float_in_generation only varies the parameter in the generation, 
   * but fixes it in the fit. This way one can do systematic studies.
   **/
  void scan(std::string param_name, double min, double max, unsigned int nsteps, unsigned int nevents, unsigned int reruns, pdf* prob, parameters* params, generator* gen, bool only_float_in_generation=false);
 /**
   * perform a parameter scan
   * @param param_name the name of the parameter which will be varied in the scan
   * @param min the start value for the varied parameter
   * @param max the stop value for the varied parameter
   * @param nsteps the number of steps in which to vary the parameter
   * @param nevents the number of events used per fit of the toy data
   * @param reruns the number of repeats for a single value of the parameter
   * @param prob pointer to the pdf to use in the likelihood fit
   * @param params pointer to parameterset to use in the likelihood fit
   * @param gen pointer to the toy data generator to use
   * @param only_float_in_generation only varies the parameter in the generation, 
   * but fixes it in the fit. This way one can do systematic studies.
   **/  
  void scan(std::string param_name, double min, double max, unsigned int nsteps, std::vector<unsigned int> nevents, unsigned int reruns, std::vector<pdf*> pdfs, std::vector<parameters*> params, std::vector<generator*> gens, bool only_float_in_generation=false);
  ///set common parameters
  void set_common_parameters(std::vector<std::string> common_pars) {
    common_params = common_pars;
  };
};

}


#endif
