#!/bin/bash
#
#  First get to main level directory for this process
#
echo "Setting up the Template to work with the StandAlone version of MadGraphII"
if [[  ! -d ./bin  ]]; then
    cd ../
    if [[ ! -d ./bin ]]; then
	echo "Error: store must be executed from the main, or bin directory"
	exit
    fi
fi

#  Now let shell know where to find important executables

main=`pwd`
dirbin=$main/bin
mgdir=$main/../MadGraphII
mad2_sa=$mgdir/mg2_sa
helas=$main/../HELAS
mgmedir=$main/..

echo "Transforming standard template in standalone dipole version"
cd $main
mkdir temp
mv ./bin/newprocess_dip ./temp/newprocess
mv ./bin/setup_model-pl ./temp/
mv ./Cards/proc_card.dat ./temp/
mv ./SubProcesses/makefile_dip ./temp/makefile
mv ./SubProcesses/check_dip.f ./temp/
mv ./SubProcesses/dipolesub.f ./temp/
mv ./SubProcesses/transform.f ./temp/
mv ./Source/makefile ./temp/mfsource
rm -rf bin/* Cards/* Events HTML Source/* lib/* SubProcesses/*
mkdir Source/MODEL
mkdir Source/DHELAS

mv ./temp/newprocess ./bin/
mv ./temp/setup_model-pl ./bin/
mv ./temp/proc_card.dat ./Cards/
mv ./temp/makefile ./SubProcesses/
mv ./temp/check_dip.f ./SubProcesses/
mv ./temp/dipolesub.f ./SubProcesses/
mv ./temp/transform.f ./SubProcesses/
mv ./temp/mfsource ./Source/makefile
rm -rf temp

echo " Ready to go with StandAlone MadGraphII "
