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