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

In This Package:

CounterEx::Counter Class Reference

Inheritance diagram for CounterEx::Counter:
[legend]
Collaboration diagram for CounterEx::Counter:
[legend]
List of all members.

Public Member Functions

def __init__
def execute

Detailed Description

Simple algorithm which manipulates with counters 

Definition at line 35 of file CounterEx.py.


Member Function Documentation

def CounterEx::Counter::__init__ (   self,
  name = 'Counter' 
)

Constructor 

Definition at line 37 of file CounterEx.py.

00037                                              :
00038         """ Constructor """
00039         GaudiAlgo.__init__( self , name )
00040         
    def execute( self ) :

def CounterEx::Counter::execute (   self  ) 

The major method 'execute', it is invoked for each event 

Definition at line 41 of file CounterEx.py.

00041                         :
00042         """ The major method 'execute', it is invoked for each event """
00043 
00044         executed = self.counter('executed')
00045         executed += 1. 
00046 
00047         gauss   = Numbers( self.randSvc() , Rndm.Gauss   ( 0.0 ,1.0 ) )
00048         poisson = Numbers( self.randSvc() , Rndm.Poisson ( 5.0      ) )
00049 
00050         # 'accuulate gauss'
00051         value = gauss.shoot() 
00052 
00053         g1 = self.counter('gauss')
00054         g2 = self.counter('g2')
00055         
00056         g1 += value
00057         g2 += value * value
00058 
00059         if 0 < value :
00060             gp = self.counter('Gpos')
00061             gp += 1.
00062         else :
00063             gn = self.counter('Gneg')
00064             gn += 1.
00065 
00066         stat1 = self.counter('NG')
00067         stat2 = self.counter('G')
00068         for i in range ( 0, int( poisson() ) ) :
00069             stat1 += 1.
00070             stat2 += gauss()
00071 
00072         stat3  = self.counter('eff')
00073         stat3 += value>0
00074         
00075         # print statistics every 1000 events
00076         executed = self.counter('executed')
00077         prnt = int( executed.flag() )
00078         if 0 == prnt%1000 :
00079             print " Event number %s " % prnt
00080             self.printStat()
00081             bc = self.counter('eff')
00082             line = "(%s += %s)%s"%(bc.eff()*100,bc.effErr()*100,'%')
00083             print ' Efficiency (binomial counter "eff"): %s'%line
00084             
00085         return SUCCESS
00086                 
00087                 
00088 # =============================================================================
00089 # job configuration 
00090 # =============================================================================
def configure( gaudi = None  ) :


The documentation for this class was generated from the following file:
| 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