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