8.4. SpecTcl Command categories

Hopefully by now you've gotten the impression that scripting SpecTcl is just writing a Tcl script except that SpecTcl provides additional variables, which we described in the previous section, and addition commands, which we will describe in the SpecTcl Command Reference chapter. This section will give a list of the SpecTcl commands broken down by functional categories. The online version of this work will have links from each command to its reference page.

In some cases, commands will appear in more than one category. This is done because you may wind up thinking about command categories differently than I do. Hopefully this will be helpful rather than confusing.

Spectrum Display. In SpecTcl 3.2, spectra can be viewed via the Xamine displayer. Daniel Bazin has written an alternative to Xamine called SpecTck. If you want to use this displayer you should contact for more information.

Xamine shared spectra with SpecTcl via a fixed sized shared memory region. The size of this memory region is set by the value of the DisplayMegabytes Tcl variable, which can be set in SpecTclRC.tcl. The commands in the table below can affect the Xamine display.

Table 8-3. Spectrum Display commands

CommandDescription
fitComputes and displays a fit on a spectrum. If the Spectrum is bound to the Xamine displayer, the fit is displayed on the spectrum.
gateCrates gates. While gates are created on parameters (primitive gates), and other gates (compound gates), where a spectrum is defined on the parameter(s) that make up a primitive gate, if possible, that gate will be displayed on the spectrum in Xamine.
sbindMakes spectra available for display in Xamine. Until this is done, spectra remain internal to SpecTcl.
unbindRemoves a spectrum from Xamine and makes it private to SpecTcl.

Event Source Control. SpecTcl analyzes data from an event source. Event sources are files or UNIX® pipes [1]. The commands listed in the table below select and control the event source.

Table 8-4. Event Source Commands

CommandDescription
attachSelects the current eventy source for SpecTcl
startStarts analyzing data from the current event source.
stopStops analyzing data from the current event source.

Parameter commands. SpecTcl's abstraction of an event is that each event consists of a set of parameters. Each parameter has a name and an index. The concept is very much like the n-tuples of Paw and ROOT. Histograms and primitive gates are then defined on parameters. The table below lists the commands that operate directly on parameters.

Table 8-5. Parameter Commands

CommandDescription
parameterCreates parameters, that is creates a correspondence between an english parameter name and a slot in the CEvent objects that hold parameters unpacked or calculated from an event.
pseudoCreates or maniupluates a parameter that is calculated by executing a Tcl proc for each event.
treeparameterManipulates tree parameters. Tree parameters provide structure on top of the CEvent array. Introduction to Treeparam described tree parameters.

Spectrum manipulation commands. Spectra are the usual Tcl products of analysis. Spectra are defined on a set of parameters. Spectra also have a gate applied to them which must be true for events to increment the spectrum.

Table 8-6. Spectrum Commands

CommandDescription
applyApplies a gate to a spectrum. Once the gate is applied, the spectrum is only incremented for events that make this gate true
chanGets or sets channels of a spectrum.
clearClears the counts in one or all spectra.
integrateIntegrates a region of interest in a spectrum.
fitCreates a fit on a spectrum. If the Spectrum is displayed in Xamine, the fit line is displayed.
projectCreates a new spectrum that is the projection of an existing 2-d spectrum.
spectrumCreates spectra
sreadReads a spectrum from file. Depending on how this is done, the contents of an existing spectrum may be ovewritten or a new spectrum generated.
swriteWrites the contents of a spectrum to file, so that sread can read them back in to recreate the spectrum.

Gate commands. Gates are SpecTcl conditional objects that have a value of true or false for each event. If a spectrum has a gate applied to it, the spectrum will only increment for events that make its gate true. The table below lists the commands that operate on gates.

Table 8-7. Spectrum Commands

CommandDescription
applyApplies an existing gate to a spectrum. Once applied, the spectrum will only be incremented for events that make the event true.
foldUses a gamma gate to fold a gamma spectrum.
integrateIntegrates a region of interest in a spectrum.
gateCreates a gate. Note that primitive gates can be created via Xamine.
projectCreates a new spectrum that is the projection of an existing 2-d spectrum.
ungateUngates a spectrum. That is removes any prior gate application.

Saving and restoring stuff. The commands in the table below save and restore things. Analysis state save/restore is usually provided by procs defined by the GUI.

Table 8-8. Save/Restore Commands

CommandDescription
sreadReads a spectrum that was written with swrite
swriteWrites the contents of one or more spectra. The spectra can be recovered with the sread command.

Miscellaneous commands. The table below lists commands that don't fit into nice categories (not that that has stopped me from listing some of them in the previous set of tables):

Table 8-9. Miscellaneous Commands

CommandDescription
filterCreates filters which allow the creation of pre-sorted output event data.
fitCreates fits on spectra.
treeparameterManipulates tree parameters
treevariableManipulates tree variables.

Notes

[1]

Older versions of SpecTcl supported analyzing data from Pre coupled cyclotron ANSI Labeled tapes. This feature has not been used and was therefore removed for quality control reasons. If you do need to do this, you can use the ltf facility to read your tapes to disk and then treat them as file event sources.