13<contact>arul.prakash@physik.uni-muenchen.de</contact>
15This file contains example for generating validation plots using python
35basf2.set_random_seed(1337)
37tfile = TFile(
"examplePython.root",
"RECREATE")
38tntuple = TNtuple(
"ntuple_test",
"ntuple test",
"x:y:z:k")
40prefix =
"examplePython"
42array_of_values = array.array(
"f", [23.4, 4.4, 5.12, -23.0])
43tntuple.Fill(array_of_values)
47 r"This is a description test. "
48 r"Lorem ipsum sit dolor amet. We also support $\LaTeX$! "
49 "\n <br> \n For example, here is the infamous "
50 "Einstein-Pythagoras-theorem: \n "
51 r"$$a^2 + b^2 = \frac{E}{m}$$ "
52 "\n Of course, you can also "
53 r"do other things, like $\theta = 90^\circ$ or $D^- "
54 r"\rightarrow D^0 \pi^- \pi^+$. "
55 "\n Sometimes it is necessary to escape commands "
56 "with a double backslash, "
57 r"because e.g. \\theta will be interpreted as [tab]heta.",
59tntuple.SetAlias(
"Check",
"This is the check text.")
60tntuple.SetAlias(
"Contact",
"Name of the contact person.")
61tntuple.SetAlias(
"MetaOptions",
"some_meta_options")
67gausH = TH1F(
"gaus_histogram", prefix +
" Gaus Histogram", 100, -3, 3)
68gausH.FillRandom(
"gaus", 5000)
70gausH.GetListOfFunctions().Add(TNamed(
"Description",
"xlog"))
71gausH.GetListOfFunctions().Add(TNamed(
"Check",
"Gaus Histogram Check"))
72gausH.GetListOfFunctions().Add(TNamed(
"Contact",
"Gaus Histogram Contact"))
73gausH.GetListOfFunctions().Add(TNamed(
"MetaOptions",
"logx, nostats"))
77gausH = TH1F(
"exp_histogram", prefix +
" Exp Histogram", 100, 0, 10)
79exp_fn = TF1(
"exp_fn",
"exp(-x)", 0, 10)
80gausH.FillRandom(
"exp_fn", 5000)
82gausH.GetListOfFunctions().Add(TNamed(
"Description",
"Expert Validation Plot"))
83gausH.GetListOfFunctions().Add(TNamed(
"Check",
"Exp Histogram Check"))
84gausH.GetListOfFunctions().Add(TNamed(
"Contact",
"Exp Histogram Contact"))
85gausH.GetListOfFunctions().Add(TNamed(
"MetaOptions",
"logy, nostats, C"))
90hist2d = TH2F(
"example_2d_histogram",
"example_2d_title", 60, -3, 3, 60, -3, 3)
95 x, y = np.random.multivariate_normal(mean, cov)
98hist2d.GetListOfFunctions().Add(TNamed(
"Description",
"Some 2D Histogram"))
99hist2d.GetListOfFunctions().Add(TNamed(
"Check",
"Check For Something"))
100hist2d.GetListOfFunctions().Add(TNamed(
"Contact",
"Contact Someone"))
101hist2d.GetListOfFunctions().Add(TNamed(
"MetaOptions",
"contz"))
106gaus_passed = TH1F(
"gaus_passed",
"gaus_passed", 50, -0.5, 49.5)
107gaus_total = TH1F(
"gaus_total",
"gaus_total", 50, -0.5, 49.5)
111 ratio = float(i) / 5000.0
112 passed = gRandom.Uniform(ratio * 0.45, 1.0)
113 pos = gRandom.Uniform(ratio * 30.0, 49.5)
117 gaus_passed.Fill(pos)
119teff = TEfficiency(gaus_passed, gaus_total)
120teff.SetName(
"TEfficiency")
121teff.GetListOfFunctions().Add(
122 TNamed(
"Description",
"Efficiency plot of something")
124teff.GetListOfFunctions().Add(TNamed(
"Check",
"Check For Something"))
125teff.GetListOfFunctions().Add(TNamed(
"Contact",
"Contact Someone"))
126teff.GetListOfFunctions().Add(TNamed(
"MetaOptions",
""))
131graph_err = TGraphErrors()
136 ratio = float(i) / 50.0
137 passed = gRandom.Uniform(ratio * 0.45, 1.0)
140graph_err.SetPoint(i, i + 1.0, passed)
142graph_err.SetName(
"TGraphErrors")
143graph_err.GetListOfFunctions().Add(
144 TNamed(
"Description",
"TGraphErrors plot of something")
146graph_err.GetListOfFunctions().Add(TNamed(
"Check",
"Check For Something"))
147graph_err.GetListOfFunctions().Add(TNamed(
"Contact",
"Contact Someone"))
148graph_err.GetListOfFunctions().Add(TNamed(
"MetaOptions",
""))