Пример #1
0
# Time resolution model
from P2VV.Parameterizations.TimeResolution import Moriond2012_TimeResolution

tres = Moriond2012_TimeResolution(
    time=t, timeResSFConstraint=True, sigmat=st, timeResSF=dict(Value=1.46, MinMax=(0.5, 5.0))
)
## from P2VV.Parameterizations.TimeResolution import LP2011_TimeResolution
## tres = LP2011_TimeResolution(time = t)
## from P2VV.Parameterizations.TimeResolution import Gaussian_TimeResolution as TimeResolution
## tres = TimeResolution(time = t)

# Signal time pdf
from P2VV.Parameterizations.TimePDFs import Single_Exponent_Time

sig_t = Single_Exponent_Time(Name="sig_t", time=t, resolutionModel=tres.model())

# Build the acceptance using the histogram as starting values
input_file = "start_values_20bins.root"
hlt1_histogram = "hlt1_shape"
hlt2_histogram = "hlt2_shape"

from ROOT import TFile

acceptance_file = TFile.Open(input_file)
if not acceptance_file:
    raise ValueError, "Cannot open histogram file %s" % input_file
hlt1_histogram = acceptance_file.Get(hlt1_histogram)
if not hlt1_histogram:
    raise ValueError, "Cannot get acceptance historgram %s from file" % hlt1_histogram
xaxis = hlt1_histogram.GetXaxis()
Пример #2
0
# now build the actual signal PDF...
from ROOT import RooGaussian as Gaussian
from ROOT import RooExponential as Exponential
from ROOT import RooDecay as Decay

# B time PDF
from P2VV.Parameterizations.TimeResolution import Multi_Gauss_TimeResolution as TimeResolution
tres_args = dict(time = t, sigmat = st, Cache = True,
                 Parameterise = 'RMS',
                 TimeResSFParam = 'linear', SplitFracs = False,
                 ScaleFactors = [(2, 2.1), (1, 1.26)],
                 Fractions = [(2, 0.2)], SplitMean = False)
tres = TimeResolution(Name = 'tres', **tres_args)

from P2VV.Parameterizations.TimePDFs import Single_Exponent_Time as TimePdf
sig_t = TimePdf(t, tres.model())

# B mass pdf
from P2VV.Parameterizations.MassPDFs import DoubleGauss_Signal_Mass as MassPdf
sig_m = MassPdf(m, Name = 'sig_m', AvSigParameterisation = True)
sig_m = sig_m.pdf()

# background
psi_c = RealVar( 'psi_c',  Unit = '1/MeV', Value = -0.0004, MinMax = (-0.1, -0.0000001))
bkg_m = Pdf(Name = 'bkg_m',  Type = Exponential, Parameters = [m, psi_c])

background = Component('background', (bkg_m,), Yield= (200000,500,5000000) )
signal = Component('signal', (sig_m, sig_t.pdf()), Yield= (200000,500,500000) )

from P2VV.Utilities.DataHandling import readData
tree_name = 'DecayTree'
Пример #3
0
# Build the acceptance using the histogram as starting values
input_file = os.path.join(base_location, 'data/start_values.root')

## hists = {hlt1_excl_biased_dec : {'excl_biased' : {'histogram' : 'hlt1_shape', 'average' : (6.285e-01, 1.633e-02)},
##                                  'unbiased' : { 'bins' : t.getRange(), 'heights' : [0.5]}}}
## hists = {hlt1_excl_biased_dec : {'exclB' : {'histogram' : 'hlt1_shape'},
##                                  'notExclB' : { 'bins' : t.getRange(), 'heights' : [0.7]}},
##          hlt2_biased : { 'B' : {'histogram' : 'hlt2_shape'}},
##          hlt2_unbiased : { 'UB' : {'histogram' : 'hlt2_shape'}}}
hists = {hlt1_excl_biased_dec : {'exclB' : {'histogram' : 'hlt1_shape'},
                                 'notExclB' : { 'bins' : t.getRange(), 'heights' : [0.7]}},
         hlt2_biased : { 'B' : {'histogram' : 'hlt2_shape'}},
         hlt2_unbiased : { 'UB' : {'bins' : t.getRange(), 'heights' : [0.7]}}}

from P2VV.Parameterizations.TimePDFs import Single_Exponent_Time
pdf_wrapper = Single_Exponent_Time(Name = 'pdf', time = t, resolutionModel = tres.model())
tau = pdf_wrapper._tau
pdf = pdf_wrapper.pdf()
split_cats = [[run_period]]
from itertools import chain
split_pars = [[tau]]
sim_pdf = SimultaneousPdf(pdf.GetName() + '_simul', MasterPdf = pdf,
                          SplitCategories = split_cats, SplitParameters = split_pars)


from ROOT import RooArgSet, RooArgList
split_cat_pars = RooArgSet()
sim_pdf.treeNodeServerList(split_cat_pars)
split_cat = sim_pdf.indexCat()
input_cats = RooArgList(split_cat) if split_cat.isFundamental() else split_cat.inputCatList()
prototype = tres.model()
Пример #4
0
                                    ('timeResComb', 'timeResSigmaFrac2'): 1.322e-06,
                                    ('timeResComb', 'timeResSigmaSF2'): 0.0001297,
                                    ('timeResSigmaFrac2', 'timeResSigmaFrac2'): 1.146e-06,
                                    ('timeResSigmaFrac2', 'timeResSigmaSF2'): -0.0001486,
                                    ('timeResSigmaSF2', 'timeResSigmaSF2'): 0.03556},
                      nGauss = 2, timeResMean = dict(Value = -4.0735e-03, Error = 1.33e-04),
                      timeResMeanConstraint = 'fixed')

## from P2VV.Parameterizations.TimeResolution import LP2011_TimeResolution
## tres = LP2011_TimeResolution(time = t)
## from P2VV.Parameterizations.TimeResolution import Gaussian_TimeResolution as TimeResolution
## tres = TimeResolution(time = t)

# Signal time pdf
from P2VV.Parameterizations.TimePDFs import Single_Exponent_Time
sig_t = Single_Exponent_Time(Name = 'sig_t', time = t, resolutionModel = tres.model())

# B mass pdf
from P2VV.Parameterizations.MassPDFs import LP2011_Signal_Mass as Signal_BMass, LP2011_Background_Mass as Background_BMass
sig_m = Signal_BMass(     Name = 'sig_m', mass = m, m_sig_mean = dict( Value = 5365, MinMax = (5363,5372) ) )

# J/psi mass pdf
mpsi_mean  = RealVar('mpsi_mean',   Unit = 'MeV', Value = 3097, MinMax = (3070, 3110))
mpsi_sigma = RealVar('mpsi_sigma',  Unit = 'MeV', Value = 10, MinMax = (5, 20))
mpsi_alpha = RealVar('mpsi_alpha',  Unit = '', Value = 1.8, MinMax = (0.5, 3), Constant = True)
mpsi_n = RealVar('mpsi_n',  Unit = '', Value = 2, MinMax = (0.1, 4), Constant = True)
psi_m  = Pdf(Name = 'psi_m', Type = CrystalBall, Parameters = [mpsi, mpsi_mean, mpsi_sigma, mpsi_alpha, mpsi_n])

# J/psi background
psi_c = RealVar( 'psi_c',  Unit = '1/MeV', Value = -0.0004, MinMax = (-0.1, -0.0000001))
bkg_mpsi = Pdf(Name = 'bkg_mpsi',  Type = Exponential, Parameters = [mpsi, psi_c])