20 Simple example to illustrate the usage functions from HistoUtils module
21 (Gaudi histograms outside of algorithm-scope in 'script-like' environment)
23 from __future__
import print_function
26 __author__ =
"Vanya BELYAEV Ivan.Belyaev@nikhef.nl"
29 from math
import cos, sin
39 cpp.gInterpreter.ProcessLine(
"cout.flush();")
49 gaudi.HistogramPersistency =
"ROOT"
52 hsvc = gaudi.service(
"HistogramPersistencySvc")
53 hsvc.OutputFile =
"HistoUtilsEx.root"
61 IRndmGenSvc = cpp.IRndmGenSvc
62 rndmSvc = gaudi.service(
"RndmGenSvc", IRndmGenSvc)
64 gaudi.createSvc(
"RndmGenSvc")
65 rndmSvc = gaudi.service(
"RndmGenSvc", IRndmGenSvc)
72 "path/to/my/histos/MyHisto",
"the title", 100, -3, 3
76 "path/to/my/histos",
"ID of 2nd histo",
"the title of 2nd histo", 100, -3, 3
80 for i
in range(0, 10000):
85 print(
" Histo1: ", histo1)
86 print(
" Histo2: ", histo2)
110 fill(histo1,
range(0, 5000), sin,
lambda x: x % 2 == 0)
111 fill(histo2,
range(0, 5000), cos,
lambda x: x % 2 != 0)
119 print(
" Histo1 : mean /err: %10f +- %10f " % (histo1.mean(), histo1.meanErr()))
120 print(
" Histo1 : rms /err: %10f +- %10f " % (histo1.rms(), histo1.rmsErr()))
122 " Histo1 : skewness/err: %10f +- %10f "
123 % (histo1.skewness(), histo1.skewnessErr())
126 " Histo1 : kurtosis/err: %10f +- %10f "
127 % (histo1.kurtosis(), histo1.kurtosisErr())
129 print(
' Histo1 : path in THS : "%s"' % histo1.path())
131 print(
" Histo2 : mean /err: %10f +- %10f " % (histo2.mean(), histo2.meanErr()))
132 print(
" Histo2 : rms /err: %10f +- %10f " % (histo2.rms(), histo2.rmsErr()))
134 " Histo2 : skewness/err: %10f +- %10f "
135 % (histo2.skewness(), histo2.skewnessErr())
138 " Histo2 : kurtosis/err: %10f +- %10f "
139 % (histo2.kurtosis(), histo2.kurtosisErr())
141 print(
' Histo2 : path in THS : "%s"' % histo2.path())