Exemplo n.º 1
0
def filter_2015_pipi():
    sels = {
        'Resolved': {
            '': selection_R,
            '_LowMass': selection_R_low,
            '_HighMass': selection_R_high
        },
        'Merged': {}
    }
    for finalstate in 'pipi', :  # 'Kpi' :
        # Merged doesn't work currently cause the BDT expects lab6&7 to be the photons.
        for pi0 in 'Resolved', :  # 'Merged' :
            for mag in 'Up', 'Down':
                dataset = 'Data_2015_{finalstate}pi0_{pi0}_Mag{mag}_full'.format(
                    **locals())
                print dataset
                info = datalib.get_data_info(dataset)
                tree = datalib.get_data(dataset)
                for suff, sel in sels[pi0].items():
                    outputname = dataset.replace('_full', suff)
                    print outputname
                    outputdir = os.path.join(filtereddatadir, outputname)
                    if not os.path.exists(outputdir):
                        os.makedirs(outputdir)
                    outputfile = os.path.join(outputdir, outputname + '.root')
                    fout = ROOT.TFile.Open(outputfile, 'recreate')
                    treeout = copy_tree(tree, sel, write=True)
                    fout.Close()
Exemplo n.º 2
0
#!/usr/bin/env python

from AGammaD0Tohhpi0.data import datalib
from AnalysisUtils.treeutils import tree_iter
total = 0.
for year in '2016', :
    yeartotal = 0.
    for mag in 'Up', 'Down':
        t = datalib.get_data('Data_2016_Mag' + mag + '_lumi')
        lumiiter = tree_iter(t, 'IntegratedLuminosity')
        lumi = sum(lumiiter)
        print year, 'Mag' + mag, ':', '{0:.1f} pb^-1'.format(lumi)
        total += lumi
        yeartotal += lumi
    print year, 'total:', '{0:.1f} pb^-1'.format(yeartotal)
print 'total:', '{0:.1f} pb^-1'.format(total)
Exemplo n.º 3
0
mpip = 139.6
mdz = 1864.84
mcmin = mpi0**2 + mpip**2 - 50
mcmax = mdz**2 - mcmin + 100
mzmin = 2*mpip**2 - 50
mzmax = mdz**2 - mzmin + 100

name = sys.argv[1]
if not name.startswith('MINT_') :
    name = 'MINT_' + name
#tree = datalib.get_data('MINT_data_NoCPV_x=2.5')
#tree = datalib.get_data('MINT_test-new')
#tree = datalib.get_data('MINT_test-new-2')
#datalib.datapaths['MINT_data_3SigmaCPV']['files'] = datalib.datapaths['MINT_data_3SigmaCPV']['files'][:10]
#tree = datalib.get_data('MINT_data_3SigmaCPV')
tree = datalib.get_data(name)

canv = ROOT.TCanvas('canv', '', 600, 600)
plots = {}
for name, form in {'dalitz' : '{0} : {1} >> h(100, {2}, {3}, 100, {2}, {3})'.format(mm, mp, mcmin, mcmax),
                   'mplus' : '{0} >> h(100, {1}, {2})'.format(mp, mcmin, mcmax),
                   'mminus' : '{0} >> h(100, {1}, {2})'.format(mm, mcmin, mcmax),
                   'mzero' : '{0} >> h(100, {1}, {2})'.format(m0, mzmin, mzmax),
                   'time' : 'decaytime >> h(100, 0, 4.1)'}.items() :
    plots[name] = {}
    for tag in '-1', '+1' :
        tree.Draw(form, 'tag == ' + tag, 'colz')
        h = ROOT.gDirectory.Get('h')
        h.SetName(name + '_tag_' + str(tag))
        plots[name][tag] = h
        canv.SaveAs(name + '_tag_' + tag + '.pdf')
Exemplo n.º 4
0
import Mint2
from AGammaD0Tohhpi0.data import datalib
from ROOT import DalitzEvent
from AGammaD0Tohhpi0.mint import set_default_config

set_default_config()

tree = datalib.get_data('MINT_test-kkpi0')

tree.GetEntry(0)
evt = DalitzEvent()
evt.fromTree(tree)
pattern = evt.eventPattern()

s12min, s12max = pattern.sijMin(1, 2), pattern.sijMax(1, 2)
s13min, s13max = pattern.sijMin(1, 3), pattern.sijMax(1, 3)

for i in xrange(tree.GetEntries()):
    tree.GetEntry(i)
    evt = DalitzEvent()
    evt.fromTree(tree)

    tag = tree.tag
    s12 = evt.s(1, 2)
    s13 = evt.s(1, 3)
    s23 = evt.s(2, 3)
Exemplo n.º 5
0
if __name__ == "__main__":

    c1 = ROOT.TCanvas("c1", "c1")
    c1.cd()    
    method = "BDT"

    if (len(sys.argv) < 2) or (sys.argv[1] not in ['Up', 'Down']):
        print "\nWarning: Polarisation not specified correctly. Defaulting to 'Up'."
        mag = "Up"
    else:
        mag = sys.argv[1]
    
    #Reading in data
    dataset_name = 'RealData_2015_Charm_Mag'+mag+'_pipipi0_Resolved_TriggerFiltered'
    #dataset_name = 'RealData_2017_Charm_Mag'+mag+'_pipipi0_Merged_TriggerFiltered'
    realtree = datalib.get_data(dataset_name)
        
    #Stops histogram data from printing on plot
    ROOT.gStyle.SetOptStat(0)

    draw_bdt_cut(0.1, realtree, c1, method = method)
    
    c2 = ROOT.TCanvas("c2", "c2")
    c2.cd()
    realtree.Draw(method+"_output", "selection_pass && inrange_all")
    
    def draw(cut, method = method):
        draw_bdt_cut(cut, realtree, c1, method = method)

Exemplo n.º 6
0
x = config.float('x')
y = config.float('y')
qoverp = config.float('qoverp')
phi = config.float('phi')
lifetime = config.float('lifetime')
width = 1. / lifetime
deltam = x * width
deltagamma = y * 2 * width

rndm = ROOT.TRandom3(0)

generator = TimeDependentGenerator(pattern_D0Topipipi0, width, deltam,
                                   deltagamma, qoverp, phi, rndm)

tree = datalib.get_data('MINT_' + name)
evtlist = DiskResidentEventList(
    datalib.get_data_info('MINT_' + name)['files'][0], 'OPEN')

diffcalc = PhaseDifferenceCalc(pattern_D0Topipipi0, config.fnames[0])

for i in xrange(tree.GetEntries()):
    tree.GetEntry(i)
    if tree.tag == 1:
        evt = evtlist.getEvent(i)
        break
for i in xrange(tree.GetEntries()):
    tree.GetEntry(i)
    if tree.tag == -1:
        cpevt = evtlist.getEvent(i)
        break