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
 
   14 shopt -s expand_aliases
 
   15 if [ -z $SINGULARITY_PATH ] || [ -z $SINGULARITY_JPP_FILE ]; then
 
   16   echo "Please export the environment variables SINGULARITY_PATH and SINGULARITY_JPP_FILE"
 
   20 JPP_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)
 
   22 for i in ${JPP_BIN_LIST}; do
 
   23     alias $i="singularity exec -B $HOME $SINGULARITY_PATH/$SINGULARITY_JPP_FILE $i"
 
   25 #command line arguments
 
   26 RUNTIME_S=$1         #Run duration in seconds
 
   27 IP=$2                #IP address of the machine
 
   28 DIR=$3               #location where the datafile is written
 
   29 DETECTOR=$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 #--------------------------------------------------------------
 
   49 if [ -f $DETECTOR ] ; then
 
   50   echo "$0: Found detector file $DETECTOR"
 
   52   echo "ERROR: could not find detector file $DETECTOR."
 
   56 if [ -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 #--------------------------------------------------------------
 
   69 cat>ev_configure_dfilter_dqdf.txt<<EOF
 
   70 numberOfFramesPerSlice = 1;
 
   71 dataWriter             = ${DATAWRITER}
 
   72 detector               = %<${DETECTOR}>%;
 
   73 triggerParameters      = trigger3DMuon.enabled   = 0;
 
   74 triggerParameters      = trigger3DShower.enabled = 0;
 
   75 triggerParameters      = writeSummary            = 1;
 
   76 triggerParameters      = writeTimeslices         = 1;
 
   77 bufferSize             = 536870912;
 
   81 cat>ev_configure_dqueue_dqdf.txt<<EOF
 
   82 timeslice_duration=100;
 
   85 dump_file_prefix=dump_;
 
   86 dump_file_postfix=.dqd;
 
   89 opto_recipients=127.0.0.1:5556;
 
   90 acou_recipient=127.0.0.1:5800;
 
   97 process  DataQueue        $DATAQUEUE   "DataQueue -u \$NAME\$  -H \$SERVER\$  -M \$LOGGER\$  -d $DEBUG -o -a </dev/null >&/dev/null &";
 
   98 process  JDataWriter      $DATAWRITER  "JDataWriter  -u \$NAME\$  -H \$SERVER\$  -M \$LOGGER\$  -d $DEBUG  </dev/null >&/dev/null &";
 
   99 process  JDataFilter      $DATAFILTER  "JDataFilter  -u \$NAME\$  -P $PORT  -H \$SERVER\$  -M \$LOGGER\$ -d $DEBUG </dev/null >&/dev/null &";
 
  104 event 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;}
 
  110 event ev_start     { RC_CMD $RUN 1 }
 
  114 event ev_pause     { RC_CMD }
 
  115 event ev_stop      { RC_CMD }
 
  116 event ev_reset     { RC_CMD }
 
  117 event ev_off       { RC_CMD }
 
  123   JDAQDriver -H $SERVER -M $LOGGER -d $DEBUG -t $TIMEOUT_S -f driver.txt -c