hec_beam_fit (mode).f       [#]

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    ( is called by:   hec_evt.f  )
 

    includes the following commons:

    hec_par.inc
    hec_beam.inc
    hec_beam_sys_cluset.inc
    hec_beam_sys_clusters.inc
    hec_beam_sys_config.inc
    hec_datacard.inc
    hec_evth.inc
    hec_trig.inc
 

    This fairly lengthy routine reconstructs the beam trajectory parameters.
    Once done, they are stored in the hec_beam common.
    No more that 5 MWPC can be used in the beamfit.

    The `mode' specifies whether the beam trajectory is to be found (1)
                                      or tune histograms are to be printed (2)
 
 

    First, a whole lot of histograms are booked.
    For mode 2 these histograms thenget printed and deleted and that's it,
                        the subroutine is then left.
                       (I can't quite follow where they are actually getting filled...?)
 

    For mode 1  we continue with a call to:
    hec_BEAM_GETCLUST(1)
    which goes and gets clusters from the beam region.

    Then the beam fit is performed in x and y. In it there are repeated calls to:
    hec_BEAM_LINEFIT(SLOP,XZERO,RESMEAN,RMAX,NCMAX)
     which uses sets of clusters and fits them to a straight line.