CERN HeadTail simulation code for simulation of multi-particle beam dynamics with collective effects