Merging the VirtualMC branch to the main development branch (HEAD)
[u/mrichter/AliRoot.git] / AliGeant4 / config / test_run_struct.sh
CommitLineData
b9d0a01d 1#!/bin/sh
676fb573 2# $Id$
3# ----------------------------------------------------------------
4# This script runs the specified (or default) test macro
5# for a specified STRUCT module and its version number
6# in aliroot/STRUCT/test/MODULE
7#
8# Usage:
9# test_run_struct.sh modName [-d detVersionNumber] [-g genNumber] [-v visNumber]
10#
11# 5.11.99, I.Hrivnacova
12
13# check input parameters
14if [ $# -lt 1 ]; then
15 echo "Usage: "
16 echo "test_run_struct.sh modName [-d detVersionNumber] [-g genNumber] [-v visNumber]"
17 exit
18fi
19
20# default parameters
21MOD=$1
22VER="0"
b9d0a01d 23GEN="1"
676fb573 24VIS="0"
25
26# get input parameters
27for param in $*
28do
29 case $param in
30 -d) VER=$3; shift 2;;
31 -g) GEN=$3; shift 2;;
32 -v) VIS=$3; shift 2;;
33 esac
34done
35
36CURDIR=`pwd`
37TO=$AG4_INSTALL/"test"
38
39# go to detector test directory
40cd $TO/STRUCT/$MOD
41
42# remove old output files if exist
43if [ -f "v"$VER"_test"$GEN""$VIS".out" ]; then
44 rm "v"$VER"_test"$GEN""$VIS".out"
45fi
46if [ -f "v"$VER"_test"$GEN""$VIS".err" ]; then
47 rm "v"$VER"_test"$GEN""$VIS".err"
48fi
49
50# run aligeant4
51aligeant4 "v"$VER"_test"$GEN""$VIS".in" > "v"$VER"_test"$GEN""$VIS".out" 2> "v"$VER"_test"$GEN""$VIS".err"
52
53# check if aligeant4 ran successfully
54if [ $? -ne 0 ]; then
55 echo " !!! ERROR: Test v"$VER"_test"$GEN""$VIS" in "$MOD
56fi
57# rename g4.prim if it was created
58if [ -f g4.prim ]; then
59 mv g4.prim "v"$VER"_test"$GEN""$VIS".prim"
60fi
815665c8 61# rename gif lego plots if they were created
62if [ -f gcm2.gif ]; then
63 mv gcm2.gif "v"$VER"_gcm2.gif"
64fi
65if [ -f etar.gif ]; then
66 mv etar.gif "v"$VER"_etar.gif"
67fi
68if [ -f radl.gif ]; then
69 mv radl.gif "v"$VER"_radl.gif"
70fi
71if [ -f abso.gif ]; then
72 mv abso.gif "v"$VER"_abso.gif"
73fi
74# rename g4.prim if it was created
75if [ -f g4.prim ]; then
76 mv g4.prim "v"$VER"_test"$GEN""$VIS".prim"
77fi
676fb573 78
79cd $CURDIR