Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JDOMDAQDriver.sh
Go to the documentation of this file.
1#!/bin/bash
2# ------------------------------------------------------------------------------------------
3#
4# Example script to run the JPP DAQ Context for DOM Testing
5#
6#
7#This script originally was authored by R. Bruijn, contributors: L. Nauta, K. Graf
8#
9#
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"
17 exit 1
18fi
19
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)
21
22for i in ${JPP_BIN_LIST}; do
23 alias $i="singularity exec -B $HOME $SINGULARITY_PATH/$SINGULARITY_JPP_FILE $i"
24done
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
30
31#settings for data filter and data queue
32DEBUG=3
33RUN=0
34TIMEOUT_S=5
35
36SERVER=$IP
37LOGGER=$IP
38
39DATAFILTER=$IP
40DATAWRITER=$IP
41DATAQUEUE=$IP
42
43PORT=5556
44
45#--------------------------------------------------------------
46#check that detector file exists and that previous data file has been removed
47#--------------------------------------------------------------
48
49if [ -f $DETECTOR ] ; then
50 echo "$0: Found detector file $DETECTOR"
51else
52 echo "ERROR: could not find detector file $DETECTOR."
53 exit 1
54fi
55
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"
58 exit
59fi
60
61if (( 0 )); then
62 JLigier-local.sh start
63fi
64
65#--------------------------------------------------------------
66#configure datafilter, data queue (magic)
67#--------------------------------------------------------------
68
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;
78EOF
79
80
81cat>ev_configure_dqueue_dqdf.txt<<EOF
82timeslice_duration=100;
83run_start_time=0;
84max_dump_size=0;
85dump_file_prefix=dump_;
86dump_file_postfix=.dqd;
87opto_ports=56015;
88acou_ports=56016;
89opto_recipients=127.0.0.1:5556;
90acou_recipient=127.0.0.1:5800;
91EOF
92
93
94
95cat>driver.txt<<EOF
96
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 &";
100
101
102enter
103
104event ev_init { RC_CMD }
105event ev_configure {
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;}
109
110event ev_start { RC_CMD $RUN 1 }
111
112sleep $RUNTIME_S
113
114event ev_pause { RC_CMD }
115event ev_stop { RC_CMD }
116event ev_reset { RC_CMD }
117event ev_off { RC_CMD }
118
119EOF
120
121if (( 1 )); then
122
123 JDAQDriver -H $SERVER -M $LOGGER -d $DEBUG -t $TIMEOUT_S -f driver.txt -c
124
125fi