Skip to content

Extend ScalarTransform to accept multiple input containers, and add MultiScalarTransform that also supports multiple output

Christopher Rob Jones requested to merge ScalarTransform-MultiInputs into future

Updates ScalarTransform to accept multiple inputs, in a similar way to Transform.

When more than one input is defined, the containers are zipped together using the range v3 library, this is then iterated over and presented to the scalar operator as a list of (dereferenced) objects.

All the input containers must have the same size, this is enforced.

Tested with a simple little algorithm as part of the RICH future developments that implements the operator

boost::optional<MassHypoRings> 
TestFunctionalScalar::operator()( const LHCb::RichTrackSegment& segment,
                                  const CherenkovAngles& ckAngle ) const
{
  info() << "Segment = " << segment << endmsg;
  info() << "ckAngle = " << ckAngle << endmsg;
  return MassHypoRings();
}

Which as expected gave output like.

2016-10-20 12:37:50 UTC ScalarTest           INFO Segment = { 
 entryPoint:	(-68.2097,100.123,990)
 middlePoint:	(-99.8328,144.768,1472.15)
 exitPoint:	(-130.686,189.416,1954.31)
 entryMomentum:	(-217.176,302.984,3272.5)
 middleMomentum:	(-212.12,303.078,3272.82)
 exitMomentum:	(-206.379,303.054,3273.19)
 radiator:	Rich1Gas
 rich:	Rich1
 entryErrors:	{ errX2=0.297912 errY2=1.39272 errTX2=1.49059e-07 errTY2=4.10173e-07 errP2=60.5738 }
 middleErrors:	{ errX2=0.130073 errY2=0.854707 errTX2=1.48332e-07 errTY2=4.10098e-07 errP2=60.5738 }
 exitErrors:	{ errX2=0.0315384 errY2=0.507397 errTX2=1.47535e-07 errTY2=4.10015e-07 errP2=60.5738 }
 } 
2016-10-20 12:37:50 UTC ScalarTest           INFO ckAngle = [ 0.0524864 0.0415792 0.0310979 0 0 0 0 ]

MultiScalarTransform also accepts multiple input, but like MultiTransformer also supports multiple output.

Merge request reports