00001 00005 #include <bpm/bpm_messages.h> 00006 #include <bpm/bpm_simulation.h> 00007 #include <math.h> 00008 00018 int get_monopole_amp( double bunchcharge, double bunchlength, 00019 double chargesens, 00020 double *amp, double *phase ){ 00021 00022 00023 double I = 0; 00024 double Q = (-1) * chargesens * bunchcharge; 00025 //need check the phase 00026 00027 *amp = sqrt( I * I + Q * Q ); 00028 if ( *amp == 0 ) *phase = 0; else 00029 *phase = acos(I / *amp); // ( I > 0 ? asin(I / *amp) : PI - asin(I / *amp) ); 00030 00031 return BPM_SUCCESS; 00032 } 00033 00034 // end of file