Commit 566028e7 authored by Jordy Butter's avatar Jordy Butter
Browse files

Merge branch 'dev_dsk_massFit' into 'master'

Small changes + config updates Jordy

See merge request lhcb/Urania!335
parents 11bfa933 35a5f7e1
###############################################################################
# (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
def getconfig():
from Bs2DsKConfigForNominalMassFit import getconfig as getconfig_nominal
configdict = getconfig_nominal()
import sys
configdict["Decay"] = "Bd2DsK"
configdict["YearOfDataTaking"] = {"2015", "2016", "2017", "2018"}
configdict["CharmModes"] = {"KKPi"}
# file name with paths to MC/data samples
configdict[
"dataName"] = "../data/Bs2DsK_Run2CPV/Bs2DsK/config_Bs2DsK_forBd2DsK.txt"
# basic variables
configdict["BasicVariables"] = {}
configdict["BasicVariables"]["BeautyMass"] = {
"Range": [5300, 5800],
"InputName": "lab0_MassFitConsD_M"
}
configdict["BasicVariables"]["CharmMass"] = {
"Range": [1930, 2015],
"InputName": "lab2_MM"
}
configdict["BasicVariables"]["BacPIDK"] = {
"Range": [1.61, 5.0],
"InputName": "lab1_PIDK"
}
configdict["AdditionalVariables"] = {}
p = "lab1_P > 3000.0&&lab1_P < 650000.00"
pt = "lab1_PT> 400.0&&lab1_PT<45000.0"
nTracks = "nTracks>15.0&&nTracks<500.0"
time = "(lab0_LifetimeFit_ctau[0] > 0.119917)&&(lab0_LifetimeFit_ctau[0] < 4.496887)"
timeErr = "(lab0_LifetimeFit_ctauErr[0] > 0.002998)&&(lab0_LifetimeFit_ctauErr[0] < 0.029979)"
bdtg = "(BDTGResponse_XGB_1 > 0.475000)&&(BDTGResponse_XGB_1 < 1.000000)"
vetoD0 = "lab34_MM < 1800."
vetoKst = "(fabs(lab15_MM-892)>30.)"
vetoD0_misID = "(fabs(sqrt(pow(sqrt(pow(139.6,2)+pow(lab1_P,2))+sqrt(pow(lab3_M,2)+pow(lab3_P,2)),2)-pow(lab1_PX+lab3_PX,2)-pow(lab1_PY+lab3_PY,2)-pow(lab1_PZ+lab3_PZ,2)) - 1864.83) > 30.)"
lab2_FDCHI2_0 = "lab2_FDCHI2_ORIVX > 0"
t = "&&"
# additional cuts applied to data sets
configdict["AdditionalCuts"] = {}
configdict["AdditionalCuts"]["All"] = {
"MC":
lab2_FDCHI2_0 + t + p + t + pt + t + nTracks + t + time + t + timeErr +
t + bdtg,
"MCID":
True,
"MCTRUEID":
True,
"BKGCAT":
True,
"DsHypo":
True
}
configdict["AdditionalCuts"]["KKPi"] = {
"MC": lab2_FDCHI2_0 + t + vetoD0 + t + vetoKst + t + vetoD0_misID
}
# children prefixes used in MCID, MCTRUEID, BKGCAT cuts
# order of particles: KKPi, KPiPi, PiPiPi
configdict["DsChildrenPrefix"] = {
"Child1": "lab3",
"Child2": "lab4",
"Child3": "lab5"
}
#weighting templates by PID eff/misID
#weighting templates by PID eff/misID
configdict["WeightingMassTemplates"] = {
"PIDBachEff": {
"2015": {
"FileLabel":
"#PIDK Kaon 2015",
"Var": ["nTracks", "lab1_P"],
"HistName":
"K_DLLK > 5 && IsMuon ==0.0 && HasRich ==1.0 && DLLe < 5.0_All"
},
"2016": {
"FileLabel":
"#PIDK Kaon 2016",
"Var": ["nTracks", "lab1_P"],
"HistName":
"K_DLLK > 5 && IsMuon ==0.0 && HasRich ==1.0 && DLLe < 5.0_All"
},
"2017": {
"FileLabel":
"#PIDK Kaon 2017",
"Var": ["nTracks", "lab1_P"],
"HistName":
"K_DLLK > 5 && IsMuon ==0.0 && HasRich ==1.0 && DLLe < 5.0_All"
},
"2018": {
"FileLabel":
"#PIDK Kaon 2018",
"Var": ["nTracks", "lab1_P"],
"HistName":
"K_DLLK > 5 && IsMuon ==0.0 && HasRich ==1.0 && DLLe < 5.0_All"
}
},
"RatioDataMC": {
"2015": {
"FileLabel": "#DataMC 2015",
"Var": ["lab0_ENDVERTEX_ZERR", "lab2_ENDVERTEX_ZERR"],
"HistName": "histRatio"
},
"2016": {
"FileLabel": "#DataMC 2016",
"Var": ["lab0_ENDVERTEX_ZERR", "lab2_ENDVERTEX_ZERR"],
"HistName": "histRatio"
},
"2017": {
"FileLabel": "#DataMC 2017",
"Var": ["lab0_ENDVERTEX_ZERR", "lab2_ENDVERTEX_ZERR"],
"HistName": "histRatio"
},
"2018": {
"FileLabel": "#DataMC 2018",
"Var": ["lab0_ENDVERTEX_ZERR", "lab2_ENDVERTEX_ZERR"],
"HistName": "histRatio"
}
},
"Shift": {
"2015": {
"BeautyMass": -1.5,
"CharmMass": 0.0
},
"2016": {
"BeautyMass": -1.5,
"CharmMass": 0.0
},
"2017": {
"BeautyMass": -1.5,
"CharmMass": 0.0
},
"2018": {
"BeautyMass": -1.5,
"CharmMass": 0.0
},
}
}
#----------------------------------------------------------------------------------------------------------------------------------------------------------------#
### FitShapes fitting settings
#----------------------------------------------------------------------------------------------------------------------------------------------------------------#
configdict["pdfList"] = {}
configdict["pdfList"]["Signal"] = {}
configdict["pdfList"]["Signal"]["Bd2DsK"] = {}
configdict["pdfList"]["Signal"]["Bd2DsK"]["BeautyMass"] = {}
configdict["pdfList"]["Signal"]["Bd2DsK"]["BeautyMass"][
"DoubleExponential"] = {
"Title": "B_{d}#rightarrow #D_{s}K",
"Bins": 100,
"Min": 5300.0,
"Max": 5800.0,
"Unit": "MeV/c^{2}",
"cB1": [-0.1, -0.5, 0],
"cB2": [-0.01, -0.1, 0],
"frac": [0.7, 0.0, 1.0]
}
configdict["pdfList"]["Signal"]["Bd2DsK"]["BeautyMass"]["Exponential"] = {
"Title": "B_{d}#rightarrow #D_{s}K",
"Bins": 100,
"Min": 5300.0,
"Max": 5800.0,
"Unit": "MeV/c^{2}",
"cB": [-0.001, -0.1, 0]
}
configdict["pdfList"]["Signal"]["Bd2DsK"]["BeautyMass"]["Ipatia"] = {
"Title": "B_{d}#rightarrow #D_{s}K",
"Bins": 100,
"Min": 5300.0,
"Max": 5800.0,
"Unit": "MeV/c^{2}",
"mean": [5280.7],
"sigma": [45.0, 1.0, 80.0],
"zeta": [0.0], #1,0.0,5.0],
"fb": [0.0],
"l": [-2.2, -5.0, -0.5], #,-15.0,0.0
"a1": [1.0], #,0.0,5.0
"a2": [1.1, 0.0, 5.0],
"n1": [1.0], #,0.8,15.0
"n2": [3.0, 0.8, 15.0]
}
configdict["dataSetPrefix"] = {"Signal": "dataSetMC_Bd2DsK_"}
#Axes titles
configdict["AxisTitle"] = {
"BeautyMass": {
"Bs2DsK": "m(D_{s}^{\mp}K^{\pm}) [MeV/c^{2}]",
"Bd2DsK": "m(D_{s}^{\mp}K^{\pm}) [MeV/c^{2}]"
},
"CharmMass": {
"Bs2DsK": "m(K^{-}K^{+}#pi^{-}) [MeV/c^{2}]",
"Bd2DsK": "m(K^{-}K^{+}#pi^{-}) [MeV/c^{2}]"
}
}
return configdict
#Signal Bs2DsK KKPi 2015
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping24r1_Sim09c/BDTG/
B2DX_MC_13264031_Bs_DsK_KKpi_2015_dw_Bs_BDTG.root
B2DX_MC_13264031_Bs_DsK_KKpi_2015_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bs2DsK KKPi 2016
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping28r1_Sim09h/BDTG/
B2DX_MC_13264031_Bs_DsK_KKpi_2016_dw_Bs_BDTG.root
B2DX_MC_13264031_Bs_DsK_KKpi_2016_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bs2DsK KKPi 2017
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping29r2_Sim09h/BDTG/
B2DX_MC_13264031_Bs_DsK_KKpi_2017_dw_Bs_BDTG.root
B2DX_MC_13264031_Bs_DsK_KKpi_2017_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bs2DsK KKPi 2018
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping34_Sim09h/BDTG/
B2DX_MC_13264031_Bs_DsK_KKpi_2018_dw_Bs_BDTG.root
B2DX_MC_13264031_Bs_DsK_KKpi_2018_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bd2DsK KKPi 2015
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping24r1_Sim09c/BDTG/
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2015_dw_Bs_BDTG.root
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2015_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bd2DsK KKPi 2016
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping28r1_Sim09c/BDTG/
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2016_dw_Bs_BDTG.root
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2016_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bd2DsK KKPi 2017
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping29r2_Sim09h/BDTG/
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2017_dw_Bs_BDTG.root
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2017_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bd2DsK KKPi 2018
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping34_Sim09h/BDTG/
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2018_dw_Bs_BDTG.root
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2018_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bs2DsK PhiPi 2015
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping24r1_Sim09c/BDTG/
B2DX_MC_13264031_Bs_DsK_KKpi_2015_dw_Bs_BDTG.root
B2DX_MC_13264031_Bs_DsK_KKpi_2015_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bs2DsK PhiPi 2016
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping28r1_Sim09h/BDTG/
B2DX_MC_13264031_Bs_DsK_KKpi_2016_dw_Bs_BDTG.root
B2DX_MC_13264031_Bs_DsK_KKpi_2016_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bs2DsK PhiPi 2017
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping29r2_Sim09h/BDTG/
B2DX_MC_13264031_Bs_DsK_KKpi_2017_dw_Bs_BDTG.root
B2DX_MC_13264031_Bs_DsK_KKpi_2017_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bs2DsK PhiPi 2018
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping34_Sim09h/BDTG/
B2DX_MC_13264031_Bs_DsK_KKpi_2018_dw_Bs_BDTG.root
B2DX_MC_13264031_Bs_DsK_KKpi_2018_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bd2DsK PhiPi 2015
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping24r1_Sim09c/BDTG/
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2015_dw_Bs_BDTG.root
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2015_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bd2DsK PhiPi 2016
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping28r1_Sim09c/BDTG/
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2016_dw_Bs_BDTG.root
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2016_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bd2DsK PhiPi 2017
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping29r2_Sim09h/BDTG/
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2017_dw_Bs_BDTG.root
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2017_up_Bs_BDTG.root
DecayTree
DecayTree
###
#Signal Bd2DsK PhiPi 2018
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/MC_Run2/Stripping34_Sim09h/BDTG/
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2018_dw_Bs_BDTG.root
B2DX_MC_11164069_Bd_Ds-K+_KKpi_2018_up_Bs_BDTG.root
DecayTree
DecayTree
###
#PIDK Kaon 2015
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_K_Turbo15_MagDown_highMom_nTracks_Brunel_Brunel_P.root
PerfHists_K_Turbo15_MagUp_highMom_nTracks_Brunel_Brunel_P.root
###
#PIDK Kaon 2016
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_K_Turbo16_MagDown_highMom_nTracks_Brunel_Brunel_P.root
PerfHists_K_Turbo16_MagUp_highMom_nTracks_Brunel_Brunel_P.root
###
#PIDK Kaon 2017
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_K_Turbo17_MagDown_highMom_nTracks_Brunel_Brunel_P.root
PerfHists_K_Turbo17_MagUp_highMom_nTracks_Brunel_Brunel_P.root
###
#PIDK Kaon 2018
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_K_Turbo18_MagDown_highMom_nTracks_Brunel_Brunel_P.root
PerfHists_K_Turbo18_MagUp_highMom_nTracks_Brunel_Brunel_P.root
###
#PIDK Pion 2015
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_Pi_Turbo15_MagDown_highMom_nTracks_Brunel_Brunel_P.root
PerfHists_Pi_Turbo15_MagUp_highMom_nTracks_Brunel_Brunel_P.root
###
#PIDK Pion 2016
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_Pi_Turbo16_MagDown_highMom_nTracks_Brunel_Brunel_P.root
PerfHists_Pi_Turbo16_MagUp_highMom_nTracks_Brunel_Brunel_P.root
###
#PIDK Pion 2017
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_Pi_Turbo17_MagDown_highMom_nTracks_Brunel_Brunel_P.root
PerfHists_Pi_Turbo17_MagUp_highMom_nTracks_Brunel_Brunel_P.root
###
#PIDK Pion 2018
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_Pi_Turbo18_MagDown_highMom_nTracks_Brunel_Brunel_P.root
PerfHists_Pi_Turbo18_MagUp_highMom_nTracks_Brunel_Brunel_P.root
###
#PIDK Proton 2015
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_P_Turbo15_MagDown_highMomProton_nTracks_Brunel_Brunel_P.root
PerfHists_P_Turbo15_MagUp_highMomProton_nTracks_Brunel_Brunel_P.root
###
#PIDK Proton 2016
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_P_Turbo16_MagDown_highMomProton_nTracks_Brunel_Brunel_P.root
PerfHists_P_Turbo16_MagUp_highMomProton_nTracks_Brunel_Brunel_P.root
###
#PIDK Proton 2017
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_P_Turbo17_MagDown_highMomProton_nTracks_Brunel_Brunel_P.root
PerfHists_P_Turbo17_MagUp_highMomProton_nTracks_Brunel_Brunel_P.root
###
#PIDK Proton 2018
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/PIDHist/
PerfHists_P_Turbo18_MagDown_highMomProton_nTracks_Brunel_Brunel_P.root
PerfHists_P_Turbo18_MagUp_highMomProton_nTracks_Brunel_Brunel_P.root
###
#DataMC 2015
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/Bd2DPi_data2MC_weights/Run2/lab0vs2_ENDVERTEX_ZERR/Stripping24r1_Sim09c/
weights_DPi_2015_dw.root
weights_DPi_2015_up.root
###
#DataMC 2016
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/Bd2DPi_data2MC_weights/Run2/lab0vs2_ENDVERTEX_ZERR/Stripping28r1_Sim09c/
weights_DPi_2016_dw.root
weights_DPi_2016_up.root
###
#DataMC 2017
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/Bd2DPi_data2MC_weights/Run2/lab0vs2_ENDVERTEX_ZERR/Stripping29r2_Sim09g/
weights_DPi_2017_dw.root
weights_DPi_2017_up.root
###
#DataMC 2018
root://eoslhcb.cern.ch//eos/lhcb/wg/b2oc/TD_Bs2Dsh_Run2/Bd2DPi_data2MC_weights/Run2/lab0vs2_ENDVERTEX_ZERR/Stripping34_Sim09h/
weights_DPi_2018_dw.root
weights_DPi_2018_up.root
###
\ No newline at end of file
......@@ -140,7 +140,7 @@ gROOT.SetBatch()
#------------------------------------------------------------
def makeCanvas(dataset, model, var, result, min, max, bins, text, title,
Xtitle, weighted, logScale, save):
Xtitle, weighted, logScale, noChi2, minY, save):
#Create canvas
canv = TCanvas("canv_" + dataset.GetName(),
......@@ -173,7 +173,6 @@ def makeCanvas(dataset, model, var, result, min, max, bins, text, title,
#Build pull histogram and get chi2/ndof
pullHist = frame_top.pullHist()
obs = result.floatParsFinal()
if not weighted:
if None != result:
......@@ -183,11 +182,17 @@ def makeCanvas(dataset, model, var, result, min, max, bins, text, title,
#No fit: ndof only given by binning
chi2ndof = frame_top.chiSquare(0)
else:
varName = TString(var.GetName())
pdfName = "pdf_Norm[" + var.GetName(
) + "]_Range[fit_nll_pdf_combData]_NormRange[fit_nll_pdf_combData]"
print(pdfName)
chi2ndof = frame_top.chiSquare(pdfName, "h_combData", obs.getSize())
if None != result:
obs = result.floatParsFinal()
varName = TString(var.GetName())
pdfName = "pdf_Norm[" + var.GetName(
) + "]_Range[fit_nll_pdf_combData]_NormRange[fit_nll_pdf_combData]"
print(pdfName)
chi2ndof = frame_top.chiSquare(pdfName, "h_combData",
obs.getSize())
else:
#No fit: ndof only given by binning
chi2ndof = frame_top.chiSquare(0)
chi2ndof = round(chi2ndof, 2)
#Plot other pdf components (if any)
......@@ -202,9 +207,11 @@ def makeCanvas(dataset, model, var, result, min, max, bins, text, title,
model.plotOn(frame_top, RooFit.Components(pdflist[pdf].GetName()),
RooFit.LineStyle(2), RooFit.LineColor(color[pdf]))
frame_top.GetYaxis().SetRangeUser(1.0, frame_top.GetMaximum() * 1.1)
frame_top.GetYaxis().SetRangeUser(0.0, frame_top.GetMaximum() * 1.1)
if logScale:
frame_top.GetYaxis().SetRangeUser(0.5, frame_top.GetMaximum() * 1.5)
frame_top.GetYaxis().SetRangeUser(
float(minY),
frame_top.GetMaximum() * 1.5)
unit = "MeV/c^{2}"
frame_top.GetYaxis().SetTitle(
(TString.Format("#font[132]{Candidates / ( " + "{0:0.2f}".format(
......@@ -216,7 +223,8 @@ def makeCanvas(dataset, model, var, result, min, max, bins, text, title,
lhcbtext = makeText(0.06)
lhcbtext.DrawTextNDC(0.93, 0.88, text)
chi2text = makeText(0.06)
chi2text.DrawLatexNDC(0.70, 0.80, "#chi^{2}/ndof=" + str(chi2ndof))
if not noChi2:
chi2text.DrawLatexNDC(0.70, 0.80, "#chi^{2}/ndof=" + str(chi2ndof))
print(chi2ndof)
pad1.Update()
pad1.Draw()
......@@ -337,6 +345,39 @@ def BuildExponentialPDF(workOut, obs, nickname, pdfDict, debug):
return WS(workOut, pdf)
#------------------------------------------------------------
def BuildDoubleExponentialPDF(workOut, obs, nickname, pdfDict, debug):
#Build parameters
varName = obs.GetName()
typemode = "doubleExpo"
samplemode = nickname
cB1 = WS(
workOut,
RooRealVar(typemode + "_" + varName + "_cB1_" + samplemode,
typemode + "_" + varName + "_cB1_" + samplemode,
*pdfDict["cB1"]))
cB2 = WS(
workOut,
RooRealVar(typemode + "_" + varName + "_cB2_" + samplemode,
typemode + "_" + varName + "_cB2_" + samplemode,
*pdfDict["cB2"]))
frac = WS(
workOut,
RooRealVar(typemode + "_" + varName + "_frac_" + samplemode,
typemode + "_" + varName + "_frac_" + samplemode,
*pdfDict["frac"]))
#Build PDF
pdf = BasicMDFitPdf.buildDoubleExponentialPDF(obs, workOut, samplemode,
typemode, debug)
return WS(workOut, pdf)
#------------------------------------------------------------
def BuildExponentialPlusConstantPDF(workOut, obs, nickname, pdfDict, debug):
......@@ -452,7 +493,7 @@ def BuildCrystalBallPDF(workOut, obs, nickname, pdfDict, debug):
workOut,
RooRealVar(typemode + "_" + varName + "_alpha_" + samplemode,
typemode + "_" + varName + "_alpha_" + samplemode,
*pdfDict["sigma"]))
*pdfDict["alpha"]))
n = WS(
workOut,
RooRealVar(typemode + "_" + varName + "_n_" + samplemode,
......@@ -1566,8 +1607,8 @@ def TakeInputPdf(workOut, pdfDict):
#------------------------------------------------------------
def fitShapes(debug, configName, inputFile, outputFile, workData, workOut,
save, initial, variable, component, mode, sample, year, merge,
hypo, pdfType, binned, weighted, superimpose, logScale,
outputplotdir):
hypo, pdfType, binned, weighted, superimpose, logScale, noChi2,
minY, jobs, outputplotdir):
# Tune integrator configuration
RooAbsReal.defaultIntegratorConfig().setEpsAbs(1e-7)
......@@ -1657,7 +1698,7 @@ def fitShapes(debug, configName, inputFile, outputFile, workData, workOut,
print(str(workData))
print("=========================================")
print("")
observables = getObservables(MDSettings, workspace, False, debug)
observables = getObservables(MDSettings, workspace, debug)
if "Beauty" in variable:
obs = observables.find(MDSettings.GetMassBVarOutName().Data())
obs.setRange(*myconfigfile["BasicVariables"]["BeautyMass"]["Range"])
......@@ -1847,6 +1888,9 @@ def fitShapes(debug, configName, inputFile, outputFile, workData, workOut,
elif "ExponentialPlusConstant" in pdfType:
pdf = BuildExponentialPlusConstantPDF(workspaceOut, obs, nickname,
pdfDict, debug)
elif "DoubleExponential" in pdfType: