|
@ -15,6 +15,12 @@ |
|
|
|
|
|
|
|
|
#include "constants.h" |
|
|
#include "constants.h" |
|
|
|
|
|
|
|
|
|
|
|
std::pair<double, double> DivWithErr(double x, double dx, double y, double dy) { |
|
|
|
|
|
double err_x = (1 / y) * dx; |
|
|
|
|
|
double err_y = - (x / (y*y)) * dy; |
|
|
|
|
|
return std::make_pair(x / y, TMath::Sqrt((TMath::Sq(err_x) + TMath::Sq(err_y)))); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
class FourVect |
|
|
class FourVect |
|
|
{ |
|
|
{ |
|
|
private: |
|
|
private: |
|
@ -136,6 +142,8 @@ struct RooFitSummary |
|
|
RooPlot *fit_histogram; |
|
|
RooPlot *fit_histogram; |
|
|
RooPlot *pull_histogram; |
|
|
RooPlot *pull_histogram; |
|
|
std::map<std::string, std::string> pdf_names; |
|
|
std::map<std::string, std::string> pdf_names; |
|
|
|
|
|
std::pair<double, double> signal_yield; |
|
|
|
|
|
std::pair<double, double> background_yield; |
|
|
std::vector<FittedParam> fitted_params; |
|
|
std::vector<FittedParam> fitted_params; |
|
|
ShapeParamters shape_parameters; |
|
|
ShapeParamters shape_parameters; |
|
|
}; |
|
|
}; |
|
@ -449,6 +457,10 @@ RooFitSummary CreateRooDataSetAndFitCB(TTree *dataSet, TString var_name, TString |
|
|
pdf_names[signal_name.Data()] = sig_cb.getTitle().Data(); |
|
|
pdf_names[signal_name.Data()] = sig_cb.getTitle().Data(); |
|
|
|
|
|
|
|
|
TString pull_compare_name{}; |
|
|
TString pull_compare_name{}; |
|
|
|
|
|
double sig_val = 0.; |
|
|
|
|
|
double sig_err = 0.; |
|
|
|
|
|
double bkg_val = 0.; |
|
|
|
|
|
double bkg_err = 0.; |
|
|
if (hasExpBkg) |
|
|
if (hasExpBkg) |
|
|
{ |
|
|
{ |
|
|
// Exponential for Background |
|
|
// Exponential for Background |
|
@ -475,17 +487,20 @@ RooFitSummary CreateRooDataSetAndFitCB(TTree *dataSet, TString var_name, TString |
|
|
fitted_params.push_back(FittedParam(var_mass_nsig, 2)); |
|
|
fitted_params.push_back(FittedParam(var_mass_nsig, 2)); |
|
|
fitted_params.push_back(FittedParam(var_mass_nbkg, 2)); |
|
|
fitted_params.push_back(FittedParam(var_mass_nbkg, 2)); |
|
|
|
|
|
|
|
|
double sig_val = var_mass_nsig.getVal(); |
|
|
|
|
|
double sig_err = var_mass_nsig.getError(); |
|
|
|
|
|
double bkg_val = var_mass_nbkg.getVal(); |
|
|
|
|
|
double bkg_err = var_mass_nbkg.getError(); |
|
|
|
|
|
|
|
|
sig_val = var_mass_nsig.getVal(); |
|
|
|
|
|
sig_err = var_mass_nsig.getError(); |
|
|
|
|
|
bkg_val = var_mass_nbkg.getVal(); |
|
|
|
|
|
bkg_err = var_mass_nbkg.getError(); |
|
|
|
|
|
|
|
|
double sig_over_bkg_val = sig_val / TMath::Sqrt(sig_val + bkg_val); |
|
|
|
|
|
|
|
|
double significance_val = sig_val / TMath::Sqrt(sig_val + bkg_val); |
|
|
double err_prop_sig = (sig_val + 2 * bkg_val) / (2 * TMath::Power((sig_val + bkg_val), (3 / 2))); |
|
|
double err_prop_sig = (sig_val + 2 * bkg_val) / (2 * TMath::Power((sig_val + bkg_val), (3 / 2))); |
|
|
double err_prop_bkg = -sig_val / (2 * TMath::Power((sig_val + bkg_val), (3 / 2))); |
|
|
double err_prop_bkg = -sig_val / (2 * TMath::Power((sig_val + bkg_val), (3 / 2))); |
|
|
double sig_over_bkg_err = TMath::Sqrt(TMath::Sq(err_prop_sig * sig_err) + TMath::Sq(err_prop_bkg * bkg_err)); |
|
|
|
|
|
|
|
|
double significance_err = TMath::Sqrt(TMath::Sq(err_prop_sig * sig_err) + TMath::Sq(err_prop_bkg * bkg_err)); |
|
|
|
|
|
|
|
|
|
|
|
auto sig_over_bkg = DivWithErr(sig_val, sig_err, bkg_val, bkg_err); |
|
|
|
|
|
|
|
|
fitted_params.push_back(FittedParam("sig_over_bkg", "N_{Sig}/#sqrt{N_{Sig} + N_{Bkg}}", sig_over_bkg_val, sig_over_bkg_err, 2)); |
|
|
|
|
|
|
|
|
fitted_params.push_back(FittedParam("significance", "N_{Sig}/#sqrt{N_{Sig} + N_{Bkg}}", significance_val, significance_err, 2)); |
|
|
|
|
|
fitted_params.push_back(FittedParam("sig_over_bkg", "N_{Sig}/N_{Bkg}", sig_over_bkg.first, sig_over_bkg.second, 2)); |
|
|
|
|
|
|
|
|
fitted_params.push_back(FittedParam(var_mass_bkg_c, 5)); |
|
|
fitted_params.push_back(FittedParam(var_mass_bkg_c, 5)); |
|
|
|
|
|
|
|
@ -519,6 +534,8 @@ RooFitSummary CreateRooDataSetAndFitCB(TTree *dataSet, TString var_name, TString |
|
|
roo_frame_mass, |
|
|
roo_frame_mass, |
|
|
roo_frame_pull, |
|
|
roo_frame_pull, |
|
|
pdf_names, |
|
|
pdf_names, |
|
|
|
|
|
std::make_pair(sig_val, sig_err), |
|
|
|
|
|
std::make_pair(bkg_val, bkg_err), |
|
|
fitted_params, |
|
|
fitted_params, |
|
|
ShapeParamters{ |
|
|
ShapeParamters{ |
|
|
var_mass_alphaL.getVal(), |
|
|
var_mass_alphaL.getVal(), |
|
|