The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
merging_transformer.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2023 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\***********************************************************************************/
12#include <string>
13
15using out_t = std::tuple<float, float>;
18using filter_out_t = std::tuple<bool, float, float>;
19
21 is2ff_merger( std::string const& name, ISvcLocator* pSvcLocator )
22 : is2ff_merger_base( name, pSvcLocator, { "InputInts", { "firstInt", "secondInt" } },
23 { KeyValue{ "O1", "firstFloat" }, KeyValue{ "O2", "secondFloat" } } ) {}
24
25 out_t operator()( ints const& is ) const override {
26 float f1 = 1, f2 = 1;
27
28 for ( auto i : is ) {
29 info() << "i: " << i << " ";
30 f1 *= i;
31 f2 *= 1.f / i;
32 }
33 info() << endmsg;
34 return { f1, f2 };
35 }
36};
37
39
41 is2ff_merger_filter( std::string const& name, ISvcLocator* pSvcLocator )
42 : is2ff_merger_filter_base( name, pSvcLocator, { "InputInts", { "firstInt", "secondInt" } },
43 { KeyValue{ "O1", "firstFloat" }, KeyValue{ "O2", "secondFloat" } } ) {}
44
45 filter_out_t operator()( ints const& is ) const override {
46 float f1 = 1, f2 = 1;
47
48 for ( auto i : is ) {
49 info() << "i: " << i << " ";
50 f1 *= i;
51 f2 *= 1.f / i;
52 }
53 info() << endmsg;
54 auto filter_passed = f1 > 10;
55 info() << "Filter " << ( filter_passed ? "passed" : "failed" ) << endmsg;
56 return { filter_passed, f1, f2 };
57 }
58};
59
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
std::tuple< float, float > out_t
std::tuple< bool, float, float > filter_out_t
Gaudi::Functional::MergingMultiTransformerFilter< out_t(ints const &)> is2ff_merger_filter_base
Gaudi::Functional::MergingMultiTransformer< out_t(ints const &)> is2ff_merger_base
Gaudi::Functional::vector_of_const_< int > ints
filter_out_t operator()(ints const &is) const override
is2ff_merger_filter(std::string const &name, ISvcLocator *pSvcLocator)
out_t operator()(ints const &is) const override
is2ff_merger(std::string const &name, ISvcLocator *pSvcLocator)