The magnetic structures of RMgSn compounds (R= Ce, Pr, Nd, Tb)