Inheritance diagram for TupleEx1::TupleEx1:
Public Member Functions | |
def | execute |
the main executiomethod |
Simple algorithm which implicitely book&fill N-Tuples
Definition at line 59 of file TupleEx1.py.
def TupleEx1::TupleEx1::execute | ( | self | ) |
the main executiomethod
The major method 'execute', it is invoked for each event
Definition at line 62 of file TupleEx1.py.
00064 : 00065 """ 00066 The major method 'execute', it is invoked for each event 00067 """ 00068 00069 rSvc = self.randSvc() 00070 gauss = Numbers ( rSvc , Rndm.Gauss ( 0.0 , 1.0 ) ) 00071 flat = Numbers ( rSvc , Rndm.Flat ( -10 , 10 ) ) 00072 expo = Numbers ( rSvc , Rndm.Exponential ( 1.0 ) ) 00073 breit = Numbers ( rSvc , Rndm.BreitWigner ( 0.0 , 1.0 ) ) 00074 poisson = Numbers ( rSvc , Rndm.Poisson ( 2.0 ) ) 00075 binom = Numbers ( rSvc , Rndm.Binomial ( 8 , 0.25 ) ) 00076 00077 # ===================================================================== 00078 # primitive row-wise n-tuple 00079 # ===================================================================== 00080 tuple1 = self.nTuple ( 1 , "Trivial Row-Wise Tuple" , 42 ) 00081 00082 # fill N-Tuple with double/float numbers: 00083 tuple1 . column ( 'gauss' , gauss () ) 00084 tuple1 . column ( 'flat' , flat () ) 00085 tuple1 . column ( 'expo' , expo () ) 00086 tuple1 . column ( 'breit' , breit () ) 00087 00088 # fill N-Tuple with integer numbers: 00089 tuple1 . column ( 'poiss' , int( poisson () ) ) 00090 tuple1 . column ( 'binom' , int( binom () ) ) 00091 00092 # fill N-Tuple with "reduced" integer numbers: 00093 tuple1 . column ( 'poiss' , int( poisson () ) , 0 , 14 ) 00094 tuple1 . column ( 'binom' , int( binom () ) , 0 , 14 ) 00095 00096 # fill N-Tuple with "boolean" numbers: 00097 tuple1 . column ( "poisb" , poisson () > 1.0 ) 00098 00099 # commit the row 00100 tuple1 . write() 00101 00102 # ===================================================================== 00103 # the same n-tuple but column-wise 00104 # ===================================================================== 00105 tuple2 = self.nTuple ( 2 , "Trivial Column-Wise Tuple" ) 00106 00107 # fill N-Tuple with double/float numbers: 00108 tuple2 . column ( 'gauss' , gauss () ) 00109 tuple2 . column ( 'flat' , flat () ) 00110 tuple2 . column ( 'expo' , expo () ) 00111 tuple2 . column ( 'breit' , breit () ) 00112 00113 # fill N-Tuple with integer numbers: 00114 tuple2 . column ( 'poiss' , int( poisson () ) ) 00115 tuple2 . column ( 'binom' , int( binom () ) ) 00116 # fill N-Tuple with "reduced" integer numbers: 00117 tuple2 . column ( 'poiss' , int( poisson () ) , 0 , 14 ) 00118 tuple2 . column ( 'binom' , int( binom () ) , 0 , 14 ) 00119 00120 # fill N-Tuple with "boolean" numbers: 00121 tuple2 . column ( "poisb" , poisson () > 1.0 ) 00122 00123 # commit the row 00124 tuple2 . write() 00125 00126 # ===================================================================== 00127 # book and fill Column-wise NTuple with "fixed"-size arrays/vectors 00128 # ===================================================================== 00129 tuple3 = self.nTuple ( 3 , "Fixed-size arrays/vectors" ) 00130 00131 tuple3.array ( 'arflat' , vct( [ flat () for i in xrange(0,50) ] ) ) 00132 tuple3.array ( 'arexpo' , vct( [ expo () for i in xrange(0,62) ] ) ) 00133 tuple3.array ( 'argau' , vct( [ gauss() for i in xrange(0,42) ] ) ) 00134 t=tuple([ gauss() for i in xrange(0,42) ]) 00135 tuple3.array ( 'argau2' , vct( t ) ) 00136 00137 tuple3.write() 00138 00139 return SUCCESS 00140