~christopher-hunt08/maus/maus_mc_control

« back to all changes in this revision

Viewing changes to third_party/bash/71test_data.bash

  • Committer: Durga Rajaram
  • Date: 2013-07-24 00:19:08 UTC
  • mfrom: (659.1.72 release-candidate)
  • Revision ID: durga@fnal.gov-20130724001908-hw36h7kefglgaw3l
Tags: MAUS-v0.6.0
MAUS-v0.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env bash
2
2
 
3
 
run=04235
4
 
filename=${run}.tar
5
 
url=http://www.hep.ph.ic.ac.uk/micedata/MICE/Step1/04200/${filename}
6
 
 
7
 
stagedir=${MAUS_THIRD_PARTY}/third_party/source/
8
 
stagefile=${stagedir}/${filename}
9
 
 
10
 
destdir=${MAUS_THIRD_PARTY}/third_party/install/share/${run}
11
 
destfile=${destdir}/${filename}
12
 
 
13
 
# the point of staging to third_party/source/ is that then this will get 
14
 
# included in the release tarball (which pulls from third_party/source/)
15
 
 
16
 
if [ -n "${MAUS_THIRD_PARTY+x}" ]; then
 
3
run_list="04234 04258 04235"
 
4
cat_list="04234 04258 04234 04258 04234 04258 04234 04258 04234 04258 04235 04235 04235 04235 04235"
 
5
if [ ! -n "${MAUS_THIRD_PARTY+x}" ]; then
 
6
    echo
 
7
    echo "FATAL: MAUS_THIRD_PARTY is not set" >&2
 
8
    exit 1
 
9
fi
 
10
 
 
11
 
 
12
for run in ${run_list}
 
13
do
 
14
    filename=${run}.tar
 
15
    url=http://www.hep.ph.ic.ac.uk/micedata/MICE/Step1/04200/${filename}
 
16
 
 
17
    stagedir=${MAUS_THIRD_PARTY}/third_party/source/
 
18
    stagefile=${stagedir}/${filename}
 
19
 
 
20
    destdir=${MAUS_THIRD_PARTY}/third_party/install/share/test_data/
 
21
    destfile=${destdir}/${filename}
 
22
 
 
23
    # the point of staging to third_party/source/ is that then this will get 
 
24
    # included in the release tarball (which pulls from third_party/source/)
17
25
 
18
26
    if [ -e "${stagefile}" ]
19
27
    then
34
42
    if [ -e "${destfile}" ]
35
43
    then
36
44
        echo "INFO: Unpacking"
37
 
        echo
38
45
        cd "${destdir}"
39
46
        tar -xf ${filename}
40
47
        sleep 1
42
49
        md5sum -c ${run}.md5 || { echo "FATAL: Failed checksum"; rm "${destdir}"; exit 1; }
43
50
        sleep 1
44
51
        echo
45
 
        echo
46
52
        echo "INFO: Data for $run now available for testing against"
47
53
    else
48
54
        echo "FATAL: Failed to get the data file - giving up">&2
49
55
        exit 1;
50
56
    fi
51
 
else
52
 
    echo
53
 
    echo "FATAL: MAUS_THIRD_PARTY is not set" >&2
54
 
    exit 1
 
57
done
 
58
 
 
59
echo "INFO: Concatenating run data"
 
60
cat_file=${destdir}/test_data.cat
 
61
if [ -e ${cat_file} ]
 
62
then
 
63
    rm ${cat_file}
55
64
fi
 
65
touch ${destdir}/test_data.cat
 
66
for item in ${cat_list}
 
67
do
 
68
    file_list=`ls ${destdir}/${item}.0*`
 
69
    for a_file in ${file_list}
 
70
    do
 
71
        cat ${cat_file} ${a_file} >& ${cat_file}.tmp
 
72
        mv ${cat_file}.tmp ${cat_file}
 
73
    done
 
74
done
 
75
echo "INFO: Following files were downloaded"
 
76
ls ${destdir}
 
77