Beam orbit generation


Files

file  bpm_orbit.h
 libbpm orbit generation routines
file  generate_bpm_orbit.c
file  generate_corr_scan.c
file  generate_mover_scan.c
file  get_bpmhit.c
file  vm.c

Data Structures

struct  v3
struct  m33

Functions

EXTERN double get_rbend (double e, double B, double l, double p)
EXTERN double get_sbend (double e, double B, double l, double p)
EXTERN int get_bpmhit (beamconf_t *beam, bpmconf_t *bpm)
EXTERN int generate_bpm_orbit (beamconf_t *beam, bpmconf_t *bpm)
EXTERN int generate_corr_scan (bpmconf_t *bpm, beamconf_t *beam, int num_evts, int num_steps, double angle_range, double angle, double z_pos)
EXTERN int generate_mover_scan (beamconf_t *beam, int num_evts, int num_steps, double mover_range, double angle)
void v_copy (struct v3 *v1, struct v3 *v2)
double v_mag (struct v3 *v1)
void v_scale (struct v3 *v1, double dscale)
void v_norm (struct v3 *v1)
void v_matmult (struct m33 *m1, struct v3 *v1)
void v_add (struct v3 *v1, struct v3 *v2)
void v_sub (struct v3 *v1, struct v3 *v2)
double v_dot (struct v3 *v1, struct v3 *v2)
void v_cross (struct v3 *v1, struct v3 *v2)
void v_print (struct v3 *v1)
void m_rotmat (struct m33 *m1, double alpha, double beta, double gamma)
void m_matmult (struct m33 *m, struct m33 *m1, struct m33 *m2)
void m_matadd (struct m33 *m1, struct m33 *m2)
void m_print (struct m33 *m1)


Function Documentation

EXTERN double get_rbend ( double  e,
double  B,
double  l,
double  p 
)

get_rbend.c

Definition at line 12 of file get_bend.c.

References cLight.

EXTERN double get_sbend ( double  e,
double  B,
double  l,
double  p 
)

Get the bending angle through a sector bending magnet

Parameters:
e the particle's charge in units of e, take sign into account !
B the magnetic field in Tesla
l the sector length of the magnet in meter
p the momentum of the particle in GeV
Returns:
the bending angle

Definition at line 17 of file get_bend.c.

References cLight.

EXTERN int generate_bpm_orbit ( beamconf_t beam,
bpmconf_t bpm 
)

Generate the beam at the bpm position, so takes the coordinates from the bpm in the global from (stored in bpm->geom_pos and bpm->geom_tilt and fills the local hit positions for the beam in the bpm, beam->bpmhit... Also transports the energy, charge etc.. through to this point...

Parameters:
beam the beam configuration
bpm the bpm confguration
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 8 of file generate_bpm_orbit.c.

References beamconf::beampos, beamconf::beamslope, bpm_error(), beamconf::bpmhit, beamconf::bpmslope, bpmconf::geom_pos, bpmconf::geom_tilt, m_rotmat(), v_add(), v_copy(), v_cross(), v_dot(), v_matmult(), v_scale(), v_sub(), v3::x, v3::y, and v3::z.

EXTERN int generate_corr_scan ( bpmconf_t bpm,
beamconf_t beam,
int  num_evts,
int  num_steps,
double  angle_range,
double  angle,
double  z_pos 
)

Fill the beamconf structures with the lab coords of a corrector scan

Parameters:
bpm A bpmconf structure containing the info about the BPM
beam The beamconf structure that contains the beam info
num_evts The number of events in each corrector scan step
num_steps The number of corrector scan steps
angle_range The angle over which the corrector scan is performed (in urad)
angle The orientation (from the horizontal) of the corrector scan axis (in urad)
z_pos The z position in the beamline of the corrector
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 8 of file generate_corr_scan.c.

References beamconf::beampos, beamconf::beamslope, bpm_error(), bpm_warning(), and bpmconf::geom_pos.

EXTERN int generate_mover_scan ( beamconf_t beam,
int  num_evts,
int  num_steps,
double  mover_range,
double  angle 
)

Fill the beamconf structures with the lab coords of a mover scan. At present, this just changes the beam coords rather than the physical bpm coords. In the future, should add the possiblility of time-varying BPM positions

Parameters:
beam The beamconf structure that contains the beam info
num_evts The number of events in each corrector scan step
num_steps The number of corrector scan steps
mover_range The size of the move (in um)
angle The orientation (from the horizontal) of the mover scan axis (in urad)
Returns:
BPM_SUCCESS upon success, BPM_FAILURE upon failure

Definition at line 8 of file generate_mover_scan.c.

References beamconf::beampos, bpm_error(), and bpm_warning().

void v_copy ( struct v3 v1,
struct v3 v2 
)

Copy 3-vector v2 into 3-vector v1

Definition at line 11 of file vm.c.

References v3::x, v3::y, and v3::z.

Referenced by generate_bpm_orbit(), and get_bpmhit().

double v_mag ( struct v3 v1  ) 

Return the magnitude of 3-vector v1

Definition at line 18 of file vm.c.

References v_dot().

Referenced by v_norm().

void v_scale ( struct v3 v1,
double  dscale 
)

Scale 3-vector v1 with factor dscale

Definition at line 22 of file vm.c.

References v3::x, v3::y, and v3::z.

Referenced by generate_bpm_orbit(), get_bpmhit(), and v_norm().

void v_norm ( struct v3 v1  ) 

Normalise 3-vector v1 to unit vector

Definition at line 28 of file vm.c.

References v_mag(), and v_scale().

void v_matmult ( struct m33 m1,
struct v3 v1 
)

Multiply matrix m1 with 3-vector v1 : m1.v1, result is in v1

Definition at line 32 of file vm.c.

References m33::e, v3::x, v3::y, and v3::z.

Referenced by generate_bpm_orbit(), and get_bpmhit().

void v_add ( struct v3 v1,
struct v3 v2 
)

Add two 3-vectors v1 and v2, result is in v1

Definition at line 44 of file vm.c.

References v3::x, v3::y, and v3::z.

Referenced by generate_bpm_orbit(), and get_bpmhit().

void v_sub ( struct v3 v1,
struct v3 v2 
)

Subtract 3-vectors v1 - v2, result is in v1

Definition at line 50 of file vm.c.

References v3::x, v3::y, and v3::z.

Referenced by generate_bpm_orbit(), and get_bpmhit().

double v_dot ( struct v3 v1,
struct v3 v2 
)

Return Scalar product of 3-vectors v1 and v2

Definition at line 56 of file vm.c.

References v3::x, v3::y, and v3::z.

Referenced by generate_bpm_orbit(), get_bpmhit(), and v_mag().

void v_cross ( struct v3 v1,
struct v3 v2 
)

Return the vector product of 3 vectors v1 x v2, result is in v1

Definition at line 60 of file vm.c.

References v3::x, v3::y, and v3::z.

Referenced by generate_bpm_orbit(), and get_bpmhit().

void v_print ( struct v3 v1  ) 

Print the 3-vector to stdout

Definition at line 74 of file vm.c.

References v3::x, v3::y, and v3::z.

void m_rotmat ( struct m33 m1,
double  alpha,
double  beta,
double  gamma 
)

Create rotation 3x3 matrix with the 3 euler angles alpha, beta and gamma, result in m1

Definition at line 78 of file vm.c.

References m33::e, and m_matmult().

Referenced by generate_bpm_orbit(), and get_bpmhit().

void m_matmult ( struct m33 m,
struct m33 m1,
struct m33 m2 
)

3x3 Matrix multiplication m1.m2, result in m

Definition at line 126 of file vm.c.

References m33::e.

Referenced by m_rotmat().

void m_matadd ( struct m33 m1,
struct m33 m2 
)

3x3 Matrix addition m1+m2, result in m1

Definition at line 140 of file vm.c.

References m33::e.

void m_print ( struct m33 m1  ) 

Print 3x3 matrix m1 to stdout

Definition at line 151 of file vm.c.

References m33::e.


Generated on Thu Jan 10 10:18:34 2008 for libbpm by  doxygen 1.5.1