artdaq-demo serves as an example of how components of the artdaq package can be pieced together to create a functioning DAQ system; a careful study of the package along with its associated documentation is intended to provide DAQ designers the knowledge base they need to develop their own, experiment-specific daq systems. artdaq-demo provides:

  • Examples of various types of ART modules useful for DAQ systems (online monitoring, data compression / decompression, etc.)
  • an example of an artdaq::Fragment class overlay for a commonly used board (CAEN digitizer unit V172x), as well as a simple class overlay which can be used to understand how they work
  • artdaq::CommandableFragmentGenerator -derived classes capable of simulating DAQ input
  • A set of scripts, the use of which is described in Running a sample artdaq-demo system and which are themselves described somewhat more in depth in Scripts source etc, that the user can run to simulate a full DAQ system run, using the artdaq::CommandableFragmentGenerator -derived class demo::V172xSimulator to simulate production of data fragments represented by the artdaq::Fragment overlay class demo::V172xFragment, and then processing the data by running ART modules and and writing the result to disk


The artdaq package provides users the tools (scripts, base classes, and applications) with which to create a DAQ system but does not itself provide a full workable DAQ. artdaq-demo is an example of how a user could create a DAQ system off of artdaq. In order to understand how artdaq-demo works, some components of artdaq first need to be understood; once this overview is read, go to Fragments and FragmentGenerators w/ Toy Fragments as Examples for more information.

The artdaq::Fragment class

The basic unit of data in artdaq-based DAQ systems is a fragment; a complete event in an experiment consists of a set of fragments. An object of the artdaq::Fragment class contains some elementary information about itself, the most important of which are the fragment id, corresponding to a section of an experiment's detector, and the sequence id, used to uniquely label an event in the experiment. It also contains a payload, the raw data describing the physics as well as potential experiment-specific metadata such as the serial number of the upstream DAQ board where the fragment was created, the sample rate frequency, etc. Users should represent their experiment's data via an overlay class which takes a basic artdaq::Fragment object as a constructor argument and adds additional experiment-specific information of interest, such as metadata values, max ADC value per channel, masked channels, etc.; artdaq-demo's demo::V172xFragment class is an example of such an overlay class.

The artdaq::CommandableFragmentGenerator class

The artdaq::CommandableFragmentGenerator class interface describes the basic state transition model of artdaq, including initialization, starting, stopping, and shutting down of the DAQ system. When implemented by a user, it can either contain the functionality to obtain fragments from an experiment's upstream hardware, or alternatively, serve as a simulation class for the experiment. The demo::V172xSimulator class is an example of such a simulation, and is employed in the standard artdaq-demo run scripts.

The BoardReaderMain application

This process, meant to be run separately on every front-end board which physically interfaces with an experiment's upstream DAQ hardware, receives state transition commands (init, start, stop, shutdown), and sends them to the fragment generator class derived from CommandableFragmentGenerator. Each BoardReaderMain is in charge of some subset of an event's fragments (i.e., fragment id range).

The EventBuilderMain application

Each EventBuilderMain application receives fragments from all BoardReaderMains; a given EventBuilderMain application will be in charge of a subset of the total number of events passing through the DAQ system, if there's more than one application in use. Containing knowledge of how many fragments a complete event consists of, EventBuilderMain will receive fragments and whenever it determines it has enough fragments for a complete event will then send the complete event to a thread it's running which then allows the event to be processed by a series of art modules.

The AggregatorMain application

EventBuilderMain applications are unaware of each other. The previous edition of artdaq (and by extension, artdaq-demo) did not contain an AggregatorMain application, and as a result each EventBuilderMain in a DAQ system would write to a separate file on disk. AggregatorMain, on the other hand, sees all EventBuilderMains and consequently the full set of events passing through the DAQ system; they can be tailored to different tasks (for example, one can focus on writing processed events to a single file on disk, another can focus on running online monitoring)


artdaq-demo comes with a pair of scripts, and, which can be run in separate terminal windows to execute a sample DAQ system. The "2x2x2" refers to the use of two BoardReaderMains, two EventBuilderMains, and two AggregatorMains. primarily serves as a wrapper around artdaq's pmt.rb script (pmt == "process management tool") which sets up the MPI environment and checks that it's possible to communicate with the processes used in the system via the XML-RPC protocol, which will be necessary in order to send them transition commands. primarily serves as a wrapper around artdaq-demo's DemoControl.rb script, which itself defines how the demo is to be run in that it's in charge of sending the FHiCL control code used to initialize the various artdaq applications comprising the DAQ system (where FHiCL is the Fermilab Hierarchical Command Language ). In order to see what those FHiCL strings are, you can include a "-v" among the options to when initializing, e.g., " -v -m on init", in which case *.fcl files for each process will be written to the directory out of which you're running. For more on this, see Running a sample artdaq-demo system .