Belle II Software  release-05-01-25
tdcpv_variables.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 """
5 a test of the TDCPV variables using the small test file for running quickly
6 """
7 
8 import b2test_utils
9 from basf2 import set_random_seed, create_path, process
10 
11 # make logging more reproducible by replacing some strings
13 set_random_seed("1337")
14 testinput = [b2test_utils.require_file('analysis/tests/mdst.root')]
15 
16 fsps = ['mu-', 'pi-', 'gamma']
17 
19 testpath = create_path()
20 testpath.add_module('RootInput', inputFileNames=testinput)
21 for fsp in fsps:
22  # There is an annoying warning in ParticleLoader about zero charged tracks
23  # If it will be removed in the future releases, the test log should be
24  # updated respectively.
25  testpath.add_module('ParticleLoader', decayStringsWithCuts=[(fsp, '')])
26 
27 
28 signal_list = 'J/psi'
29 # Find J/psi
30 testpath.add_module('ParticleCombiner', decayString=f'{signal_list} -> mu+ mu-',
31  cut='daughter(0, isSignal) > 0 and daughter(1, isSignal) > 0 '
32  ' and daughter(0, genMotherID) == daughter(1, genMotherID)')
33 # Signal vertex fit using kFit
34 testpath.add_module('ParticleVertexFitter', listName=signal_list,
35  confidenceLevel=0., vertexFitter='KFit')
36 
37 testpath.add_module('ParticlePrinter', listName=signal_list, fullPrint=False)
38 # Build ROE
39 testpath.add_module('RestOfEventBuilder', particleList=signal_list,
40  particleListsInput=['pi+', 'gamma'])
41 # Tag vertex fit
42 testpath.add_module('TagVertex', listName=signal_list)
43 # Define ROE variables for testing
44 tdcpv_vars = ['DeltaT', 'DeltaTErr', 'DeltaTBelle', 'TagVz', 'TagVzErr']
45 # Print the variables to log
46 testpath.add_module('ParticlePrinter', listName=signal_list, fullPrint=False,
47  variables=tdcpv_vars)
48 process(testpath, 10)
b2test_utils.configure_logging_for_tests
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:99
b2test_utils.require_file
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:47