The normalized characteristic function of a piecewise constant time dependent Heston model
with time intervals and constant parameters within these intervals
is given by the recurrence relation
and the initial condition
It should be noted that the complex logarithm in this formulation can be restricted to the principal branch without introducing any discontinuities . It is important to know the asymptotic behaviour of in order to calculate the truncation point for the integral over the characteristic function when using the Andersen-Piterbarg approach with control variate . A Mathematica script gives
The implementation of the Andersen-Piterbarg method for the piecewise constant time dependent Heston model is part of the pull request #251.
 Afshani, S. (2010) Complex logarithms and the piecewise constant extension of the Heston model.
 Andersen, L. and Piterbarg, V. (2010) Interest Rate Modeling, Volume I: Foundations and Vanilla Models, (Atlantic Financial Press London).