DDAS Format  1.1.1
A self-contained, lightweight format library and unpacker for DDAS data
Public Member Functions | List of all members
ddasfmt::DDASHit Class Reference

Encapsulation of a generic DDAS event. More...

#include <DDASHit.h>

Public Member Functions

 DDASHit ()
 Default constructor. More...
 
 DDASHit (const DDASHit &obj)
 Copy constructor.
 
DDASHitoperator= (const DDASHit &obj)
 Assignment operator.
 
virtual ~DDASHit ()
 Destructor. More...
 
void Reset ()
 Resets the state of all member data to that of initialization. More...
 
double getTime () const
 Retrieve computed time. More...
 
uint64_t getCoarseTime () const
 Retrieve the 48-bit timestamp in nanoseconds without any CFD correction. More...
 
uint32_t getEnergy () const
 Retrieve the energy. More...
 
uint32_t getTimeHigh () const
 Retrieve most significant 16-bits of raw timestamp. More...
 
uint32_t getTimeLow () const
 Retrieve least significant 32-bit of raw timestamp. More...
 
uint32_t getTimeCFD () const
 Retrieve the raw CFD time. More...
 
uint32_t getFinishCode () const
 Retrieve finish code. More...
 
uint32_t getChannelLength () const
 Retrieve number of 32-bit words that were in original data packet. More...
 
uint32_t getChannelHeaderLength () const
 Retrieve length of header in original data packet. More...
 
uint32_t getSlotID () const
 Retrieve the slot that the module resided in. More...
 
uint32_t getCrateID () const
 Retrieve the index of the crate the module resided in. More...
 
uint32_t getChannelID () const
 Retrieve the channel index. More...
 
uint32_t getModMSPS () const
 Retrieve the ADC frequency of the module. More...
 
int getHardwareRevision () const
 Retrieve the hardware revision. More...
 
int getADCResolution () const
 Retrieve the ADC resolution. More...
 
uint32_t getCFDTrigSource () const
 Retrieve trigger source bit from CFD data. More...
 
uint32_t getCFDFailBit () const
 Retreive failure bit from CFD data. More...
 
uint32_t getTraceLength () const
 Retrieve trace length. More...
 
std::vector< uint16_t > & getTrace ()
 Access the trace data. More...
 
const std::vector< uint16_t > & getTrace () const
 Access the trace data. More...
 
std::vector< uint32_t > & getEnergySums ()
 Access the energy/baseline sum data. More...
 
const std::vector< uint32_t > & getEnergySums () const
 Access the energy/baseline sum data. More...
 
std::vector< uint32_t > & getQDCSums ()
 Access the QDC data. More...
 
const std::vector< uint32_t > & getQDCSums () const
 Access the QDC data. More...
 
uint64_t getExternalTimestamp () const
 Retrieve the external timestamp. More...
 
bool getADCOverflowUnderflow () const
 Retrieve the ADC overflow/underflow status. More...
 
void setChannelID (uint32_t channel)
 Set the channel ID. More...
 
void setSlotID (uint32_t slot)
 Set the slot ID. More...
 
void setCrateID (uint32_t crate)
 Set the crate ID. More...
 
void setChannelHeaderLength (uint32_t channelHeaderLength)
 Set the channel header length. More...
 
void setChannelLength (uint32_t channelLength)
 Set the channel length. More...
 
void setFinishCode (bool finishCode)
 Set the finish code. More...
 
void setCoarseTime (uint64_t time)
 Set the coarse timestamp. More...
 
void setRawCFDTime (uint32_t data)
 Set the raw CFD time. More...
 
void setCFDTrigSourceBit (uint32_t bit)
 Set the CFD trigger source bit. More...
 
void setCFDFailBit (uint32_t bit)
 Set the CFD fail bit. More...
 
void setTimeLow (uint32_t datum)
 Set the lower 32 bits of the 48-bit timestamp. More...
 
void setTimeHigh (uint32_t datum)
 Set the higher 16 bits of the 48-bit timestamp. More...
 
void setTime (double compTime)
 Set the hit time. More...
 
void setEnergy (uint32_t energy)
 Set the energy for this hit. More...
 
void setTraceLength (uint32_t length)
 Set the ADC trace length. More...
 
void setModMSPS (uint32_t msps)
 Set the value of the ADC frequency in MSPS for the ADC which recorded this hit. More...
 
void setADCResolution (int value)
 Set the value of the ADC resolution (bit depth) for the ADC which recorded this hit. More...
 
void setHardwareRevision (int value)
 Set the ADC hardware revision for the ADC which recorded this hit. More...
 
void appendEnergySum (uint32_t value)
 Set the crate ID. More...
 
void setEnergySums (std::vector< uint32_t > eneSums)
 Set the energy sum data from an existing set of sums. More...
 
void appendQDCSum (uint32_t value)
 Append a QDC value to the vector of QDC sums. More...
 
void setQDCSums (std::vector< uint32_t > qdcSums)
 Set the QDC sum data from an existing set of sums. More...
 
void appendTraceSample (uint16_t value)
 Append a 16-bit ADC trace sample to the trace vector. More...
 
void setTrace (std::vector< uint16_t > trace)
 Set the trace data from an existing trace. More...
 
void setExternalTimestamp (uint64_t value)
 Set the value of the external timestamp. More...
 
void setADCOverflowUnderflow (bool state)
 Set ADC over- or under-flow state. More...
 

Detailed Description

Encapsulation of a generic DDAS event.

The DDASHit class is intended to encapsulate the information that is emitted by the Pixie-16 digitizer for a single event. It contains information for a single channel only. It is generic because it can store data for the 100 MSPS, 250 MSPS, and 500 MSPS Pixie-16 digitizers used at the lab. In general all of these contain the same set of information, however, the meaning of the CFD data is different for each. The DDASHit class abstracts these differences away from the user.

This class does not provide any parsing capabilities likes its companion class ddasdumper. To fill this with data, you should use the DDASHitUnpacker class. Here is how you use it:

DDASHit hit;
DDASHitUnpacker unpacker;
unpacker.unpack(pData, pData + sizeOfHit, hit);
DDASHit()
Default constructor.
Definition: DDASHit.cpp:40

where pData is a pointer to the first 32-bit word of the event and sizeOfHit is the size also in 32-bit words. Note that pData + sizeOfHit is a pointer off the end of the current hit.

Constructor & Destructor Documentation

◆ DDASHit()

ddasfmt::DDASHit::DDASHit ( )

Default constructor.

All member data are zero-initialized.

◆ ~DDASHit()

ddasfmt::DDASHit::~DDASHit ( )
virtual

Destructor.

The destrutor is virtual to ensure proper destruction of objects derived from DDASHit.

Member Function Documentation

◆ appendEnergySum()

void ddasfmt::DDASHit::appendEnergySum ( uint32_t  value)

Set the crate ID.

Parameters
valueCrate ID value for this hit.

◆ appendQDCSum()

void ddasfmt::DDASHit::appendQDCSum ( uint32_t  value)

Append a QDC value to the vector of QDC sums.

Parameters
valueThe QDC value appended to the vector.

◆ appendTraceSample()

void ddasfmt::DDASHit::appendTraceSample ( uint16_t  value)

Append a 16-bit ADC trace sample to the trace vector.

Parameters
valueThe 16-bit ADC sample appended to the vector.

◆ getADCOverflowUnderflow()

bool ddasfmt::DDASHit::getADCOverflowUnderflow ( ) const
inline

Retrieve the ADC overflow/underflow status.

Returns
bool
Return values
trueIf the ADC over- or underflows.
falseOtherwise.

In the 12 and 14 bit modules, this is the value of bit 15 in the 4th header word. In the 16 bit modules, this is the value of bit 31 in the 4th header word.

◆ getADCResolution()

int ddasfmt::DDASHit::getADCResolution ( ) const
inline

Retrieve the ADC resolution.

Returns
Module ADC resolution (bit depth).

◆ getCFDFailBit()

uint32_t ddasfmt::DDASHit::getCFDFailBit ( ) const
inline

Retreive failure bit from CFD data.

Returns
The CFD fail bit.

The fail bit == 1 if the CFD fails, 0 otherwise.

◆ getCFDTrigSource()

uint32_t ddasfmt::DDASHit::getCFDTrigSource ( ) const
inline

Retrieve trigger source bit from CFD data.

Returns
The CFD trigger source bit.

◆ getChannelHeaderLength()

uint32_t ddasfmt::DDASHit::getChannelHeaderLength ( ) const
inline

Retrieve length of header in original data packet.

Returns
Length of the channel header.

◆ getChannelID()

uint32_t ddasfmt::DDASHit::getChannelID ( ) const
inline

Retrieve the channel index.

Returns
Channel index on the module.

◆ getChannelLength()

uint32_t ddasfmt::DDASHit::getChannelLength ( ) const
inline

Retrieve number of 32-bit words that were in original data packet.

Returns
The number of 32-bit words in the event.

Note that this only really makes sense to be used if the object was filled with data using UnpackChannelData().

◆ getCoarseTime()

uint64_t ddasfmt::DDASHit::getCoarseTime ( ) const
inline

Retrieve the 48-bit timestamp in nanoseconds without any CFD correction.

Latching of the coarse timestamp depends on whether or not the CFD is enabled, and, if enabled, whether the CFD algorithm succeeds or not:

  • If the CFD is enabled and a vaild CFD exists, the coarse timestamp is latched to the trace sample immidiately prior to the zero-crossing point.
  • If the CFD is enabled and fails, the coarse timestamp is latched to the leading-edge trigger point.
  • If the CFD is disabled, the coarse timestamp is latched to the leading-edge trigger point.
    Returns
    The raw 48-bit timestamp in nanoseconds.

◆ getCrateID()

uint32_t ddasfmt::DDASHit::getCrateID ( ) const
inline

Retrieve the index of the crate the module resided in.

Returns
Module crate ID.

◆ getEnergy()

uint32_t ddasfmt::DDASHit::getEnergy ( ) const
inline

Retrieve the energy.

With the advent of Pixie-16 modules with 16-bit ADCs, the getEnergy() method no longer includes the ADC overflow/underflow bit. The overflow/underflow bit can be accessed via the getADCOverflowUnderflow() method instead.

Returns
The energy.

◆ getEnergySums() [1/2]

std::vector<uint32_t>& ddasfmt::DDASHit::getEnergySums ( )
inline

Access the energy/baseline sum data.

Returns
The energy sum data.

◆ getEnergySums() [2/2]

const std::vector<uint32_t>& ddasfmt::DDASHit::getEnergySums ( ) const
inline

Access the energy/baseline sum data.

Returns
The energy sum data.

◆ getExternalTimestamp()

uint64_t ddasfmt::DDASHit::getExternalTimestamp ( ) const
inline

Retrieve the external timestamp.

Returns
The 48-bit external timestamp in nanoseconds.

◆ getFinishCode()

uint32_t ddasfmt::DDASHit::getFinishCode ( ) const
inline

Retrieve finish code.

Returns
The finish code.

The finish code will be set to 1 if pileup was detected.

◆ getHardwareRevision()

int ddasfmt::DDASHit::getHardwareRevision ( ) const
inline

Retrieve the hardware revision.

Returns
int Module hardware revision number.

◆ getModMSPS()

uint32_t ddasfmt::DDASHit::getModMSPS ( ) const
inline

Retrieve the ADC frequency of the module.

Returns
Module ADC MSPS.

◆ getQDCSums() [1/2]

std::vector<uint32_t>& ddasfmt::DDASHit::getQDCSums ( )
inline

Access the QDC data.

Returns
The QDC sum data.

◆ getQDCSums() [2/2]

const std::vector<uint32_t>& ddasfmt::DDASHit::getQDCSums ( ) const
inline

Access the QDC data.

Returns
The QDC sum data.

◆ getSlotID()

uint32_t ddasfmt::DDASHit::getSlotID ( ) const
inline

Retrieve the slot that the module resided in.

Returns
Module slot.

◆ getTime()

double ddasfmt::DDASHit::getTime ( ) const
inline

Retrieve computed time.

This method performs a computation that depends on the type of the digitizer that produced the data. In each case, the coarse timestamp is formed using the timelow and timehigh. This is coarse timestamp is then corrected using any CFD time that exists.

The calculations for the various modules are as follows:

For the 100 MSPS modules:

\[\text{time} = 10\times((\text{timeHigh} << 32) + \text{timeLow} + \text{timeCFD}/2^{15})\]

For the 250 MSPS modules:

\[\text{time} = 8\times((\text{timeHigh} << 32) + \text{timeLow}) + 4\times(\text{timeCFD}/2^{14} - \text{cfdTrigSourceBit})\]

For the 500 MSPS modules:

\[\text{time} = 10\times((\text{timeHigh} << 32) + \text{timeLow}) + 2\times(\text{timeCFD}/2^{13} + \text{cfdTrigSourceBit} - 1)\]

Returns
double The timestamp in units of nanoseconds.

◆ getTimeCFD()

uint32_t ddasfmt::DDASHit::getTimeCFD ( ) const
inline

Retrieve the raw CFD time.

Returns
The raw CFD time value from the data word.

◆ getTimeHigh()

uint32_t ddasfmt::DDASHit::getTimeHigh ( ) const
inline

Retrieve most significant 16-bits of raw timestamp.

Returns
The upper 16 bits of the 48-bit timestamp.

◆ getTimeLow()

uint32_t ddasfmt::DDASHit::getTimeLow ( ) const
inline

Retrieve least significant 32-bit of raw timestamp.

Returns
The lower 16 bits of the 48-bit timestamp.

◆ getTrace() [1/2]

std::vector<uint16_t>& ddasfmt::DDASHit::getTrace ( )
inline

Access the trace data.

Returns
The ADC trace.

◆ getTrace() [2/2]

const std::vector<uint16_t>& ddasfmt::DDASHit::getTrace ( ) const
inline

Access the trace data.

Returns
The ADC trace.

◆ getTraceLength()

uint32_t ddasfmt::DDASHit::getTraceLength ( ) const
inline

Retrieve trace length.

Returns
The trace length in ADC samples.

◆ Reset()

void ddasfmt::DDASHit::Reset ( )

Resets the state of all member data to that of initialization.

For primitive types, this sets the values to 0. For vector data (i.e. trace), the vector is cleared and resized to 0.

◆ setADCOverflowUnderflow()

void ddasfmt::DDASHit::setADCOverflowUnderflow ( bool  state)

Set ADC over- or under-flow state.

Parameters
stateThe ADC under-/overflow state. True if the ADC under- or overflows the ADC.

◆ setADCResolution()

void ddasfmt::DDASHit::setADCResolution ( int  value)

Set the value of the ADC resolution (bit depth) for the ADC which recorded this hit.

Parameters
valueThe ADC resolution.

◆ setCFDFailBit()

void ddasfmt::DDASHit::setCFDFailBit ( uint32_t  bit)

Set the CFD fail bit.

Parameters
bitThe CFD fail bit value.

The CFD fail bit == 1 if the CFD algorithm fails. The CFD can fail if the threshold value is too high or the CFD algorithm fails to find a zero-crossing point within 32 samples of the leading-edge trigger point.

◆ setCFDTrigSourceBit()

void ddasfmt::DDASHit::setCFDTrigSourceBit ( uint32_t  bit)

Set the CFD trigger source bit.

Parameters
bitThe CFD trigger source bit value for this hit.

The 250 MSPS and 500 MSPS modules de-serialize data into an FPGA which operates at some fraction of the ADC sampling rate. The CFD trigger source bit specifies which fractional time offset from the FPGA clock tick the CFD zero-crossing occured. For 100 MSPS modules, the source bit is always equal to 0 (FPGA captures data also at 100 MSPS).

◆ setChannelHeaderLength()

void ddasfmt::DDASHit::setChannelHeaderLength ( uint32_t  channelHeaderLength)

Set the channel header length.

Parameters
channelHeaderLengthChannel header length of this hit.

◆ setChannelID()

void ddasfmt::DDASHit::setChannelID ( uint32_t  channel)

Set the channel ID.

Parameters
channelChannel value for this hit.

◆ setChannelLength()

void ddasfmt::DDASHit::setChannelLength ( uint32_t  channelLength)

Set the channel length.

Parameters
channelLengthThe length of the hit.

◆ setCoarseTime()

void ddasfmt::DDASHit::setCoarseTime ( uint64_t  time)

Set the coarse timestamp.

Parameters
timeThe coarse timestamp.

Latching of the coarse timestamp depends on whether or not the CFD is enabled, and, if enabled, whether the CFD algorithm succeeds or not:

  • If the CFD is enabled and a vaild CFD exists, the coarse timestamp is latched to the trace sample immidiately prior to the zero-crossing point.
  • If the CFD is enabled and fails, the coarse timestamp is latched to the leading-edge trigger point.
  • If the CFD is disabled, the coarse timestamp is latched to the leading-edge trigger point.

◆ setCrateID()

void ddasfmt::DDASHit::setCrateID ( uint32_t  crate)

Set the crate ID.

Parameters
crateCrate ID value for this hit.

◆ setEnergy()

void ddasfmt::DDASHit::setEnergy ( uint32_t  energy)

Set the energy for this hit.

Parameters
energyThe energy for this hit.

◆ setEnergySums()

void ddasfmt::DDASHit::setEnergySums ( std::vector< uint32_t >  eneSums)

Set the energy sum data from an existing set of sums.

Parameters
eneSumsVector of energy sums.

◆ setExternalTimestamp()

void ddasfmt::DDASHit::setExternalTimestamp ( uint64_t  value)

Set the value of the external timestamp.

Parameters
valueThe value of the external timestamp supplied to DDAS.

◆ setFinishCode()

void ddasfmt::DDASHit::setFinishCode ( bool  finishCode)

Set the finish code.

Parameters
finishCodeFinish code for this hit.

◆ setHardwareRevision()

void ddasfmt::DDASHit::setHardwareRevision ( int  value)

Set the ADC hardware revision for the ADC which recorded this hit.

Parameters
valueThe hardware revision of the ADC.

◆ setModMSPS()

void ddasfmt::DDASHit::setModMSPS ( uint32_t  msps)

Set the value of the ADC frequency in MSPS for the ADC which recorded this hit.

Parameters
mspsThe ADC frequency in MSPS.

◆ setQDCSums()

void ddasfmt::DDASHit::setQDCSums ( std::vector< uint32_t >  qdcSums)

Set the QDC sum data from an existing set of sums.

Parameters
qdcSumsVector of QDC sums.

◆ setRawCFDTime()

void ddasfmt::DDASHit::setRawCFDTime ( uint32_t  data)

Set the raw CFD time.

Parameters
dataThe raw CFD value from the data word.

◆ setSlotID()

void ddasfmt::DDASHit::setSlotID ( uint32_t  slot)

Set the slot ID.

Parameters
slotSlot value for this hit.

◆ setTime()

void ddasfmt::DDASHit::setTime ( double  compTime)

Set the hit time.

Parameters
compTimeThe computed time for this hit with the CFD correction applied.

◆ setTimeHigh()

void ddasfmt::DDASHit::setTimeHigh ( uint32_t  datum)

Set the higher 16 bits of the 48-bit timestamp.

Parameters
datumThe higher 16 bits of the 48-bit timestamp extracted from the lower 16 bits of the 32-bit word passed to this function.

◆ setTimeLow()

void ddasfmt::DDASHit::setTimeLow ( uint32_t  datum)

Set the lower 32 bits of the 48-bit timestamp.

Parameters
datumThe lower 32 bits of the timestamp.

◆ setTrace()

void ddasfmt::DDASHit::setTrace ( std::vector< uint16_t >  trace)

Set the trace data from an existing trace.

Parameters
traceThe trace.

◆ setTraceLength()

void ddasfmt::DDASHit::setTraceLength ( uint32_t  length)

Set the ADC trace length.

Parameters
lengthThe length of the trace in 16-bit words (samples).

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