예제 #1
0
print('Input RMS beta     ', bunch.get_beta(['x']), 'mm')
print('Input RMS alpha    ', bunch.get_alpha(['x']))
print('Input RMS gamma    ', bunch.get_gamma(['x']), 'mm^{-1}')
print('Input RMS emittance', bunch.get_emittance(['x']), 'mm')

#plot x x' and amplitude distribution
bunch.root_scatter_graph('x',
                         'x\'',
                         'MeV/c',
                         'MeV/c',
                         include_weightless=False)
bunch.root_histogram('amplitude x', 'mm')
#transform the transverse phase space to a new set of coordinates, conserving emittance
#for example, to remove an x-x' correlation into the beam
target_ellipse = Bunch.build_ellipse_2d(target_beta, target_alpha, emit_trans,
                                        bunch.mean(['p'])['p'],
                                        Common.pdg_pid_to_mass[13], True)
bunch.transform_to(['x', 'x\''], target_ellipse, mass_shell_variable='energy')

#print target Twiss parameters
print(
    '\nNow I will make a transformation to target (x,x\') covariance matrix\n',
    target_ellipse)
print('Target RMS beta     ', target_beta, 'mm')
print('Target RMS alpha    ', target_alpha)
print('Target RMS gamma    ', (1. + target_alpha**2) / target_beta, 'mm^{-1}')
print('Transformation will conserve emittance by construction')
print()

#print Twiss parameters of transformed distribution
print("Transformed phase space (x,x\') covariance matrix\n",