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