Belle II Software  release-08-00-10
B2A903-PrintOutVariableValues.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
22 
23 import basf2 as b2
24 import modularAnalysis as ma
25 
26 # create path
27 my_path = b2.create_path()
28 
29 # load input ROOT file
30 ma.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
35 ma.fillParticleListFromMC(decayString='K-:gen', cut='', path=my_path)
36 ma.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
43 ma.printVariableValues(list_name='K-:gen', var_names=['charge', 'E', 'p'], path=my_path)
44 ma.printVariableValues(list_name='pi-:gen', var_names=['charge', 'px', 'py', 'pz'], path=my_path)
45 
46 # Process the events
47 b2.process(my_path)
48 
49 # print out the summary
50 print(b2.statistics)