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