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