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