Skip to content
Snippets Groups Projects

Fix recalcitrant test failure in Ostap

Merged Eduardo Rodrigues requested to merge eduardo-fix-ostap-12-13 into run2-patches
1 file
+ 6
18
Compare changes
  • Side-by-side
  • Inline
@@ -10,19 +10,12 @@
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
# =============================================================================
# $Id$
# =============================================================================
## @file TestWeighted.py
#
# tests for weighted fits and model with convolution
#
# @author Vanya BELYAEV Ivan.Belyaeve@itep.ru
# @date 2014-05-11
#
# $Revision$
# Last modification $Date$
# by $Author$
# =============================================================================
import ROOT
from Ostap.PyRoUts import *
@@ -33,11 +26,6 @@ if '__main__' == __name__: logger = getLogger('Ostap.TestWeighted')
else: logger = getLogger(__name__)
# =============================================================================
logger.info('Test for weighted fits and model with convolution')
# ============================================================================
RAD = ROOT.RooAbsData
if RAD.Tree != RAD.getDefaultStorageType():
logger.info('DEFINE default storage type to be TTree! ')
RAD.setDefaultStorageType(RAD.Tree)
# ============================================================================
# The variables
@@ -46,6 +34,7 @@ m_b = ROOT.RooRealVar('mB', 'm(B)', 5.2, 5.4)
m_phi = ROOT.RooRealVar('mPhi', 'm(Phi)', 1.0, 1.050)
h_phi = m_phi.histo(50)
# ============================================================================
store = []
import Ostap.FitModels as Models
sigB = Models.Gauss_pdf('Bh', xvar=m_b, mean=5.278, sigma=0.015)
@@ -65,8 +54,9 @@ model0 = Models.Fit2D(
bkg_1y=Models.PSPol_pdf('PSP0', m_phi, ps2, power=1),
bkg_2y=Models.PSPol_pdf('PSB0', m_phi, ps2, power=1),
suffix='_GEN')
## model0.bkg1.tau.fix(0)
## model0.bkgA.tau.fix(0)
varset = ROOT.RooArgSet(m_b, m_phi)
dataset = model0.pdf.generate(varset, 1900)
model0.SS.fix(1000)
model0.SB.fix(300)
@@ -89,9 +79,6 @@ model_phi = Models.Fit1D(
model_B = Models.Fit1D(
signal=sigB, background=Models.Bkg_pdf('BB', m_b, power=1), suffix='_B')
varset = ROOT.RooArgSet(m_b, m_phi)
dataset = model0.pdf.generate(varset, 1900)
## 2D fits
with rooSilent():
r, u = model1.fitTo(dataset)
@@ -108,8 +95,9 @@ with rooSilent():
logger.info('Results of B-mass fit \n%s' % rB)
#
dataset.project(h_phi, 'mPhi', 'S_B_sw')
## dataset.project(h_phi, 'mPhi', 'S_B_sw')
dataW = dataset.makeWeighted('S_B_sw')
ROOT.SetOwnership(dataW, False)
with rooSilent():
Loading