Documentation of KWFIT Routines

The general sequence of calls is shown in the simple example to help you get started. More extensive examples are provided elsewhere in the documentation.


Important General Routines

kset_init

Initialize KWFIT (first call to system)

kset_clear

Clear track list (done at beginning of event)

kset_bfield

Set B field information (done at beginning of run)

kset_beam_position

Set beam position and errors (done at beginning of run)

kset_beam_momentum

Set beam 4-momentum (done at beginning of run)

kset_fit_criteria

Sets fit criteria used in KWFIT

kset_default_vtx_errors

Sets default large vertex errors when fitting for unknown vertices

General Information Routines

kget_bfield

Returns B field information

kget_beam_position

Returns beam position and errors

kget_beam_position_cov

Returns beam covariance matrix

kget_beam_momentum

Returns beam 4-momentum

kget_fit_criteria

Returns fit criteria used in all fits

kget_last_fit_info

Returns information about last fit

Routines Which Fill the Track List

kfil_track_create

Create an entry in track list. No information is stored

kfil_track_delete

Delete a track

kfil_track_cd

Load CD track and its errors into track list

kfil_track_cd_all

Load all CD tracks and errors into track list

kfil_track_cd_list

Load a list of CD tracks and errors into track list

kfil_track_knvf

Load secondary vertex and its errors from KNVF into track list

kfil_track_knvf_all

Load all secondary vertices and errors from KNVF into track list

kfil_track_vfnd

Load secondary vertex and its errors from VFND into track list

kfil_track_vfnd_all

Load all secondary vertices and errors from VFND into track list

kfil_track_svtf

Load track segment and its errors from SVTF into track list

kfil_track_svtf_all

Load all track segments and errors from SVTF into track list

kfil_track_ccfc

Load CCFC shower and its errors into track list

kfil_track_ccfc_all

Load all CCFC showers and errors into track list

kfil_track_xbal

Load XBAL shower and its errors into track list

kfil_track_xbal_all

Load all XBAL showers and errors into track list

kfil_track_pi0

Load pizero and its errors into track list

kfil_track_pi0_all

Load all pizeros and errors into track list

kfil_track_qq

Load QQ track into track list

kfil_track_qq_all

Load all QQ tracks into track list

kfil_track_ftmonte

Load FTMONTE track and its errors into track list

kfil_track_ftmonte_all

Load all FTMONTE tracks and errors into track list

Get Track Information

kget_track_number

Returns number of tracks in track list

kget_track_param

Returns track current parameters

kget_track_param0

Returns track unconstrained parameters

kget_track_p4

Returns track 4-momentum

kget_track_covar

Returns track covariance matrix

kget_track_mass

Returns actual mass of track

kget_track_dca_bend

Returns dca of track to point (in bend plane)

kget_track_origin

Returns type of original list track came from (e.g., CD)

kget_track_index

Returns track index in original list (e.g., CD list)

kget_track_is_covar

TRUE if track has a covariance matrix

kget_track_is_position

TRUE if track has position information

kget_track_is_mass_fixed

TRUE if track has a fixed mass

kget_track_err_energy

Returns the energy error of a track

kget_track_err_mass

Returns the mass error of a track

kget_track_err_momentum

Returns the momentum error of a track

kget_track_err_pperp

Returns the pperp error of a track

kget_track_err_phi

Returns the phi error of a track

kget_track_err_theta

Returns the theta error of a track

kget_track_err_dca_bend

Returns error error in dca of track to point (in bend plane)

Set Track Information

kset_track_copy

Copy information from one track to another

kset_track_info

Set most information for a KWFIT track

kset_track_param

Set current track parameters

kset_track_param0

Set unconstrained track parameters

kset_track_covar

Set track covariance matrix for a track

kset_track_mass

Set mass of a track

kset_track_origin

Set the origin of a KWFIT track (i.e., CD list)

kset_track_index

Set index of track in original list (e.g., CD list)

kset_track_is_covar

Set flag indicating whether or not a track has a covariance matrix

kset_track_is_mass_fixed

Set flag indicating whether a track has a fixed or floating mass

kset_track_is_position

Set flag indicating whether or not a track has position information

General Track Utility Routines

ktrk_set_parameters

Set unconstrained parameters to be same as current ones

ktrk_restore_parameters

Restore current track parameters to unconstrained ones

ktrk_add_momentum Add 4-momentum of one track to another, ignoring position

ktrk_move_arc

Move track & its covariance matrix by a fixed distance

ktrk_move_point

Move track & its covariance matrix to true PCA to a point

ktrk_move_point_bend

Move track & its covariance matrix to PCA in bend plane to a point (CLEO definition of PCA)

ktrk_move_line

Move track & its covariance matrix to a line

ktrk_move_plane

Move track & its covariance matrix to a plane

ktrk_move_zplane

Move track & its covariance matrix to a z position

ktrk_move_radius

Move track & its covariance matrix to a particular radius

Fitting Routines

kfit_update_tracks

Update all tracks from the previous fit

kfit_3momentum

Constrain a KWFIT track to a fixed 3-momentum

kfit_4momentum

Constrain a KWFIT track to a fixed 4-momentum

kfit_mass

Constrain a KWFIT track to a fixed mass

kfit_energy

Constrain a KWFIT track to a fixed energy

kfit_momentum

Constrain a KWFIT track to a fixed total momentum

kfit_vertex_fixed

Constrain a KWFIT track to come from a fixed vertex

kfit_vertex_known

Constrain a KWFIT track to come from a vertex having position & errors

kfit_back_to_back

Constrain 2 KWFIT tracks to be back to back, i.e., dimuon

kfit_back_to_back_cm

Constrain 2 KWFIT tracks to be back to back in CM (unboosted) frame

Vertex Fitting Routines

Note: All vertex fitting routines have an argument which optionally allows the track parameters to be updated. If they are not updated, only the vertex and chi-square information are returned.

kvtx_unknown_approx

Find 3-D vertex using line approximation. No chisquare computed.

kvtx_unknown

Find unknown 3-D vertex

kvtx_known

Find vertex, where initial position and covariance matrix are specified

kvtx_beam

Find vertex, incorporating beam spot information

kvtx_fixed

Force a set of tracks to pass through a single point

kvtx_unknown_2d Same as kvtx_unknown, except that only r-phi constraint is used
kvtx_known_2d Same as kvtx_known, except that only r-phi constraint is used
kvtx_fixed_2d Same as kvtx_fixed, except that only r-phi constraint is used

kvtx_known_lifetime

Find c*tau, where position and cov. matrix of starting point are specified

kvtx_beam_lifetime

Find c*tau using beam spot as starting point

kvtx_fixed_lifetime

Find c*tau, where position of starting point (fixed) is specified

kvtx_two_vertex Find vertex given a fuzzy prod. pt. and a decay into 1 daughter + neutrals
kvtx_two_vertex_life Same as kvtx_two_vertex but also fit for lifetime.

Routines Which Build Virtual Particles

kvir_add_nofit

Build particle by adding 4-momenta from several tracks (no constraint)

kvir_vertex_fixed

Build particle constraining tracks to go through fixed vertex

kvir_vertex_known

Build particle constraining tracks to go through known vertex with errors

kvir_vertex_beam

Build particle constraining tracks to go through beam spot

kvir_vertex_unknown

Build particle constraining tracks to go through unknown vertex

kvir_two_vertex Build particle constraining tracks to the "two-vertex" fit

Miscellaneous Move Routines

Note: All routines which manipulate W tracks use the current B field specified by kset_bfield. None of these routines use the KWFIT track list, they use only information in the argument list.

kmove_wtk_arc

Move a W track a fixed 3-D arc length

kmove_wtk_point

Move a W track to true PCA to the specified point

kmove_wtk_point_bend

Move a W track to PCA in bend plane to the specified point (CLEO definition of PCA)

kmove_wtk_line

Move a W track to PCA to the specified line

kmove_wtk_plane

Move a W track to the specified plane

kmove_wtk_zplane

Move a W track to a particular z value

kmove_wtk_cylinder

Move a W track to the specified cylinder

kmove_wtk_radius

Move a W track to the specified radius

Miscellaneous Utility Routines

Note: All routines which manipulate W tracks use the current B field specified by kset_bfield. None of these routines use the KWFIT track list; they use only information in the argument list.

kutl_boost_from_frame

Boost a W track from a frame moving with a specified velocity

kutl_boost_to_frame

Boost a W track to a frame moving with a specified velocity

kutl_convert_c_to_w

Convert C track (CLEO parameters) to W format

kutl_convert_w_to_c

Convert W track to C track (CLEO parameters)

kutl_convert_ccov_to_wcov

Convert 5x5 C track covariance matrix to 7x7 W covariance matrix

kutl_convert_wcov_to_ccov

Convert 7x7 W track covariance matrix to 5x5 C covariance matrix

kutl_origin_to_current

Returns 3-D arc length from origin to current position on W track

kutl_distance_to_point

Returns the 3-D distance of closest approach from a W track to a point

kutl_dca_bend

Returns the dca from a W track to a point (measured in bend plane)

kutl_distance_line_point

Returns the distance between a 3-D line and a point

kutl_distance_line_line

Returns the distance between two 3-D lines

kutl_intersect_2lines

Finds the intersection point of two 3-D lines

kutl_vertex_approx Find 3-D vertex using line approximation. No chisquare computed.

kutl_vertex_average

Finds the weighted average of two 3-D vertices and returns chisquare

kutl_vertex_same

Finds the chi-square for two 3-D vertices to be the same

kutl_vertex_err_project

Returns the vertex error along a specified direction

kutl_2vertex_err

Returns the error along line connecting two vertices

ktrk_2vertex_d_over_sigma

Returns D/sigma between a track and vertex along line connecting them

kutl_mass2

Returns the invariant mass of two W tracks

kutl_mass3

Returns the invariant mass of three W tracks

kutl_mass4

Returns the invariant mass of four W tracks

kutl_sum2

Returns the 4-momentum sum of two W tracks

kutl_sum3

Returns the 4-momentum sum of three W tracks

kutl_sum4

Returns the 4-momentum sum of four W tracks