Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
36 using extends::extends;
44 :
ToolBinder{ std::move(
type ), std::move(
name ), parent, KeyValue{
"MyInt",
"/Event/MyInt" },
45 construct<BoundInstance>(
this ) } {}
54 parent->always() <<
"BoundInstance - got: " << i <<
" from " << parent->inputLocation<
int>() <<
endmsg;
64 :
Consumer(
name, svcLoc, KeyValue{
"MyTool",
"MyExampleTool" } ) {}
77 always() <<
"CountingConsumer: incrementing \"This is not an error\" twice" <<
endmsg;
81 always() <<
"CountingConsumer: incrementing \"This is not a warning\" twice" <<
endmsg;
85 always() <<
"CountingConsumer: incrementing \"This is not info\" twice" <<
endmsg;
96 :
Producer(
name, svcLoc, KeyValue(
"OutputLocation",
"/Event/MyInt" ) ) {}
99 info() <<
"executing IntDataProducer, storing " << m_value.value() <<
" into " << outputLocation() <<
endmsg;
113 :
Producer(
name, svcLoc, KeyValue(
"OutputLocation",
"/Event/MyVector" ) ) {}
116 info() <<
"executing VectorDataProducer, storing " << m_data.value() <<
" into " << outputLocation() <<
endmsg;
127 :
Producer(
name, svcLoc, KeyValue(
"OutputLocation",
"/Event/MyKeyed" ) ) {}
135 info() <<
"executing KeyedDataProducer, storing [4,5] into " << outputLocation() <<
endmsg;
145 :
Consumer(
name, svcLoc, KeyValue(
"InputLocation",
"/Event/MyInt" ) ) {}
148 info() <<
"executing IntDataConsumer, consuming " << input <<
" from " << inputLocation() <<
endmsg;
157 :
Transformer(
name, svcLoc, KeyValue(
"InputLocation",
"/Event/MyInt" ),
158 KeyValue(
"OutputLocation",
"/Event/MyFloat" ) ) {}
161 info() <<
"Converting: " << input <<
" from " << inputLocation() <<
" and storing it into " << outputLocation()
173 { KeyValue(
"InputLocation",
"/Event/MyInt" ), KeyValue{
"OtherInput",
"/Event/MyOtherFloat" } },
174 KeyValue(
"OutputLocation",
"/Event/OtherFloat" ) ) {}
176 float operator()(
const int& in1,
const float& in2 )
const override {
177 info() <<
"Converting: " << in1 <<
" from " << inputLocation<int>() <<
" and " << in2 <<
" from "
178 << inputLocation<float>() <<
" and storing it into " << outputLocation() <<
endmsg;
189 { KeyValue(
"InputLocation1", {
"/Event/MyInt" } ),
190 KeyValue(
"InputLocation2", {
"/Event/MyOtherInt" } ) },
191 { KeyValue(
"OutputLocation1", {
"/Event/MyMultiFloat1" } ),
192 KeyValue(
"OutputLocation2", {
"/Event/MyMultiFloat2" } ) } ) {}
194 std::tuple<float, float>
operator()(
const int& input1,
const int& input2 )
const override {
195 info() <<
"Number of inputs : " << inputLocationSize() <<
", number of outputs : " << outputLocationSize()
197 info() <<
"Converting " << input1 <<
" from " << inputLocation<0>() <<
" and " << input2 <<
" from "
198 << inputLocation<1>() <<
endmsg;
199 info() <<
"Storing results into " << outputLocation<0>() <<
" and " << outputLocation<1>() <<
endmsg;
200 return std::tuple<float, float>{ input1, input2 };
214 {
"OutputLocation",
"/Event/MyConcatenatedIntVector" } ) {}
219 auto nelements =
std::accumulate( intVectors.begin(), intVectors.end(), 0,
220 [](
const auto a,
const auto b ) { return a + b.size(); } );
221 std::vector<int>
out;
222 out.reserve( nelements );
224 for (
auto& intVector : intVectors ) {
225 info() <<
"Concatening vector " << intVector <<
endmsg;
226 out.insert(
out.end(), intVector.begin(), intVector.end() );
229 info() <<
"Storing output vector " <<
out <<
" to " << outputLocation() <<
endmsg;
242 {
"OutputLocation",
"/Event/MyConcatenatedIntVector" } ) {}
247 auto nelements =
std::accumulate( intVectors.begin(), intVectors.end(), 0,
248 [](
const auto a,
const auto b ) { return a + ( b ? b->size() : 0 ); } );
249 std::vector<int>
out;
250 out.reserve( nelements );
252 for (
auto& intVector : intVectors ) {
253 info() <<
"Concatening vector " << intVector <<
endmsg;
255 out.insert(
out.end(), intVector->begin(), intVector->end() );
259 info() <<
"Storing output vector " <<
out <<
" to " << outputLocation() <<
endmsg;
269 :
Consumer(
name, svcLoc, KeyValue(
"InputLocation",
"/Event/MyFloat" ) ) {}
272 info() <<
"executing FloatDataConsumer: " << input <<
endmsg;
283 info() <<
"executing ContextConsumer, got " <<
ctx <<
endmsg;
292 :
Transformer(
name, svcLoc, KeyValue{
"OutputLoc",
"/Event/SomeOtherInt" } ) {}
295 info() <<
"executing ContextConsumer, got " <<
ctx <<
endmsg;
305 :
Consumer(
name, svcLoc, KeyValue(
"InputLocation",
"/Event/MyInt" ) ) {}
308 info() <<
"executing ContextIntConsumer, got context = " <<
ctx <<
", int = " << i <<
endmsg;
317 :
Producer(
name, svcLoc, KeyValue(
"OutputLocation",
"/Event/MyVectorOfDoubles" ) ) {}
320 info() <<
"storing vector<double> into " << outputLocation() <<
endmsg;
321 return { 12.34, 56.78, 90.12, 34.56, 78.90 };
328 :
Gaudi::Functional::MultiScalarTransformer<
332 : MultiScalarTransformer(
name, svcLoc, KeyValue{
"InputDoubles", {
"/Event/MyVectorOfDoubles" } },
333 { KeyValue{
"OutputFractions", {
"/Event/MyVectorOfFractions" } },
334 KeyValue{
"OutputIntegers", {
"/Event/MyVectorOfIntegers" } } } ) {}
336 using MultiScalarTransformer::operator();
338 std::tuple<double, int>
operator()(
const double& d )
const {
340 double frac = std::frexp( d, &i );
341 info() <<
"Converting " << d <<
" -> " << frac <<
", " << i <<
endmsg;
348 :
Gaudi::Functional::MultiScalarTransformer<
352 : MultiScalarTransformer(
name, svcLoc, KeyValue{
"InputDoubles", {
"/Event/MyVectorOfDoubles" } },
353 { KeyValue{
"OutputFractions", {
"/Event/OptMyVectorOfFractions" } },
354 KeyValue{
"OutputIntegers", {
"/Event/OptMyVectorOfIntegers" } } } ) {}
356 using MultiScalarTransformer::operator();
358 std::optional<std::tuple<double, int>>
operator()(
const double& d )
const {
360 info() <<
"Skipping " << d <<
endmsg;
364 double frac = std::frexp( d, &i );
365 info() <<
"Converting " << d <<
" -> " << frac <<
", " << i <<
endmsg;
366 return std::make_tuple( frac, i );
372 :
Gaudi::Functional::ScalarTransformer<
375 : ScalarTransformer(
name, svcLoc,
376 { KeyValue{
"InputFractions", {
"/Event/MyVectorOfFractions" } },
377 KeyValue{
"InputIntegers", {
"/Event/MyVectorOfIntegers" } } },
378 { KeyValue{
"OutputDoubles", {
"/Event/MyNewVectorOfDoubles" } } } ) {}
380 using ScalarTransformer::operator();
383 double d = std::ldexp( frac, i );
384 info() <<
"Converting " << i <<
", " << frac <<
" -> " << d <<
endmsg;
395 : ScalarTransformer(
name, svcLoc,
396 { KeyValue{
"InputFractions", {
"/Event/MyVectorOfFractions" } },
397 KeyValue{
"InputIntegers", {
"/Event/MyVectorOfIntegers" } } },
398 { KeyValue{
"OutputDoubles", {
"/Event/MyOptVectorOfDoubles" } } } ) {}
400 using ScalarTransformer::operator();
402 std::optional<double>
operator()(
const double& frac,
const int& i )
const {
403 double d = std::ldexp( frac, i );
405 info() <<
"Skipping " << d <<
endmsg;
408 info() <<
"Converting " << i <<
", " << frac <<
" -> " << d <<
endmsg;
434 :
Producer(
name, svcLoc, KeyValue(
"OutputLocation",
"/Event/MyS" ) ) {}
438 for (
int i = 0; i <
j; ++i )
out.insert(
new S{} );
439 info() <<
"storing KeyedContainer of size " <<
out.size() <<
" into " << outputLocation() <<
endmsg;
454 {
"OutputLocation",
"/Event/MyConcatenatedIntFromSVector" } ) {}
458 std::vector<int>
out;
460 for (
const auto& SVector : SVectors ) {
461 info() <<
"Concatening range of size " << SVector.size() <<
endmsg;
462 for (
auto*
s : SVector ) {
out.push_back(
s->a ); }
464 info() <<
"Storing output vector " <<
out <<
" to " << outputLocation() <<
endmsg;
480 OptSVectors )
const override {
482 for (
const auto& OptSVector : OptSVectors ) {
483 if ( OptSVector.has_value() ) {
484 auto SVector = OptSVector.value();
485 info() <<
"Consuming vector of size: " << SVector.size() <<
endmsg;
487 info() <<
"Skipping empty optional range" <<
endmsg;
503 auto nelements =
std::accumulate( intVectors.begin(), intVectors.end(), 0,
504 [](
const auto a,
const auto b ) { return a + b.size(); } );
505 info() <<
"sum of input sizes: " << nelements <<
endmsg;
507 for (
const auto& intVector : intVectors ) { info() <<
"Consuming vector " << intVector <<
endmsg; }
521 :
Base(
name, svcLoc, {
"InputLocations", {} } ) {}
525 auto nelements =
std::accumulate( intVectors.begin(), intVectors.end(), 0,
526 [](
const auto a,
const auto b ) { return a + b.size(); } );
527 info() <<
"sum of input sizes: " << nelements <<
endmsg;
529 for (
const auto& intVector : intVectors ) { info() <<
"Consuming vector " << intVector <<
endmsg; }
543 :
Producer(
name, pSvcLocator, KeyValue{
"TrackLocation",
"" } ){};
554 const
Gaudi::Functional::vector_of_const_<
std::
vector<
double>>& ),
558 : MergingMultiTransformer{
name,
560 { KeyValues{
"InputInts", {} }, KeyValues{
"InputDoubles", {} } },
561 { KeyValue{
"OutputInts",
"/Event/MySummedInts" },
562 KeyValue{
"OutputDoubles",
"/Event/MySummedDoubles" } } } {}
564 std::tuple<std::vector<int>, std::vector<double>>
567 auto r = std::tuple{ std::vector<int>{}, std::vector<double>{} };
569 std::transform(
begin( intVectors ),
end( intVectors ), std::back_inserter( is ),
571 always() <<
" accumulated: " << is <<
endmsg;
572 std::transform(
begin( doubleVectors ),
end( doubleVectors ), std::back_inserter( ds ),
574 always() <<
" accumulated: " << ds <<
endmsg;
595 :
Producer(
name, svcLoc, KeyValue(
"OutputLocation",
"/Event/MySharedFoo" ) ) {}
599 info() <<
"executing ShrdPtrProducer, storing shared_ptr<Foo> with payload at " << foo.get() <<
" and value "
600 << foo->i <<
" into " << outputLocation() <<
endmsg;
612 :
Consumer(
name, svcLoc, KeyValue(
"InputLocation",
"/Event/MySharedFoo" ) ) {}
614 void operator()(
const std::shared_ptr<Foo>& foo )
const override {
615 info() <<
"executing ShrdPtrConsumer, got shared_ptr<Foo> with payload at " << foo.get() <<
" with value "
616 << foo->
i <<
" from " << inputLocation() <<
endmsg;
637 for (
const auto& iv : intVectors ) { info() <<
"loaded " << iv <<
" from " << inputLocation(
l++ ) <<
endmsg; }
638 std::vector<int>
out( outputLocationSize(), 0 );
639 for (
const auto& [
l, r] : m_mapping.value() ) {
643 for (
const auto& o :
out ) { info() <<
"storing " << o <<
" in " << outputLocation(
l++ ) <<
endmsg; }
656 : parent{ std::exchange( other.parent,
nullptr ) },
action{ std::exchange( other.action,
nullptr ) } {}
658 parent = std::exchange( other.parent,
nullptr );
659 action = std::exchange( other.action,
nullptr );
670 Gaudi::Functional::Traits::use_<BaseClass_t, Gaudi::Functional::Traits::WriteOpaqueFor<Eventually>>> {
673 :
Producer(
name, svcLoc, KeyValue(
"OutputLocation",
"/Event/Eventually" ) ) {}
676 always() <<
"creating Eventually" <<
endmsg;
678 me->always() <<
"My Eventually is about to be destroyed" <<
endmsg;
690 std::vector<int>
const*> );
692 std::vector<int>
const> );
RangeProducer(const std::string &name, ISvcLocator *pSvcLocator)
IntVectorsMergingConsumer(const std::string &name, ISvcLocator *svcLoc)
OpaqueProducer(const std::string &name, ISvcLocator *svcLoc)
details::MergingTransformer< Signature, Traits_, details::isLegacy< Traits_ > > MergingTransformer
details::Consumer< Signature, Traits_, details::isLegacy< Traits_ > > Consumer
std::vector< int > operator()(const Gaudi::Functional::vector_of_const_< std::vector< int >> &intVectors) const override
std::vector< int > operator()() const override
ContextTransformer(const std::string &name, ISvcLocator *svcLoc)
TwoDMerger(const std::string &name, ISvcLocator *svcLoc)
KeyedDataProducer(const std::string &name, ISvcLocator *svcLoc)
VectorDoubleProducer(const std::string &name, ISvcLocator *svcLoc)
IntToFloatData(const std::string &name, ISvcLocator *svcLoc)
std::vector< int > operator()(const Gaudi::Functional::vector_of_const_< Gaudi::Range_< std::vector< S const * >>> &SVectors) const override
IntDataProducer(const std::string &name, ISvcLocator *svcLoc)
KeyedObject()=default
Standard Constructor. The object key is preset to the invalid value.
std::tuple< std::vector< int >, std::vector< double > > operator()(const Gaudi::Functional::vector_of_const_< std::vector< int >> &intVectors, const Gaudi::Functional::vector_of_const_< std::vector< double >> &doubleVectors) const override
void operator()(const std::shared_ptr< Foo > &foo) const override
void operator()(Gaudi::Functional::vector_of_const_< std::vector< int >> const &intVectors) const override
transform a vector of vector of int to a vector of int, where the output vector of in is scattered in...
Eventually(Eventually const &)=delete
FloatDataConsumer(const std::string &name, ISvcLocator *svcLoc)
Foo & operator=(const Foo &)=delete
ShrdPtrConsumer(const std::string &name, ISvcLocator *svcLoc)
Eventually operator()() const override
void operator()() const override
Base class to be used to extend an interface.
Eventually(Gaudi::Algorithm const *p, void(*a)(Gaudi::Algorithm const *))
std::vector< const MyData * > ConstVector
void operator()(const Gaudi::Functional::vector_of_const_< std::optional< Gaudi::NamedRange_< std::vector< S const * >>>> &OptSVectors) const override
details::ToolBinder< Signature, Traits_ > ToolBinder
PIntVectorsToIntVector(const std::string &name, ISvcLocator *svcLoc)
long add(ContainedObject *pObject) override
ObjectContainerBase overload: Add an object to the container.
VectorDataProducer(const std::string &name, ISvcLocator *svcLoc)
IntIntToFloatFloatData(const std::string &name, ISvcLocator *svcLoc)
AttribStringParser::Iterator begin(const AttribStringParser &parser)
void operator()(const int &input) const override
OptionalSRangesMerger(const std::string &name, ISvcLocator *svcLoc)
details::Producer< Signature, Traits_, details::isLegacy< Traits_ > > Producer
Eventually(Eventually &&other)
Base class from which all concrete algorithm classes should be derived.
Concatenates a list of input vectors into a single output vector.
Eventually & operator=(Eventually &&other)
int operator()(const EventContext &ctx) const override
const ValueType & value() const
void operator()(const float &input) const override
IntVectorsMerger(const std::string &name, ISvcLocator *svcLoc)
float operator()(const int &in1, const float &in2) const override
int operator()() const override
IntVectorsToInts(const std::string &name, ISvcLocator *svcLoc)
std::vector< int > operator()(const Gaudi::Functional::vector_of_const_< std::vector< int >> &intVectors) const override
IntFloatToFloatData(const std::string &name, ISvcLocator *svcLoc)
std::shared_ptr< Foo > operator()() const override
template class KeyedContainer, KeyedContainer.h
Definition of the templated KeyedObject class.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Base class used to extend a class implementing other interfaces.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
IntDataConsumer(const std::string &name, ISvcLocator *svcLoc)
std::vector< int > operator()(const Gaudi::Functional::vector_of_const_< std::vector< int > * > &intVectors) const override
details::MultiTransformer< Signature, Traits_, details::isLegacy< Traits_ > > MultiTransformer
Gaudi::Property< int > m_value
std::tuple< float, float > operator()(const int &input1, const int &input2) const override
Foo & operator=(Foo &&)=delete
struct GAUDI_API vector
Parametrisation class for vector-like implementation.
float operator()(const int &input) const override
std::vector< S const * > ConstVector
#define DECLARE_COMPONENT(type)
details::SplittingMergingTransformer< Signature, Traits_, false > SplittingMergingTransformer
S::Container operator()() const override
SRangesToIntVector(const std::string &name, ISvcLocator *svcLoc)
void operator()(const Gaudi::Functional::vector_of_const_< std::vector< int >> &intVectors) const override
IntVectorsToIntVector(const std::string &name, ISvcLocator *svcLoc)
std::vector< double > operator()() const override
details::Transformer< Signature, Traits_, details::isLegacy< Traits_ > > Transformer
ShrdPtrProducer(const std::string &name, ISvcLocator *svcLoc)
int_container operator()() const override
MyDataRange operator()() const override
SDataProducer(const std::string &name, ISvcLocator *svcLoc)
KeyedObjectManager< hashmap > HashMap
Forward declaration of specialized std::hashmap-like object manager.
void operator()(const EventContext &ctx) const override
ContextIntConsumer(const std::string &name, ISvcLocator *svcLoc)
void accumulate(Counter &counter, const Container &container, Fun f=Identity{})
A helper function for accumulating data from a container into a counter This is internally using buff...
details::MergingTransformer< Signature, Traits_, details::isLegacy< Traits_ > > MergingConsumer
void operator()() const override
void operator()(const EventContext &ctx, const int &i) const override
Eventually & operator=(Eventually const &)=delete
Concatenates a list of input vectors into a single output vector.