The Gaudi Framework  v36r9 (fd2bdac3)
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 49 of file Counter.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 52 of file Counter.py.

52  def __init__(self, name="Counter"):
53  """Constructor"""
54  GaudiAlgo.__init__(self, name)
55 

Member Function Documentation

◆ execute()

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

Definition at line 56 of file Counter.py.

56  def execute(self):
57  """The major method 'execute', it is invoked for each event"""
58 
59  executed = self.counter("executed")
60  executed += 1.0
61 
62  gauss = Numbers(self.randSvc(), Rndm.Gauss(0.0, 1.0))
63  poisson = Numbers(self.randSvc(), Rndm.Poisson(5.0))
64 
65  # 'accuulate gauss'
66  value = gauss.shoot()
67 
68  g1 = self.counter("gauss")
69  g2 = self.counter("g2")
70 
71  g1 += value
72  g2 += value * value
73 
74  if 0 < value:
75  gp = self.counter("Gpos")
76  gp += 1.0
77  else:
78  gn = self.counter("Gneg")
79  gn += 1.0
80 
81  stat1 = self.counter("NG")
82  stat2 = self.counter("G")
83  for i in range(0, int(poisson())):
84  stat1 += 1.0
85  stat2 += gauss()
86 
87  stat3 = self.counter("eff")
88  stat3 += value > 0
89 
90  # print statistics every 1000 events
91  executed = self.counter("executed")
92  prnt = int(executed.flag())
93  if 0 == prnt % 1000:
94  six.print_(" Event number %s " % prnt, flush=True)
95  bc = self.counter("eff")
96  line = "(%.12g += %.12g)%s" % (bc.eff() * 100, bc.effErr() * 100, "%")
97  six.print_(' 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:39
Rndm::Gauss
Parameters for the Gauss random number generation.
Definition: RndmGenerators.h:32
GaudiPython.Pythonizations.execute
execute
Definition: Pythonizations.py:588
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:102