~ajdobbs/maus/event-selection

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash

if [ -z "$MAUS_ROOT_DIR" ]; then
   echo "FATAL: \$MAUS_ROOT_DIR not set. Please source env.sh"
   exit 1;
fi
if [ -z "$MAUS_THIRD_PARTY" ]; then
   echo "FATAL: \$MAUS_THIRD_PARTY not set. Please source env.sh"
   exit 1;
fi

if [ -z "$1" ]; then
   echo "FATAL: No argument supplied. Please supply either StepI or StepIV"
   exit 1;
fi

if [ ! "$MAUS_ROOT_DIR" = "$MAUS_THIRD_PARTY" ]; then
   echo "FATAL: MAUS_ROOT_DIR != MAUS_THIRD_PARTY - rebuild the unpacker manually"
   exit 1;
fi

echo "INFO: Current unpacker version is set as: " $MAUS_UNPACKER_VERSION
echo "INFO: Current unpacker is located in: " $MAUS_THIRD_PARTY

if [ "$1" = "StepI" ]; then
  echo "INFO: Setting up StepI unpacker"
  export MAUS_UNPACKER_VERSION="StepI"
  sed -i '/MAUS_UNPACKER_VERSION/c\     export MAUS_UNPACKER_VERSION="StepI"' env.sh
elif [ "$1" = "StepIV" ]; then
  echo "INFO: Setting up StepIV unpacker"
  sed -i '/MAUS_UNPACKER_VERSION/c\     export MAUS_UNPACKER_VERSION="StepIV"' env.sh
  export MAUS_UNPACKER_VERSION="StepIV"
else
  echo "FATAL: Bad argument supplied. Please supply either StepI or StepIV"
  exit 1;
fi

echo
echo "INFO: Rebuilding the unpacker"
echo

if $MAUS_THIRD_PARTY/third_party/bash/53unpacking.bash; then
  echo
  echo "INFO: Unpacker rebuilt"
  echo
else
  echo
  echo "FATAL: Building the unpacker failed"
  echo
  exit 1;
fi

echo
echo "INFO: Rebuilding MAUS"
echo
if scons -c; then
  echo
  echo "INFO: MAUS build cleaned"
  echo
else
  echo
  echo "FATAL: Cleaning the build failed"
  echo
  exit 1;
fi
if scons -j8; then
  echo
  echo "INFO: MAUS build succeeded"
  echo
else
  echo
  echo "FATAL: Failed to build MAUS"
  echo
  exit 1;
fi

echo
echo "INFO: Testing the unpacker"
echo

if python src/input/InputCppDAQOfflineData/test_InputCppDAQOfflineData.py; then
  echo
  echo "INFO: Unpacker changed successfully"
  echo
else
  echo
  echo "FATAL: Unpacker test failed"
  echo
  exit 1;
fi