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

#ifndef BU2KSTARMUMU_GENERATOR_H
#define BU2KSTARMUMU_GENERATOR_H

#include <vector>
#include <bu2kstarmumu_parameters.hh> //Forward declaration is complainign due to dynamic_cast
#include <bu2kstarmumu_pdf.hh>
#include <generator.hh>

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

///Class to generate toy data for the decay Bs -> JPsi Phi.
class bu2kstarmumu_generator: public generator {
public:
  ///constructor
  bu2kstarmumu_generator(options* o):
    opts(o) {
  effective_f_sig = 0.5;
};
  /** 
   * generate Bs -> Phi gamma toy monte carlo and return a vector of the generated events
   * @param nevents number of events to generate
   * @param parameters parameter values to use in generation
   * @param probability pdf to use in the generation. Some helper routines are used from here
   */
  std::vector<event> generate(unsigned int nevents, bu2kstarmumu_parameters* parameters, bu2kstarmumu_pdf* probability);
  std::vector<event> generate(unsigned int nevents, parameters* params, pdf* probability) {
    return generate(nevents, dynamic_cast<bu2kstarmumu_parameters*>(params), dynamic_cast<bu2kstarmumu_pdf*>(probability));
  };
private:
  ///pointer to the pdf
  bu2kstarmumu_pdf* prob;
  ///pointer to the parameters to use in the generation
  bu2kstarmumu_parameters* params;
  ///pointer to options
  options* opts;
  ///used internally for threaded generation of the events
  void generation_thread(unsigned int thread_id, unsigned long nevents, std::vector<event>* eventVec);
  ///background and signal weight correction for f_sig
  double effective_f_sig;
};

}

#endif

