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