Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework
v36r16 (ea80daf8)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
c
d
e
f
i
l
m
n
o
p
r
s
t
Enumerator
a
b
c
d
e
f
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
g
h
i
m
o
p
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
_
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
z
Variables
a
b
c
d
e
g
h
i
m
o
p
r
s
t
v
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
c
e
f
p
u
v
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
HistoTimingAlg.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
// Include files
12
13
// local
14
#include "
HistoTimingAlg.h
"
15
16
// only needed for old style histogram for speed comparison
17
#include "AIDA/IHistogram1D.h"
18
19
//-----------------------------------------------------------------------------
20
// Implementation file for class : HistoTimingAlg
21
//
22
// 2005-08-12 : Chris Jones
23
//-----------------------------------------------------------------------------
24
25
// Declaration of the Algorithm Factory
26
DECLARE_COMPONENT
(
HistoTimingAlg
)
27
28
//=============================================================================
29
// Initialization
30
//=============================================================================
31
StatusCode
HistoTimingAlg
::initialize() {
32
// must be called first
33
const
StatusCode
sc =
GaudiHistoAlg::initialize
();
34
if
( sc.
isFailure
() )
return
sc;
35
36
// random number generator
37
auto
randSvc = service<IRndmGenSvc>(
"RndmGenSvc"
,
true
);
38
if
( !randSvc || !m_rand.initialize( randSvc,
Rndm::Flat
( 0., 1. ) ) ) {
39
return
Error(
"Unable to create Random generator"
);
40
}
41
42
// book histos
43
for
(
unsigned
int
iH = 0; iH < m_nHistos; ++iH ) {
44
std::ostringstream
title;
45
title <<
"Histogram Number "
<< iH;
46
m_histos[book1D( title.
str
(), 0, 1, 100 )] = title.
str
();
47
}
48
49
return
sc;
50
}
51
52
//=============================================================================
53
// Main execution
54
//=============================================================================
55
StatusCode
HistoTimingAlg::execute
() {
56
57
for
(
unsigned
int
iT = 0; iT <
m_nTracks
; ++iT ) {
58
59
// fill histos
60
for
( HistoMap::iterator iH =
m_histos
.
begin
(); iH !=
m_histos
.
end
(); ++iH ) {
61
if
(
m_useGaudiAlg
) {
62
plot1D
(
m_rand
(), iH->second, 0, 1, 100 );
63
}
else
{
64
iH->first->fill(
m_rand
() );
65
}
66
}
67
}
68
69
return
StatusCode::SUCCESS
;
70
}
71
72
//=============================================================================
GaudiHistos< GaudiAlgorithm >::plot1D
AIDA::IHistogram1D * plot1D(const double value, const std::string &title, const double low, const double high, const unsigned long bins=100, const double weight=1.0) const
fill the 1D histogram (book on demand)
Definition:
GaudiHistos_1DFixedBinning.icpp:113
HistoTimingAlg.h
Rndm::Flat
Parameters for the flat random number generation within boundaries [minimum, maximum].
Definition:
RndmGenerators.h:253
HistoTimingAlg::m_nTracks
Gaudi::Property< unsigned int > m_nTracks
Definition:
HistoTimingAlg.h:50
HistoTimingAlg::m_histos
HistoMap m_histos
Definition:
HistoTimingAlg.h:46
HistoTimingAlg
Definition:
HistoTimingAlg.h:32
StatusCode
Definition:
StatusCode.h:65
std::ostringstream
STL class.
StatusCode::isFailure
bool isFailure() const
Definition:
StatusCode.h:129
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition:
StatusCode.h:100
std::map::begin
T begin(T... args)
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition:
PluginServiceV1.h:46
HistoTimingAlg::m_useGaudiAlg
Gaudi::Property< bool > m_useGaudiAlg
Definition:
HistoTimingAlg.h:48
std::ostringstream::str
T str(T... args)
std::map::end
T end(T... args)
HistoTimingAlg::execute
StatusCode execute() override
Algorithm execution.
Definition:
HistoTimingAlg.cpp:55
GaudiHistos< GaudiAlgorithm >::initialize
StatusCode initialize() override
standard initialization method
Definition:
GaudiHistos.icpp:91
HistoTimingAlg::m_rand
Rndm::Numbers m_rand
Definition:
HistoTimingAlg.h:42
GaudiExamples
src
Histograms
HistoTimingAlg.cpp
Generated on Fri Jul 28 2023 16:22:54 for The Gaudi Framework by
1.8.18