Belle II Software
development
highlight_particle.py
1
#!/usr/bin/env python3
2
3
10
11
# given a DST file as input, this example reconstructs D*+ candidates
12
# and highlights all final state particles assigned to the candidate
13
# in the display.
14
15
import
basf2
as
b2
16
17
from
ROOT
import
Belle2
18
import
modularAnalysis
as
ma
19
20
21
class
HighlighterModule
(b2.Module):
22
"""Select all things related to a Particle"""
23
24
def
initialize
(self):
25
"""reimplementation of Module::initialize()."""
26
27
Belle2.PyStoreObj
(
"DisplayData"
).registerInDataStore()
28
29
def
event
(self):
30
"""reimplementation of Module::event()."""
31
32
displayData =
Belle2.PyStoreObj
(
"DisplayData"
)
33
displayData.create()
34
35
particles =
Belle2.PyStoreArray
(
'Particles'
)
36
for
p
in
particles:
37
if
abs(p.getPDGCode()) == 413:
38
b2.B2WARNING(
"highlighting D*+ candidate"
)
39
# displayData.obj().select(p)
40
daughters = p.getFinalStateDaughters()
41
for
d
in
daughters:
42
# selecting the MCParticle also gets the tracks
43
mcp = d.getRelated(
'MCParticles'
)
44
displayData.obj().select(mcp)
45
break
# only one
46
47
48
main = b2.create_path()
49
50
main.add_module(
'RootInput'
)
51
main.add_module(
'Gearbox'
)
52
geometry = main.add_module(
'Geometry'
)
53
geometry.param(
'excludedComponents'
, [
'ECL'
])
54
55
56
ma.fillParticleList(
'K-'
,
'kaonID > 0.1'
, path=main)
57
ma.fillParticleList(
'pi+'
,
'pionID > 0.1'
, path=main)
58
ma.fillParticleList(
'gamma'
,
''
, path=main)
59
60
ma.reconstructDecay(
'pi0 -> gamma gamma'
,
'0.110 < M < 0.150'
, path=main)
61
62
ma.reconstructDecay(
'D0 -> K- pi+'
,
'1.7 < M < 2.0'
, path=main)
63
ma.reconstructDecay(
'D*+ -> D0 pi+'
,
'1.9 < M < 2.1'
, path=main)
64
65
66
main.add_module(
HighlighterModule
())
67
68
main.add_module(
'Display'
)
69
70
b2.process(main)
Belle2::PyStoreArray
A (simplified) python wrapper for StoreArray.
Definition
PyStoreArray.h:73
Belle2::PyStoreObj
a (simplified) python wrapper for StoreObjPtr.
Definition
PyStoreObj.h:67
highlight_particle.HighlighterModule
Definition
highlight_particle.py:21
highlight_particle.HighlighterModule.initialize
initialize(self)
Definition
highlight_particle.py:24
highlight_particle.HighlighterModule.event
event(self)
Definition
highlight_particle.py:29
display
examples
highlight_particle.py
Generated on Mon Sep 1 2025 02:49:41 for Belle II Software by
1.13.2