nscl_logo_small.gif (2463 bytes)

filter - SpecTcl Command

HH00706_.jpg (6530 bytes)

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

Syntax

filter [-new] filtername gatename {par1 par2 ...}
filter -delete filtername
filter -enable filtername
filter -disable filtername
filter -regate filtername gatename
filter -file filename filtername
filter -list ?glob-pattern?

Top

Synopsis

Creates, modifies, enables, lists and deletes filters:

Top

Detailed Description

SpecTcl maintains a dictionary of Filters.  A filter consists of:

Item Description
Name A name that is used to refer to the filter in future operations.
Gate A gate that determines which events pass the filter.
Filename The name of a file to which the passed events are written
Parameter List The set of parameters that are written for passed events
State A flag that indicates if the filter is active (enabled) or inactive (disabled).  Note: Filters are created in the disabled state.

The filter command allows you to define and manipulate these parameters.  

A filter does nothing until it is enabled.  Once enabled, it opens its output file and begins to produce filtered event streams on its output file.  See the filter section of the programming guide for a description of how to read back filtered files.

Top

Creating a filter

The following syntax creates a filter:

filter [-new] filtername gatename {par1 par2 ...}

Note that the -new switch is optional.  If the filter command does not have a command switch, the default action is to create a new filter.

Parameter Meaning
filtername The name of the filter.  This name will be used to refer to the filter in future filter commands.
gatename This is the name of a previously existing gate.  When the filter is enabled, this gate is checked against each event.  For each event that makes the gate true, an output event is written in the event file.
{par1 par2...} A TCL list of the names of defined parameters. Each event that is written to the output stream contains those and only those parameters.  Note that parameters that have not been assigned to in the event processors are never passed to the output file.

Top

Deleting a Filter

To delete a filter:

filter -delete filtername

Where filtername  is the name you assigned to a filter when you created it.

Top

Enabling a Filter

To enable an existing filter:

filter -enable filtername

Where filtername is the name you assigned to the filter when you created it.  

Filters are created in the disabled state.  Once enabled, filters open their output files and start writing filtered event data to them.  When this command is successful it will return a description of the filter that was enabled.

Top

Disabling a Filter

To disable an existing filter:

filter -disable filtername

Where filtername is the name you assigned to the filter when you created it.  

Filters are created in the disabled state.  once enabled, filters open their output files and start writing filtered event data to them.   To close the filter's output file and stop filtering the incoming event stream, disable the filter.

Top

Changing the gate on a filter.

To change the gate on a filter, use the command:

filter -regate filtername gatename

filtername is the name of the filter you created. gatename is the name of an existing gate that will be applied to the filter.  When enabled, this gate will be used to select events that are written to the output file.

The output of a successfull filter -regate command is a description of the gate.

Top

Setting the filter filename

To set the filename of the filter:

filter -file filename filtername

The filename defaults to ~/filter.flt so if you have more than one filter, it is a good idea to set a new filename for each filter.

Top

Listing filters

To list the set of filters that are known to SpecTcl:

filter -list

or alternatively

filter -list pattern

The first form lists all filters known to SpecTcl,  The second form lists the filters whose names match pattern.  pattern may contain "glob" wildcard characters.   For example, the first command is equivalent to :

filter -list *

Top

Examples

In the examples below, SpecTcl's output is given in red.

The example below creates two filters named george and harry:

% filter george Slice {Distribution1 Distribution2}
george Slice /user/fox/filter.flt {Distribution1 Distribution2} disabled
% filter harry Band1 Distribution3
harry Band1 /user/fox/filter.flt {Distribution3} disabled

For george, only the parameters Distribution1 and Distribution2 are written to the output filter file. For Harry,  only Distribution3 is written.  Note that both filters are disabled, and the filenames for both filters are the same. 

The example below modifies the filenames for the two filters:

% filter -filename george.flt george
harry Band1 /user/fox/filter.flt {Distribution3} disabled
% filter -filename harry.flt harry
harry Band1 harry.flt {Distribution3} disabled
% 

Both filters are still disabled.  The following enables the two filters:

% filter -enable george
george Slice george.flt {Distribution1 Distribution2} enabled
%
filter -enable harry
harry Band1 harry.flt {Distribution3} enabled
%


Top


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