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