The resistive plate chambers for CMS and their simulation