8.3. SpecTcl global variables

SpecTcl creates several global variables. These variables may be useful when writing scripts for SpecTcl. This section describes the variable SpecTcl creates.

The SpecTcl global variables fall into two groups.

SpecTcl processing/limit variables. The table below describes the SpecTcl processing/limit variables. If the variable must be defined in SpecTclInit.tcl this is also indicated:

Table 8-1. SpecTcl processing and limit variables

VariableDescription
DisplayMegabytes

Determines the size of the spectrum shared memory region. This determines the number of megabytes worth of spectra that can be added to Xamine memory via the sbind command.

This variable can only be set in SpecTclInit.tcl

EventListSize

SpecTcl histograms groups of events by sending event lists to its histogramming engine. The EventListSize variable determines how many events can be put in an event list before it is sent to the histogrammer.

Regardless of the value of EventListSize The event list is sent to the histogrammer at buffer boundaries. This variable can only be set in the SpecTclInit.tcl file.

ParameterCount

SpecTcl event objects are dynamically resized as needed to supply enough slots to hold all parameters. ParameterCount provides the initial size of an event. In previous versions of SpecTcl, making this the maximum paramter number had a strong effect on performance. Now, however event objects are re-used so they tend to reach an equilibrium size that does not require them to be resized, and therefore this parameter has no real impact on performance, although SpecTcl still uses it.

ParameterCount must be set in the SpecTclInit.tcl file.

SpecTclHome

This variable should be treated as read-only. SpecTcl initializes it on startup to the top level directory of the SpecTcl installation directory. You can use this to locate other files in the SpecTcl directory. e.g. the Script directory of SpecTcl is:


set scriptDir [file join $SpecTclHome Script]
                                        

SpecTclIODwellMax

Determines how many milliseconds, SpecTcl will wait for data from a data source before returning to the Tcl event loop. If the user interface is sluggish, this can be decreased. SpecTclDwellMax can be dynamically modified while SpecTcl is running.

splashImage

This file is the name of an image file that contains the SpecTcl splash image. If you would like to substitute your own splash image for the SpecTcl splash, modify this in SpecTclInit.tcl.

Performance variables. Several variables are maintained by SpecTcl so that you can get performance information. These variables should all be treated as read-only. The table below describes these variables:

Table 8-2. SpecTcl performance/statistics variables.

VariableDescription
BuffersAnalyzed

This variable should be treated as a readonly variable. At the beginning of run it is zeroed. Each time an event buffer is accepted, it is incremented. Along with LastSequence, this provides an estimate of the fraction of the raw data SpecTcl kept up with when attached to an online sampling data source.

LastSequence

Buffers from the NSCL data acquisition system include a sequence number. The sequence number is reset at the beginning of the run and increments for each event buffer.

When attached to an online data source, SpecTcl usually will only sample the set of buffers it can keep up with. The fraction of events analyzed during an online session can be estimated as: $BuffersAnalyzed/$LastSequence. Custom GUI's often periodically calculate and display this figure

RunNumber

Each NSCL event file or online run has a unique run number. The RunNumber variable contains this number

RunState

Reflects the state of analysis. This is boolean true if analysis is active or boolean fals if not. Note that this is not the same as whether or not the run is active in an online data source. The only way to know that is by keeping track of the set of begin and end buffers seen by SpecTcl.

RunTitle

NSCL event files contain a text string that provides a title to the run. RunTitle contains the title string from the most recently seen begin run buffer.

Statistics

This is an array that is not completely implemented. The array elements contains counters of various sorts. The array indices, available via array name Statistics are pretty self descriptive. With SpecTcl 3.2, however, you will have to play a bit with this to see which counters are actually maintained at this time.

Future releases of SpecTcl will implement all counters.

Tree Variables. In The C++ part of TreeParam, we introduced Tree Variables. Recall that a Tree Variable is a Tcl variable that is bound to an object that behaves like a float that has units attached to it. Each Tree Variable is therefore a Tcl variable. We will see in the SpecTcl Command Reference that the treevariable command can dynamically create new tree variables as well.