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