2# ------------------------------------------------------------------------------------------
4# Example script to run the JPP DAQ Context for DOM Testing
7#This script originally was authored by R. Bruijn, contributors: L. Nauta, K. Graf
10#To run stand-alone, try
11#./JDOMDAQDriver.sh 60 192.16.192.179(180) $TMP_DIR some_detfile.detx
12# ------------------------------------------------------------------------------------------
13#Setting Singularity environment
14shopt -s expand_aliases
15if [ -z $SINGULARITY_PATH ] || [ -z $SINGULARITY_JPP_FILE ]; then
16 echo "Please export the environment variables SINGULARITY_PATH and SINGULARITY_JPP_FILE"
20JPP_BIN_LIST=$(singularity exec $SINGULARITY_PATH/$SINGULARITY_JPP_FILE bash -c 'export JPP_BIN_LIST=`ls -1 /Jpp/out/Linux/bin` && echo $JPP_BIN_LIST' | tail -n1)
22for i in ${JPP_BIN_LIST}; do
23 alias $i="singularity exec -B $HOME $SINGULARITY_PATH/$SINGULARITY_JPP_FILE $i"
25#command line arguments
26RUNTIME_S=$1 #Run duration in seconds
27IP=$2 #IP address of the machine
28DIR=$3 #location where the datafile is written
29DETECTOR=$4 #location of the detector file
31#settings for data filter and data queue
45#--------------------------------------------------------------
46#check that detector file exists and that previous data file has been removed
47#--------------------------------------------------------------
49if [ -f $DETECTOR ] ; then
50 echo "$0: Found detector file $DETECTOR"
52 echo "ERROR: could not find detector file $DETECTOR."
56if [ -f $DIR/KM3NeT_00000001_00000000.root ] ; then
57 echo "The file $DIR/KM3NeT_00000001_00000000.root already exists, please rename or remove it first, then restart this script"
62 JLigier-local.sh start
65#--------------------------------------------------------------
66#configure datafilter, data queue (magic)
67#--------------------------------------------------------------
69cat>ev_configure_dfilter_dqdf.txt<<EOF
70numberOfFramesPerSlice = 1;
71dataWriter = ${DATAWRITER}
72detector = %<${DETECTOR}>%;
73triggerParameters = trigger3DMuon.enabled = 0;
74triggerParameters = trigger3DShower.enabled = 0;
75triggerParameters = writeSummary = 1;
76triggerParameters = writeTimeslices = 1;
77bufferSize = 536870912;
81cat>ev_configure_dqueue_dqdf.txt<<EOF
82timeslice_duration=100;
85dump_file_prefix=dump_;
86dump_file_postfix=.dqd;
89opto_recipients=127.0.0.1:5556;
90acou_recipient=127.0.0.1:5800;
97process DataQueue $DATAQUEUE "DataQueue -u \$NAME\$ -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG -o -a </dev/null >&/dev/null &";
98process JDataWriter $DATAWRITER "JDataWriter -u \$NAME\$ -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG </dev/null >&/dev/null &";
99process JDataFilter $DATAFILTER "JDataFilter -u \$NAME\$ -P $PORT -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG </dev/null >&/dev/null &";
104event ev_init { RC_CMD }
106 RC_DQUE %<ev_configure_dqueue_dqdf.txt>%
107 RC_DFLTR %<ev_configure_dfilter_dqdf.txt>%
108 RC_DWRT path=$DIR; update_s=10; logger_s=5;}
110event ev_start { RC_CMD $RUN 1 }
114event ev_pause { RC_CMD }
115event ev_stop { RC_CMD }
116event ev_reset { RC_CMD }
117event ev_off { RC_CMD }
123 JDAQDriver -H $SERVER -M $LOGGER -d $DEBUG -t $TIMEOUT_S -f driver.txt -c