Overview of tracker DAQ code

Quick overview

The gm2-tracker-readout-daq repository contains code for the g-2 straw tracker DAQ system. The core of the DAQ system is a sequence of nested hardware controllers controlled by a state machine. This DAQ system is run and controlled by a top-level run controller, which in the nominal use case is invoked by a MIDAS frontend end. The human interface in this sytem is then via the MIDAS DAQ system.

The interface between software and hardware is achieved using the IPBus tool suite.

In addition to the MIDAS system, more basic python scripts and a GUI are available for running the DAQ.

The repo also includes emulators for the DAQ hardware which allow the DAQ system to be executed on emulated hardware if no real hardware is available. See here for more details.

Repository contents

The top-level directory ($GM2_TRACKER_DAQ_DIR) structure is:

  • cactus - contains ipbus firmware files
  • hardware - contains tracker DAQ firmware files
  • midas - contains the straw tracker MIDAS experiment
    • Distinct from MIDAS system (gm2midas) and common g-2 frontends, event builder, etc (gm2daq)
  • software - contains the tracker DAQ, DQM, analysis and simulation software

Software directory contents

The directory in the software directory ($GM2_TRACKER_DAQ_SW) is:

  • bin - contains executables, scripts etc
  • cfg - contains configuration files, including XML config files for DAQ SW and IPBus
  • dep - contains generated make targets based on dependency scans
  • dict - contains ROOT dictionary files generated in DQM builds
  • include - contains header files (C++)
  • lib - contains libraries
  • obj - contains compiled object files
  • src - contains source files (C++, python)

In general, all the work a developer will do will be in src and include.

Within src and include the code is organised mainly in the following directories:

  • Becoming deprecated as we move to the main g-2 offline SW (gm2tracker)
  • daq
    • Core online DAQ code (hardware controllers, IPBus interfaces, etc)
    • Classes named like XXXController (e.g. GLIBController) control specific tasks or pieces of hardware, and are nested in a hierarchical fashion such that state machine commands at the top-level propagate throughout all controllers
    • The top level class controlling the DAQ system is DAQController (configuration file DAQConfig.xml), this dynamically instantiates controllers for the HW in the DAQ system (e.g. GLBs and TDCs, and soon the logic board)
    • RunController (configuration file RunConfig.xml) is the top level controller of the run system, it creates the DAQController and handles run-based input like logger level, etc, and handles the interface between the MIDAS-style state machine (BOS,EOS,etc) and the lower-level HW state machine (CONFIGURE,START,STOP,etc)
    • Free of MIDAS dependencies so that can run DAQ with python GUI instead if desired
  • midas
    • Straw MIDAS frontend and helper functions, plus MIDAS-ROOT data converter
    • Largely just wraps behaviour of daq directory classes so that they can run in MIDAS
  • data
    • Data structures and data handling classes for straw tracker DAQ data
    • Abstract banks (separated from MIDAS-specific banks) used to read and buffer raw data from GLIB
    • Specific classes defining TDC data structure (raw TDCDataRaw and unpacked TDCDataProcessed) provided, along with unpacking functions (TDCDataManager)
    • Currently out of date, ignore for now
  • emulator
    • Tracker DAQ system emulator (emulated GLIBs and TDCs to allow DAQ to be run without hardware)
    • Mirrors controller system in daq directory with an emulator for each hardware controller
  • general
    • Common utilities such as logging, error handling, etc
  • mtest
    • Code relating to MTest detectors developed during 2014 test beams
  • SiDet
    • MIDAS FE and MIDAS-ROOT data converter for Liverpool Silicon telescope
  • test
    • Suite of python unit tests
    • GUIs and scripts for running the straw DAQ
    • GUIs and scripts connecting to an IPBus device
  • LowVoltage
    • Python scripts for communicating with the low voltage hardware
  • SlowControls
    • Python scripts for communicating with the logic board over the slow control link
  • dqm
    • Data Quality Management system
    • Currently out of date, soon to be populated with ROME experiment
  • analysis
    • Offline analysis code for straw DAQ data
    • Gradually being replaced with code in the offline SW environment (gm2tracker)
  • sim
    • Simulations written relating to the straws (GARFIELD straw model, 2014 test beam simulation, simplified fast ring simulation for quick EDM studies)
    • 2015 test beam simulations and analysis being developed separately in the g-2 offline SW environment (gm2tracker)

There are also many .cc files in the top-level src directory that contain main functions. Most of these are deprecated now and will be removed soon.

Tracker DAQ code

The following is a summary of key elements of the tracker DAQ software code:

    • Top-level run control for straws
    • Accepts BOR, BOS, EOS, EOR and SHUTDOWN commands
    • Top-level controller for straw DAQ hardware
    • Highest level of system of nested controllers for hardware (also have GLIB and TDC controllers)
    • Accepts CONFIGURE, START, STOP and SHUTDOWN commands
  • $GM2_TRACKER_DAQ_SRC/midas/
    • The MIDAS frontend for the straws DAQ
    • Essentailly a MIDAS frontend IF to RunController state machine
  • $GM2_TRACKER_DAQ_SRC/midas/strawsMidasToRoot.cpp
    • Analyzer to convert MIDAS output data files (.mid) to ROOT files
    • Soon to be repalced with midas2art
    • Wrapper for IPBus read/write functionality and connection handling for a single SW <-> device connection
    • One instantiated per GLIB