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