:

if(test -z "$COMPHEP") then
   COMPHEP=../
   export COMPHEP
fi

if( test -e results_) then
  rm -r results_
fi

if(test $# -lt 2) then
  echo " This command needs at least two parameters,
           which indicates the numbers of models"
  exit 1
fi

modeln=$1
model1=""
while(test $modeln  -ne 1  )
do
  modeln=`expr $modeln  - 1` 
  model1=$model1"]"
done

modeln=$2
model2=""
while(test $modeln  -ne 1  )
do
  modeln=`expr $modeln  - 1`  
  model2=$model2"]"
done

#Exclude to exlcude diagrams with virtual particles from the $Exclude list

if(test $# -lt 3) then 
  Exclude=""
  echo "% let S13=0; let S23=0;" >let_tmp   
else 
  Exclude="e3,n3,t,b"
  echo " let S13=0; let S23=0;" >let_tmp
fi 

SqrtS="1000"


Prg=""       # ""/"]}["  (do not create)/(create) Reduce code
             # "]}9"  make the  Reduce code and finish.

Output=""    # "" - Reduce; "]"- Mathematica; "]]" - Form; "]]]" - C; ...
             # "}]]]" - Reduce plus C, ....

read Process

#read Process #It is expected to read a process  string like "e1,E1->e2,E2"

while( test  "$Process" )
do

  rm   results/* tmp/*   # to start from the beginning

  $COMPHEP/s_comphep -blind \
     $model1"}}"$Process"}$SqrtS}$Exclude}]]}]$Prg}}"$Output"}9"
  
  mv results results_
  mkdir results 
  rm tmp/*

  $COMPHEP/s_comphep -blind \
     $model2"}}"$Process"}$SqrtS}$Exclude}]]}]$Prg}}"$Output"}9"

#  YOUR CHECK BEGIN
#
     echo =========================
     echo $Process

     if(test -f r-session) then 
        rm r-session
     fi 

     if(test -f message) then 
        rm message
     fi 

     cat let_tmp  cmp.red |  reduce >r-session 
     grep -i heap r-session 
     rm r-session
     if (test ! -f message) then 
        echo  REDUCE can not perform summation for  $Process 
     else 
        cat message
     fi
     rm -r results_
#
# YOUR CHECK END


  read Process
done

rm let_tmp r-session message
