Belle II Software  release-06-02-00
B2A502-WriteOutDecayHash.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
28 
29 import basf2 as b2
30 import modularAnalysis as ma
31 
32 # create path
33 my_path = b2.create_path()
34 
35 # load input ROOT file
36 ma.inputMdst(environmentType='default',
37  filename=b2.find_file('JPsi2ee_e2egamma.root', 'examples', False),
38  path=my_path)
39 
40 # reconstruct the decay
41 ma.fillParticleList(decayString='e+',
42  cut='electronID > 0.2 and d0 < 2 and abs(z0) < 4',
43  writeOut=False,
44  path=my_path)
45 ma.fillParticleList(decayString='gamma',
46  cut='',
47  writeOut=False,
48  path=my_path)
49 ma.reconstructDecay(decayString='J/psi -> e+ e-',
50  cut='',
51  path=my_path)
52 
53 # generate the decay string
54 my_path.add_module('ParticleMCDecayString', listName='J/psi', fileName='hashmap_Jpsi_from_B2A502.root')
55 
56 
57 # write out ntuples
58 var = ['M',
59  'p',
60  'E',
61  'x', 'y', 'z',
62  'extraInfo(DecayHash)',
63  'extraInfo(DecayHashExtended)',
64  ]
65 
66 ma.variablesToNtuple(decayString='J/psi',
67  variables=var,
68  filename='Jpsi_from_B2A502.root',
69  path=my_path)
70 
71 # process the events
72 b2.process(my_path)
73 
74 # print out the summary
75 print(b2.statistics)