slicer=slicer,
                          Dt_ref=10e-12,
                          pyecl_input_folder='./pyecloud_config',
                          chamb_type=chamb_type,
                          x_aper=x_aper,
                          y_aper=y_aper,
                          filename_chm=filename_chm,
                          Dh_sc=Dh_sc,
                          init_unif_edens_flag=init_unif_edens_flag,
                          init_unif_edens=init_unif_edens,
                          N_mp_max=N_mp_max,
                          nel_mp_ref_0=nel_mp_ref_0,
                          B_multip=B_multip_per_eV * machine.p0 / e * c)

# install ecloud in the machine
machine.install_after_each_transverse_segment(ecloud)

# setup transverse losses (to "protect" the ecloud)
import PyHEADTAIL.aperture.aperture as aperture
apt_xy = aperture.EllipticalApertureXY(x_aper=ecloud.impact_man.chamb.x_aper,
                                       y_aper=ecloud.impact_man.chamb.y_aper)
machine.one_turn_map.append(apt_xy)

# generate a bunch
bunch = machine.generate_6D_Gaussian_bunch_matched(n_macroparticles=300000,
                                                   intensity=intensity,
                                                   epsn_x=epsn_x,
                                                   epsn_y=epsn_y,
                                                   sigma_z=1.35e-9 / 4 * c)

# apply initial displacement
from PyHEADTAIL.particles.slicing import UniformBinSlicer
slicer = UniformBinSlicer(n_slices = 64, n_sigma_z = 2.)
ecloud = PyEC4PyHT.Ecloud(L_ecloud=machine.circumference/n_segments, slicer=slicer , 
				Dt_ref=10e-12, pyecl_input_folder='./pyecloud_config',
				chamb_type = chamb_type,
				x_aper=x_aper, y_aper=y_aper,
				filename_chm=filename_chm, Dh_sc=Dh_sc,
				init_unif_edens_flag=init_unif_edens_flag,
				init_unif_edens=init_unif_edens, 
				N_mp_max=N_mp_max,
				nel_mp_ref_0=nel_mp_ref_0,
				B_multip=B_multip_per_eV*machine.p0/e*c)


# install ecloud in the machine
machine.install_after_each_transverse_segment(ecloud)

# setup transverse losses (to "protect" the ecloud)
import PyHEADTAIL.aperture.aperture as aperture
apt_xy = aperture.EllipticalApertureXY(x_aper=ecloud.impact_man.chamb.x_aper, y_aper=ecloud.impact_man.chamb.y_aper)
machine.one_turn_map.append(apt_xy)

# generate a bunch 
bunch = machine.generate_6D_Gaussian_bunch_matched(n_macroparticles=300000, intensity=intensity, 
		epsn_x=epsn_x, epsn_y=epsn_y, sigma_z=1.35e-9/4*c)
       


# apply initial displacement
bunch.x += x_kick
bunch.y += y_kick