The Gaudi Framework  v36r1 (3e2fb5a8)
Counter.Counter Class Reference
Inheritance diagram for Counter.Counter:
Collaboration diagram for Counter.Counter:

Public Member Functions

def __init__ (self, name='Counter')
 
def execute (self)
 

Detailed Description

Simple algorithm which manipulates with counters 

Definition at line 47 of file Counter.py.

Constructor & Destructor Documentation

◆ __init__()

def Counter.Counter.__init__ (   self,
  name = 'Counter' 
)
Constructor 

Definition at line 50 of file Counter.py.

50  def __init__(self, name='Counter'):
51  """ Constructor """
52  GaudiAlgo.__init__(self, name)
53 

Member Function Documentation

◆ execute()

def Counter.Counter.execute (   self)
The major method 'execute', it is invoked for each event 

Definition at line 54 of file Counter.py.

54  def execute(self):
55  """ The major method 'execute', it is invoked for each event """
56 
57  executed = self.counter('executed')
58  executed += 1.
59 
60  gauss = Numbers(self.randSvc(), Rndm.Gauss(0.0, 1.0))
61  poisson = Numbers(self.randSvc(), Rndm.Poisson(5.0))
62 
63  # 'accuulate gauss'
64  value = gauss.shoot()
65 
66  g1 = self.counter('gauss')
67  g2 = self.counter('g2')
68 
69  g1 += value
70  g2 += value * value
71 
72  if 0 < value:
73  gp = self.counter('Gpos')
74  gp += 1.
75  else:
76  gn = self.counter('Gneg')
77  gn += 1.
78 
79  stat1 = self.counter('NG')
80  stat2 = self.counter('G')
81  for i in range(0, int(poisson())):
82  stat1 += 1.
83  stat2 += gauss()
84 
85  stat3 = self.counter('eff')
86  stat3 += value > 0
87 
88  # print statistics every 1000 events
89  executed = self.counter('executed')
90  prnt = int(executed.flag())
91  if 0 == prnt % 1000:
92  six.print_(" Event number %s " % prnt, flush=True)
93  bc = self.counter('eff')
94  line = "(%.12g += %.12g)%s" % (bc.eff() * 100, bc.effErr() * 100,
95  '%')
96  six.print_(
97  ' Efficiency (binomial counter "eff"): %s' % line, flush=True)
98 
99  return SUCCESS
100 
101 
102 # =============================================================================
103 # job configuration
104 # =============================================================================

The documentation for this class was generated from the following file:
Counter.Numbers
Numbers
Definition: Counter.py:37
Rndm::Gauss
Parameters for the Gauss random number generation.
Definition: RndmGenerators.h:32
GaudiPython.Pythonizations.execute
execute
Definition: Pythonizations.py:566
HistoUtilsEx.gauss
gauss
Definition: HistoUtilsEx.py:66
Rndm::Poisson
Parameters for the Poisson distributed random number generation with a given mean.
Definition: RndmGenerators.h:209
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:97