14 *******************************************************************************
16 * Simple example which illustrate the usage of useful algorithm base class *
17 * HistoAlgo (python version of C++ GaudiHistoAlg) for 'easy' histogramming. *
19 * This example illustrates the usage of 1D and 2D profile histograms *
21 *******************************************************************************
24 __author__ =
"Vanya BELYAEV ibelyaev@physics.syr.edu"
38 """Simple algorithm which explicitly book&fill profile histograms"""
42 HistoAlgo.__init__(self, name)
45 """The major method 'execute', it is invoked for each event"""
48 for i
in range(0, 1000):
51 self.plot2D(x, y,
" x vs y ", -2, 2, -4, 4)
52 self.plot2D(x, y + 3 * x,
" x vs y+3x ", -2, 2, -4, 4)
53 self.plot2D(x, y - 3 * x,
" x vs y-3x ", -2, 2, -4, 4)
54 self.profile1D(x, y,
" x vs y (profile)", -2, 2)
55 self.profile1D(x, y + 3 * x,
" x vs y+3x (profile)", -2, 2)
56 self.profile1D(x, y - 3 * x,
" x vs y-3x (profile)", -2, 2)
64 """Configuration of the job"""
75 hsvc = gaudi.service(
"HistogramPersistencySvc")
76 hsvc.OutputFile =
"histoex2.root"
79 gaudi.addAlgorithm(alg)
89 if "__main__" == __name__:
90 print(__doc__ + __author__)
101 for alg
in (
"HistoEx",
"HistoEx1",
"HistoEx2"):
102 alg = gaudi.algorithm(alg)
103 histos = alg.Histos()
104 for key
in sorted(histos):
106 print(
" Alg='%s', ID='%s' , Histo=%s " % (alg.name(), key, histo))
107 if hasattr(histo,
"dump"):
108 print(histo.dump(60, 20,
True))