Belle II Software  release-08-01-10
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(filename=b2.find_file('JPsi2ee_e2egamma.root', 'examples', False),
37  path=my_path)
38 
39 # reconstruct the decay
40 ma.fillParticleList(decayString='e+',
41  cut='electronID > 0.2 and d0 < 2 and abs(z0) < 4',
42  writeOut=False,
43  path=my_path)
44 ma.fillParticleList(decayString='gamma',
45  cut='',
46  writeOut=False,
47  path=my_path)
48 ma.reconstructDecay(decayString='J/psi -> e+ e-',
49  cut='',
50  path=my_path)
51 
52 # generate the decay string
53 my_path.add_module('ParticleMCDecayString', listName='J/psi', fileName='hashmap_Jpsi_from_B2A502.root')
54 
55 
56 # write out ntuples
57 var = ['M',
58  'p',
59  'E',
60  'x', 'y', 'z',
61  'extraInfo(DecayHash)',
62  'extraInfo(DecayHashExtended)',
63  ]
64 
65 ma.variablesToNtuple(decayString='J/psi',
66  variables=var,
67  filename='Jpsi_from_B2A502.root',
68  path=my_path)
69 
70 # process the events
71 b2.process(my_path)
72 
73 # print out the summary
74 print(b2.statistics)