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