Go to the documentation of this file.
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
25 __author__ =
"Vanya BELYAEV Ivan.Belyaev@nikhef.nl"
28 from math
import sin, cos
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)
71 histo1 =
book(
'path/to/my/histos/MyHisto',
'the title', 100, -3,
74 histo2 =
book(
'path/to/my/histos',
'ID of 2nd histo',
'the title of 2nd histo',
78 for i
in range(0, 10000):
83 print(
' Histo1: ', histo1)
84 print(
' Histo2: ', histo2)
108 fill(histo1,
range(0, 5000), sin,
lambda x: x % 2 == 0)
109 fill(histo2,
range(0, 5000), cos,
lambda x: x % 2 != 0)
117 print(
' Histo1 : mean /err: %10f +- %10f ' % (histo1.mean(),
119 print(
' Histo1 : rms /err: %10f +- %10f ' % (histo1.rms(),
121 print(
' Histo1 : skewness/err: %10f +- %10f ' % (histo1.skewness(),
122 histo1.skewnessErr()))
123 print(
' Histo1 : kurtosis/err: %10f +- %10f ' % (histo1.kurtosis(),
124 histo1.kurtosisErr()))
125 print(
' Histo1 : path in THS : "%s"' % histo1.path())
127 print(
' Histo2 : mean /err: %10f +- %10f ' % (histo2.mean(),
129 print(
' Histo2 : rms /err: %10f +- %10f ' % (histo2.rms(),
131 print(
' Histo2 : skewness/err: %10f +- %10f ' % (histo2.skewness(),
132 histo2.skewnessErr()))
133 print(
' Histo2 : kurtosis/err: %10f +- %10f ' % (histo2.kurtosis(),
134 histo2.kurtosisErr()))
135 print(
' Histo2 : path in THS : "%s"' % histo2.path())
Parameters for the Gauss random number generation.
Random number accessor This small class encapsulates the use of the random number generator.
GAUDI_API AIDA::IHistogram1D * book(IHistogramSvc *svc, const std::string &path, const Gaudi::Histo1DDef &hist)
helper function to book 1D-histogram
GAUDI_API void fill(AIDA::IHistogram1D *histo, const double value, const double weight=1.0)
simple function to fill AIDA::IHistogram1D objects
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.