Filtering data with Sunsort

There are two steps to filtering data: firstly, you have to set up your sort code to mark the interesting events you want to get written to your output file; and secondly, you have to tell Sunsort where to put the filtered data.

Marking events for filtering

To mark an event for filtering, your sort code must set a global variable called wrtevt to be true. This is accomplished in FORTRAN with a line like:
        wrtevt=.true.
    
and in C with a line like:
        adcs_.wrtevt = 1;
    

Usually you will put this line at the end of a suitable if statement. Something like:

        if (e1.gt.10.and.e2.gt.10) wrtevt=.true.
    

There's no harm in leaving this statement in when you're not filtering data. If no write file has been opened in Sunsort then setting wrtevt has no effect.

Writing out filtered data

Once your sort code has been set up to mark data for filtering, compile and load it in the usual way. Then, when you are ready to filter data, you open the write file.

Opening the write file from the GUI

To open the write file from the GUI you use Sunsort's write window which is accessible by pressing the Write... button on Sunsort's main window.

If you are writing to tape, you should either mount an existing tape or initialise a new tape. Select Write Media: Tape, then select the correct drive, enter the volume label in the field marked Write vol and press either Mount to mount an existing tape, or NewVol to initialise a new tape. Note that initialising a tape will erase any information already on it.

If you are writing to disk, then just select Write media: Disk.

You then need to open the write file. Enter the file name in the field marked Write file and press Open. From now until when you close the output file, any events that get marked whilst sorting will be written to the output file. Just read input files in the usual way.

Opening the write file from the command line or from a batch file

The command to mount a tape for writing is:
        tapemount volume_name_or_NONANSI drive_number w
    
The command to initialise a new tape is:
        newtape volume_name drive_number
    
To open a file (on disk or tape) for output do:
        wopen medium filename
    
where medium is one of tape or disk.

To close the output file use the wclose command. This takes an optional argument which is the medium you wish to close but this is ignored at the moment so may be safely omitted.

A typical sequence of commands is:

        wopen disk carbon+carbon
        open tape run03
        sort 0 -1
        close
        open tape run04
        sort 0 -1
        close
        wclose
    

Steven M. Singer
Last modified: Fri Sep 3 15:42:54 BST 1999