Exemplo n.º 1
0
# RooFit classes
from ROOT import RooWorkspace, RooFit
from ROOT import RooArgSet, RooArgList, RooDataHist

# my stuff
from factory import get_workspace, get_file, get_object, load_library

# Load custom ROOT classes
load_library('libacceptance.so')
from ROOT import PowLawAcceptance, AcceptanceRatio


## Read everything from file
# Get objects from workspace
workspace, ffile = get_workspace(fname, 'workspace')
workspace.Print('v')

# Variables
time = workspace.var('time')
# time range
tmin = time.getMin()
tmax = time.getMax()
time.setRange('fullrange', tmin, tmax)
nbins = time.getBins()

# Dataset
argset = RooArgSet(time)
decaycat = workspace.cat('decaycat')
decaycat.setRange('onlydspi', 'DsPi')
decaycat.setRange('onlydsk', 'DsK')
Exemplo n.º 2
0
from ROOT import TH1, TH1D

# RooFit classes
from ROOT import RooWorkspace, RooFit
from ROOT import RooArgSet, RooArgList, RooDataHist

# my stuff
from factory import get_workspace, get_file, get_object, load_library

# Load custom ROOT classes
load_library('libacceptance.so')
from ROOT import PowLawAcceptance, AcceptanceRatio

## Read everything from file
# Get objects from workspace
workspace, ffile = get_workspace(fname, 'workspace')
workspace.Print('v')

# Variables
time = workspace.var('time')
# time range
tmin = time.getMin()
tmax = time.getMax()
time.setRange('fullrange', tmin, tmax)
nbins = time.getBins()

# Dataset
argset = RooArgSet(time)
decaycat = workspace.cat('decaycat')
decaycat.setRange('onlydspi', 'DsPi')
decaycat.setRange('onlydsk', 'DsK')
Exemplo n.º 3
0
# my stuff
from factory import load_library, set_integrator_config, get_workspace

# suppress RooFit logging
from helpers import rf_msg_lvl
rf_msg_lvl(RooFit.ERROR, RooFit.Plotting, ROOT.RooPlot())

# Load custom ROOT classes
load_library('libacceptance.so')
set_integrator_config()
epsilon = 0.2
tmax = 15.0

# Get objects from workspace
workspace, rfile = get_workspace(options.filename, 'workspace')

# sample filename: fitresult-cpowerlaw-w-flat-ratio-2013-02-22-Fri-20-27.root
fnametokens = rfile.GetTitle().split('-')
ratiofn = fnametokens[3]

# variables
time = workspace.var('time')

offset = workspace.var('offset')
turnon = workspace.var('turnon')
exponent = workspace.var('exponent')
beta = workspace.var('beta')

rturnon = workspace.var('rturnon')
roffset = workspace.var('roffset')
Exemplo n.º 4
0
tfloor = 0.2
tceil = 15.0
nbins = 150

# Files with fitresults:
# data/fitresult-DsPi-powerlaw4-2012-08-10-Fri-05-30.root
# data/fitresult-DsK-powerlaw4-2012-08-10-Fri-07-56.root

# Get objects from workspace
fitresults = []
fnames = [fname1, fname2]
modes = [mode1, mode2]
for i in xrange(0, len(fnames)):
    fn = fnames[i]
    mode = modes[i]
    ws, ffile = get_workspace(fn, "workspace")
    # ws.Print('v')
    fitresult = ws.obj("fitresult_Model_dataset")
    fitresult.SetNameTitle("fitresult_Model_dataset_%s" % mode, "%s decay time acceptance" % mode)
    fitresults.append(fitresult.Clone())
    ffile.Close()

# order of parameters:
# - beta
# - exponent
# - offset
# - turnon
formula = "((1.-1./(1. + ([3]*x)**[1] - [2]))*(1 - [0]*x))"
acceptance = TF1("acceptance", formula, tfloor, tceil)
acceptance.SetMinimum(0.5)
acceptance.SetMaximum(1.5)
Exemplo n.º 5
0
tfloor = 0.2
tceil = 15.0
nbins = 150

# Files with fitresults:
# data/fitresult-DsPi-powerlaw4-2012-08-10-Fri-05-30.root
# data/fitresult-DsK-powerlaw4-2012-08-10-Fri-07-56.root

# Get objects from workspace
fitresults = []
fnames = [ fname1, fname2 ]
modes = [mode1, mode2]
for i in xrange(0, len(fnames)):
    fn = fnames[i]
    mode = modes[i]
    ws, ffile = get_workspace(fn, 'workspace')
    # ws.Print('v')
    fitresult = ws.obj('fitresult_Model_dataset')
    fitresult.SetNameTitle('fitresult_Model_dataset_%s' % mode,
                           '%s decay time acceptance' % mode)
    fitresults.append(fitresult.Clone())
    ffile.Close()

# order of parameters:
# - beta
# - exponent
# - offset
# - turnon
formula = '((1.-1./(1. + ([3]*x)**[1] - [2]))*(1 - [0]*x))'
acceptance = TF1('acceptance', formula, tfloor, tceil)
acceptance.SetMinimum(0.5)
Exemplo n.º 6
0
loadstatus = { 0: 'loaded',
               1: 'already loaded',
               -1: 'does not exist',
               -2: 'version mismatch' }

status = gSystem.Load('libacceptance')
if status < 0: sys.exit('Problem loading %s, %s' % (library, loadstatus[status]) )

from ROOT import PowLawAcceptance

# my stuff
from factory import get_workspace
epsilon = 2E-4

# Get workspaces from files
workspace1 = get_workspace(fname1, 'workspace')
workspace1.SetName('workspace1')
workspace2 = get_workspace(fname2, 'workspace')
workspace2.SetName('workspace2')

# create new workspace
workspace = RooWorkspace('workspace')

# observable
time = workspace1.var('time')
time.setRange('fullrange', epsilon, 1E-2 + epsilon)
_import(workspace, time)

# parameters
offset = workspace1.var('offset')
turnon = workspace1.var('turnon')
Exemplo n.º 7
0
tfloor = 0.2
tceil = 15.0
nbins = 150

# Files with fitresults:
# data/fitresult-DsPi-powerlaw4-2012-08-10-Fri-05-30.root
# data/fitresult-DsK-powerlaw4-2012-08-10-Fri-07-56.root

# Get objects from workspace
fitresults = []
fnames = [ fname1, fname2 ]
modes = [mode1, mode2]
for i in xrange(0, len(fnames)):
    fn = fnames[i]
    mode = modes[i]
    ws, ffile = get_workspace(fn, 'workspace')
    # ws.Print('v')
    fitresult = ws.obj('fitresult_Model_dataset')
    fitresult.SetNameTitle('fitresult_Model_dataset_%s' % mode,
                           '%s decay time acceptance' % mode)
    fitresults.append(fitresult.Clone())
    ffile.Close()

# order of parameters:
# - beta
# - exponent
# - offset
# - turnon
formula = '((1.-1./(1. + ([3]*x)**[1] - [2]))*(1 - [0]*x))'
acceptance = TF1('acceptance', formula, tfloor, tceil)
acceptance.SetMinimum(0.5)