What is midas
Midas is a framework for data acquisition (DAQ) in physics experiments. This page explains what a DAQ system does, what you need from a DAQ framework, and how midas provides it.
DAQ 101
If you already know about DAQ systems, skip to Midas 101.
In physics, a DAQ system turns the signals from a detector into data on disk that can be analysed. Electronics (amplifiers, discriminators, digitisers, timing and counting modules etc.) turn the signals into numbers. Software then reads these numbers from the electronics and does everything else.
Some ideas are common to almost every experiment:
- Trigger: detectors produce signals all the time, so data is usually only read out when something interesting happens. The trigger can come from the detector signals themselves (e.g. two channels firing at the same time), or from outside (e.g. a beam or laser pulse). Some large experiments don't use a trigger, and read out everything.
- Event: all the data that belongs together, e.g. everything read out for one trigger. An event often combines data from many devices.
- Run: a period of data-taking with fixed conditions, such as the detector voltages, the position of a calibration source or the beam energy. Each run has a number, and its data is kept separately.
- Slow control: the control and monitoring of things that change slowly, such as high voltages, temperatures and pressures. Their values need to be recorded alongside the main data from the detectors.
What you need from a DAQ framework
Any non-trivial experiment needs custom DAQ software, to talk to its particular hardware. A DAQ framework provides everything around that, so that you only have to write the parts that are specific to your experiment:
| You need to… | Midas provides |
|---|---|
| Read data from many types of hardware | Frontends, written in C++ or Python. Midas includes drivers for common devices, and there are community contributions for many more |
| Configure the devices, and know later how they were configured | The ODB, a central database for all the settings. A copy is saved in the data files at the start and end of every run |
| Control and monitor voltages, temperatures etc. | Slow control, with values recorded in the history and plotted in a web browser |
| Combine data from many devices into one event | Event buffers and event building |
| Take data in runs with defined conditions | Runs, with run numbers and run parameters, and the sequencer for automating a series of runs |
| Write the data to disk | Data logging, with compression and automatic copying to other storage |
| Run many programs, on several computers | Programs that each connect to the experiment, locally or over the network |
| Rely on it for many years | Ongoing development since 1993 at PSI and TRIUMF |
| Handle high data rates | Experiments with 1–50 computers and data rates of about 1 GB/s (see Performance) |
| Know when something goes wrong | Messages and alarms |
| Operate the experiment, from anywhere | A web interface, custom web pages for your experiment, an electronic logbook and chat |
| Check the data while it's being taken | Data analysis online and offline, with histograms that you can watch in a web browser |
Midas 101
This is how the main parts of midas fit together:
flowchart LR
hw[Detectors and<br>electronics] --> fe[Frontends]
fe -- events --> buf[(Event buffer)]
buf --> logger[mlogger]
buf --> ana[Analyzer]
logger --> files[(Data files)]
logger --> hist[(History)]
odb[(ODB)]
fe -.- odb
logger -.- odb
ana -.- odb
odb -.- web[mhttpd]
hist -- plots --> web
ana -- results --> web
web --- browser[Web browser]
- Experiment
- An experiment is all the midas programs that work together, on one or more computers. Each experiment has a name, and an experiment directory that holds its ODB, its message log and (by default) its data files. One computer can host several experiments. See Set up your first experiment.
- ODB (Online Database)
- A central database that holds the configuration and status of the experiment, in a tree of directories and keys, like a file system. Every program can read and change it, and can ask to be told when a value changes. A copy of the ODB is saved in the data files at the start and end of each run. See ODB.
- Programs
- Midas is made of many programs that each connect to the experiment: the ones that come with midas (such as mhttpd and mlogger) and your own. Programs on the main computer connect through shared memory, and programs on other computers through the mserver program. See Programs.
- Frontends and equipment
- A frontend is a program that reads data from hardware. It contains one or more pieces of equipment, each of which produces events, either when there's a trigger or at regular intervals. Frontends are written in C++ or Python, with frameworks that do most of the work. See Frontends.
- Events and banks
- An event has a header (event ID, trigger mask, serial number and time stamp) and data banks. A bank is a named array of values, e.g. the ADC values of one module. See Event data format.
- Event buffers
- Frontends send their events to an event buffer (usually the one called
SYSTEM), where other programs (such as mlogger and analyzers) receive them. An event builder can combine the events from several frontends into one. See Event buffers. - Runs and transitions
- A run is started, stopped, paused and resumed through run transitions, e.g. from the web interface. Every program can ask to be told about each transition, e.g. to configure its hardware at the start of a run. The sequencer can run a series of runs automatically. See Runs.
- Data logging and history
- mlogger writes the events to data files, usually one file per run. It also records values such as voltages and temperatures in the history, at any time, not just during runs. See Data logging and History.
- Messages and alarms
- Programs report what they're doing, and any problems, in messages, which are shown in the web interface and saved in a log file. Alarms warn the operators when something needs attention, e.g. a program has stopped or a value is out of range. See Messages and Alarms.
- Web interface
- The mhttpd program serves web pages for running the experiment: the status page, run control, an ODB editor, history plots, messages, alarms and more. You can add custom pages for your experiment, written in HTML and JavaScript. See Web interface.
- Analysis
- Analyzers read events from an event buffer while data is being taken, or from the data files afterwards. See Data analysis.
The glossary explains these and other midas terms.
Is midas right for you?
Midas suits experiments of many sizes, from a teaching lab with one crate to large experiments with dozens of frontends on many computers:
- Platforms: Linux and macOS. Some programs can also be built for small embedded computers
- Languages: frontends and other programs in C++ or Python, and web pages in JavaScript
- Hardware: midas has been used with VME, CAMAC, Fastbus, RS232, GPIB, USB, ethernet, optical fibre and MSCB devices
- Licence: free and open source (GPL)
Other tools may suit you better for a small tabletop setup that only uses one vendor's hardware and software, or for very large experiments that read out every hit from millions of channels.
Next steps
- Operators, who run shifts on an experiment that's already set up: take the Operator quick tour
- Experiment admins, who install midas and set up the experiment: install midas, then set up your first experiment
- Developers, who write frontends, analyzers, scripts or web pages: install midas, then read Writing programs