Angular analysis of B+->K*+(K+pi0)mumu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
4.6 KiB

  1. #include "GlobalFunctions.hh"
  2. #include "BackgroundPdf.hpp"
  3. using namespace std;
  4. using namespace RooFit;
  5. using namespace RooStats;
  6. //pdfs background
  7. RooExponential * BackgroundPdf::bkg_exp1(RooRealVar *B_plus_M){
  8. RooRealVar *exp = getRooRealVar("exp_par1",false);
  9. BkgRooVars.push_back(exp);
  10. RooExponential *bkg_exp = new RooExponential("bkg_exp1","ExponentialBckGnd1",*B_plus_M, *exp);
  11. if (verboseLevel <2) bkg_exp->Print();
  12. return bkg_exp;
  13. }
  14. RooExponential * BackgroundPdf::bkg_exp2(RooRealVar *B_plus_M){
  15. RooRealVar *exp = getRooRealVar("exp_par2",false);
  16. BkgRooVars.push_back(exp);
  17. RooExponential *bkg_exp = new RooExponential("bkg_exp2","ExponentialBckGnd2",*B_plus_M, *exp);
  18. if (verboseLevel <2) bkg_exp->Print();
  19. return bkg_exp;
  20. }
  21. RooExpAndGauss * BackgroundPdf::ExpG(RooRealVar *B_plus_M){
  22. RooRealVar *mean = getRooRealVar("bkg_mean",false);
  23. RooRealVar *sigma = getRooRealVar("bkg_sigma",false);
  24. RooRealVar *decay = getRooRealVar("bkg_decay",false);
  25. BkgRooVars.push_back(mean);
  26. BkgRooVars.push_back(sigma);
  27. BkgRooVars.push_back(decay);
  28. RooExpAndGauss *ExpG = new RooExpAndGauss("ExpG", "ExpG", *B_plus_M, *mean, *sigma, *decay);
  29. if (verboseLevel <2) ExpG->Print();
  30. return ExpG;
  31. }
  32. RooDoubleCB * BackgroundPdf::bkg_CB(RooRealVar *B_plus_M){
  33. RooRealVar *mean = getRooRealVar("bkg_mean",false);
  34. RooRealVar *sigma = getRooRealVar("bkg_sigma",false);
  35. RooRealVar *alpha1 = getRooRealVar("bkg_alpha1",false);
  36. RooRealVar *alpha2 = getRooRealVar("bkg_alpha2",false);
  37. RooRealVar *n1 = getRooRealVar("bkg_n1",false);
  38. RooRealVar *n2 = getRooRealVar("bkg_n2",false);
  39. BkgRooVars.push_back(mean);
  40. BkgRooVars.push_back(sigma);
  41. BkgRooVars.push_back(alpha1);
  42. BkgRooVars.push_back(alpha2);
  43. BkgRooVars.push_back(n1);
  44. BkgRooVars.push_back(n2);
  45. RooDoubleCB *CBBplus = new RooDoubleCB("CBbkg", "CBbkg", *B_plus_M, *mean, *sigma, *alpha1, *n1, *alpha2, *n2);
  46. if (verboseLevel <2) CBBplus->Print();
  47. return CBBplus;
  48. }
  49. RooAddPdf* BackgroundPdf::getBplusBkgModel(RooRealVar *B_plus_M){
  50. RooAddPdf *BplusBckGndModel = NULL;
  51. RooExponential *exp1 = NULL; //could be defined right away, I keep it as it is in case fo future addons
  52. if (NoBackground){
  53. coutDebug("No background PDF!");
  54. return NULL;
  55. }
  56. RooRealVar *zeroSlope = new RooRealVar("zeroSlope","slope", 0.05, 0.0, 0.1); //Doesn't matter anyhow
  57. zeroSlope->setConstant("kTrue");
  58. RooRealVar *zeroF = new RooRealVar("zeroF","zeroF", 1.0, 1.0, 1.0);
  59. RooPolynomial *zeroLine = new RooPolynomial("zeroLine", "zeroLine", *B_plus_M, RooArgList(*zeroSlope));
  60. coutDebug("Created zero slope for bkgPdf.");
  61. if (SingleExponential){//No else-if, because then I can add OneCB
  62. coutDebug("Creating single exponential");
  63. exp1 = bkg_exp1(B_plus_M);
  64. if (!bkgOneCB && !ExpGaus) BplusBckGndModel = new RooAddPdf("BplusBckGndModel", "SingleExponentialBckGnd", RooArgList(*exp1, *zeroLine),RooArgList(*zeroF));
  65. }
  66. if (bkgOneCB) { //No else-ifs, because then I can add the previously defined functions
  67. coutDebug("Creating OneCB");
  68. RooDoubleCB *OneCB = NULL;
  69. OneCB = bkg_CB(B_plus_M);
  70. if (!SingleExponential) BplusBckGndModel = new RooAddPdf("BplusBckGndModel", "OneCBBckGnd", RooArgList(*OneCB, *zeroLine),RooArgList(*zeroF));
  71. else{
  72. RooRealVar *f = getRooRealVar("bkg_f",false);
  73. BkgRooVars.push_back(f);
  74. BplusBckGndModel = new RooAddPdf("BplusBckGndModel", "SingleExponentialWithCBBckGnd", RooArgList(*OneCB, *exp1),RooArgList(*f));
  75. coutDebug("Setting OneCB+SingleExp");
  76. if (verboseLevel<3) BplusBckGndModel->Print();
  77. }
  78. }
  79. else if (DoubleExponential){
  80. coutDebug("Creating double exponential");
  81. RooExponential *exp2 = bkg_exp2(B_plus_M);
  82. RooRealVar *f = getRooRealVar("bkg_f",false);
  83. BkgRooVars.push_back(f);
  84. BplusBckGndModel = new RooAddPdf("BplusBckGndModel", "DoubleExponentialBckGnd", RooArgList(*exp1, *exp2),RooArgList(*f));
  85. }
  86. else if (ExpGaus){
  87. coutDebug("Creating ExpGaus");
  88. RooExpAndGauss *expGauss = ExpG(B_plus_M);
  89. RooRealVar *f = getRooRealVar("bkg_f",false);
  90. BkgRooVars.push_back(f);
  91. BplusBckGndModel = new RooAddPdf("BplusBckGndModel", "ExpGausBckGnd", RooArgList(*exp1, *expGauss),RooArgList(*f));
  92. }
  93. if (NoBackground) coutDebug("No background PDF!");
  94. else if (verboseLevel < 2) BplusBckGndModel->Print();
  95. return BplusBckGndModel;
  96. }
  97. void BackgroundPdf::setAllRooVarsConstant(){
  98. for (auto var : BkgRooVars){
  99. var->setConstant(kTRUE);
  100. }
  101. }