Belle II Software development
B2A504-TrackingSystematics.py
1#!/usr/bin/env python3
2
3
10
11
29
30import basf2 as b2
31import modularAnalysis as ma
32
33# define systematic tests
34sys_tests = ['def', 'scale', 'scaleUp', 'scaleDown', 'Efficiency']
35
36# Select the systematic variation from the list
37test = 'scaleDown'
38
39if test not in sys_tests:
40 print(f"Unknown systematic test {test}")
41 exit(1)
42
43# create path
44my_path = b2.create_path()
45
46# load input ROOT file
47ma.inputMdst(filename=b2.find_file('JPsi2ee_e2egamma.root', 'examples', False),
48 path=my_path)
49
50
51# fill particleLists
52ma.fillParticleList(decayString='e+:sel',
53 cut='electronID > 0.2 and dr < 2 and abs(dz) < 4',
54 path=my_path)
55
56if test == 'def':
57 pass
58elif test == 'scale':
59 ma.scaleTrackMomenta(inputListNames=['e+:sel'], scale=1.00056, path=my_path)
60elif test == 'scaleUp':
61 ma.scaleTrackMomenta(inputListNames=['e+:sel'], scale=1.001, path=my_path)
62elif test == 'scaleDown':
63 ma.scaleTrackMomenta(inputListNames=['e+:sel'], scale=0.999, path=my_path)
64elif test == 'Efficiency':
65 ma.removeTracksForTrackingEfficiencyCalculation(inputListNames=['e+:sel'], fraction=0.01, path=my_path)
66
67# J/psi
68ma.reconstructDecay(decayString='J/psi:out -> e+:sel e-:sel',
69 cut='',
70 path=my_path)
71
72var1 = ['M',
73 'p',
74 'E',
75 ]
76
77ma.variablesToNtuple(decayString='J/psi:out',
78 variables=var1,
79 filename=f'Jpsi_out_{test}.root',
80 path=my_path)
81
82# process the events
83b2.process(my_path)
84
85# print out the summary
86print(b2.statistics)