The NSCL DAQ recognizes that you may want to supply data from the NSCL DAQ system to non NSCL DAQ aware clients. The most important clients of this sort are SpecTcl ore root which an be used to analyze data from the online system.
ringselector selects items from a ring buffer data source and copies them unmodified (binary) to its stdout. It can be run in a command line pipeline (e.g. with od to get a simple undecoded dump of the data), or on the other end of a pipe from an application to provide event data to that application.
Command line options provide a mechanism for to configure a predicate that will be used to select the type of items copied as well as whether or not all specified itesm or only a sample of the specified items will be copied to the output.
See OPTIONS below for information on how to configure this program.
--formatted
If supplied the data this application sends to stdout will be formatted rather than binary. Each item in the ring buffer will appear on a single line. Each 16 bit data entry for each ring item will be separated by a space from the others on the line.
The intent of this switch is to allow ringselector to be used as a data source for Tcl scripts that are easier to write if the data is ascii.
--source
=ringurlDetermines the ring buffer from which data is taken. Most NSCL readout software create, if necessary, and produces data into a local ring buffer that matches the user name of the user running that program.
By default, therefore, unless --source
is specified, the
ringselector data source
is tcp://localhost/username
where username is the
username running the program.
If --source
is provided, its value
is the URI of a ring buffer. The URI of a ring buffer
is of the form:
tcp://hostname/ringname
where hostname is the host
on which the ring lives (localhost for
local rings), and ringname is
the name of the ring on that host.
--sample
=typeList
If specified, the typeList
item types
are only sampled. typeList
is a
comma separated list of item types. Item types can
be specified numerically or symbolically. The
type symbols and value scan be found in the
$daqroot/include/DataFormat.h
header file.
--exclude
=typeList
Specifies the set of ring item types that will not be
accepted for copy to stdout. If this
option is present, the --accept
option
may not be presnt.
typeList
is a
comma separated list of item types. Item types can
be specified numerically or symbolically. The
type symbols and value scan be found in the
$daqroot/include/DataFormat.h
header file.
--accept
=typeList
Specifies the set of ring bufer types that are accepted.
If this option is present, the --exclude
option may not be.
typeList
is a
comma separated list of item types. Item types can
be specified numerically or symbolically. The
type symbols and value scan be found in the
$daqroot/include/DataFormat.h
header file.
--exitonend
If this is supplied, the ringselector exits when it sees the first end run event. This is meant to be used for pipelines that only need to process a single run. An example of that is the compatibility event logging utility.
--version
Prints out the version of the program and exists.
--help
Prints out program usage information and exits.
Let's look at a few examples. First let's take data from
from a ring buffer with our username on spdaq22.nscl.msu.edu.
We'll just pipe this into the od utility. We will only be interested
in state transition items and sampled event data (a
CDesiredTypesPredicate
).
Example 1. Dumping state changes and sampled event data with od
ringselector --accept=BEGIN_RUN,END_RUN,PAUSE_RUN,RESUME_RUN \ --sample=PHYSICS_EVENT \ --source=tcp://spdaq22.nscl.msu.edu/`whoami` | od -xa
Note how the whoami command is used to make this work independent of the actual user running the program.
Let's take data from the same ring buffer. Now we'll
specify that we want all data items, except for the packet type
documentation. We will still sample physics events. This produces
a CAllButPredicate
.
Example 2. Dumping all but packet types
ringselector --exclude=PACKET_TYPES --sample=PHYSICS_EVENT \ --source=tcp://spdaq22.nscl.msu.edu/`whoami` | od -xa
If neither --exclude
nor --accept
is provided on the commandline, the predicate used is
a CAllButPredicate
.
The following attaches SpecTcl to data from the ring we've been
using as an example, in the normal way.