Measurement of isolated photon production in pp and PbPb collisions at