Mean and quantile Loss curve computation

Implements https://bugs.launchpad.net/openquake/+bug/1101270

For a clean diff, https://github.com/gem/oq-engine/pull/1019/ should land first.