19 import modularAnalysis
20 import generators
as ge
24 from validationplots
import get_metadata
40 """ This test tests the ValidationMetadataSetter module via its interface
41 :func:`validation_tools.metadata.create_validation_histograms`
45 """ Open temporary directory to work in. """
47 self.
tmp_dirtmp_dir = tempfile.TemporaryDirectory()
50 """ Clean up temporary directory """
55 tmp_dir_path = pathlib.Path(self.
tmp_dirtmp_dir.name)
57 dec_path = tmp_dir_path /
"test_y4s_trivial.dec"
58 with dec_path.open(
"w")
as decfile:
59 decfile.write(TRIVIAL_DECFILE)
64 path = basf2.create_path()
66 ge.add_evtgen_generator(
69 signaldecfile=basf2.find_file(str(dec_path)),
76 out_file_path = tmp_dir_path /
"out.root"
77 create_validation_histograms(
88 "me <wontreply@dont.try>",
105 "me <wontreply@dont.try>",
106 "some description nobody reads",
113 description=
"Overall description of plots in this package.",
116 basf2.process(path=path)
121 tf = ROOT.TFile(str(out_file_path))
126 d = tf.Get(
"Description")
128 d.GetTitle(),
"Overall description of plots in this package."
134 md = get_metadata(tf.Get(
"M"))
135 self.assertEqual(md[
"description"],
"description of M")
136 self.assertEqual(md[
"check"],
"nothing to check")
137 self.assertEqual(md[
"metaoptions"], [])
138 self.assertEqual(md[
"contact"],
"me <wontreply@dont.try>")
143 md = get_metadata(tf.Get(
"MM"))
144 self.assertEqual(md[
"description"],
"some description nobody reads")
145 self.assertEqual(md[
"check"],
"nothing to check")
146 self.assertEqual(md[
"metaoptions"], [
"mop1",
"mop2"])
147 self.assertEqual(md[
"contact"],
"me <wontreply@dont.try>")
150 if __name__ ==
"__main__":
def loadGearbox(path, silence_warning=False)
def fillParticleListFromMC(decayString, cut, addDaughters=False, skipNonPrimaryDaughters=False, writeOut=False, path=None)
def setupEventInfo(noEvents, path)