53 def test(self):
54 """ Perform tests """
55 tmp_dir_path = pathlib.Path(self.tmp_dir.name)
56
57 dec_path = tmp_dir_path / "test_y4s_trivial.dec"
58 with dec_path.open("w") as decfile:
59 decfile.write(TRIVIAL_DECFILE)
60
61
62
63
64 path = basf2.create_path()
66 ge.add_evtgen_generator(
67 path=path,
68 finalstate="signal",
69 signaldecfile=basf2.find_file(str(dec_path)),
70 )
71
73
74 out_file_path = tmp_dir_path / "out.root"
75 create_validation_histograms(
76 path,
77 out_file_path,
78 "Upsilon(4S)",
79 variables_1d=[
80 (
81 "M",
82 100,
83 5,
84 15,
85 "mass",
86 "me <wontreply@dont.try>",
87 "description of M",
88 "nothing to check",
89 "x label",
90 )
91 ],
92 variables_2d=[
93 (
94 "M",
95 100,
96 5,
97 15,
98 "M",
99 100,
100 5,
101 15,
102 "mass vs mass",
103 "me <wontreply@dont.try>",
104 "some description nobody reads",
105 "nothing to check",
106 "x label",
107 "why label?",
108 "mop1, mop2",
109 )
110 ],
111 description="Overall description of plots in this package.",
112 )
113
114 basf2.process(path=path)
115
116
117
118
119 tf = ROOT.TFile(str(out_file_path))
120
121
122
123
124 d = tf.Get("Description")
125 self.assertEqual(
126 d.GetTitle(), "Overall description of plots in this package."
127 )
128
129
130
131
132 md = get_metadata(tf.Get("M"))
133 self.assertEqual(md["description"], "description of M")
134 self.assertEqual(md["check"], "nothing to check")
135 self.assertEqual(md["metaoptions"], [])
136 self.assertEqual(md["contact"], "me <wontreply@dont.try>")
137
138
139
140
141 md = get_metadata(tf.Get("MM"))
142 self.assertEqual(md["description"], "some description nobody reads")
143 self.assertEqual(md["check"], "nothing to check")
144 self.assertEqual(md["metaoptions"], ["mop1", "mop2"])
145 self.assertEqual(md["contact"], "me <wontreply@dont.try>")
146
147
def setupEventInfo(noEvents, path)
def fillParticleListFromMC(decayString, cut, addDaughters=False, skipNonPrimaryDaughters=False, writeOut=False, path=None, skipNonPrimary=False, skipInitial=True)