NSCL DDAS
1.0
Support for XIA DDAS at the NSCL
|
Raw data unpacker for built DDAS data. More...
#include <DDASBuiltUnpacker.h>
Public Member Functions | |
CDDASBuiltUnpacker (const std::set< uint32_t > &validSourceIds, CParameterMapper &rParameterMapper) | |
~CDDASBuiltUnpacker () | |
void | setValidSourceIds (const std::set< uint32_t > &validSourceIds) |
Pass in new set of source ids. More... | |
std::set< uint32_t > | getValidSourceIds () const |
void | setParameterMapper (CParameterMapper &rParameterMapper) |
Pass in a different parameter mapper. More... | |
CParameterMapper & | getParameterMapper () const |
virtual Bool_t | operator() (const Address_t pEvent, CEvent &rEvent, CAnalyzer &rAnalyzer, CBufferDecoder &rDecoder) |
Process the raw data and call user's mapper. More... | |
Protected Member Functions | |
void | setEventSize (const Address_t pEvent, CBufferDecoder &rDecoder, CAnalyzer &rAnalyzer) |
Bool_t | selectivelyParseData (uint16_t *p16) |
Bool_t | parseAndStoreFragment (FragmentInfo &fragInfo) |
Raw data unpacker for built DDAS data.
If attaching SpecTcl to a ring buffer downstream of the event builder, this is the unpacker for you to use. It is an event processor that will parse the data and construct a set of DDASHit objects that contain the parse data elements. Because built data is composed of fragments from a set of different sources that are not necessarily all part of DDAS, the user must provide a set of source ids to concern themselves with. If a fragment with source id X is found in the built item and the user said that X is a valid source id, this will process it. If X is not a valid source id, then it will be skipped over for a different event processor to parse.
The user obtains access to the data through an object derived from class ParameterMapper. That class is responsible for mapping the data in the DDASHit objects, that are produced by this, to their TreeParameters. This class takes ownership of the object and deletes it on destructions so the user must dynamically allocate the ParameterMapper they pass in. In other words, a proper way to set this up would be:
This unpacker does not support byte-swapping. Don't worry, it is not likely to be an issue in the future unless you try to analyze your system on a computer with a strange architecture.
DAQ::DDAS::CDDASBuiltUnpacker::CDDASBuiltUnpacker | ( | const std::set< uint32_t > & | validSourceIds, |
CParameterMapper & | rParameterMapper | ||
) |
Constructor
validSourceIds | list of source ids to parse |
rParameterMapper | user's mapper (must be dynamically allocated, ownership transfers to class) |
DAQ::DDAS::CDDASBuiltUnpacker::~CDDASBuiltUnpacker | ( | ) |
Destructor
CParameterMapper & DAQ::DDAS::CDDASBuiltUnpacker::getParameterMapper | ( | ) | const |
Retrieve the active mapper
std::set< uint32_t > DAQ::DDAS::CDDASBuiltUnpacker::getValidSourceIds | ( | ) | const |
Retrieve the list of source ids
|
virtual |
Process the raw data and call user's mapper.
This is designed to process data downstream from the event builder. The parsing handles the body of built items which has the following structure
index | description | size (bytes) |
---|---|---|
0 | inclusive byte size of body | 4 |
1 | Frag #0 : timestamp | 8 |
2 | Frag #0 : source id | 4 |
3 | Frag #0 : payload size | 4 |
4 | Frag #0 : barrier type | 4 |
5 | Frag #0 payload: item header | depends |
... | Frag #1 : timestamp | 8 |
... | ... | ... |
This sets the event size.
pEvent | address in buffer to begin parsing at |
rEvent | current SpecTcl event |
rAnalyzer | the analyzer |
rDecoder | current buffer decoder |
void DAQ::DDAS::CDDASBuiltUnpacker::setParameterMapper | ( | CParameterMapper & | rParameterMapper | ) |
Pass in a different parameter mapper.
The user must allocate the parameter dynamically before passing it in. For example:
Ownership of the mapper is transferred into this object.
rParameterMapper | the user's parameter mapper |
void DAQ::DDAS::CDDASBuiltUnpacker::setValidSourceIds | ( | const std::set< uint32_t > & | validSourceIds | ) |
Pass in new set of source ids.
validSourceIds | the list |