A Guide to Using the Program tape_to_1d

Currently, tape_to_1d is a sorting program which creates gated spectra based on double, triple or quadrupole gating. The program reads the file which is used as input to butcher, thus making it compatible with the gator program.

Getting Started

In order to run tape_to_1d, you need two files. The first file must be in the directory you are running the program from, and it must have the name tape_to_1d.inc. An example of the contents of tape_to_1d.inc is given below:
      sd2.butcher
      4096,2,0
      Yes
      hg191_4k.2DP
      hg191_4k.cnts
The first line gives the name of the butcher input file. The butcher file defines all gated spectra which tape_to_1d will create. Currently, one can create up to 250 spectra with each spectrum having up to 900 gates associate with it.

The second line contains the number of channels for each spectrum, the compression factor applied to the pseudo event (see below), and a so-called cleanliness factor. The restrictions on these parameters are given as follows:

The third line contains either "Yes" or "No" to indicate whether or not the raw 2-dimensional projection is to be created. The fourth line gives the name of the 2-D projection file and is only required if line three is "Yes".

The fifth line give the name of the count-file. This file keeps tract of the number of counts each doubple gate contributes to a spectrum. It is used in later programs to perform background subtraction of the spectra.

The second file needed by tape_to_1d is the output file created by Ben Crowell's gator program. Since this file is used as the input to his butcher program, it will be referred to in the remaining portion of this document as the butcher file. To create this file, one must first create a gator file. The gator file defines all of the spectra and gates to be applied to each spectraum Once you have created the gator file run the program with this command line.

       gator sd2.gator > sd2.butcher
Once these two files are created you are set to go. Place your tape in the appropriate drive and give the command
       tape_to_1d
Of course, if you want to run the program in the background and send the text written to the screen to a log file, you should give the command.
       tape_to_1d > myfile.log &

Spectra files created by tape_to_1d

Tape_to_1d creates two types of files, a 2D-projection and 1d spe files. The 2d-projection is stored as an integer*4 triangular matrix in my own particular format. Since tape_to_1d must be re-run for each tape sorted, it needs to update both the 1 and 2-d spectra. Any output file which exists, tape_to_1d will attempt to read and add the sorted contents to that spectrum. If the file does not exist, it will create it and write the sorted data to it. Therefore, the user must make sure that he does not have spectrum files the same name as the files you plan to create in the sort unless you wish the files to be updated.

User manipulation of event stream.

Tape_to_1d also allows for user defined subroutines. This allows the user to manipulate the data string before sending it off to be sorted. For example, one might wish to place time conditions on the sorted dated or change the gain of a data set before histogramming. I have chosen to have data passed to the usersub via common blocks. Therefore, you should start building your usersub from the standard file first in order that you get the common blocks correct.

The source files for tape_to_1d currently sit in the directory /dk/gam1/disk2/util/src/incub8r. The standard usersub is located in t21d_usersub.f in this directory. In order to make your customized version of tape_to_1d, you copy this file along with the make file which is called make.tape_to_1d.

The file t21d_usersub.f contains three subroutines, userinit, usersub and userend. Userinit is called once by tape_to_1d, and any initializations you wish to do can be coded here. For example, if you wanted to gain shift the event stream from 0.5 kev/channel to 0.55 kev/channel, you could generate an array of random numbers in the userinit and pass them via a common block to the usersub. Userend is called at the end of sort and could be used to print out information obtained during the sort such as the Ge multiplicity before and after applying the time gate.

Background Subtraction of Spectra

Since tape_to_1d only creates unsubtracted gated spectra, one must run auxillary programs to create subtractred spectra. Currently, I written a program which will subtract double gated spectra using Ben Crowell's FUL algorithm. The name of the program is sob. Sob will read the tape_to_1d.inc file and perform the subtraction. It will also ask you whether or not you wish to create the error spectrum as well, thus the results are compatible with those of butcher. The subtracted spectra will have a "s1" or "s2" appended to the name depending whether or not you used the cnt-file for the subtraction. Thus, if your raw spectrum file is called gate_303_343.spe, the results of the subtraction will be stored in gate_303_343s2.spe (if you use cnt-file option). The error spectrum would be called gate_303_343.err.