Belle II Software light-2406-ragdoll
B2A203-LoadV0s.py
1#!/usr/bin/env python3
2
3
10
11
28
29import basf2 as b2
30import modularAnalysis as ma
31import variables.collections as vc
32import variables.utils as vu
33import stdV0s as stdv
34
35# create path
36my_path = b2.create_path()
37
38# load input ROOT file
39ma.inputMdst(filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples', False),
40 path=my_path)
41
42# print contents of the DataStore before loading Particles
43ma.printDataStore(path=my_path)
44
45# The recommended way to create and fill Ks/Lambda0 ParticleLists is to use
46# the default functions provided in analysis/scripts/stdV0s.py
47# These functions load a combined list of V0 objects merged with
48# a list of particles combined using the analysis ParticleCombiner module.
49# See the script (analysis/scripts/stdV0s.py) for more details.
50stdv.stdKshorts(prioritiseV0=True, path=my_path)
51stdv.stdLambdas(prioritiseV0=True, path=my_path)
52
53# print contents of the DataStore after loading Particles
54ma.printDataStore(path=my_path)
55
56# print out the contents of each ParticleList
57ma.printList(list_name='K_S0:merged', full=False, path=my_path)
58ma.printList(list_name='Lambda0:merged', full=False, path=my_path)
59
60# define variables
61pi0_vars = vc.kinematics + \
62 vc.pid + \
63 vc.track + \
64 vc.track_hits + \
65 vc.mc_truth
66
67v0_vars = vc.kinematics + \
68 vc.inv_mass + \
69 vc.vertex + \
70 vc.mc_truth + \
71 ['chiProb'] + \
72 vu.create_daughter_aliases(pi0_vars, 0) +\
73 vu.create_daughter_aliases(pi0_vars, 1)
74
75
76# saving variables to ntuple
77rootOutputFile = 'B2A203-LoadV0s.root'
78
79# K_S0 from standard list (merged list, see stdV0s.py)
80ma.variablesToNtuple(treename='kshort_std',
81 decayString='K_S0:merged',
82 variables=v0_vars,
83 filename=rootOutputFile,
84 path=my_path)
85
86# Lambda0 from standard list (merged list, see stdV0s.py)
87ma.variablesToNtuple(treename='lambda_std',
88 decayString='Lambda0:merged',
89 variables=v0_vars,
90 filename=rootOutputFile,
91 path=my_path)
92
93
94b2.process(my_path)
95
96# print out the summary
97print(b2.statistics)