bpmsimulation/get_dipole_amp.c

Go to the documentation of this file.
00001 
00005 #include <bpm/bpm_messages.h>
00006 #include <bpm/bpm_simulation.h>
00007 #include <math.h>
00008 
00023 int get_dipole_amp( double bunchcharge, double bunchlength,
00024                     double pos, double possens,
00025                     double slope, double slopesens,
00026                     double tilt, double tiltsens,
00027                     double *amp, double *phase ){
00028 
00029 
00030   double I =        ( pos * possens ) * bunchcharge;
00031   double Q = (-1) * ( slope * slopesens ) * bunchcharge;
00032   //need to add the tilt
00033 
00034   *amp = sqrt( I * I + Q * Q );
00035   if ( *amp == 0 ) *phase = 0; else
00036   *phase = acos(I / *amp); // ( I > 0 ? asin(I / *amp) : PI - asin(I / *amp) );
00037   
00038   return BPM_SUCCESS;
00039 }
00040 
00041 // end of file

Generated on Fri Nov 9 21:17:11 2007 for libbpm by  doxygen 1.5.1