Belle II Software development
1_makeNtuple.py
1#!/usr/bin/env python3
2
3
10
11"""
12<header>
13 <input>EvtGenSimRec.root, EvtGenSimRec_B2Kpi.root</input>
14 <output>TOPNtuple.root</output>
15 <contact>marko.staric@ijs.si</contact>
16 <description>Makes a flat ntuple with TOP PID, track info and MC truth </description>
17</header>
18"""
19
20import basf2 as b2
21
22# ---------------------------------------------------------------
23# Make a flat ntuple for validation of top package
24# ---------------------------------------------------------------
25
26# Suppress messages and warnings during processing:
27b2.set_log_level(b2.LogLevel.ERROR)
28
29# Create path
30main = b2.create_path()
31
32# Input
33roinput = b2.register_module('RootInput')
34roinput.param('inputFileNames', ['../EvtGenSimRec_B2Kpi.root',
35 '../EvtGenSimRec.root'])
36main.add_module(roinput)
37
38# Gearbox: access to database (xml files)
39gearbox = b2.register_module('Gearbox')
40main.add_module(gearbox)
41
42# Geometry (only TOP is needed and B-field)
43geometry = b2.register_module('Geometry')
44geometry.param('components', ['MagneticField', 'TOP'])
45main.add_module(geometry)
46
47# Output: make flat ntuple from TOPLikelihoods, tracking info and MC truth
48output = b2.register_module('TOPNtuple')
49output.param('outputFileName', '../TOPNtuple.root')
50main.add_module(output)
51
52# Show progress of processing
53main.add_module('Progress')
54
55# Process events
56b2.process(main)
57
58# Print call statistics
59print(b2.statistics)