Belle II Software development
B2A902-PrintOutMCParticles.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# print out the contents of the StoreArray<MCParticle>
34ma.printPrimaryMCParticles(path=my_path)
35
36# The printed information can be stored in TTree via VariablesToNtuple module
37# The branch __MCDecayString__ is automatically created if printMCParticles is called
38ma.variablesToNtuple(decayString="", variables=[], path=my_path)
39
40# Process the events
41b2.process(my_path)
42
43# print out the summary
44print(b2.statistics)