Belle II Software light-2406-ragdoll
B2A201-LoadMCParticles.py
1#!/usr/bin/env python3
2
3
10
11
31
32import basf2 as b2
33import modularAnalysis as ma
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_evtgen.root', 'examples', False),
40 path=my_path)
41
42# print contents of the DataStore before loading MCParticles
43ma.printDataStore(path=my_path)
44
45# create and fill gamma/e/mu/pi/K/p ParticleLists
46# second argument are the selection criteria: '' means no cut, take all
47photons = ('gamma:gen', '')
48electrons = ('e-:gen', '')
49muons = ('mu-:gen', '')
50pions = ('pi-:gen', '')
51kaons = ('K-:gen', '')
52protons = ('anti-p-:gen', '')
53
54ma.fillParticleListsFromMC([photons, electrons, muons, pions, kaons, protons], path=my_path)
55
56# print contents of the DataStore after loading MCParticles
57# the difference is that DataStore now contains StoreArray<Particle>
58# filled with Particles created from generated final state particles
59ma.printDataStore(path=my_path)
60
61# print out the contents of each ParticleList
62ma.printList(list_name='gamma:gen', full=False, path=my_path)
63ma.printList(list_name='e-:gen', full=False, path=my_path)
64ma.printList(list_name='mu-:gen', full=False, path=my_path)
65ma.printList(list_name='pi-:gen', full=False, path=my_path)
66ma.printList(list_name='K-:gen', full=False, path=my_path)
67ma.printList(list_name='anti-p-:gen', full=False, path=my_path)
68
69# Process the events
70b2.process(my_path)
71
72# print out the summary
73print(b2.statistics)