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)
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
31 #settings for data filter and data queue
45 #--------------------------------------------------------------
46 #check that detector file exists and that previous data file has been removed
47 #--------------------------------------------------------------
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
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 &";
106 RC_DQUE %<ev_configure_dqueue_dqdf.txt>%
107 RC_DFLTR %<ev_configure_dfilter_dqdf.txt>%
123 JDAQDriver -
H $SERVER -
M $LOGGER -
d $DEBUG -t $TIMEOUT_S -
f driver.txt -c
then usage $script[port]< option > nPossible restart fi case set_variable OPTION set_variable PORT
then JLigiers sh continue fi cat driver txt<< EOFprocess dfilter $HOST1 ssh\$HOST\$"JDataFilter -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG &";enterevent ev_init{RC_CMD%< ev_init.txt > from me< ev_init.txt > event ev_configure
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null if do_usage *then usage $script fi SERVER
static const double H
Planck constant [eV s].
do echo Generating $dir eval DIR
then usage $script< string identifier >< detectorfile > input file(toashort file)+" "\nNote that the input files and toashort files should be one-to-one related." fi if (( $
then echo Please export the environment variables SINGULARITY_PATH and SINGULARITY_JPP_FILE exit fi JPP_BIN_LIST
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable SERVER localhost define_variable LOGGER if do_usage *then usage $script[host[local file]] fi case set_variable LOGGER
do cat driver txt<< EOFevent ev_configure{RC_EVT%< ev_configure.txt > RC_DWRT path
then cat ev_configure txt<< EOFdatawriter=$DWRITER_HOST;inputFile=$INPUT_FILE;eventRate_Hz=100.0;EOFfiif[[!-f driver.txt]];thencat > driver txt<< EOFprocess JEventGenerator $HOST ssh\$HOST\$"$JPP_BIN/JEventGenerator -u \$NAME\$ -H \$SERVER\$ -M \$LOGGER\$ -d $DEBUG </dev/null >& dev null& process JDataWriter $HOST ssh $HOST $JPP_BIN JDataWriter u $NAME H $SERVER M $LOGGER d $DEBUG</dev/null >& dev null& enter event ev_init
then rm i $OUTPUT_FILE fi let RUN
then error Missing CDF files error Run
esac for TAG in RC_CMD RC_DOM RC_EVT RC_DWRT RC_DFLTR RC_DQUE
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
then set_variable MODULE getModule a $DETECTOR L $STRING $FLOOR JEditDetector a $DETECTOR M $MODULE add $X o $DETECTOR else echo No update of detector $DETECTOR
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
static const JNET::JTag RC_CMD
do set_variable DETECTOR_TXT $WORKDIR detector
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in