Shared memory interface - art-daq/artdaq GitHub Wiki
Shared memory interface
art Process Management
In artdaq v3, art is started as a separate process by the
SharedMemoryEventManager.
SMEM::RunArt starts a new instance of art, and restarts it when it
closes
SMEM::StartArt starts the configured number of art processes using the
configured art ParameterSet
SMEM::StartArtProcess starts an art process using the given
configuration file (used so that each connected Online Monitor has its
own Dispatcher art process)
SMEM::ShutdownArtProcesses kills all running art processes and reports
their return codes
SMEM::ReconfigureArt starts the configured number of art processes
using a new ParameterSet
The default is that the art ParameterSet is the same as the
application’s ParameterSet with the daq: {} key removed (this is the
same behavior as previous versions of artdaq.
The Dispatcher, however, will start art processes using ParameterSet
data it received through the register_monitor command. This allows some
prefiltering to be done on the Dispatcher before transferring data to
the monitors, or implementing partial transfer in an art::EDAnalyzer
module.
Data Flow
The shared memory interface is similar between the EventBuilder, DataLogger and Dispatcher.
- A Fragment Header is received by a Transfer plugin running in the runReceiver_ loop of DataReceiverManager
- DataReceiverManager passes the Fragment Header to SharedMemoryEventManager
- SharedMemoryEventManager determines whether it has a buffer
allocated for the Fragment’s sequence ID
#* If not, one is allocated if buffer space is available
#* If no buffer space is available, a nullptr is returned - SMEM returns the pointer to the buffer where the Fragment should be saved
- DataReceiverManager calls the TransferInterface::receiveFragmentData function targeting the pointer received from SMEM
- Once the transfer completes, DataReceiverManager informs SMEM
- If the Fragment completes an event (fragment count for that sequence ID is equal to the expected fragment count), the buffer is marked “Full”
- The art SharedMemoryEventReceiver loops over the shared memory buffers looking for “Full” buffers
- SMER copies event into art for analysis