#!/bin/tcsh 

if ( $# < 2 ) then
   echo "usage: SdEvent2ps.csh <sd id> "
   exit 1
endif 

set binDir=$ADSTROOT/EventBrowser/bin
set texName=tmpRdEvB$1
if ( -e $texName.tex ) then
  rm -f $texName.tex
endif

cat $ADSTROOT/EventBrowser/bin/RdEvent.tex | sed -e 's/XXX/'$1'/' > $texName.tex
latex $texName  >& /dev/null
dvips $texName -o >& /dev/null

rm -f $texName.tex
rm -f $texName.dvi
rm -f $texName.aux
rm -f $texName.log
mv $texName.ps $2

rm -f /tmp/tmp$1_info.eps
rm -f /tmp/tmp$1_array.eps
rm -f /tmp/tmp$1_ldf.eps
rm -f /tmp/tmp$1_time.eps

