Belle II Software development
mc_roe_compatibility.py
1#!/usr/bin/env python3
2
3
10
11"""
12This is a log-type unit test of the ROE made out of MCParticles.
13It runs over a mdst file which contains two muons, converted gamma, K_S0 and Lambda0.
14It uses a muon as a signal side, so ROE should contain only 3 V0 objects + a muon.
15The mdst file was generated by scripts in the external repository:
16https://gitlab.desy.de/belle2/software/examples-data-creation/roe-unittest-mc
17There is no larger equivalent of this test.
18"""
19
20import b2test_utils
21from basf2 import set_random_seed, create_path, process
22
23# make logging more reproducible by replacing some strings
25set_random_seed("1337")
26testinput = [b2test_utils.require_file('analysis/tests/pgun-roe-mdst.root')]
27fsps = ['mu+', 'K_S0', 'Lambda0', 'gamma']
28
30testpath = create_path()
31testpath.add_module('RootInput', inputFileNames=testinput)
32for fsp in fsps:
33 testpath.add_module('ParticleLoader', decayStrings=[fsp + ':MC'],
34 addDaughters=True, skipNonPrimaryDaughters=True, useMCParticles=True)
35 testpath.add_module('ParticleListManipulator', outputListName=fsp,
36 inputListNames=[fsp + ':MC'], cut='mcPrimary > 0')
37signal_side_name = 'B0'
38testpath.add_module('ParticleCombiner',
39 decayString=signal_side_name+' -> mu+ mu-',
40 cut='')
41testpath.add_module('ParticlePrinter',
42 listName='mu+')
43
44testpath.add_module('RestOfEventBuilder', particleList=signal_side_name,
45 particleListsInput=fsps, fromMC=True)
46
47roe_path = create_path()
48roe_path.add_module('RestOfEventPrinter',
49 unpackComposites=False,
50 fullPrint=False)
51testpath.for_each('RestOfEvent', 'RestOfEvents', path=roe_path)
52
53process(testpath, 2)
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