Supporting Non-NSCL data buffers |
SpecTcl Home General Information User Guide Programmer's Guide Obtaining and Installing
SpecTcl uses an object which is an instance of a class derived from CBufferDecoder to manage the global properties of the buffer. Physics event buffers are assumed to consist in general of some framing information which encapsulates a set of events. The Events are in a region called the body. To Build a version of SpecTcl which is able to anaylze data from non NSCL data sources you must:
The services provided by CBufferDecoder are described here. Many of these services are not used by the Analyzer, and, if necessary can be stubbed off to return dummy values, if your decoder does not use them. The members which are required, however are:
Member | Description |
getBody | Return a pointer to the body section of the buffer. |
getEntityCount | Return the number of events in the buffer. |
getBufferType | Return the type of the buffer. |
The AppInit.cpp file contains code which initializes SpecTcl. AppInit instantiates and initializes the analyzer as well as hooking the decoder and the unpacker to the analyzer. This is done in the following code fragment in AppInit.cpp:
// Analyzer initial sizing is based on m_pAnalyzer. m_pAnalyzer = new CAnalyzer(m_nParams, m_nListSize); gpAnalyzer = m_pAnalyzer; // // Hook the analyzer together with its sink, unpacker and decoder. // gpAnalyzer->AttachSink(*gpEventSink); gpAnalyzer->AttachUnpacker(*gpUnpacker); gpAnalyzer->AttachDecoder(*gpBufferDecoder);
The global variable gpBufferDecoder is a pointer to a buffer decoder. Setting this global variable to another value prior to this code segment subsitutes your buffer decoder for the default SpecTcl decoder. For example, the code fragment above can be modified to read:
// Analyzer initial sizing is based on m_pAnalyzer. m_pAnalyzer = new CAnalyzer(m_nParams, m_nListSize); gpAnalyzer = m_pAnalyzer; // // Create a buffer decoder of type CMyDecoder and arrange to have it hooked // into SpecTcl's analyzer: // static CMyDecoder decoder; gpBufferDecoder = &decoder; // // Hook the analyzer together with its sink, unpacker and decoder. // gpAnalyzer->AttachSink(*gpEventSink); gpAnalyzer->AttachUnpacker(*gpUnpacker); gpAnalyzer->AttachDecoder(*gpBufferDecoder);
Note that the static storage qualifier is required or else the decoder will be destroyed when control passes out of the function. Alternatively, the decoder could be created dynamically with new, in which case it must be deleted in the CTCLGrammerApp class destructor.
SpecTcl Home General Information User Guide Programmer's Guide Obtaining and Installing
Last Modified: October 28, 2003 by: fox@nscl.msu.edu
© Copyright NSCL 1999, All rights reserved