Hi guys,
I am a relative beginner to Roofit and am currently trying to write a simple Toy MC that performs a simultaneous fit to two independent sWeighted data samples in order to extract the decay time (and inverse decay time). Both these samples contain a fitted crystal ball signal peak and then a fitted exponential function with a realistic acceptance tail as the combinatorial background. These two samples would loosely correspond to bins of a multivariate classifier, so the two samples are generated to have the same proportion of signal events but differing amounts of combinatorial background (i.e low BDT bin and high BDT bin). I have been following the simultaneous fit tutorial steps in order to implement this, but I am finding that my simultaneous fit is underestimating the value of the decay time considerably (the pull distribution is centered on -12). I am fitting the same RooAccExponential PDF to both samples. I was just wondering whether I have implemented the simultaneous fit properly, and if not am I doing something wrong or is there some other issue that means the fit is not performing well? I have included the section of my code that implements the simultaneous fit here
//------------------------------------------------
// Simultaneous fit for the lifetime
//------------------------------------------------
// Create observables
RooRealVar Bs2mumu_lifetime ("Bs2mumu_lifetime" , "Bs2mumu_lifetime" , Bs_Lifetime, -10.0, 10.0, "ps");
RooFormulaVar Bs2mumu_invLifetime("Bs2mumu_invLifetime", "Bs2mumu_invLifetime", "-1/@0", RooArgList(Bs2mumu_lifetime));
// Construct low BDT pdf
RooExponential Bs2mumu_Time_Lifetime_Exp_LowBDT("Bs2mumu_Time_Lifetime_Exp_LowBDT","Bs2mumu_Time_Lifetime_Exp_LowBDT", *B_s0_TAU, Bs2mumu_invLifetime);
RooAccExponential Bs2mumu_Time_Lifetime_AccExp_LowBDT ("Bs2mumu_Time_Lifetime_AccExp_LowBDT", "Bs2mumu_Time_Lifetime_AccExp_LowBDT", *B_s0_TAU, RooConst(t0_acc_val), RooConst(a_acc_val), RooConst(n_acc_val),
Bs2mumu_invLifetime);
RooAbsPdf* Bs2mumu_Time_Lifetime_PDF_LowBDT = &Bs2mumu_Time_Lifetime_AccExp_LowBDT;
if(Acceptance == "Flat")
Bs2mumu_Time_Lifetime_PDF_LowBDT = &Bs2mumu_Time_Lifetime_Exp_LowBDT;
// Construct high BDT pdf
RooExponential Bs2mumu_Time_Lifetime_Exp_HighBDT("Bs2mumu_Time_Lifetime_Exp_HighBDT","Bs2mumu_Time_Lifetime_Exp_HighBDT", *B_s0_TAU, Bs2mumu_invLifetime);
RooAccExponential Bs2mumu_Time_Lifetime_AccExp_HighBDT ("Bs2mumu_Time_Lifetime_AccExp_HighBDT", "Bs2mumu_Time_Lifetime_AccExp_HighBDT", *B_s0_TAU, RooConst(t0_acc_val), RooConst(a_acc_val), RooConst(n_acc_val),
Bs2mumu_invLifetime);
RooAbsPdf* Bs2mumu_Time_Lifetime_PDF_HighBDT = &Bs2mumu_Time_Lifetime_AccExp_HighBDT;
if(Acceptance == "Flat")
Bs2mumu_Time_Lifetime_PDF_HighBDT = &Bs2mumu_Time_Lifetime_Exp_HighBDT;
// Define category to distinguish lowBDT and highBDT samples
RooCategory BDTCat("BDTCat","BDTCat");
BDTCat.defineType("lowBDT");
BDTCat.defineType("highBDT");
// Construct a combined dataset in (B_s0_TAU, BDTCat)
RooDataSet combData("combData", "combined data", *B_s0_TAU , Index(BDTCat), Import("lowBDT", wDataLowBDT), Import("highBDT", wDataHighBDT));
// Construct a simultaneous pdf using BDTCat as an index
RooSimultaneous simPDF1("simPDF1", "simultaneous pdf", BDTCat);
simPDF1.addPdf(*Bs2mumu_Time_Lifetime_PDF_LowBDT, "lowBDT");
simPDF1.addPdf(*Bs2mumu_Time_Lifetime_PDF_HighBDT, "highBDT");
//------------------------------------------------
// Simultaneous fit for the inverse lifetime
//------------------------------------------------
// Create observables
RooRealVar Bs2mumu_gamma ("Bs2mumu_gamma" , "Bs2mumu_gamma" , 1.0/Bs_Lifetime, -10.0, 10.0, "ps");
RooFormulaVar Bs2mumu_negGamma("Bs2mumu_negGamma", "Bs2mumu_negGamma", "-1.0*@0", RooArgList(Bs2mumu_gamma));
// Construct low BDT pdf
RooExponential Bs2mumu_Time_Gamma_Exp_LowBDT("Bs2mumu_Time_Gamma_Exp_LowBDT", "Bs2mumu_Time_Gamma_Exp_LowBDT", *B_s0_TAU, Bs2mumu_negGamma);
RooAccExponential Bs2mumu_Time_Gamma_AccExp_LowBDT ("Bs2mumu_Time_Gamma_Exp_LowBDT", "Bs2mumu_Time_Gamma_Exp_LowBDT", *B_s0_TAU, RooConst(t0_acc_val), RooConst(a_acc_val), RooConst(n_acc_val), Bs2mumu_negGamma);
RooAbsPdf* Bs2mumu_Time_Gamma_PDF_LowBDT = &Bs2mumu_Time_Gamma_AccExp_LowBDT;
if(Acceptance == "Flat")
Bs2mumu_Time_Gamma_PDF_LowBDT = &Bs2mumu_Time_Gamma_Exp_LowBDT;
// Construct high BDT pdf
RooExponential Bs2mumu_Time_Gamma_Exp_HighBDT("Bs2mumu_Time_Gamma_Exp_HighBDT", "Bs2mumu_Time_Gamma_Exp_HighBDT", *B_s0_TAU, Bs2mumu_negGamma);
RooAccExponential Bs2mumu_Time_Gamma_AccExp_HighBDT ("Bs2mumu_Time_Gamma_AccExp_HighBDT", "Bs2mumu_Time_Gamma_AccExp_HighBDT", *B_s0_TAU, RooConst(t0_acc_val), RooConst(a_acc_val), RooConst(n_acc_val), Bs2mumu_negGamma);
RooAbsPdf* Bs2mumu_Time_Gamma_PDF_HighBDT = &Bs2mumu_Time_Gamma_AccExp_HighBDT;
if(Acceptance == "Flat")
Bs2mumu_Time_Gamma_PDF_HighBDT = &Bs2mumu_Time_Gamma_Exp_HighBDT;
// Construct a simultaneous pdf using BDTCat as an index
RooSimultaneous simPDF2("simPDF2", "simultaneous pdf", BDTCat);
simPDF2.addPdf(*Bs2mumu_Time_Gamma_PDF_LowBDT, "lowBDT");
simPDF2.addPdf(*Bs2mumu_Time_Gamma_PDF_HighBDT, "highBDT");
// Perform a simultaneous fit of both exponential functions to their respective data sets
if(t > 0) {
simPDF1.fitTo(combData, Minos(kTRUE) ,Verbose(kFALSE), PrintLevel(-1), PrintEvalErrors(-1));
simPDF2.fitTo(combData, Minos(kTRUE) , Verbose(kFALSE), PrintLevel(-1), PrintEvalErrors(-1));
}
if(t == 0) {
simPDF1.fitTo(combData, Minos(kTRUE));
simPDF2.fitTo(combData, Minos(kTRUE));
Any help would be greatly appreciated!