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