Belle II Software  release-06-01-15
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(environmentType='default',
31  filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples', False),
32  path=my_path)
33 
34 # create charged kaon and pion particle lists with names "K-:gen" and "pi-:gen"
35 # all generated kaons(pions) will be added to the kaon(pion) list
36 ma.fillParticleListFromMC(decayString='K-:gen', cut='', path=my_path)
37 ma.fillParticleListFromMC(decayString='pi-:gen', cut='', path=my_path)
38 
39 # print charge, energy and total momentum of generated kaons
40 # and x,y,z components of momenta for generated pions
41 #
42 # the list of all available variables can be obtained by executing
43 # basf2 analysis/scripts/variables/print_variables.py
44 ma.printVariableValues(list_name='K-:gen', var_names=['charge', 'E', 'p'], path=my_path)
45 ma.printVariableValues(list_name='pi-:gen', var_names=['charge', 'px', 'py', 'pz'], path=my_path)
46 
47 # Process the events
48 b2.process(my_path)
49 
50 # print out the summary
51 print(b2.statistics)