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 *******************************************************************************
23 from __future__
import print_function
26 __author__ =
"Vanya BELYAEV ibelyaev@physics.syr.edu"
41 """Simple algorithm which explicitly book&fill profile histograms"""
45 HistoAlgo.__init__(self, name)
48 """The major method 'execute', it is invoked for each event"""
52 for i
in range(0, 10000):
55 self.plot2D(x, y,
" x vs y ", -2, 2, -4, 4)
56 self.plot2D(x, y + 3 * x,
" x vs y+3x ", -2, 2, -4, 4)
57 self.plot2D(x, y - 3 * x,
" x vs y-3x ", -2, 2, -4, 4)
58 self.profile1D(x, y,
" x vs y (profile)", -2, 2)
59 self.profile1D(x, y + 3 * x,
" x vs y+3x (profile)", -2, 2)
60 self.profile1D(x, y - 3 * x,
" x vs y-3x (profile)", -2, 2)
68 """Configuration of the job"""
80 gaudi.addAlgorithm(alg)
90 if "__main__" == __name__:
91 print(__doc__ + __author__)
102 for alg
in (
"HistoEx",
"HistoEx1",
"HistoEx2"):
103 alg = gaudi.algorithm(alg)
104 histos = alg.Histos()
105 for key
in sorted(histos):
107 print(
" Alg='%s', ID='%s' , Histo=%s " % (alg.name(), key, histo))
108 if hasattr(histo,
"dump"):
109 print(histo.dump(60, 20,
True))