| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

TupleEx.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # =============================================================================
00003 # $Id: TupleEx.py,v 1.9 2007/10/29 14:29:47 mato Exp $
00004 # =============================================================================
00005 # CVS tag $Name: GAUDI_v20r4-pre $ , version $Revision: 1.9 $
00006 # =============================================================================
00007 ## @file
00008 #
00009 #  Simple example which illustrate the usage of useful                         
00010 #  algorithm  base class for N-Tuple manipulations
00011 #
00012 #  @author Vanya BELYAEV ibelyaev@physics.syr.edu
00013 #  @date 2006-11-26
00014 # =============================================================================
00015 """
00016 *******************************************************************************
00017 *                                                                             *
00018 * Simple example which illustrate the usage of useful                         *
00019 * algorithm  base class for N-Tuple manipulations                             *
00020 *                                                                             *
00021 *******************************************************************************
00022 """
00023 # =============================================================================
00024 __author__ = 'Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr'
00025 # =============================================================================
00026 
00027 import GaudiPython, math 
00028 
00029 Rndm    = GaudiPython.gbl.Rndm
00030 SUCCESS = GaudiPython.SUCCESS 
00031 
00032 from   GaudiPython.GaudiAlgs   import TupleAlgo
00033 
00034 # =============================================================================
00035 ## @class TupleEx
00036 #  Simple algorithm which books&fills three histograms
00037 #  @author Vanya BELYAEV ibelyaev@physics.syr.edu
00038 #  @date 2006-11-26
00039 class TupleEx(TupleAlgo) :
00040     """
00041     Simple algorithm which implicitely book&fill N-Tuples
00042     """
00043     ## standard constructor 
00044     def __init__ ( self , name = 'TupleEx' ) :
00045         """ Constructor """
00046         TupleAlgo.__init__( self , name )
00047 
00048     ## the main execution method 
00049     def execute( self ) :
00050         """
00051         The major method 'execute', it is invoked for each event
00052         """
00053 
00054         gauss = Rndm.Numbers( self.randSvc() , Rndm.Gauss( 0.0 , 1.0 ) )
00055 
00056         tup = self.nTuple('My trivial N-tuple')
00057         for i in range(0,100) :
00058             tup.column( 'a' , math.sin(i) )
00059             tup.column( 'b' , math.cos(i) )
00060             tup.column( 'c' , math.tan(i) )
00061             tup.column( 'g' , gauss()     )
00062             tup.write()
00063 
00064         return SUCCESS
00065                 
00066                 
00067 # =============================================================================
00068 ## job configuration 
00069 #  @author Vanya BELYAEV ibelyaev@physics.syr.edu
00070 #  @date 2006-11-26
00071 def configure( gaudi = None  ) :
00072     """ Configuration of the job """
00073     
00074     if not gaudi : gaudi = GaudiPython.AppMgr()
00075     
00076     gaudi.JobOptionsType       = 'NONE'
00077     gaudi.EvtSel               = 'NONE'
00078     gaudi.HistogramPersistency = 'ROOT'
00079 
00080     gaudi.ExtSvc += ["NTupleSvc" ]
00081 
00082     ntSvc = gaudi.service('NTupleSvc')
00083     ntSvc.Output = [ "MYLUN DATAFILE='TupleEx.root' OPT='NEW' TYP='ROOT'" ] 
00084 
00085     gaudi.config()
00086     
00087     gaudi.DLLs = [ 'GaudiAlg', 'RootHistCnv', ]
00088 
00089     alg = TupleEx()
00090     gaudi.setAlgorithms( [alg] )
00091 
00092     ## configure the property
00093     alg.NTupleLUN = 'MYLUN'
00094     
00095     return SUCCESS
00096 
00097 
00098 # =============================================================================
00099 ## The actual job excution 
00100 #  @author Vanya BELYAEV ibelyaev@physics.syr.edu
00101 #  @date 2006-11-26
00102 if '__main__' == __name__ :
00103     print __doc__
00104     gaudi = GaudiPython.AppMgr()
00105     configure( gaudi )
00106     gaudi.run(20)
00107     
00108 # =============================================================================
00109 # The END 
00110 # =============================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:59:39 2011 for GaudiExamples by doxygen 1.4.7