Belle II Software  release-06-02-00
tdcpv_variables.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 a test of the TDCPV variables using the small test file for running quickly
14 """
15 
16 import b2test_utils
17 from basf2 import set_random_seed, create_path, process
18 
19 # make logging more reproducible by replacing some strings
21 set_random_seed("1337")
22 testinput = [b2test_utils.require_file('analysis/tests/mdst.root')]
23 
24 fsps = ['mu-', 'pi-', 'gamma']
25 
27 testpath = create_path()
28 testpath.add_module('RootInput', inputFileNames=testinput)
29 for fsp in fsps:
30  testpath.add_module('ParticleLoader', decayStrings=[fsp])
31 
32 
33 signal_list = 'J/psi'
34 # Find J/psi
35 testpath.add_module('ParticleCombiner', decayString=f'{signal_list} -> mu+:all mu-:all',
36  cut='daughter(0, isSignal) > 0 and daughter(1, isSignal) > 0 '
37  ' and daughter(0, genMotherID) == daughter(1, genMotherID)')
38 # Signal vertex fit using kFit
39 testpath.add_module('ParticleVertexFitter', listName=signal_list,
40  confidenceLevel=0., vertexFitter='KFit')
41 
42 testpath.add_module('ParticlePrinter', listName=signal_list, fullPrint=False)
43 # Build ROE
44 testpath.add_module('RestOfEventBuilder', particleList=signal_list,
45  particleListsInput=['pi+:all', 'gamma:all'])
46 # Tag vertex fit
47 testpath.add_module('TagVertex', listName=signal_list)
48 # Define ROE variables for testing
49 tdcpv_vars = ['DeltaT', 'DeltaTErr', 'DeltaTBelle', 'TagVz', 'TagVzErr']
50 # Print the variables to log
51 testpath.add_module('ParticlePrinter', listName=signal_list, fullPrint=False,
52  variables=tdcpv_vars)
53 process(testpath)
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:106
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:54