ABSTRACT We present a cosmological hydrodynamical simulation of a 1013 M⊙ galaxy group and its environment (out to 10 times the virial radius) carried out using the eagle model of galaxy formation. Exploiting a novel technique to increase the resolution of the dark matter calculation independently of that of the gas, the simulation resolves dark matter haloes and subhaloes of mass 5 × 106 M⊙. It is therefore useful for studying the abundance and properties of the haloes and subhaloes targeted in strong lensing tests of the cold dark matter model. We estimate the halo and subhalo mass functions and discuss how they are affected both by the inclusion of baryons in the simulation and by the environment. We find that the halo and subhalo mass functions have lower amplitude in the hydrodynamical simulation than in its dark-matter-only counterpart. This reflects the reduced growth of haloes in the hydrodynamical simulation due to the early loss of gas by reionization and galactic winds and, additionally, in the case of subhaloes, disruption by enhanced tidal effects within the host halo due to the presence of a massive central galaxy. The distribution of haloes is highly anisotropic reflecting the filamentary character of mass accretion on to the cluster. As a result, there is significant variation in the number of structures with viewing direction. The median number of structures near the centre of the halo, when viewed in projection, is reduced by a factor of 2 when baryons are included.