nscl_logo_small.gif (2463 bytes)

Recovering run state and run variable data

HH00706_.wmf (6530 bytes)

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

This page describes how to recover run state and run variable data produced by the production readout software. Run state and run variables are TCL variables. Within production readout, run state variables are write locked while a run is in progress. Run variables, by contrast may change.

The software described on this page analyzes the NSCL data buffers created by the production readout software, recreating the run state and run variables.

The remainder of this document:

Enabling Run State and run variable processing

The run state and run variable processing is implemented as callbacks within the NSCL buffer processing framework used by the scaler buffer processing software. The simplest way to enable run statne and run variable processing is to:

  1. Enable scaler buffer processing
  2. Add to that run state and run variable processing

To add runstate and run variable processing to scaler buffer processing you must make modifications to your MySpecTclApp.cpp file that:

  1. Include header files that define the Documentation callback
  2. Register this callback to be invoked when the analysis framework encounters runvariable and run state buffers

Including header files that define the documentation callback

The code fragment below shows additional header files that must be included in your MySpecTclApp.cpp file:

#include <buftypes.h>
#include <Globals.h>
#include <DocumentationCallback.h>

Globals.h enables you to locate the TCL interpreter used by SpecTcl. DocumentationCallback.h defines the callbackthat decodes the documentation buffers containing runstate and run variables.

Adding documentation callbacks

The code fragment below taken from CMySpecTclApp::CreateAnalysisPipline shows how to add the documentation buffer processing callback to the scaler analysis framework.

    CDocumentationCallback* pDocCallback = new CDocumentationCallback(gpInterpreter);
    CBufferProcessor* pProcessor = ScalerStage.getProcessor();
    pProcessor->addCallback(STATEVARBF, *pDocCallback);
    pProcessor->addCallback(RUNVARBF, *pDocCallback);

    RegisterEventProcessor(ScalerStage);    // Pre-existing for scaler analysis.

The first line creates a documentation callback object. This object will actually analyze the buffers. Next the scaler event processor is asked to give its Buffer processing object (see the buffer processor man page for more information about this). Finally,the documentation callback is registered to process both STATEVARBF (run state variable), and RUNVARBF (run variable) buffers before the scaler event processor is registered on the analysis pipeline.

Top

Services offered to C/C++ software

If you maintain a pointer to the CDocumentationCallback object you created, you can access the services of this object from within your own C++ application specific code. The member functions below are available for your use:

class CDocumentationCallback {
public:
  STD(string) getValue(STD(string) name) const;
  STD(string) getElementValue(STD(string) name, STD(string) element) const;
  void addChangeHandler(STD(string) name, CVariableTraceCallback& callback);
  void removeChangeHandler(STD(string) name, CVariableTraceCallback& callback);

};