The Gaudi Framework
master (53dee381)
Toggle main menu visibility
Loading...
Searching...
No Matches
NTupleWriterProducers.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 2024-2026 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 <
Gaudi/Algorithm.h
>
12
#include <
Gaudi/Functional/Producer.h
>
13
#include <
Gaudi/TestSuite/NTuple/MyStruct.h
>
14
#include <
GaudiTestSuite/Counter.h
>
15
#include <string>
16
#include <vector>
17
18
namespace
Gaudi::TestSuite::NTuple
{
19
struct
IntVectorDataProducer
final
20
:
Gaudi::Functional::Producer
<std::vector<int>(), Gaudi::Functional::Traits::BaseClass_t<Gaudi::Algorithm>> {
21
IntVectorDataProducer
(
const
std::string& name,
ISvcLocator
* svcLoc )
22
: Producer( name, svcLoc, {
"OutputLocation"
,
"MyVector"
} ) {}
23
24
std::vector<int>
operator()
()
const override
{
return
std::vector<int>{ 0, 1, 2, 3, 4 }; }
25
};
26
27
DECLARE_COMPONENT
( IntVectorDataProducer )
28
29
struct
FloatDataProducer
final
30
:
Gaudi
::
Functional
::Producer<
float
(),
Gaudi
::
Functional
::Traits::
BaseClass_t
<
Gaudi
::
Algorithm
>> {
31
FloatDataProducer
(
const
std::string& name,
ISvcLocator
* svcLoc )
32
: Producer( name, svcLoc, {
"OutputLocation"
,
"MyFloat"
} ) {}
33
34
float
operator()
()
const override
{
return
2.5; }
35
};
36
37
DECLARE_COMPONENT
( FloatDataProducer )
38
39
struct
StrDataProducer
final
40
:
Gaudi
::
Functional
::Producer<
std
::
string
(),
Gaudi
::
Functional
::Traits::
BaseClass_t
<
Gaudi
::
Algorithm
>> {
41
StrDataProducer
(
const
std::string& name,
ISvcLocator
* svcLoc )
42
: Producer( name, svcLoc, {
"OutputLocation"
,
"MyString"
} ) {}
43
44
std::string
operator()
()
const override
{
return
m_stringValue
; }
45
46
private
:
47
Gaudi::Property<std::string>
m_stringValue
{
this
,
"StringValue"
,
"Default string"
,
"Specify the string to write"
};
48
};
49
50
DECLARE_COMPONENT
( StrDataProducer )
51
52
struct
StructDataProducer
final
53
:
Gaudi
::
Functional
::Producer<
Gaudi
::
TestSuite
::
NTuple
::
MyStruct
(),
54
Gaudi
::
Functional
::Traits::
BaseClass_t
<
Gaudi
::
Algorithm
>> {
55
StructDataProducer
(
const
std::string& name,
ISvcLocator
* svcLoc )
56
: Producer( name, svcLoc, {
"OutputLocation"
,
"MyStruct"
} ) {}
57
58
Gaudi::TestSuite::NTuple::MyStruct
operator()
()
const override
{
59
Gaudi::TestSuite::NTuple::MyStruct
myStruct = { 1,
"myStruct"
};
60
return
myStruct;
61
}
62
};
63
64
DECLARE_COMPONENT
( StructDataProducer )
65
66
struct
CounterDataProducer
final
67
:
Gaudi
::
Functional
::Producer<
Gaudi
::
TestSuite
::
Counter
(),
68
Gaudi
::
Functional
::Traits::
BaseClass_t
<
Gaudi
::
Algorithm
>> {
69
CounterDataProducer
(
const
std::string& name,
ISvcLocator
* svcLoc )
70
: Producer( name, svcLoc, {
"OutputLocation"
,
"MyCounter"
} ) {}
71
72
Counter
operator()
()
const override
{
return
Counter
(); }
73
};
74
DECLARE_COMPONENT
( CounterDataProducer )
75
76
}
// namespace Gaudi::TestSuite::NTuple
Counter.h
Algorithm.h
MyStruct.h
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
Producer.h
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition
Algorithm.h:87
Gaudi::Property
Implementation of property with value of concrete type.
Definition
Property.h:35
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
Gaudi::Functional
Definition
Consumer.h:15
Gaudi::Functional::Producer
details::Producer< Signature, Traits_, details::isLegacy< Traits_ > > Producer
Definition
Producer.h:37
Gaudi::TestSuite::Counter
Definition
CounterHistos.cpp:23
Gaudi::TestSuite::NTuple
Definition
MyStruct.h:15
Gaudi::TestSuite
Definition
ConditionAccessorHolder.h:21
Gaudi::TestSuite::BaseClass_t
Gaudi::Functional::Traits::BaseClass_t< Gaudi::Algorithm > BaseClass_t
Definition
MakeAndConsume.cpp:63
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition
__init__.py:1
NTuple
NTuple name space.
Definition
INTupleSvc.h:16
std
STL namespace.
Gaudi::TestSuite::NTuple::CounterDataProducer::operator()
Counter operator()() const override
Definition
NTupleWriterProducers.cpp:72
Gaudi::TestSuite::NTuple::CounterDataProducer::CounterDataProducer
CounterDataProducer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleWriterProducers.cpp:69
Gaudi::TestSuite::NTuple::FloatDataProducer::operator()
float operator()() const override
Definition
NTupleWriterProducers.cpp:34
Gaudi::TestSuite::NTuple::FloatDataProducer::FloatDataProducer
FloatDataProducer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleWriterProducers.cpp:31
Gaudi::TestSuite::NTuple::IntVectorDataProducer::operator()
std::vector< int > operator()() const override
Definition
NTupleWriterProducers.cpp:24
Gaudi::TestSuite::NTuple::IntVectorDataProducer::IntVectorDataProducer
IntVectorDataProducer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleWriterProducers.cpp:21
Gaudi::TestSuite::NTuple::MyStruct
Definition
MyStruct.h:16
Gaudi::TestSuite::NTuple::StrDataProducer::m_stringValue
Gaudi::Property< std::string > m_stringValue
Definition
NTupleWriterProducers.cpp:47
Gaudi::TestSuite::NTuple::StrDataProducer::operator()
std::string operator()() const override
Definition
NTupleWriterProducers.cpp:44
Gaudi::TestSuite::NTuple::StrDataProducer::StrDataProducer
StrDataProducer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleWriterProducers.cpp:41
Gaudi::TestSuite::NTuple::StructDataProducer::StructDataProducer
StructDataProducer(const std::string &name, ISvcLocator *svcLoc)
Definition
NTupleWriterProducers.cpp:55
Gaudi::TestSuite::NTuple::StructDataProducer::operator()
Gaudi::TestSuite::NTuple::MyStruct operator()() const override
Definition
NTupleWriterProducers.cpp:58
GaudiTestSuite
src
NTuple
NTupleWriterProducers.cpp
Generated on
for The Gaudi Framework by
1.17.0