14<output>validationTestPlots.root, validationTestPlotsExpertOnly.root</output>
15<contact>Kilian Lieret, Kilian.Lieret@campus.lmu.de</contact>
18This file will generate various output into a root-file to have
19a fast turn-around during development
29from datetime
import datetime
30from validationtest
import add_properties
33if __name__ ==
"__main__":
35 basf2.set_random_seed(1337)
37 tfile = ROOT.TFile(
"validationTestPlots.root",
"RECREATE")
42 tntuple = ROOT.TNtuple(
"ntuple_test",
"ntuple test",
"x:y:z:k")
44 array_of_values = array.array(
"f", [23.4, 4.4, 5.12, -23.0])
45 tntuple.Fill(array_of_values)
49 r"This is a description test. "
50 r"Lorem ipsum sit dolor amet. We also support $\LaTeX$! "
51 "\n <br> \n For example, here is the infamous "
52 "Einstein-Pythagoras-theorem: \n "
53 r"$$a^2 + b^2 = \frac{E}{m}$$ "
54 "\n Of course, you can also do other things, "
55 r"like $\theta = 90^\circ$ or $D^- \rightarrow D^0 \pi^- \pi^+$. "
56 "\n Sometimes it is necessary to escape commands with a double backslash, "
57 r"because e.g. \\theta will be interpreted as [tab]heta.",
59 tntuple.SetAlias(
"Check",
"This is the check text.")
60 tntuple.SetAlias(
"Contact",
"Name of the contact person.")
61 tntuple.SetAlias(
"MetaOptions",
"shifter, some_meta_options")
69 gaus_h = ROOT.TH1F(
"gaus_histogram",
" Gaus Histogram", 100, -3, 3)
70 gaus_h.FillRandom(
"gaus", 500)
75 "Description":
"xlog",
76 "Check":
"Gaus Histogram Check",
77 "Contact":
"Gaus Histogram Contact",
78 "MetaOptions":
"shifter, logx, nostats",
87 warnings_h = ROOT.TH1F(
89 "Histogram with missing check and description",
94 warnings_h.FillRandom(
"gaus", 500)
101 "Contact":
"Kilian Lieret, Kilian.Lieret@campus.lmu.de",
102 "MetaOptions":
"shifter, logx, nostats",
111 exp_h = ROOT.TH1F(
"exp_histogram",
" Expert Histogram", 100, 0, 10)
113 exp_fn = ROOT.TF1(
"exp_fn",
"exp(-x)", 0, 10)
114 exp_h.FillRandom(
"exp_fn", 500)
119 "Description":
"Expert Validation Plot",
120 "Check":
"Expert Histogram Check. Should only appear if expert button"
122 "Contact":
"Expert Histogram Contact",
123 "MetaOptions":
"logy, nostats, C",
134 basf2.set_random_seed(datetime.now().microsecond)
136 gaus_changing = ROOT.TH1F(
137 "gaus_changing_histogram",
"Gaus Changing Histogram", 100, -5, 5
139 mean = ROOT.gRandom.Uniform(-1.0, 1.0)
142 v = ROOT.gRandom.Gaus(mean, 1.0)
143 gaus_changing.Fill(v)
148 "Description":
r"xlog ylog with stats. I can haz $\LaTeX$?",
149 "Check":
"Gaus Changing Histogram Check",
150 "Contact":
"Gaus Changing Histogram Contact",
151 "MetaOptions":
"shifter, logx, logy",
155 gaus_changing.Write()
160 "example_2d_histogram",
"example_2d_title", 60, -3, 3, 60, -3, 3
164 cov = [[1, 0], [0, 1]]
166 x, y = np.random.multivariate_normal(mean, cov)
172 "Description":
"Some 2D Histogram",
173 "Check":
"Check For Something",
174 "Contact":
"Contact Someone",
175 "MetaOptions":
"shifter, contz",
184 gaus_passed = ROOT.TH1F(
"gaus_passed",
"gaus_passed", 50, -0.5, 49.5)
185 gaus_total = ROOT.TH1F(
"gaus_total",
"gaus_total", 50, -0.5, 49.5)
189 ratio = float(i) / 500.0
190 passed = ROOT.gRandom.Uniform(ratio * 0.45, 1.0)
191 pos = ROOT.gRandom.Uniform(ratio * 30.0, 49.5)
195 gaus_passed.Fill(pos)
197 teff = ROOT.TEfficiency(gaus_passed, gaus_total)
198 teff.SetName(
"TEfficiency")
199 teff.SetTitle(
"Tefficiency")
204 "Description":
"Efficiency plot of something",
205 "Check":
"Check For Something",
206 "Contact":
"Contact Someone",
207 "MetaOptions":
"shifter",
216 graph_err = ROOT.TGraphErrors()
221 ratio = float(i) / 50.0
222 passed = ROOT.gRandom.Uniform(ratio * 0.45, 1.0)
224 graph_err.SetPoint(i, i + 1.0, passed)
226 graph_err.SetName(
"TGraphErrors")
227 graph_err.SetTitle(
"TGraphErrors")
231 "Description":
"TGraphErrors plot of something",
232 "Check":
"Check For Something",
233 "Contact":
"Contact Someone",
234 "MetaOptions":
"shifter",
244 html_content = ROOT.TNamed(
245 "This is a bold HTML tag",
"<p><b>THIS IS USER'S HTML</b></p>"
255 tfile = ROOT.TFile(
"validationTestPlotsExpertOnly.root",
"RECREATE")
257 "gaus_histogram_exprt",
" Gaus Histogram Expert", 100, -3, 3
259 gaus_h.FillRandom(
"gaus", 500)