The Gaudi Framework
v26r1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
RandomNumberAlg.cpp
Go to the documentation of this file.
1
// Framework include files
2
#include "GaudiKernel/SmartIF.h"
3
#include "GaudiKernel/MsgStream.h"
4
#include "GaudiKernel/ISvcLocator.h"
5
#include "GaudiKernel/IRndmGen.h"
6
#include "GaudiKernel/IRndmGenSvc.h"
7
#include "GaudiKernel/IHistogramSvc.h"
8
#include "GaudiKernel/IDataProviderSvc.h"
9
#include "GaudiKernel/DataObject.h"
10
#include "GaudiKernel/SmartDataPtr.h"
11
12
#include "AIDA/IHistogram1D.h"
13
#include "AIDA/IHistogram2D.h"
14
15
// Example related include files
16
#include "
RandomNumberAlg.h
"
17
18
DECLARE_COMPONENT
(
RandomNumberAlg
)
19
20
23
RandomNumberAlg
::
RandomNumberAlg
(const
std
::
string
& name,
ISvcLocator
* pSvcLocator)
24
:
Algorithm
(name, pSvcLocator) {
25
}
26
27
// Standard destructor
28
RandomNumberAlg::~RandomNumberAlg
() {
29
}
30
31
// The "functional" part of the class: For the EmptyAlgorithm example they do
32
// nothing apart from print out info messages.
33
StatusCode
RandomNumberAlg::initialize
() {
34
MsgStream
log
(
msgSvc
(),
name
());
35
StatusCode
sc
;
36
37
// Initilize random number generators
38
sc =
m_poissonNumbers
.
initialize
(
randSvc
(),
Rndm::Poisson
(0.3));
39
if
( sc.
isFailure
() )
return
sc;
40
sc =
m_gaussNumbers
.
initialize
(
randSvc
(),
Rndm::Gauss
(0.5,0.2));
41
if
( sc.
isFailure
() )
return
sc;
42
sc =
m_expNumbers
.
initialize
(
randSvc
(),
Rndm::Exponential
(0.2));
43
if
( sc.
isFailure
() )
return
sc;
44
45
46
// Initiatize Histograms
47
m_gaussHisto
=
histoSvc
()->book(
"simple/1"
,
"Gauss"
, 40, 0., 3.);
48
m_gauss2Histo
=
histoSvc
()->book(
"simple/2"
,
"Gauss 2D"
, 40, 0., 3., 50, 0., 3.);
49
m_expHisto
=
histoSvc
()->book(
"simple/3"
,
"Exponential"
, 40, 0., 3.);
50
m_poissonHisto
=
histoSvc
()->book(
"simple/4"
,
"Poisson"
, 40, 0., 3.);
51
52
return
sc
;
53
}
54
55
StatusCode
RandomNumberAlg::execute
() {
56
MsgStream
log
(
msgSvc
(),
name
());
57
StatusCode
sc
;
58
59
m_gaussHisto
->fill(
m_gaussNumbers
(), 1.0 );
60
m_gauss2Histo
->fill(
m_gaussNumbers
(),
m_gaussNumbers
(), 1.0 );
61
m_poissonHisto
->fill(
m_poissonNumbers
(), 1.0 );
62
m_expHisto
->fill(
m_expNumbers
(), 1.0 );
63
return
sc
;
64
}
65
66
StatusCode
RandomNumberAlg::finalize
() {
67
return
StatusCode::SUCCESS
;
68
}
69
GaudiPython
src
Test
RandomNumberAlg.cpp
Generated on Mon Feb 16 2015 11:56:57 for The Gaudi Framework by
1.8.2