Monte Carlo simulation of the HEGRA cosmic ray detector performance