11#! /bin/bash
2+ # WARNING: coatjava must already be built at ../../coatjava/
3+
4+ set -e
25
36webDir=http://clasweb.jlab.org/clas12offline/distribution/coatjava/validation_files/eb
47webVersion=dev-fid-r11
58webDir=$webDir /$webVersion
6-
7- # coatjava must already be built at ../../coatjava/
8-
9- # whether to use CLARA (0=no)
10- useClara=0
11-
12- # if non-zero, don't redownload dependencies, don't run reconstruction:
139runTestOnly=0
1410
15- # gemc default solenoid (changed in 4a.2.4):
16- gemcSolenoidDefault=-1.0
17- if [[ $webVersion = * " 4a.2.2" * ]] || [[ $webVersion = * " 4a.2.3" * ]]
18- then
19- gemcSolenoidDefault=1.0
20- fi
21-
22- # geometry variation for DC
23- geoDbVariation=" default"
24- if [[ $webVersion = * " 4a.2.2" * ]] || [[ $webVersion = * " 4a.2.3" * ]] || [[ $webVersion = * " 4a.2.4" * ]]
25- then
26- geoDbVariation=" dc_geo_gemc424"
27- fi
28-
29- nEvents=-1
30-
11+ # check command-line options:
3112for arg in $@
3213do
3314 if [ " $arg " == " -t" ]
@@ -42,120 +23,27 @@ done
4223# last argument is input file stub:
4324stub=" ${@: -1} "
4425
45- # sanity check on filestub name,
46- # just to error with reasonable message before proceeding:
47- case $stub in
48- # electron in forward, hadron in forward:
49- electronproton)
50- ;;
51- electronkaon)
52- ;;
53- electronpion)
54- ;;
55- electrongamma)
56- ;;
57- electronneutron)
58- ;;
59- electronFTproton)
60- ;;
61- electronFTkaon)
62- ;;
63- electronFTpion)
64- ;;
65- electronFTgamma)
66- ;;
67- electrongammaFT)
68- ;;
69- electronprotonC)
70- ;;
71- electronkaonC)
72- ;;
73- electronpionC)
74- ;;
75- electrongammaC)
76- ;;
77- electronneutronC)
78- ;;
79- electrondeuteronC)
80- ;;
81- * )
82- echo Invalid input evio file: $stub
83- exit 1
84- esac
26+ # check stub validity:
27+ ! grep " ^$stub -pid" src/eb/scripts/list.txt && echo Invalid stub: $stub && exit 1
8528
8629# set up environment
87- if [ $useClara -eq 0 ]
88- then
89- COAT=../../coatjava
90- source $COAT /libexec/env.sh
91- else
92- CLARA_HOME=$PWD /clara_installation/
93- COAT=$CLARA_HOME /plugins/clas12/
94- export CLARA_HOME
95- fi
30+ coatjava=../../coatjava
31+ source $coatjava /libexec/env.sh
32+ classPath=" $coatjava /lib/services/*:$coatjava /lib/clas/*:$coatjava /lib/utils/*:../lib/*:src/"
9633
97- classPath=" $COAT /lib/services/*:$COAT /lib/clas/*:$COAT /lib/utils/*:../lib/*:src/"
98-
99- classPath2=" ../../coatjava/lib/services/*:../../coatjava/lib/clas/*:../../coatjava/lib/utils/*:../lib/*:src/"
100-
101- # make sure test code compiles before anything else:
102- javac -cp $classPath2 src/eb/EBTwoTrackTest.java
103- if [ $? != 0 ] ; then echo " EBTwoTrackTest compilation failure" ; exit 1 ; fi
34+ # make sure test code compiles first:
35+ javac -cp $classPath src/eb/EBTwoTrackTest.java
10436
10537# download and setup dependencies, run reconstruction:
10638if [ $runTestOnly -eq 0 ]
10739then
108-
109- if ! [ $useClara -eq 0 ]
110- then
111- # tar the local coatjava build so it can be installed with clara
112- cd ../..
113- tar -zcvf coatjava-local.tar.gz coatjava
114- mv coatjava-local.tar.gz validation/advanced-tests/
115- cd -
116-
117- # install clara
118- if ! [ -d clara_installation ]
119- then
120- ../../install-clara clara_installation
121- fi
122- fi
123-
124- # download test files, if necessary:
12540 wget -N --no-check-certificate $webDir /${stub} .hipo
126- if [ $? != 0 ] ; then echo " wget validation files failure" ; exit 1 ; fi
127-
128- # update the schema dictionary: (no longer necessary now that recon-util does it)
129- # rm -f up_${stub}.hipo
130- # ../../coatjava/bin/hipo-utils -update -d ../../coatjava/etc/bankdefs/hipo4/ -o up_${stub}.hipo ${stub}.hipo
131-
132- # run reconstruction:
13341 rm -f out_${stub} .hipo
134- if [ $useClara -eq 0 ]
135- then
136- GEOMDBVAR=$geoDbVariation
137- export GEOMDBVAR
138- ../../coatjava/bin/recon-util -i ${stub} .hipo -o out_${stub} .hipo -c 2
139- else
140- echo " set inputDir $PWD /" > cook.clara
141- echo " set outputDir $PWD /" >> cook.clara
142- echo " set threads 7" >> cook.clara
143- echo " set javaMemory 2" >> cook.clara
144- echo " set session s_cook" >> cook.clara
145- echo " set description d_cook" >> cook.clara
146- ls ${stub} .hipo > files.list
147- echo " set fileList $PWD /files.list" >> cook.clara
148- echo " run local" >> cook.clara
149- echo " exit" >> cook.clara
150- $CLARA_HOME /bin/clara-shell cook.clara
151- fi
42+ export GEOMDBVAR=default
43+ ../../coatjava/bin/recon-util -i ${stub} .hipo -o out_${stub} .hipo -c 2
15244fi
15345
154- # run Event Builder tests:
155- java -DCLAS12DIR=" $COAT " -Xmx1536m -Xms1024m -cp $classPath2 -DINPUTFILE=out_${stub} .hipo org.junit.runner.JUnitCore eb.EBTwoTrackTest
156- if [ $? != 0 ] ; then echo " EBTwoTrackTest unit test failure" ; exit 1 ; else echo " EBTwoTrackTest passed unit tests" ; fi
157-
158- $COAT /bin/trutheff ./out_${stub} .hipo
159-
160- exit 0
46+ # run tests:
47+ $coatjava /bin/trutheff ./out_${stub} .hipo
48+ java -DCLAS12DIR=" $coatjava " -Xmx1536m -Xms1024m -cp $classPath -DINPUTFILE=out_${stub} .hipo org.junit.runner.JUnitCore eb.EBTwoTrackTest
16149
0 commit comments