This is code adapted from the publication:

Johannes Hanika and Carsten Dachsbacher. 2014.
Efficient Monte Carlo rendering with realistic lenses.
Comput. Graph. Forum 33, 2 (May 2014), 323-332. DOI=http://dx.doi.org/10.1111/cgf.12301

Licence is generally not provided, so public domain is assumed.