Belle II Software  release-08-01-10
event_kinematics_variables.py
1 #!/usr/bin/env python3
2 
3 
10 
11 """
12 a test of the EventKinematics 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 
18 # make logging more reproducible by replacing some strings
20 set_random_seed("1337")
21 testinput = [b2test_utils.require_file('analysis/tests/mdst.root')]
22 
23 fsps = ['pi-:all', 'gamma:all']
24 
26 testpath = create_path()
27 testpath.add_module('RootInput', inputFileNames=testinput)
28 # There is an annoying warning in ParticleLoader about zero charged tracks
29 # If it will be removed in the future releases, the test log should be
30 # updated respectively.
31 testpath.add_module('ParticleLoader', decayStrings=fsps)
32 testpath.add_module('ParticleSelector', decayString='gamma:all', cut='isFromECL')
33 
34 # Variables created by event kinematics module
35 event_kinematics = [
36  "missingMomentumOfEvent",
37  "missingMomentumOfEvent_Px",
38  "missingMomentumOfEvent_Py",
39  "missingMomentumOfEvent_Pz",
40  "missingMomentumOfEvent_theta",
41  "missingMomentumOfEventCMS",
42  "missingMomentumOfEventCMS_Px",
43  "missingMomentumOfEventCMS_Py",
44  "missingMomentumOfEventCMS_Pz",
45  "missingMomentumOfEventCMS_theta",
46  "missingEnergyOfEventCMS",
47  "missingMass2OfEvent",
48  "visibleEnergyOfEventCMS",
49  "totalPhotonsEnergyOfEvent"
50 ]
51 
52 testpath.add_module('EventKinematics', particleLists=fsps)
53 # Print the variables to log
54 testpath.add_module('ParticlePrinter', listName='', fullPrint=False,
55  variables=event_kinematics)
56 process(testpath, 1)
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