$Id: faq.html,v 1.4 2002/11/12 22:38:07 tl Exp $

GSSort/GSUtil FAQs

root documentation

Q:where is root documented?
A: Root is documented at http://root.cern.ch. The Gammasphere root sorter and utilities are documented at http://www.phy.anl.gov/gs/doc/GSSort/ .

crosshair cursor

Q:how do I get a crosshair cursor?
A: after you have displayed the first spectrum, type c1->SetCrosshair(1). This will automatically be done if you type mkcanvas() in rootn.exe.

cursor/channel info

Q:How do I get information about what the channel number is where the cursor is located?
A: In the histogram display window, click on 'Options'. Then toggle on "Event Status" and the channel numbers will be shown at the bottom of the display window. This will automatically be done if you type mkcanvas() in rootn.exe.

print list of spectra

Q: How do I print a list of the spectra in the shared memory
A: first type 'mfile->ls();> x.dir', then print the file (which you can do from inside root by typing: '.!lpr x.dir')

zap spectra

Q: How do I zap the spectra GSSort is generating
A: Since the spectra you look at in rootn.exe are read only, zapping the spectra can only be done from inside GSSort while it is sorting. There is a hook for this using the GSSort command file option:
echo "zapall" > GSSort.command ; pkill -HUP GSSort
The above command will write the command 'zapall' in the GSSort command file 'GSSort.command'. The you signal GSSort with the 'pkill -HUP GSSort'. When the program is signaled, it will realize that the command file is there, execute the 'zapall' command, update the shared memory (or disk file) and continue the sort.

You can do all this from inside rootn.exe by typing 'zapall()'. There is also a 'zap("h1")' function to zap just one spectrum.

summing gates

Q:how do I sum up a number of gates from a 2D gamma gamma matrix ?
A: The easiest way to to sum a number of gates is to create a 'command' file. Use te("sndgates.rcf") to open the file "sndgates.rcf". Put lines like:
in it. We here generate four gates, clear a summed spectrum, and add the gates up. Finally we display the sum. NOTICE THAT YOU MUST ENCLOSE THE COMMANDS WITH THE {} BRACKET!!

To execute the command file type

   .x sndgates.rcf
in rootn.exe

plot a spectrum

Q:how do I plot/print a spectrum?
A: Click on the 'File" option in the display window and find the print option. A postscript version of the current canvas will be written to the postscript file stated (typically c1.ps). You can now print this ps file as e.g.,
    .! lpr -P fwhp4550 c1.ps

X11 errors

Q:I can't display anything, it complains about some X11 error (something like
root [5] d2("gamtof");                          
: created default TCanvas with name c1
Error in : BadAccess (attempt to access private resource denied) (XID: 0)
Error in : BadAlloc (insufficient resources for operation) (XID: 0)
What do I do?
A: If you start up rootn.exe and it complains about some X11 resource missing or not being able to load a color or anything like that - chances are that the display will not work.

To fix this, try to kill as many X11 utilities as you can - especially netscape. This may not effectively free up all the X11 resources that rootn.exe needs - in which case you should be able to resolve the problem by logging out and then log in again.

how do I exit rootn.exe?

Q:Help, I want to get out of rootn.exe!
A:The command to stop rootn.exe is '.q'. Notice that you can stop rootn.exe and still have GSSort running happily in the background. You can start rootn.exe up again and use sload to attach to the shared memory again.

adding rootfiles

Q:How do I add root files to get a final dataset if I sorted each tape individually?
A:I haven't tried it myself, but there is a script that is supposed to do just that.

source codes

Q:where are the GSSort/GSUtil source codes?
A: check here for both source codes and binaries for Solaris and Linux.

HK matrix

Q:how do I make an HK (sumed energy total multiplicity) matrix in GSSort?
A: The summed energy of the germaniums and BGOs are calculated in the EFFs and handed to you in the two GS pevs: sumge and sumbgo. Gssort also sums up all detectors that fired (clean + dirty Germaniums and clean BGOs) in the pev lentotal.

The snipped from a chat file below shows how you could make and HK matrix that even tries to approximately take into account the effect of longlived isomer in a thin target experiment.

# make an hk 2D plot
# First add ge and bgo energies to proper total energy.
# If we assume that the calibration of the germanium
# summed energy is: 16 Kev/ch and the summed bgo energy
# calculated in the EFFs is: 10 keV/ch (as the
# GS WWW documantation claims) and we want
# 500 kev/ch for the total energy, HH, then 
# we should generate HH as:
mkpev HH
modpev addpev HH 0.0320 sumge
modpev addpev HH 0.0200 sumbgo
# (sumge and sumbgo are calculated in the EFFs!)
# This nucleus has an isomer, and we do not observe
# energyes below the isomer, so we add this level
# energy (5088 keV, or 10.18 ch or). The sum efficency
# might be something like 65% (total ge+BGO), so add 6.2
modpev addconst HH 6.2
# total multiplicity is already available in the 
# pev 'lentotal'. But the isomer hides some transitions.
# Of the ~8 transitions below the isomer, we would
# should see a multiplicity of perhaps 0.73*8~6
# so, to get an estimate of the true multiplicity
# we make KK as
mkpev KK
modpev addpev KK 1.0 lentotal
modpev addconst KK 6
# For the HHxKK matrix, let us bin multiplicity up
# 30 and HH up to 50 MeV in 50 channels. 
binpev2d KK 40 0 39 HH 50 0 100

stacker sort

Q: How do I use a stacker to sort many tapes into a root file?
A: You will need a script something like this one:


set INDRIVE  = /dev/rmt/1mbn
foreach tape ( 2 3 4 5 6 7 8 )

echo "`which GSSort`"

echo "-----------------------------------------------------"
echo "-------                                      --------"
echo "-----------------------------------------------------"

# ... test if new tape is ready

  echo "test for input tape..."
  mt -f $INDRIVE status
  set st = $status
  if ( $st != 0) then 
    echo "input tape NOT ready - quitting..."

# ... do Sort

  echo "-----> sorting tape $tape"
  GSSort -chat mychat.chat >! GSSort_{$tape}.log 
  set st = $status
  echo "__done skimming, status is: $st"
# ... where are we on input tape?

  echo "status of input tape>>"
  mt -f $INDRIVE status

# ... kick the old tape out of the stacker drive

  if ( $st == 0) then
    echo "popping the input tape..."
    mt -f $INDRIVE rewoffl

# ... wait for stacker to put new tape in

  echo "waiting for stacker..."
  sleep 300

# send an Email message that the sort is done

echo "... sorting seems to be done" 
echo "GSSort done on `date` in `\pwd`" | mailx me@phy.anl.gov


Here we assume you have sorted tape 1 already and now we want to sort tapes 2-8, which you have loaded up in the stacker. It is also assumed that you have started the stacker sequence so that tape 2 is in the stacker tape drive (ususally with a 'reset' 'enter' command).

The script will then sort the tapes and write a logfile for each tape it sorted. The command "mt -f $INDRIVE rewoffl" will eject the tape and the stacker will put the next tape in. This takes some time, so the script will wait 300 seconds before it will start sorting the next tape.

Please Note: Your chatscript better contain the line:

   rootfileoption UPDATE
or the root file will be RECREATE (== overwritten) every time a new tape is sorted. Also, use a rootfile, not shared memory when you sort tapes. Shared memory is only for online use.

how do I tar my stuff?

Q: How do I make a tar backup of my (online)sort?
A: Put a tape in on of the 8mm drives. Then probe what the name is with
   mt -f /dev/rmt/1mbn status
(or 0mbn or 2mbn) if the name isn't written on the drive.

Then, if the tape is new, do

  cd DirectoryOfInterest
  tar -cvf /dev/rmt/1mbn .
Else if you already have saved to the tape and you want to add another backup:
  cd DirectoryOfInterest
  mt -f /dev/rmt/1mbn eom
  tar -cvf /dev/rmt/1mbn .
"mt -f /dev/rmt/1mbn eom" will position the tape at the end of the last tar backup you did (eom=End Of Medium). Please note: if you forget this repositioning step, you will overwrite the old tar backups you did!

undo tac2 and realign

Q:How do I undo tac2 and realign the germanium detectors?
A: and you should be all set. You can do the same for the BGO detectors if you are writing those out.