A code for hadrontherapy treatment planning with the voxelscan method