Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework
master (f31105fd)
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
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
y
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
q
r
s
t
v
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
r
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
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
q
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
SimulationAlg.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 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
12
#include "
MCHit.h
"
13
#include "
MCTrack.h
"
14
15
#include <
Gaudi/Accumulators.h
>
16
#include <
Gaudi/Functional/Transformer.h
>
17
18
#include <cmath>
19
20
namespace
{
21
std::pair<float, float>
sincos(
float
arg ) {
return
{
std::sin
( arg ),
std::cos
( arg ) }; }
22
}
// namespace
23
24
namespace
Gaudi::Example::TinyExperiment
{
25
29
class
SimulationAlg
:
public
Functional::Transformer
<MCHits( MCTracks const& )> {
30
public
:
31
SimulationAlg
(
const
std::string
&
name
,
ISvcLocator
* pSvcLocator )
32
:
Transformer
(
name
, pSvcLocator, { {
"MCTracksLocation"
,
"/Event/MCTracks"
} },
33
{
"MCHitsLocation"
,
"/Event/MCHits"
} ) {}
34
35
MCHits
operator()
(
MCTracks
const
& tracks )
const override
{
36
MCHits
hits;
37
hits.
reserve
( tracks.
size
() *
m_nbHitsPerTrack
);
38
for
(
auto
const
& track : tracks ) {
39
auto
[
s
,
c
] = sincos( track.theta );
40
for
(
unsigned
int
i = 0; i <
m_nbHitsPerTrack
; i++ ) {
41
hits.
emplace_back
( i *
c
, i *
s
);
42
++
n_hits
;
43
}
44
}
45
return
hits;
46
};
47
48
private
:
49
Gaudi::Property<unsigned int>
m_nbHitsPerTrack
{
this
,
"NbHitsPerTrack"
, 10 };
50
mutable
Gaudi::Accumulators::Counter<>
n_hits
{
this
,
"Number of MCHits"
};
51
};
52
53
DECLARE_COMPONENT
( SimulationAlg )
54
55
}
// namespace Gaudi::Example::TinyExperiment
std::string
STL class.
std::pair
std::vector::reserve
T reserve(T... args)
Gaudi::Accumulators::Counter<>
std::cos
T cos(T... args)
gaudirun.s
string s
Definition:
gaudirun.py:346
std::vector
STL class.
std::vector::size
T size(T... args)
ISvcLocator
Definition:
ISvcLocator.h:46
Gaudi::Example::TinyExperiment::SimulationAlg::SimulationAlg
SimulationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition:
SimulationAlg.cpp:31
gaudirun.c
c
Definition:
gaudirun.py:525
Gaudi::Example::TinyExperiment::SimulationAlg::operator()
MCHits operator()(MCTracks const &tracks) const override
Definition:
SimulationAlg.cpp:35
Gaudi::Example::TinyExperiment::SimulationAlg
Simulation algorithm creating MC Hits from a set of tracks.
Definition:
SimulationAlg.cpp:29
Gaudi::Example::TinyExperiment::SimulationAlg::m_nbHitsPerTrack
Gaudi::Property< unsigned int > m_nbHitsPerTrack
Definition:
SimulationAlg.cpp:49
Transformer.h
MCHit.h
MCTrack.h
std::sin
T sin(T... args)
Accumulators.h
std::vector::emplace_back
T emplace_back(T... args)
ConditionsStallTest.name
name
Definition:
ConditionsStallTest.py:77
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition:
PluginServiceV1.h:46
Gaudi::Example::TinyExperiment
Definition:
CheckerAlg.cpp:20
Gaudi ::Functional::Transformer
details::Transformer< Signature, Traits_, details::isLegacy< Traits_ > > Transformer
Definition:
Transformer.h:237
Gaudi::Property< unsigned int >
Gaudi::Example::TinyExperiment::SimulationAlg::n_hits
Gaudi::Accumulators::Counter n_hits
Definition:
SimulationAlg.cpp:50
GaudiExamples
TinyExperiment
src
SimulationAlg.cpp
Generated on Mon Apr 7 2025 16:26:21 for The Gaudi Framework by
1.8.18