Belle II Software
release-05-01-25
interactive_python.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
9
10
from
basf2
import
Module, Path, process, B2INFO
11
import
interactive
12
from
ROOT
import
Belle2
13
14
15
class
MinModule
(Module):
16
"""
17
Example module to drop into ipython and create some objects to look at.
18
If you just want to start IPython and create PyStoreArray etc.
19
interactively in your own steering file, the 'Interactive' module
20
might be of interest.
21
"""
22
23
def
event
(self):
24
"""
25
reimplement Module::event()
26
"""
27
evtmetadata =
Belle2.PyStoreObj
(
"EventMetaData"
)
28
particles =
Belle2.PyStoreArray
(
"MCParticles"
)
29
B2INFO(80 *
'='
)
30
B2INFO(
"Dropping into interactive python shell. Try:"
31
"\n print evtmetadata.obj().getEvent()"
32
"\n particles[0].Dump()"
33
"\n help(particles[0])"
34
"\nTo continue non-interactively (until next event), press Ctrl+D."
35
"\nPress Ctrl+C followed by Ctrl+D to exit basf2."
)
36
B2INFO(80 *
'='
)
37
interactive.embed()
38
39
40
main = Path()
41
main.add_module(
'EventInfoSetter'
, evtNumList=[2])
42
main.add_module(
'ParticleGun'
)
43
main.add_module(
MinModule
())
44
process(main)
Belle2::PyStoreObj
a (simplified) python wrapper for StoreObjPtr.
Definition:
PyStoreObj.h:69
interactive_python.MinModule.event
def event(self)
Definition:
interactive_python.py:23
Belle2::PyStoreArray
a (simplified) python wrapper for StoreArray.
Definition:
PyStoreArray.h:58
interactive_python.MinModule
Definition:
interactive_python.py:15
framework
examples
interactive_python.py
Generated on Fri Nov 5 2021 03:52:13 for Belle II Software by
1.8.17