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