#!/bin/tcsh -f
# this should be used when the disptracebygeomv is used
# onece and all display data is ready.
#
#****************** fix below for your pupose
set vdir = ../Work
# ptcl code to be displayed. (charged/neutral/both can be
#                             specfied from command line)
set ptcls = "1 2 3 4 5 6 9"
#***********************************


# --------------------
# Display type.
# 1)  only trace data. 
#
#     Usage:  ./disptracebygeomv [-{c|z|b}]  tracedata 
#
# 2)  Trace data + detector
#
#     Usage: ./disptracebygeomv  [-{c|z|b}] tracedata  det [-e|-a][-i] [outdir]
#
# where
#   [-{c|z|b}] specifies display of charged particles only
#           or neutral particles only, or both. partilce codes
#           to be displayed are given in $ptcls. You must be carful
#           to use -z or -b; huge number of gamma rays must be
#           displayed.  The default is -c.
#   det:    should be given literally.  detector is also displayed
#   -e:     detector display is by each component base
#   -a:     //                  all-in-one 
#   -i:     detector color and material correspondence is displayed
#  outdir;  working directory to contain files for Geomview.
#           default is ../Work.
#
#  To fix the color for each particle code, colortab is used.
#  ===============
#


if( $#argv < 1 || $#argv >6 ) then
        echo "You gave "  $#argv " arguments"
  error:
        echo " Usage: "
	echo "./disptracebygeomv [-{c|z|b}] tracedata  [det]"
	echo " "
        gawk ' $2 ~ /---------/, $2 ~ /===========/' $0 | less
	exit 1
endif

set chg = "-c"
if (  "$1" == "-c"  || "$1" == "-z"  ||  "$1" == "-b"  ) then
	set chg = $1
	shift
else if ( "$1" =~ "-"* )  then
	echo $1 " is not supported "
	goto error
endif


if($#argv >= 2) then
        if( $2 == "det" ) then
            set case = "2"
        else
 	    goto error
        endif
else if( $#argv == 1 ) then
    set case = "1"
else
    goto error
endif



echo $case

switch ( $case )
    case "1":
	   $GEOMVIEW  $vdir/ptcl???*.vect &
	   breaksw
    case "2":
            shift; shift 
            source ./convconfig $argv

            if( $dispcolormap == "yes" ) then
        	$GEOMVIEW  $vdir/mediatext   &
		sleep 1
            endif

            $GEOMVIEW  `find $outdir -name '*.list' -print `  $vdir/ptcl???*.vect  &

            breaksw
endsw     

