Belle II Software development
event_kinematics_mc_compatibility.py
1#!/usr/bin/env python3
2
3
10
11"""
12a test of the EventKinematics variables using the small test file for running quickly
13"""
14
15import b2test_utils
16from basf2 import set_random_seed, create_path, process
17
18# make logging more reproducible by replacing some strings
20set_random_seed("1337")
21testinput = [b2test_utils.require_file('analysis/tests/mdst.root')]
22
23fsps = ['gamma', 'e+', 'mu+', 'pi+', 'K+', 'p+',
24 'K_S0', 'Lambda0']
25
27testpath = create_path()
28testpath.add_module('RootInput', inputFileNames=testinput)
29testpath.add_module('ParticleLoader', decayStrings=[fsp + ':MC' for fsp in fsps],
30 addDaughters=True, skipNonPrimaryDaughters=True, useMCParticles=True)
31for fsp in fsps:
32 testpath.add_module('ParticleListManipulator', outputListName=fsp,
33 inputListNames=[fsp + ':MC'], cut='mcPrimary > 0 and nDaughters == 0')
34
35# Variables filled by event kinematics module
36event_kinematics = [
37 'genMissingMass2OfEvent',
38 'genMissingEnergyOfEventCMS',
39 'genMissingMomentumOfEventCMS',
40 'genTotalPhotonsEnergyOfEvent', # It is 0, because there is no primary photons in the event
41 'genVisibleEnergyOfEventCMS',
42]
43
44testpath.add_module('EventKinematics', particleLists=fsps, usingMC=True)
45# Print the variables to log
46testpath.add_module('ParticlePrinter', listName='', fullPrint=False,
47 variables=event_kinematics)
48process(testpath, 1)
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:54
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:106