nscl_logo_small.gif (2463 bytes)

attach - SpecTcl Command

HH00706_.wmf (6530 bytes)

SpecTcl Home  General Information User Guide Programmer's Guide Obtaining and Installing

Syntax

attach {switches...} connection
  Where:
     Switches are taken from the following:
     -format filter|nscl  - Choose buffer format
     -size nBytes - Number of bytes per buffer.
     {sourcetype} which can be only one of:
        -file  when connection is the name of the file
               from which data will be taken
        -tape  When connection is the name of a tape device
               special file and the tape command selects
               files on the ansi labelled volume
        -pipe  When connection is a command whose stdout is 
               taken as the event source.
      -list returns a description of the current event source.

Synopsis

Detaches SpecTcl from the current source of events and attaches it to a new source.

Detailed Description

This command detaches SpecTcl from the current source of events and attaches it to a new event source:

The -format switch selects the buffer decoder.  Presently, nscl and filter buffer decoders are built into SpecTcl. Tailored SpecTcls also exist to decode Xsys and HIMAC data.  In the future we plan to integrate these into an extensible buffer format list as is done for the sread/swrite commands.

The -size switch selects the size of each read done on the data file in bytes.

attach -file filename [blocksize]

Attaches SpecTcl to a file data source. filename is the path to the file. This can be either a relative or absolute path.  blocksize if supplied is the buffersize of data in that file.  If omitted, this defaults to 8192 for the 'standard' NSCL event tape blocksize.  The file is opened and can be immediately analyzed using the start command. Analysis of a data source can be halted using the stop command.

attach -tape devicename

Attaches SpecTcl to a tape data source.  The devicename parameter is the name of the tape device on which the tape is physically mounted (e.g. /dev/nrmt0h on Digital UNIX). Tape data sources can contain several event files.  Each file is delimited by ANSI tape labels which provide, among other things, a filename and the file blocksize.  The tape command is used to actually select a single file from the tape.   This must be done before starting analysis.

attach -pipe [-size nBytes] command string

Attaches SpecTcl to a pipeline data source. A pipeline data source allows SpecTcl to connect to data sources which do not map well to files, for example, online data acquisition systems or ftp or httpd served data. the -size switch indicates what buffersize to use for the reads. If omitted the NSCL default buffer size is used. the remainder of the command line is treated as a UNIX command string. The attach command then:

attach -list

Returns a human readable description of the current event source. This is intended for display to the user.

Examples:

The attach -pipe command below is equivalent to using a file data source:

attach -pipe cat run1.evt

The command cat run1.evt copies the file run1.evt to it's stdout which is the write side of the pipe on which SpecTcl is reading. Note that unlike a -file source, this sort of pipe source allows you to easily sum the results from several runs:

attach -pipe cat run1.evt run2.evt run3.evt

The command above analyzes three event files as if they were a single event source file. The following command shows how to analyze data which has been compressed using the unix compress command:

attach -pipe zcat run1.evt

The file run1.evt.Z (or run1.evt.gz on Linux) is decompressed and analyzed.

Note that pipelines and redirections are not supported on the command line, however shell scripts are allowed. The command and script below support analyzing a single file of data which is contained in a gzipped tar file:

attach -pipe tarread run1.evt

Along with the shell script tarread:

#!/bin/csh
#   Shell script to extract  a single run from a gzipped 
#   tar file and send it to stdout
#
gunzip -c | tar xf - $1
cat $1
rm  $1

Top

SpecTcl Home  General Information User Guide Programmer's Guide Obtaining and Installing


Last Modified: October 28, 2003 by: fox@nscl.msu.edu
© Copyright NSCL 1999, All rights reserved