Belle II Software light-2406-ragdoll
B2A903-PrintOutVariableValues.py
1#!/usr/bin/env python3
2
3
10
11
22
23import basf2 as b2
24import modularAnalysis as ma
25
26# create path
27my_path = b2.create_path()
28
29# load input ROOT file
30ma.inputMdst(filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples', False),
31 path=my_path)
32
33# create charged kaon and pion particle lists with names "K-:gen" and "pi-:gen"
34# all generated kaons(pions) will be added to the kaon(pion) list
35ma.fillParticleListFromMC(decayString='K-:gen', cut='', path=my_path)
36ma.fillParticleListFromMC(decayString='pi-:gen', cut='', path=my_path)
37
38# print charge, energy and total momentum of generated kaons
39# and x,y,z components of momenta for generated pions
40#
41# the list of all available variables can be obtained by executing
42# basf2 analysis/scripts/variables/print_variables.py
43ma.printVariableValues(list_name='K-:gen', var_names=['charge', 'E', 'p'], path=my_path)
44ma.printVariableValues(list_name='pi-:gen', var_names=['charge', 'px', 'py', 'pz'], path=my_path)
45
46# Process the events
47b2.process(my_path)
48
49# print out the summary
50print(b2.statistics)