3.5. Data sources

The purpose of SpecTcl is to analyze data so no 'getting started' chapter would be complete without some discussion of data sources. The SpecTcl GUI (Using the 'standard' SpecTcl GUI) will say a bit more about data sources. Here we introduce:

SpecTcl can connect to two types of data sources:

  1. Files visible to the filesystem of the computer in which SpecTcl runs.

  2. Programs that send data to SpecTcl along a Unix pipeline.

Note that SpecTcl is data acquisition system neutral. It therefore has no way to directly connect to an online data acquisition systems. To connect SpecTcl to a data acquisition system, you need to have a program that connects to that system and outputs data received from the system to its standard output. Connecting that program as a pipe data source will give access to online data.

NSCLDAQ provides a program; ringselector that can be used as a pipe data source for SpecTcl. [1]

Tailoring SpecTcl to analyze data from systems other than NSCLDAQ is beyond the scope of this document. It can and has been done for two non-NSCL systems that I know of (IUCF XSYS and Lucid from Univ. of Saskatchewan).

Three commands control data source selection and analysis from data sources. Data source selection in SpecTcl is called attaching.

The attach command:

  1. Stops any analysis in progress

  2. Disconnects SpecTcl from any data source it is currently connected to.

  3. Connects SpecTcl to the data source specified by the attach command.

Note that attach does not start analyzing data from the event source. The start command starts analyzing data from a data source. Data will be analyzed until one of the three conditions is true:

  1. An end file is detected on the data source. For pipe data sources this means the program on the other end of the pipe has exited.

  2. The stop command is issued, which stops analyzing data from the data source ( start can restart analysis ).

  3. The attach is issued.

For details on the attach command, which can be rather complex, see the command reference. Here are some simple examples however:

Example 3-8. Sample attach commands


attach -file -format ring /projects/myexperiment/myevents/run-0010-00.evt

attach -pipe -format ring /usr/opt/daq/current/bin/ringselector --sample=PHYSICS_EVENT --non-blocking

The first example attaches the file /projects/myexperiment/myevents/run-0010-00.evt as the data source. The file is from nscldaq-10.0 or later (ring buffer format).

The second command attaches to the data acquisition system via pipe data source (ringselector), the data acquisition system is, again, version 10.0 or higher as the format of the data is ringbuffer.

Note that NSCLDAQ currently has two versions of the ring buffer DAQ system; 10.x and 11.x or higher. If you attach to a file, or attach to an online system prior to the start of a run, SpecTcl can figure out which version you've attached automatically. If, however you attach to an online run in progress, prior to the start command you must use the ringformat to tell SpecTcl the NSCLDAQ version for example:


ringformat 11.0

Says the data source provides data from nscldaq 11.0 or higher.



Technically, ringtostdout could be used as a pipe data source but ringselector provides the mechanics to allow SpecTcl to sample the data if it is not able to keep up with the online rate.