CNSCLBufferDecoder

Name

CNSCLBufferDecoder -- Decode fixed sized event buffers from NSCLDAQ-7.x/8.x

Synopsis


#include <NSCLBufferDecoder.h>

class CNSCLBufferDecoder : public CBufferDecoder {
public:
  CNSCLBufferDecoder();
  virtual ~CNSCLBufferDecoder();
  virtual const Address_t getBody();
  virtual UInt_t getBodySize();
  virtual UInt_t getRun();
  virtual UInt_t getEntityCount();
  virtual UInt_t getSequenceNo();
  virtual UInt_t getLamCount();
  virtual UInt_t getPatternCount();
  virtual UInt_t getBufferType();
  virtual void getByteOrder(Short_t& Signature16, Int_t& Signature32);
  virtual std::string getTitle();
  virtual void operator()(UInt_t nBytes, Address_t pBuffer, CAnalyzer& rAnalyzer);
};
        

DESCRIPTION

This buffer decoder decodes fixed length event bufers from NSCLDAQ-7.x/8.x. These buffers are typically 8Kbytes long, however they may be longer or shorter as long as the total number of bytes per buffer is no larger than 128K-2 bytes.

See CNSCLJumboBufferDecoder for larger bufer sizess.

This data format uses homogeneous buffers. Typically, non event buffers have a single item. Event buffers, however are packed with as many items as will fit. This means that buffers that contain non event data are typically very space wasteful. Fortunately in most cases they are also not frequently emitted compared with event data buffers.

This class is concrete.

METHODS

CNSCLBufferDecoder();

Constructor.

virtual const Address_t getBody();

NSCLDAQ 7.x/8.x buffers have a header of 32 bytes (16 uin16_t). This method returns a pointer to the first byte after this header.

virtual UInt_t getBodySize();

Returns the number of words used in the body of the buffer. Note that not all words of the buffer may be used. THe first 16 bits of the buffer contain the number of used 16 bit words in the buffer; nwds. This method, therefore returns (nwds - 16) * sizeof(uint16_t)

virtual UInt_t getRun();

The header of NSCLDAQ 7.x/8.x buffers contains the run number. This method returns the run number from the most recently received buffer.

virtual UInt_t getEntityCount();

Returns the number of entities in the buffer. For physics buffers, this is the number of events in the buffer. For scaler events, this is the number of scaler channels present in the buffer. For all other item typesm, this is 1

virtual UInt_t getSequenceNo();

NSCLDAQ 7.x/8.x buffers have sequence numbers. These, together with a count of the number of buffers seen can be used to approximate the sampling fraction for online analysis (when SpecTcl may not be able to keep up with the data rate).

This method returns the sequence number from the last buffer received. Note that sequence numbers start from zero at the beginning of each run.

virtual UInt_t getLamCount();

The header of NSCLDAQ 7.x/8.x buffers includes a word that contains the number of lam masks in an event. This actually is vestigial dating back to K500 days when events has a much more fixed format that include a set of pattern registers and a set of LAM registers.

virtual UInt_t getPatternCount();

Same as for getLamCount but the method returns the header field containing the pattern register count. This too is vestigial.

virtual UInt_t getBufferType();

virtual void getByteOrder( Short_t& Signature16, Int_t& Signature32);

Returns the byte order signatures that describe the byte ordering of the system that generated the most recent data buffer. Note that these values are header members for buffers from NSCLDAQ 7.x/8.x

virtual std::string getTitle();

Returns the title of the current run. In NSCLDAQ 7.x/8.x run titles are stored in state transition buffers. The value returnes is the value from the most recently received state transition buffer.

virtual void operator()( UInt_t nBytes, Address_t pBuffer, CAnalyzer& rAnalyzer);

Processes a new buffer of data. nBytes is the physical size of the buffer. The header of the buffer determines how much of the physical buffer contains useful data. pBuffer points to the data and rAnalyzer is a reference to the analyzer we must call back for item processing.