Instructions for installing NCSL's DAQ

public

 

Prerequisites

General

  • build-essential

  • openssh-server

  • magit

  • libgsl0-dev

  • subversion

nscldaq

  • swig2.0 (swig in debian)

  • gengetopt

  • tcl8.5-dev # defaults to tcl8.6 in ubuntu

  • tk8.5-dev # defaults to tk8.6 in ubuntu

  • libtk (tklib in debian) # these give runtime errors if not present

  • libtcl (tcllib in debian)

  • libcppunit-dev # no errors in configure about this but it's needed!

  • ftpd

  • rsh-server

  • rsh-client

  • libusb-dev

  • tcllib

  • tklib

spectcl

  • libmotif-dev (liblestif2-dev in debian)

  • imagemagick

  • libgd-dev (libgd2-xpm-dev in debian)

  • byacc # build error about yacc

  • flex

  • bison

  • gri

  • libtk-img-dev

  • itcl3-dev

  • itk3-dev

  • iwidgets4

  • bwidget

  • blt-dev

  • libxt-dev

General

  • Install in /usr/opt/

  • DO NOT TRY ANYTHING ELSE! There are some hard coded references in the code to this directory so it's just not worth your troubleā€¦

  • Build everything as root

    • sudo su -
    • cd /usr/src/
    • mkdir NSCLDAQ
    • mkdir SpecTcl

For NSCLDAQ

  • http://sourceforge.net/projects/nscldaq/

  • I'm using Version 10.2.108

  • By the way, if you screw up in here, make sure you make clean and remove any installed files before trying again!

  • Download to NSCLDAQ directory and untar (tar -xzvf nscldaq-10.2-108.tar.gz)

  • cd nscldaq-10.2-108

  • Compile

    • ./configure --prefix=/usr/opt/nscldaq/nscldaq-10.2-108 --enable-usb
    • make
    • make install
    • ln -s /usr/opt/nscldaq /usr/opt/daq

For SpecTcl

  • http://sourceforge.net/projects/nsclspectcl/

  • I'm using Version SpecTcl-3.3-016

  • Download to NSCLDAQ directory and untar (tar -xzvf SpecTcl-3.3-016.tar.gz)

  • cd SpecTcl-3.3-016

  • ./configure --prefix=/usr/opt/spectcl/SpecTcl-3.3-016
    --with-tcl-libdir=/usr/lib/x86_64-linux-gnu/

  • make

  • Touch some files to avoid errors in documentation

    • touch ccusb/dummy.html
    • touch vmusb/dummy.html
  • make install

Set up some "current" links

  • ln -s /usr/opt/nscldaq/nscldaq-10.2-108 /usr/opt/nscldaq/current

  • ln -s /usr/opt/spectcl/SpecTcl-3.3-016/ /usr/opt/spectcl/current

Post-install

  • Log out of root

    • exit
    • cd
  • Do "the ssh trick"

    • ssh localhost
    • Answer "yes"
    • Enter password to log in, then exit to log out
    • ssh-keygen and don't use a password (choose all defaults)
    • cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  • Find the nscldaq file in the source directory

    • mkdir -p /home/daq/Live
    • cp /usr/src/NSCLDAQ/nscldaq-10.2-108/nscldaq ~/NSCLDAQ
    • Edit the nscldaq file (This has all been done and the file is in /home/daq/NSCLDAQ/PostInstallFiles)

      • Make DAQHOME=/usr/opt/nscldaq/current
      • Fix the bash script to make == into =
      • Make PIDFILEDIR=/home/daq/Live
      • Make sure ~PORTMGRSWITCHES=""~
    • Make it executable: chmod u+x nscldaq

    • sudo ./nscldaq start

    • sudo ./nscldaq status

    • sudo ./nscldaq stop

    • sudo ./nscldaq status

  • Copy this file into /etc/init.d/

  • Link in runlevels so that it starts on boot
    sudo update-rc.d nscldaq defaults

  • ls /etc/rc2.d/ (You should see it in there somewhere)

  • Reboot and check if it's running
    sudo /etc/init.d/nscldaq status
    or
    ps aux | grep DaqPortManager
    ps aux | grep RingMaster

Environment

  • In .bashrc put the following (my version is in PostInstallFiles)

    • export HOMEDIR=$HOME
    • export NSCLBASE=$HOME
    • export DISTDIR=/usr/opt/applications
    • export BinDir=$HOMEDIR/bin
    • export DAQHOST=localhost
    • export SSHTARGET=localhost
    • export INSTROOT=/usr/opt/nscldaq/current
    • ~export TCLLIBPATH="$TCLLIBPATH $INSTROOT/lib $INSTROOT/Scripts $INSTROOT/TclLibs"~
    • export PATH=$PATH:/usr/opt/nscldaq/current/bin:/usr/opt/spectcl/current/bin:~/bin
  • There are some files needed in ~/bin. I'll put these in /home/daq/NSCLDAQ/PostInstallFiles/bin

    • Menu
    • startCfd
    • startReadout
    • startScaler
    • startSpecTcl
  • Put the Menu application in /usr/opt/applications.
    I've put it in /home/daq/NSCLDAQ/PostInstallFiles/menu

    • sudo mkdir /usr/opt/applications
    • sudo cp -r /home/daq/NSCLDAQ/PostInstallFiles/menu /usr/opt/applications/
  • Make an event directory and link it

    • mkdir ~/events
    • ln -s ~/events ~/stagearea

Bin files

These files are all found in /home/daq/NSCLDAQ/PostInstallFiles/bin/

  • Menu

    • A simple bash script to run the menu application
    • wish $DISTDIR/menu/Menu.ui.tcl &
  • startReadout

    • Make sure this points at
    • /usr/opt/nscldaq/current/bin/ReadoutShell
    • with -host=localhost
    • and -path=/usr/opt/nscldaq/current/bin/VMUSBReadout
  • startScalers

    • Make sure this points at
    • /usr/opt/nscldaq/current/bin/ScalerDisplay
    • Read the settings from /config/scalerConfig.tcl
  • startSpecTcl

    • This one points at SpecTcl run file
    • cd into the script directory
      cd ~/config
    • exec /usr/opt/spectcl/current/bin/VMUSBSpecTcl </dev/null &

Setup Experiment

  • The setup is in ~/config

  • Copy this from /home/daq/NSCLDAQ/PostInstallFiles/config/

  • Do the same for the spectcl directory

    • cp /home/daq/NSCLDAQ/PostInstallFiles/spectcl /home/daq/

Running with USB

  • Users need access to the USB device. If you get an error that looks like
    CTheApplication caught a string exception: usb_get_string_simple failed in CVMUSBusb::serialNo

It's probably because the user does not have USB access.

  • First check that the VM-USB card is found by:

    • Run tail -f /var/log/syslog
    • Unplug and replug the USB cable
  • Some udev rules need to be set

    • Edit /etc/udev/rules.d/90-usb.rules

      SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",   MODE="0666"
      
    • NOTE: This is slightly different from the usb_device subsystem used in previous versions

    • This will allow users to read and write to the usb device

  • If this doesn't work

    • First try changing 90 to 95 in the filename above. No need to reboot, just unplug and replug the USB cable
    • here are some useful testing utilities
    • Find the device (not simply /dev/usb0 as in old linux kernels)

      • In Ubuntu, do the following. In debian, you need to figure out which device to use some other way!
      • less /var/log/udev
      • Look for VM-USB
      • eg. DEVNAME=/dev/bus/usb/002/004
      • Use this DEVNAME in the commands below
    • Read all of the attributes of this device with
      udevadm info -a -n /dev/bus/usb/002/004

    • Test the udev rules as you edit them with
      udevadm test $(udevadm info -q path -n /dev/bus/usb/002/004) 2>&1

    • You should see the /etc/udev/rules.d/90-usb.rules get sourced and the permissions of the device get set to "0666"