nscl_logo_small.gif (2463 bytes)

Recovering Scaler Data in SpecTcl.

HH00706_.wmf (6530 bytes)

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

This page describes how to make scaler data available to your SpecTcl data analysis software. The software described on this page assumes that your event data is in NSCL data buffer format.

The remainder of this page describes:

What the scaler data event processor produces

The scaler event processer is highly compatible with the scaler display sclclient feed program. It maintains the following variables and arrays:
Variable Type Initialized to Contains
Scaler_Totals Array of floats zeroes Scaler totals for the run so far
Scaler_Increments Array of ints zeroes Increments from the last scaler read
ScalerDeltaTime Integer zero The number of seconds of run time covered by the most recent event scaler read interval.
ElapsedRunTime Integer Zero The elapsed active time in the run in seconds
RunNumber Integer -1 The run number of the active or most recently ended run
ScalerRunState Text The current run state. Note that the name of this variable is different than the corresponding variable in the scaler display subsystem (RunState). This is because standard SpecTcl uses the the variable RunState in an incompatble manner.
RunTitle Text The title of the active or most recently ended run.

In addition to maintaining these variables, the scaler event processor will invoke Tcl procedures at significant times if they have been defined. The Tcl procedures should be defined to take no parameters and are defined in the table below:
Procedure When invoked
Update Data has been updated. If you maintain computed data based on tde raw data produced by the event processor you should update the computed data at this time.
BeginRun A begin run buffer has been received and processed.
EndRun An end run buffer has been received and processed.
PauseRun A pause run buffer has been received and processed.
ResumeRun A resume run buffer has been received and processed
Top

How to enable the scaler data processor in your tailored SpecTcl

This section provides a step by step recipe for adding scaler data processing to your tailored SpecTcl. The Scaler data processing is implemented as an event processor. To enable it you must therefore:

  1. Add includes to your spectcl application code to define the scaler event processing class
  2. Create an instance of the scaler data event processor.
  3. Register the event processor in CMySpecTclApp::CreateAnalysisPipeline
  4. Use make to build your tailored SpecTcl.

This discussion assumes you already know how to run make to rebuild your SpecTcl.

Adding includes to MySpecTclApp.cpp

The Scaler event processor is defined in the header ScalerProcessor.h. The fragment of MySpecTclApp.cpp shown below shows this header incorporated into that module:

#include <config.h>
#include "MySpecTclApp.h"    
#include "EventProcessor.h"
#include "TCLAnalyzer.h"
#include <Event.h>
#include <ScalerProcessor.h>  //-- this line added.

Creating an instance of the scaler event processor

The ScalerProcessor.h header defines the class CScalerProcessor. You must create an instance of this class (an object). The code below shows MySpecTclApp.cpp as it appears out of the box modified to create a static instance of this class:
static CFixedEventUnpacker Stage1;
static CAddFirst2          Stage2;

static CScalerProcessor ScalerStage;    //-- this line added.

Registering the event processor in CMySpecTclApp::CreateAnalysisPipline

Finally, you must register this processor with the Event analysis pipeline. The code below shows how this is done in the MySpecTclApp.cpp that comes out of the box.:
void 
CMySpecTclApp::CreateAnalysisPipeline(CAnalyzer& rAnalyzer)  
{ 

#ifdef WITHF77UNPACKER
  RegisterEventProcessor(legacyunpacker);
#endif
  
    RegisterEventProcessor(Stage1);
    RegisterEventProcessor(Stage2);
    RegisterEventProcessor(ScalerStage);   //--- This line added.
}  

Top

Last modified: Fri Feb 18 14:04:52 EST 2005 by: fox@nscl.msu.edu
© Copyright NSCL 1999, All rights reserved