Study of Z production in PbPb and pp collisions at (Formula presented.) TeV in the dimuon and dielectron decay channels