Instructions for determining bpm buttons gains from turn by turn data

1. Fill one bunch (bunch 1 train 1) to current appropriate to BPM range
     (typically 0.8mA for fixed gain mode)
2. Lock horizontal and vertical shakers and drive hard. Adjust tunes for
     maximum stable amplitude
3. Take turn by turn data. 1024 turns. 
     CESR28$ do cbpm_tbt_positrons
4. Note the larger of the tbt file numbers <####> that are written
5. To compute gains
     $ACC_EXE/gain_tbt
     Real or fake data ? << real >>
     Orbit or Turn by turn data ? << tbt >>
     Turn by turn data file ? e.g. "RD-003175.dat" or "3175" << #### >>
      {The program will real file #### and ####-1}
     tbt_file_type = << 3 >>  
     Correct tbt data for gain and pedstal ?
    (1= no correct, 2=pedesdal correct, 3 = gain and pedestal correct)
    {3 => gain and pedestal corrections are applied to the tbt data
    {2 => Pedestal corrections are applied but not gain corrections are applied to tbt data
    {1 => No gain or pedestal corrections are applied to the tbt data
 
     which bpm ? (-1 for all) << -1 >>

     Read fitted gains << no >>
   ------------
     If the plotted gains are "reasonable" (0.9 < gain < 1.1) then you have good tbt data.
      If not you may need to adjust tunes, coupling and/or tune tracker amplitudes.

     The fitted gains are written to file << RD-00####.dat_out >>

     This step may be repeated with additional turn by turn data.
     Each repitition yields another RD-00####.dat_out file

6. To combine the fitted gains from the tbt data and to write a file that can be read by
   the CBPM-II system
    - Create a file called list.dat that lists all of the tbt files.
      (ls RD-00*.dat_out > list.dat)
    - $ACC_EXE/summarize_gain
       List of files to read ? << list.dat >>
       Data type ? << 0 0 >>     This refers to the species and current range
                                 The species is positrons (0) or electrons (1)
                                 The current range is
                                 Fixed gain mode (0)
                                 and then 1 - 10

       button gain file ? (DEF=cbpmii_gain_template.dat) << carriage return >> for default

The output file "cbpmii_gain_template_todays-date.dat" is read by CBPM-II code.