NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Public Member Functions | Protected Member Functions | List of all members
DAQ::DDAS::CDDASBuiltUnpacker Class Reference

Raw data unpacker for built DDAS data. More...

#include <DDASBuiltUnpacker.h>

Inheritance diagram for DAQ::DDAS::CDDASBuiltUnpacker:

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...
 
CParameterMappergetParameterMapper () 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)
 

Detailed Description

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:

CDDASBuiltUnpacker unpacker({0, 1, 2}, *pMapper);

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.

Constructor & Destructor Documentation

DAQ::DDAS::CDDASBuiltUnpacker::CDDASBuiltUnpacker ( const std::set< uint32_t > &  validSourceIds,
CParameterMapper rParameterMapper 
)

Constructor

Parameters
validSourceIdslist of source ids to parse
rParameterMapperuser's mapper (must be dynamically allocated, ownership transfers to class)
DAQ::DDAS::CDDASBuiltUnpacker::~CDDASBuiltUnpacker ( )

Destructor

Member Function Documentation

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

Bool_t DAQ::DDAS::CDDASBuiltUnpacker::operator() ( const Address_t  pEvent,
CEvent &  rEvent,
CAnalyzer &  rAnalyzer,
CBufferDecoder &  rDecoder 
)
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.

Parameters
pEventaddress in buffer to begin parsing at
rEventcurrent SpecTcl event
rAnalyzerthe analyzer
rDecodercurrent 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:

auto pMapper = new MyParameterMapper;
unpacker.setParameterMapper(*pMapper);

Ownership of the mapper is transferred into this object.

Parameters
rParameterMapperthe user's parameter mapper
void DAQ::DDAS::CDDASBuiltUnpacker::setValidSourceIds ( const std::set< uint32_t > &  validSourceIds)

Pass in new set of source ids.

Parameters
validSourceIdsthe list

The documentation for this class was generated from the following files: