Belle II Software  release-05-01-25
0_EvtGenSimRec_B2Kpi.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 """
5 <header>
6  <output>EvtGenSimRec_B2Kpi.root</output>
7  <contact>marko.staric@ijs.si</contact>
8  <description>Generates signal MC of B0 -> K-pi+, 200 events</description>
9 </header>
10 """
11 
12 from basf2 import *
13 import os
14 from simulation import add_simulation
15 from reconstruction import add_reconstruction
16 from ROOT import Belle2
17 import glob
18 
19 set_random_seed(123451)
20 
21 main = create_path()
22 
23 # specify number of events to be generated
24 eventinfosetter = register_module('EventInfoSetter')
25 eventinfosetter.param('evtNumList', [1000])
26 main.add_module(eventinfosetter)
27 
28 # generate events (B0 -> K+pi- + cc, other B0 generic)
29 evtgeninput = register_module('EvtGenInput')
30 evtgeninput.param('userDECFile', Belle2.FileSystem.findFile('top/validation/B2Kpi.dec'))
31 main.add_module(evtgeninput)
32 
33 # detector simulation
34 bg = None
35 if 'BELLE2_BACKGROUND_DIR' in os.environ:
36  bg = glob.glob(os.environ['BELLE2_BACKGROUND_DIR'] + '/*.root')
37 add_simulation(main, bkgfiles=bg)
38 
39 # reconstruction
40 add_reconstruction(main)
41 
42 # output (to save space only branches needed in 1_makeNtuple.py)
43 output = register_module('RootOutput')
44 output.param('outputFileName', '../EvtGenSimRec_B2Kpi.root')
45 output.param('branchNames', ['MCParticles', 'Tracks', 'TrackFitResults',
46  'TOPLikelihoods', 'TOPBarHits', 'ExtHits'])
47 main.add_module(output)
48 
49 process(main)
50 
51 # Print call statistics
52 print(statistics)
Belle2::FileSystem::findFile
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:147