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
25 __author__ =
'Vanya BELYAEV ibelyaev@physics.syr.edu'
40 """ Simple algorithm which explicitly book&fill profile histograms """
44 HistoAlgo.__init__(self, name)
47 """ The major method 'execute', it is invoked for each event """
51 for i
in range(0, 10000):
54 self.plot2D(x, y,
' x vs y ', -2, 2, -4, 4)
55 self.plot2D(x, y + 3 * x,
' x vs y+3x ', -2, 2, -4, 4)
56 self.plot2D(x, y - 3 * x,
' x vs y-3x ', -2, 2, -4, 4)
57 self.profile1D(x, y,
' x vs y (profile)', -2, 2)
58 self.profile1D(x, y + 3 * x,
' x vs y+3x (profile)', -2, 2)
59 self.profile1D(x, y - 3 * x,
' x vs y-3x (profile)', -2, 2)
67 """ Configuration of the job """
78 gaudi.addAlgorithm(alg)
88 if '__main__' == __name__:
89 print(__doc__ + __author__)
100 for alg
in (
'HistoEx',
'HistoEx1',
'HistoEx2'):
101 alg = gaudi.algorithm(alg)
102 histos = alg.Histos()
103 for key
in sorted(histos):
105 print(
" Alg='%s', ID='%s' , Histo=%s " % (alg.name(), key, histo))
106 if hasattr(histo,
'dump'):
107 print(histo.dump(60, 20,
True))