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

#ifndef BU2KSTARMUMU_LOADER_H
#define BU2KSTARMUMU_LOADER_H

#include "TLorentzVector.h"

namespace fcnc {
    class options;
    class event;

///class that implements the ability to load the Bs -> JPsi Phi signal decay from Zoo-ntuple root files.
class bu2kstarmumu_loader {
public:
  ///constructor 
  bu2kstarmumu_loader(options* o):
    opts(o) {};
  ///Read events from decaytree tuple
  std::vector<event> read_decaytree_tuple(std::string filename,  std::string treename, bool mctruth=false, int nevents=1000000, int syst_variation=-1);
  std::vector<event> read_full_tuple(int year, std::string filename,  std::string treename, bool isMC = false, bool mctruth=false, bool genLevelMC = false, int nevents=1000000);

  void test_angles(std::string filename,  std::string treename, bool mctruth=false, int nevents=1000000);

  ///calculate decay angles according to theory convention http://arxiv.org/abs/0805.2525
  void theory_angles(const TLorentzVector& muplus, const TLorentzVector& muminus, const TLorentzVector& kaon, const TLorentzVector& pion, double& costhetal, double& costhetak, double& phi);

  ///calculate decay angles according to lhcb convention http://arxiv.org/abs/1304.6325
  void lhcb_angles(bool bplus, const TLorentzVector& muplus, const TLorentzVector& muminus, const TLorentzVector& kaon, const TLorentzVector& pion, double& costhetal, double& costhetak, double& phi);

  void hd_angles(bool bplus, const TLorentzVector& muplus, const TLorentzVector& muminus, const TLorentzVector& kaon, const TLorentzVector& pion, double& costhetal_lhs, double& costhetal_rhs, double& costhetak_lhs, double& costhetak_rhs, double& phi);

private:
  ///pointer to options
  options* opts;
};

}

#endif
