Commit fa207f28 authored by Gerhard Raven's avatar Gerhard Raven
Browse files

extend unit test

parent 9248dc55
......@@ -10,6 +10,11 @@ from Configurables import Gaudi__Examples__IntToFloatData as IntToFloatData
from Configurables import Gaudi__Examples__IntIntToFloatFloatData as IntIntToFloatFloatData
from Configurables import Gaudi__Examples__ContextConsumer as ContextConsumer
from Configurables import Gaudi__Examples__ContextIntConsumer as ContextIntConsumer
from Configurables import Gaudi__Examples__VectorDoubleProducer as VectorDoubleProducer
from Configurables import Gaudi__Examples__FrExpTransformer as FrExpTransformer
from Configurables import Gaudi__Examples__LdExpTransformer as LdExpTransformer
from Configurables import Gaudi__Examples__OptFrExpTransformer as OptFrExpTransformer
from Configurables import Gaudi__Examples__OptLdExpTransformer as OptLdExpTransformer
# Application setup
app = ApplicationMgr()
......@@ -21,8 +26,13 @@ app.TopAlg = [IntDataProducer("IntDataProducer"), OtherIntDataProducer,
"IntToFloatData"),
IntIntToFloatFloatData("IntIntToFloatFloatData"), FloatDataConsumer(
"FloatDataConsumer"),
ContextConsumer(),
ContextIntConsumer()
ContextConsumer("ContextConsumer"),
ContextIntConsumer("ContextIntConsumer"),
VectorDoubleProducer("VectorDoubleProducer"),
FrExpTransformer("FrExpTransformer"), LdExpTransformer(
"LdExpTransfomer"),
OptFrExpTransformer("OptFrExpTransformer"), OptLdExpTransformer(
"OptLdExpTransformer")
]
# - Events
app.EvtMax = 2
......
......@@ -163,6 +163,22 @@ namespace Gaudi
DECLARE_COMPONENT( ContextIntConsumer )
struct VectorDoubleProducer final : Gaudi::Functional::Producer<std::vector<double>(), BaseClass_t> {
VectorDoubleProducer( const std::string& name, ISvcLocator* svcLoc )
: Producer( name, svcLoc, KeyValue( "OutputLocation", "/Event/MyVectorOfDoubles" ) )
{
}
std::vector<double> operator()() const override
{
info() << "storing vector<double> into " << outputLocation() << endmsg;
return {12.34, 56.78, 90.12, 34.56, 78.90};
}
};
DECLARE_COMPONENT( VectorDoubleProducer )
struct FrExpTransformer final
: Gaudi::Functional::MultiScalarTransformer<FrExpTransformer, std::tuple<std::vector<double>, std::vector<int>>(
const std::vector<double>& ),
......@@ -170,7 +186,7 @@ namespace Gaudi
FrExpTransformer( const std::string& name, ISvcLocator* svcLoc )
: MultiScalarTransformer( name, svcLoc, KeyValue{"InputDoubles", {"/Event/MyVectorOfDoubles"}},
{KeyValue{"OutputFractions", {"/Event/MyVectorOfFractions"}},
KeyValue{"OutputIntegers", {"/Event/MyVectorOfIntergers"}}} )
KeyValue{"OutputIntegers", {"/Event/MyVectorOfIntegers"}}} )
{
}
......@@ -187,13 +203,13 @@ namespace Gaudi
DECLARE_COMPONENT( FrExpTransformer )
struct OptFrExpTransformer final
: Gaudi::Functional::MultiScalarTransformer<FrExpTransformer, std::tuple<std::vector<double>, std::vector<int>>(
const std::vector<double>& ),
BaseClass_t> {
: Gaudi::Functional::MultiScalarTransformer<
OptFrExpTransformer, std::tuple<std::vector<double>, std::vector<int>>( const std::vector<double>& ),
BaseClass_t> {
OptFrExpTransformer( const std::string& name, ISvcLocator* svcLoc )
: MultiScalarTransformer( name, svcLoc, KeyValue{"InputDoubles", {"/Event/MyVectorOfDoubles"}},
{KeyValue{"OutputFractions", {"/Event/MyVectorOfFractions"}},
KeyValue{"OutputIntegers", {"/Event/MyVectorOfIntergers"}}} )
{KeyValue{"OutputFractions", {"/Event/OptMyVectorOfFractions"}},
KeyValue{"OutputIntegers", {"/Event/OptMyVectorOfIntegers"}}} )
{
}
......@@ -201,12 +217,12 @@ namespace Gaudi
boost::optional<std::tuple<double, int>> operator()( const double& d ) const
{
int i;
double frac = std::frexp( d, &i );
if ( i == 0 ) {
if ( d < 30. ) {
info() << "Skipping " << d << endmsg;
return {};
}
int i;
double frac = std::frexp( d, &i );
info() << "Converting " << d << " -> " << frac << ", " << i << endmsg;
return std::make_tuple( frac, i );
}
......@@ -218,15 +234,15 @@ namespace Gaudi
const std::vector<int>& ),
BaseClass_t> {
LdExpTransformer( const std::string& name, ISvcLocator* svcLoc )
: ScalarTransformer( name, svcLoc, {KeyValue{"InputFractions", {"/Event/MyVectorOfDoubles"}},
: ScalarTransformer( name, svcLoc, {KeyValue{"InputFractions", {"/Event/MyVectorOfFractions"}},
KeyValue{"InputIntegers", {"/Event/MyVectorOfIntegers"}}},
{KeyValue{"OutputDoubles", {"/Event/MyVectorOfDoubles"}}} )
{KeyValue{"OutputDoubles", {"/Event/MyNewVectorOfDoubles"}}} )
{
}
using ScalarTransformer::operator();
double operator()( const double& frac, const int& i ) const
double operator()( double frac, int i ) const
{
double d = std::ldexp( frac, i );
info() << "Converting " << i << ", " << frac << " -> " << d << endmsg;
......@@ -240,9 +256,9 @@ namespace Gaudi
const std::vector<int>& ),
BaseClass_t> {
OptLdExpTransformer( const std::string& name, ISvcLocator* svcLoc )
: ScalarTransformer( name, svcLoc, {KeyValue{"InputFractions", {"/Event/MyVectorOfDoubles"}},
: ScalarTransformer( name, svcLoc, {KeyValue{"InputFractions", {"/Event/MyVectorOfFractions"}},
KeyValue{"InputIntegers", {"/Event/MyVectorOfIntegers"}}},
{KeyValue{"OutputDoubles", {"/Event/MyVectorOfDoubles"}}} )
{KeyValue{"OutputDoubles", {"/Event/MyOptVectorOfDoubles"}}} )
{
}
......@@ -251,7 +267,7 @@ namespace Gaudi
boost::optional<double> operator()( const double& frac, const int& i ) const
{
double d = std::ldexp( frac, i );
if ( i > 3 ) {
if ( i > 6 ) {
info() << "Skipping " << d << endmsg;
return {};
}
......
# setting LC_ALL to "C"
# --> Including file '/var/local/sponce/native/Gaudi/GaudiExamples/options/FunctionalAlgorithms/ProduceConsume.py'
# <-- End of file '/var/local/sponce/native/Gaudi/GaudiExamples/options/FunctionalAlgorithms/ProduceConsume.py'
ApplicationMgr SUCCESS
# --> Including file '/project/bfys/graven/master/Gaudi/GaudiExamples/options/FunctionalAlgorithms/ProduceConsume.py'
# <-- End of file '/project/bfys/graven/master/Gaudi/GaudiExamples/options/FunctionalAlgorithms/ProduceConsume.py'
ApplicationMgr SUCCESS
====================================================================================================================================
Welcome to ApplicationMgr (GaudiCoreSvc v28r1)
running on lblhcbpr3.cern.ch on Tue Apr 18 09:48:23 2017
Welcome to ApplicationMgr (GaudiCoreSvc v30r3)
running on stbc-i5.nikhef.nl on Sun Sep 30 23:16:02 2018
====================================================================================================================================
ApplicationMgr INFO Application Manager Configured successfully
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING Unable to locate service "EventSelector"
EventLoopMgr WARNING No events will be processed from external input.
HistogramPersis...WARNING Histograms saving not required.
ApplicationMgr INFO Application Manager Initialized successfully
......@@ -20,8 +20,29 @@ IntIntToFloatFl... INFO Number of inputs : 2, number of outputs : 2
IntIntToFloatFl... INFO Converting 7 from /Event/MyInt and 7 from /Event/MyOtherInt
IntIntToFloatFl... INFO Storing results into /Event/MyMultiFloat1 and /Event/MyMultiFloat2
FloatDataConsumer INFO executing FloatDataConsumer: 7
Gaudi::Examples... INFO executing ContextConsumer, got INVALID
Gaudi::Examples... INFO executing ContextIntConsumer, got context = INVALID, int = 7
ContextConsumer INFO executing ContextConsumer, got INVALID
ContextIntConsumer INFO executing ContextIntConsumer, got context = INVALID, int = 7
VectorDoublePro... INFO storing vector<double> into /Event/MyVectorOfDoubles
FrExpTransformer INFO Converting 12.34 -> 0.77125, 4
FrExpTransformer INFO Converting 56.78 -> 0.887188, 6
FrExpTransformer INFO Converting 90.12 -> 0.704063, 7
FrExpTransformer INFO Converting 34.56 -> 0.54, 6
FrExpTransformer INFO Converting 78.9 -> 0.616406, 7
LdExpTransfomer INFO Converting 4, 0.77125 -> 12.34
LdExpTransfomer INFO Converting 6, 0.887188 -> 56.78
LdExpTransfomer INFO Converting 7, 0.704063 -> 90.12
LdExpTransfomer INFO Converting 6, 0.54 -> 34.56
LdExpTransfomer INFO Converting 7, 0.616406 -> 78.9
OptFrExpTransfo... INFO Skipping 12.34
OptFrExpTransfo... INFO Converting 56.78 -> 0.887188, 6
OptFrExpTransfo... INFO Converting 90.12 -> 0.704063, 7
OptFrExpTransfo... INFO Converting 34.56 -> 0.54, 6
OptFrExpTransfo... INFO Converting 78.9 -> 0.616406, 7
OptLdExpTransfo... INFO Converting 4, 0.77125 -> 12.34
OptLdExpTransfo... INFO Converting 6, 0.887188 -> 56.78
OptLdExpTransfo... INFO Skipping 90.12
OptLdExpTransfo... INFO Converting 6, 0.54 -> 34.56
OptLdExpTransfo... INFO Skipping 78.9
IntDataProducer INFO executing IntDataProducer, storing 7 into /Event/MyInt
OtherIntDataPro... INFO executing IntDataProducer, storing 7 into /Event/MyOtherInt
IntDataConsumer INFO executing IntDataConsumer, consuming 7 from /Event/MyInt
......@@ -30,8 +51,29 @@ IntIntToFloatFl... INFO Number of inputs : 2, number of outputs : 2
IntIntToFloatFl... INFO Converting 7 from /Event/MyInt and 7 from /Event/MyOtherInt
IntIntToFloatFl... INFO Storing results into /Event/MyMultiFloat1 and /Event/MyMultiFloat2
FloatDataConsumer INFO executing FloatDataConsumer: 7
Gaudi::Examples... INFO executing ContextConsumer, got INVALID
Gaudi::Examples... INFO executing ContextIntConsumer, got context = INVALID, int = 7
ContextConsumer INFO executing ContextConsumer, got INVALID
ContextIntConsumer INFO executing ContextIntConsumer, got context = INVALID, int = 7
VectorDoublePro... INFO storing vector<double> into /Event/MyVectorOfDoubles
FrExpTransformer INFO Converting 12.34 -> 0.77125, 4
FrExpTransformer INFO Converting 56.78 -> 0.887188, 6
FrExpTransformer INFO Converting 90.12 -> 0.704063, 7
FrExpTransformer INFO Converting 34.56 -> 0.54, 6
FrExpTransformer INFO Converting 78.9 -> 0.616406, 7
LdExpTransfomer INFO Converting 4, 0.77125 -> 12.34
LdExpTransfomer INFO Converting 6, 0.887188 -> 56.78
LdExpTransfomer INFO Converting 7, 0.704063 -> 90.12
LdExpTransfomer INFO Converting 6, 0.54 -> 34.56
LdExpTransfomer INFO Converting 7, 0.616406 -> 78.9
OptFrExpTransfo... INFO Skipping 12.34
OptFrExpTransfo... INFO Converting 56.78 -> 0.887188, 6
OptFrExpTransfo... INFO Converting 90.12 -> 0.704063, 7
OptFrExpTransfo... INFO Converting 34.56 -> 0.54, 6
OptFrExpTransfo... INFO Converting 78.9 -> 0.616406, 7
OptLdExpTransfo... INFO Converting 4, 0.77125 -> 12.34
OptLdExpTransfo... INFO Converting 6, 0.887188 -> 56.78
OptLdExpTransfo... INFO Skipping 90.12
OptLdExpTransfo... INFO Converting 6, 0.54 -> 34.56
OptLdExpTransfo... INFO Skipping 78.9
ApplicationMgr INFO Application Manager Stopped successfully
EventLoopMgr INFO Histograms converted successfully according to request.
ApplicationMgr INFO Application Manager Finalized successfully
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment