| # Gaudi Framework, version v21r9 |

Home |  | Generated: 3 May 2010

# GaudiPython::GaudiAlgs::HistoAlgo Class Reference

The base class for easy histogramming. More...

Inheritance diagram for GaudiPython::GaudiAlgs::HistoAlgo:

[legend]
Collaboration diagram for GaudiPython::GaudiAlgs::HistoAlgo:

[legend]

List of all members.

## Detailed Description

The base class for easy histogramming.

    *******************************************************************************
    *                                                * 'Physisics do not like it, *
    *                                                *  physisics do not need it, *
    *                                                *  physisics do not use  it' *
    *                                                * ****************************
    *  Usage:                                                                     *
    *                                                                             *
    *  from GaudiPython.GaudiAlgs import HistoAlgo, SUCCESS                       *
    *                                                                             *
    *  class MyClass(HistoAlgo) :                                                 *
    *       ' My specific Algorithm, derived from GaudiAlgo base class '          *
    *       def __init__( self , name , **args ) :                                *
    *            'Constructor from algorithm instance name'                       *
    *             #invoke the constructor of base class                           *
    *             HistoAlgo.__init__(self , name , **args )                       *
    *                                                                             *
    *       def execute ( self ) :                                                *
    *            'Major method (from IAlgorithm interface)'                       *
    *                                                                             *
    *           # get some data from Transient Event Store                        *
    *           tracks = self.get('/Event/Rec/Tracks')                            *
    *                                                                             *
    *           self.plot1D ( tracks->size() , '#tracks' , 0 , 100 )              *
    *                                                                             *
    *           return SUCCESS                                                    *
    *                                                                             *
    * Alternatively the histogram  could be booked in advance:                    *
    *                                                                             *
    *  class MyClass(HistoAlgo) :                                                 *
    *       ' My specific Algorithm, derived from GaudiAlgo base class '          *
    *       def __init__( self , name ) :                                         *
    *            'Constructor from algorithm instance name'                       *
    *             #invoke the constructor of base class                           *
    *             HistoAlgo.__init__(self , name )                                *
    *                                                                             *
    *       def initialize ( self ) :                                             *
    *           'Algorithm initialization'                                        *
    *           # initialize the base class                                       *
    *           status = HistoAlgo.initialize( self )                             *
    *           if status.isFailure() : return status                             *
    *                                                                             *
    *           # book the histogram                                              *
    *           self.h1 = selff.book1D ( '#tracks' , 0 , 100 )                    *
    *                                                                             *
    *           return SUCCESS                                                    *
    *                                                                             *
    *                                                                             *
    *       def execute ( self ) :                                                *
    *            'Major method (from IAlgorithm interface)'                       *
    *                                                                             *
    *           # get some data from Transient Event Store                        *
    *           tracks = self.get('/Event/Rec/Tracks')                            *
    *                                                                             *
    *           # fill the histogram                                              *
    *           self.h1.fill ( tracks->size() )                                   *
    *                                                                             *
    *           return SUCCESS                                                    *
    *                                                                             *
    *******************************************************************************

Usage:

      from GaudiPython.GaudiAlgs import HistoAlgo, SUCCESS

      class MyClass(HistoAlgo) :
           ' My specific Algorithm, derived from GaudiAlgo base class '
           def __init__( self , name , **args ) :
                'Constructor from algorithm instance name & parameters'
                 #invoke the constructor of base class
                 HistoAlgo.__init__(self , name , **args )

           def execute ( self ) :
                'Major method (from IAlgorithm interface)'

               # get some data from Transient Event Store
               tracks = self.get('/Event/Rec/Tracks')

               self.plot1D ( tracks->size() , '#tracks' , 0 , 100 )

               return SUCCESS

Alternatively the histogram could be booked in advance:

      class MyClass(HistoAlgo) :
           ' My specific Algorithm, derived from GaudiAlgo base class '
           def __init__( self , name ) :
                'Constructor from algorithm instance name'
                 #invoke the constructor of base class
                 HistoAlgo.__init__(self , name )

           def initialize ( self ) :
               'Algorithm initialization'
               # initialize the base class
               status = HistoAlgo.initialize( self )
               if status.isFailure() : return status

               # book the histogram
               self.h1 = selff.book1D ( '#tracks' , 0 , 100 )

               return SUCCESS

           def execute ( self ) :
                'Major method (from IAlgorithm interface)'

               # get some data from Transient Event Store
               tracks = self.get('/Event/Rec/Tracks')

               # fill the histogram
               self.h1.fill ( tracks->size() )

                return SUCCESS

See also:
  GaudiHistoAlg

Author:
  Vanya BELYAEV ibelyaev@physics.syr.edu

Date:
  2006-11-26

Definition at line 656 of file GaudiAlgs.py.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r9/GaudiPython/python/GaudiPython/GaudiAlgs.py