Skip to content

Latest commit

 

History

History
393 lines (384 loc) · 12.8 KB

File metadata and controls

393 lines (384 loc) · 12.8 KB

MIDAS

1 Install

This is based on the new install instructions on the TRIUMF website

1.1 Environment

Make sure you have something like the following set in .bashrc

## MIDAS
export MIDASSYS=/home/daq/midas/packages/midas
export PATH=$PATH:$MIDASSYS/bin
export MIDAS_EXPTAB=/home/daq/midas/online/exptab
export MIDAS_EXPT_NAME=v785
export ROOTANASYS=/home/daq/midas/packages/rootana

1.2 Prerequisites

  • Everything in the standard install
  • apache2-utils

1.3 Package installation

  • Get the source
    cd ~
    mkdir -p midas/packages
    cd midas/packages
    git clone https://bitbucket.org/tmidas/midas --recursive
    cd midas
        
  • Checkout a release version
    git checkout release/midas-2020-08
    git submodule update --init --recursive
        
  • Build midas
    mkdir build
    cd build
    cmake ..
    make
    make install
        
  • Rootana is needed
    cd $HOME/midas/packages
    git clone https://bitbucket.org/tmidas/rootana
    cd rootana
        
    • Rootana needs -fPIC to work with EngeSpec
    • Edit Makefile to include -fPIC in the CXXFLAGS definition at the top
    • compile (without ROOT support)
    make NO_ROOT=1
        
  • Install JSROOT just in case we need it (for browser views of root files)
    cd $HOME/midas/packages
    git clone https://github.com/linev/jsroot.git
        

1.4 Setting up experiment structure

  • See if the exptab file below already exists. make sure it looks like the 5th line below:
    cd
    mkdir midas/online
    cd midas/online
    cat > exptab
      v785 /home/daq/midas/online/ daq
        

    (Press ctrl-c to exit the cat command)

  • Make the directory structures (data is a link to the storage partition)
    cd ~/midas/online
    mkdir -p /data/midas/data
    ln -s /data/midas/data data
    mkdir elog
    mkdir history
    mkdir src
        
  • To separate experiments I like to create a link in the data directory (see below for more)
    cd /data/midas/data
    mkdir TestExperiment
    ln -s TestExperiment v785
    ls -l
        
  • Test the system
    odbedit
    ls
        

    You should see the following:

    [local:v785:S]/>ls
    Experiment                      
    System                          
    Programs                        
    Logger                          
    Runinfo                         
    Alarms                          
    [local:v785:S]/>
        

    Press ctrl-c to exit

1.5 Download the Enge MIDAS DAQ

  • The DAQ is already written (probably with some improvements that should be made)
    cd $HOME/midas/online/src
    git clone https://github.com/TUNL-Enge/MIDAS-v785.git v785
    cd v785
    make clean
        
  • With the new version of MIDAS, some work need to be done to get the DAQ working. The following command may fail
    make
        

    If so, see: https://midas.triumf.ca/MidasWiki/index.php/Changelog#Upgrade_guide

  • The corrected version is on the c++ branch:
    git checkout c++
    make clean
    make
        

1.6 Password security

  • Run the httpd server
    mhttpd
        
  • The first time you run the MIDAS http server it’ll give you some errors. Do what it tells you:
    cd $MIDASSYS
    openssl req -new -nodes -newkey rsa:2048 -sha256 -out ssl_cert.csr -keyout ssl_cert.key -subj "/C=/ST=/L=/O=midas/OU=mhttpd/CN=localhost"
    openssl x509 -req -days 365 -sha256 -in ssl_cert.csr -signkey ssl_cert.key -out ssl_cert.pem
    cat ssl_cert.key >> ssl_cert.pem
        
  • Try again mhhtpd and do what it tells you (almost! - but put the password somewhere else and use the daq user
    touch /home/daq/midas/online/htpasswd.txt
    htdigest /home/daq/midas/online/htpasswd.txt v785 daq
        

    Use the usual daq password when prompted

  • Try one more time! mhttpd You should now be able to open a browser and go to localhost:8080 (feel free to tell the browser you trust the website!)

1.7 Logger

This saves the data! So make sure it works and then tell MIDAS that it’s absolutely needed!

mlogger

Check for errors

  • Set up MIDAS to make sure mlogger is always running
    1. Start the http server: mhttpd
    2. In a browser, go to localhost:8080
    3. From MIDAS page go to “ODB” -> “Programs” -> “Logger”
    4. Set Required to “y”, Start Commant to “mlogger -D”, Alarm class to “Alarm”

1.8 Test the demo frontend

  • Go to the v785 source directory, make sure everything compiles
    cd ~/midas/online/src/v785
    make
    ls -ltr
        

    One of the recent files should be fedemo

  • There should be a shell script that starts MIDAS with this demo. It should look something like:
    #!/bin/sh
    
    export MIDAS_EXPT_NAME='v785'
    
    # First make sure the DAQ is stopped
    ./kill_daq.sh
    
    # Clean the ODB (Online DataBase)
    odbedit -c clean
    
    # Start the logger, which does the saving of information
    mlogger -D
    sleep 2     
    
    # Start the web control
    mhttpd -D -a localhost 
    
    # Start the analyser
    konsole -e ./analyzer&
    
    make clean
    make fedemo
    konsole -e ./fedemo&
    #end file
        
  • Try running that: ./start_demo.sh Several windows should open!
  • The first time it’s run you’ll see some analyzer errors about a missing “last.root” file. Don’t worry about that!
  • Open the web browser at localhost:8080. Look to make sure everything works. Try starting and stopping a run. The demo runs at about 100 Hz.

2 Switching over to MIDAS from NSCLDAQ

2.1 Hardware

  • Take veto (O1) out of VM-USB module in VME crate
  • Plug the twisted pair cable into busy of ADC (red on bottom)

2.2 Software

2.2.1 General Notes <<StorageLinks>>:

  • Data is saved in /home/daq/midas/online
    • link points to /data/midas/data
  • Run files saved at v785 (symbolic link)
  • v785 points to specific directory (eg. /2017-11-14_DAQTests)
  • Actual DAQ code is in /home/daq/midas/online/src/v785
    • ‘v785’ is the experiment name

2.2.2 Starting the DAQ

  • See what experiment is active
    echo $MIDAS_EXPT_NAME
        
  • If it’s not ‘v785’, do this:
    export MIDAS_EXPT_NAME=v785
        
  • Move into the experiement directory
    cd /home/daq/midas/online/src/v785
        
  • To start the DAQ
    ./start_daq.sh
        

    The analyzer should pop up (there may be a couple of errors but ignore them)

  • Open google chrome
    • Click on MIDAS bookmark
    • If there’s an error about security, go to Advanced -> proceed anyway
    • Username: daq
    • Password: the usual ;)
    • Click on “EngeRun” to go to the Enge-specific run page
    • Logger and analyzer should be green
    • Click on “ODB” at the top
    • Click on “Run info”
    • Click on “Run Number”, set to zero if this is a new experiment
  • Start the frontend
    • In a terminal, open a new window or tab
	cd /home/daq/midas/online/src/v785
	./sync
	ssh engesbc
	cd midas/online/src/v785
	make clean
	make
	./start_fe.sh

You should see a bunch of things in the terminal that make it look like everything’s working (running clock, run status, etc.)

  • “Frontend” should now be green in browser
  • Start the root analyzer
    • Go to the original terminal
	cd rootana
	./anaDistplay.exe
  • Close the graph window that opened
  • Resize the other window (silly fix for window wize issues)
  • “Root Analyzer” should now be green in browser

2.2.3 Quit the DAQ

  • Quit root analyzer by pressing the “quit” button
  • Go to src/v785 directory
    ./kill_daq.sh
        
  • F5 on webpage should show that it disappeared

3 Single-board Computer

3.1 Setup SBC

  • Do a fresh install of CentOS 7
  • Somehow connect it to the internet (I used a wifi dongle and the CraneLabWireless)
  • Do the following commands
    yum update
    yum groupinstall 'Development Tools'
    yum install epel-release
    yum install cmake3 kernel-devel kernel-headers openssl-devel sqlite-devel
    ln -s /usr/bin/cmake3 /usr/bin/cmake
        
  • Reboot to use the correct kernel

3.2 Install MIDAS

  • This is a simplified version of the instructions above, but only install what’s needed on the SBC
    cd ~
    mkdir -p midas/packages
    cd midas/packages
    git clone https://bitbucket.org/tmidas/midas --recursive
    cd midas
        
  • Checkout a release version (the same version as on the DAQ machine)
    git checkout midas-2020-08-a
        
  • Build midas
    mkdir build
    cd build
    cmake ..
    make
    make install
        
  • Put the following in ~~/.bashrc~
    ## MIDAS
    export MIDASSYS=/home/daq/midas/packages/midas
    export PATH=$PATH:$MIDASSYS/bin
    export MIDAS_EXPTAB=/home/daq/midas/online/exptab
    export MIDAS_EXPT_NAME=v1730
    #export ROOTANASYS=/home/daq/midas/packages/rootana
    
    export MIDAS_SERVER_HOST=10.0.0.1:1175
        

3.3 Install the VME modules

  • Based on instructions in https://daq.triumf.ca/DaqWiki/index.php/VME-CPU#V7865_and_XVB-602_:_Setup_gefvme.2Ftsi148_VME_drivers
    git clone https://ladd00.triumf.ca/~olchansk/git/kernel-module-gefvme.git
    cd kernel-module-gefvme
    make
    sudo make install
    sudo sh /etc/rc.local
    dmesg 
        
  • If this worked properly, dmesg should show some stuff about
    [   18.703633] tsi148: VME master control register VMCTRL: 0x00000003
    [   18.703637] tsi148: VME control register         VCTRL: 0x00000008
    [   18.703641] tsi148: VME status register          VSTAT: 0x00000100
    [   18.703644] tsi148: DMA channel 0 status: 0x02000000
    [   18.703648] tsi148: DMA channel 1 status: 0x02000000
    [   18.703651] tsi148: Interrupt enable register     INTEN: 0x03ff20fe
    [   18.703655] tsi148: Interrupt enable out register INTEO: 0x03ff20fe
    [   18.703658] tsi148: Control and status register   GCTRL: 0x10000001
        
  • Make sure that runs on boot
    sudo chmod +x /etc/rc.d/rc.local
        
  • Reboot and check dmesg again
  • Install the test software
    cd ~/midas/packages
    svn checkout https://ladd00.triumf.ca/svn/daqsvn/trunk/vme # username svn, password svn
    cd vme
    make -k # some programs will fail to build, this is expected.
        
  • Run test software
    ./vmescan_gef.exe
        

3.4 Finish setting up the network

(This may be a little trial and error)

  • Edit the network using nmtui
    • I’m editing port enp9s0
    • IP4 Configuration = <Manual>
    • Address = 10.0.0.5/24
    • Make sure Automatically Connect and Available to all users are checked
  • Edit the hostname: sudo vi /etc/hostname
    engesbc
        
  • Edit the hosts: sudo vi /etc/hosts
    127.0.0.1   localhost 
    127.0.0.1   engesbc
    10.0.0.1    engedaq-dev
        
  • Make sure the firewall is set up as expected
    sudo firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="10.0.0.1/32" port protocol="tcp" port="0-65535" accept"
    sudo firewall-cmd --reload
    sudo firewall-cmd --list-all
        
  • Reboot

3.5 Test the MIDAS works

  • Copy a frontend over (eg /midas/online/src/v785)
  • Make sure it compiles
    cd ~/midas/online/src/v785
    make clean
    make
        
  • Make sure the connection works
    odbedit
        
  • Troubleshoot!