Simulation of the detector response function with the code MCSHAPE