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