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
15import basf2 as b2
16
17from ROOT import Belle2
18import modularAnalysis as ma
19
20
21class 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
48main = b2.create_path()
49
50main.add_module('RootInput')
51main.add_module('Gearbox')
52geometry = main.add_module('Geometry')
53geometry.param('excludedComponents', ['ECL'])
54
55
56ma.fillParticleList('K-', 'kaonID > 0.1', path=main)
57ma.fillParticleList('pi+', 'pionID > 0.1', path=main)
58ma.fillParticleList('gamma', '', path=main)
59
60ma.reconstructDecay('pi0 -> gamma gamma', '0.110 < M < 0.150', path=main)
61
62ma.reconstructDecay('D0 -> K- pi+', '1.7 < M < 2.0', path=main)
63ma.reconstructDecay('D*+ -> D0 pi+', '1.9 < M < 2.1', path=main)
64
65
66main.add_module(HighlighterModule())
67
68main.add_module('Display')
69
70b2.process(main)
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67