Belle II Software  release-08-01-10
tdcpv_variables.py
1 #!/usr/bin/env python3
2 
3 
10 
11 """
12 A test of the TDCPV variables using the small test file for running quickly
13 """
14 
15 import b2test_utils
16 from basf2 import set_random_seed, create_path, process
17 import modularAnalysis as ma
18 import vertex as vx
19 
20 # make logging more reproducible by replacing some strings
22 set_random_seed("1337")
23 
24 
25 path = create_path()
26 
27 # load single event from the mdst file
28 path.add_module('RootInput', inputFileNames=b2test_utils.require_file('analysis/tests/tdcpv-mdst.root'))
29 
30 # Creates Muon particle list
31 ma.fillParticleList(decayString='mu+:all', cut='', path=path)
32 
33 # reconstruct J/psi -> mu+ mu- decay
34 ma.reconstructDecay(decayString='J/psi:mumu -> mu+:all mu-:all', cut='dM<0.11', path=path)
35 
36 # reconstruct Ks from standard pi+ particle list
37 ma.fillParticleList(decayString='pi+:all', cut='', path=path)
38 ma.reconstructDecay(decayString='K_S0:pipi -> pi+:all pi-:all', cut='dM<0.25', path=path)
39 
40 # reconstruct B0 -> J/psi Ks decay
41 ma.reconstructDecay(decayString='B0:sig -> J/psi:mumu K_S0:pipi', cut='Mbc > 5.2 and abs(deltaE)<0.15', path=path)
42 
43 # Does the matching between reconstructed and MC particles
44 ma.matchMCTruth(list_name='B0:sig', path=path)
45 
46 # build the rest of the event associated to the B0
47 ma.buildRestOfEvent(target_list_name='B0:sig', fillWithMostLikely=True,
48  path=path)
49 
50 # Vertex fit for the signal B0
51 vx.treeFit('B0:sig', ipConstraint=True, path=path)
52 
53 # Fit Vertex of the B0 on the tag side
54 vx.TagV(list_name='B0:sig', MCassociation='breco', fitAlgorithm='KFit', constraintType='tube', path=path)
55 
56 tdcpv_vars = ['DeltaT', 'DeltaTErr', 'DeltaTBelle', 'TagVz', 'TagVzErr', 'mcDeltaT', 'mcDeltaTau', 'isSignal']
57 
58 # Print the variables to log
59 ma.printVariableValues('B0:sig', var_names=tdcpv_vars, path=path)
60 
61 process(path)
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