forked from sPHENIX-Collaboration/rcdaq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
67 lines (40 loc) · 1.8 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#! /bin/sh
# the following line identifies this script as one to be
# listed in the configuration GUI
# --RCDAQGUI
# lines starting with the "--SC" tag are short comments
# (can be only one, later ones override earlier ones)
# --SC Top Level setup script with a random device
# lines starting with the "--SC" tag are long comments
# --LC This setup script is part of the RCDAQ distribution.
# --LC It uses the random device (i.e. no particular hardware)
# --LC and can run on any machine to give RCDAQ a spin.
# --LC It can serve as a template to develop your own setups.
# we need the $0 as absolute path b/c we pass it on to a "file" device further down
D=`dirname "$0"`
B=`basename "$0"`
MYSELF="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B"
# we figure out if a server is already running
if ! rcdaq_client daq_status > /dev/null 2>&1 ; then
echo "No rcdaq_server running, starting... log goes to $HOME/rcdaq.log"
rcdaq_server > $HOME/rcdaq.log 2>&1 &
sleep 2
# see if we have an elog command (ok, this is a weak test but
# at least it tells us that elog is installed.)
ELOG=$(which elog 2>/dev/null)
[ -n "$ELOG" ] && rcdaq_client elog localhost 666 RCDAQLog
rcdaq_client daq_webcontrol 8899
fi
# remember this is an executable script. We
# have the full power of a shell script at our
# fingertips.
rcdaq_client daq_clear_readlist
# we add this very file to the begin-run event
rcdaq_client create_device device_file 9 900 "$MYSELF"
# make the first randown device trigger enabled
rcdaq_client create_device device_random 1 1001 64 0 4096 1
rcdaq_client create_device device_random 1 1002 32 0 2048
# we add some artificial deadtime to slow down a bit
rcdaq_client create_device device_deadtime 1 0 20000
rcdaq_client daq_list_readlist
rcdaq_client daq_status -l