22 *******************************************************************************
24 * Simple example which illustrate the usage of useful *
25 * algorithm base class for N-Tuple manipulations *
27 *******************************************************************************
30 __author__ =
"Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr"
35 SUCCESS = GaudiPython.SUCCESS
38 Rndm = GaudiPython.gbl.Rndm
52 Primitive function which transform arbitrary sequence into
53 GaudiPython.Vector ( std::vector<double> )
55 result = GaudiPython.gbl.GaudiPython.Vector()
56 if hasattr(sequence,
"__len__"):
57 result.reserve(len(sequence))
58 elif hasattr(sequence,
"size"):
59 result.reserve(sequence.size())
62 result.push_back(item)
75 Simple algorithm which implicitely book&fill N-Tuples
82 The major method 'execute', it is invoked for each event
96 tuple1 = self.nTuple(1,
"Trivial Row-Wise Tuple", 42)
99 tuple1.column(
"gauss",
gauss())
100 tuple1.column(
"flat", flat())
101 tuple1.column(
"expo", expo())
102 tuple1.column(
"breit", breit())
105 tuple1.column(
"poiss1", int(poisson()))
106 tuple1.column(
"binom1", int(binom()))
109 tuple1.column_ll(
"poiss2", int(poisson()))
110 tuple1.column_ll(
"binom2", int(binom()))
113 tuple1.column_ull(
"poiss3", int(poisson()))
114 tuple1.column_ull(
"binom3", int(binom()))
117 tuple1.column(
"poiss4", int(poisson()), 0, 14)
118 tuple1.column(
"binom4", int(binom()), 0, 14)
121 tuple1.column(
"poisb", poisson() > 1.0)
129 tuple2 = self.nTuple(2,
"Trivial Column-Wise Tuple")
132 tuple2.column(
"gauss",
gauss())
133 tuple2.column(
"flat", flat())
134 tuple2.column(
"expo", expo())
135 tuple2.column(
"breit", breit())
138 tuple2.column(
"poiss", int(poisson()))
139 tuple2.column(
"binom", int(binom()))
141 tuple2.column(
"poiss", int(poisson()), 0, 14)
142 tuple2.column(
"binom", int(binom()), 0, 14)
145 tuple2.column(
"poisb", poisson() > 1.0)
153 tuple3 = self.nTuple(3,
"Fixed-size arrays/vectors")
155 tuple3.array(
"arflat",
vct([flat()
for i
in range(0, 50)]))
156 tuple3.array(
"arexpo",
vct([expo()
for i
in range(0, 62)]))
159 tuple3.array(
"argau2",
vct(t))
171 """Configuration of the job"""
176 gaudi.JobOptionsType =
"NONE"
177 gaudi.EvtSel =
"NONE"
178 gaudi.HistogramPersistency =
"ROOT"
180 gaudi.ExtSvc += [
"NTupleSvc"]
182 ntSvc = gaudi.service(
"NTupleSvc")
183 ntSvc.Output = [
"MYLUN DATAFILE='TupleEx1.root' OPT='NEW' TYP='ROOT'"]
193 gaudi.setAlgorithms([alg])
196 alg.NTupleLUN =
"MYLUN"
205 if "__main__" == __name__: