Belle II Software development
udst_compatibility-v05-00-00.py
1#!/usr/bin/env python3
2
3
10
11"""
12Test backwards compatibility for a udst file produced with release-05-00-00.
13
14This is the *start* of analysis objects guarantee of backwards compatibility.
15Pragmatically, we are backwards compatible with release-04 **in** release-05
16but we cannot guarantee this in general.
17
18See https://confluence.desy.de/display/BI/Backward+Compatibility for more
19specific statements about guarantees, and in case you observe a test failure.
20
21We keep a coarse log of the changes here for reference. Please reference a
22GitLab issue wherever possible...
23
24CHANGES between release-04-00-00 and release-05-00-00:
25 * Renamed m_particleType to m_particleSource (a more meaningful name).
26 See BII-3959 and BII-7148.
27
28CHANGES since release-05-00-00:
29 * Added m_momentumScale to handle the momentum scale correction for
30 TreeFitter. See BII-6971.
31"""
32
33import basf2
34import b2test_utils
35import udst
36
37if __name__ == "__main__":
38
39 # clear out stray env variables and set seeding for reproducible results
41 basf2.set_random_seed(1)
42
43 # configure processing path - input file is a single event from the feiSL
44 # skim run over the file mdst/tests/mdst-v05-00-00.root
45 main = basf2.create_path()
46 main.add_module(
47 "RootInput", inputFileName=basf2.find_file("analysis/tests/udst-v05-00-00.root")
48 )
49 main.add_module("EventInfoPrinter")
50
51 # this function does the hard work
52 udst.add_udst_dump(main, True)
53
54 # also dump some variables just in case the DataStorePrinter hides some
55 # problems (like has happened once: GitLab issue #7023).
56 sanity_check_variables = [
57 "mcPDG",
58 "daughter(0, mcPDG)", # check the MCParticle <--> Particle relation (or array index lookup)
59 "Mbc", "InvM", "deltaE",
60 "daughter(1, pionID)", # check the PIDLikelihoods <--> Particle relation
61 "daughter(1, kaonID)",
62 "daughter(1, clusterE)", # check the ECLCluster <--> Particle relation (or array index lookup)
63 "daughter(1, klmClusterLayers)", # check the KLMCluster <--> Particle relation (or array index lookup)
64 ]
65 for listname in ["B+:feiSL", "B-:feiSL", "B0:feiSL"]:
66 main.add_module(
67 "ParticlePrinter", listName=listname, variables=sanity_check_variables)
68
69 # only 1 event in the file, but set explicitly case this test script gets copied
70 basf2.process(main, 1)
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:106
def add_udst_dump(path, print_untested=False)
Definition: udst.py:166