DDAS Format
1.1.1
A self-contained, lightweight format library and unpacker for DDAS data
|
Encapsulation of a generic DDAS event. More...
#include <DDASHit.h>
Public Member Functions | |
DDASHit () | |
Default constructor. More... | |
DDASHit (const DDASHit &obj) | |
Copy constructor. | |
DDASHit & | operator= (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... | |
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:
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.
ddasfmt::DDASHit::DDASHit | ( | ) |
Default constructor.
All member data are zero-initialized.
|
virtual |
Destructor.
The destrutor is virtual to ensure proper destruction of objects derived from DDASHit.
void ddasfmt::DDASHit::appendEnergySum | ( | uint32_t | value | ) |
Set the crate ID.
value | Crate ID value for this hit. |
void ddasfmt::DDASHit::appendQDCSum | ( | uint32_t | value | ) |
Append a QDC value to the vector of QDC sums.
value | The QDC value appended to the vector. |
void ddasfmt::DDASHit::appendTraceSample | ( | uint16_t | value | ) |
Append a 16-bit ADC trace sample to the trace vector.
value | The 16-bit ADC sample appended to the vector. |
|
inline |
Retrieve the ADC overflow/underflow status.
true | If the ADC over- or underflows. |
false | Otherwise. |
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.
|
inline |
Retrieve the ADC resolution.
|
inline |
Retreive failure bit from CFD data.
The fail bit == 1 if the CFD fails, 0 otherwise.
|
inline |
Retrieve trigger source bit from CFD data.
|
inline |
Retrieve length of header in original data packet.
|
inline |
Retrieve the channel index.
|
inline |
Retrieve number of 32-bit words that were in original data packet.
Note that this only really makes sense to be used if the object was filled with data using UnpackChannelData().
|
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:
|
inline |
Retrieve the index of the crate the module resided in.
|
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.
|
inline |
Access the energy/baseline sum data.
|
inline |
Access the energy/baseline sum data.
|
inline |
Retrieve the external timestamp.
|
inline |
Retrieve finish code.
The finish code will be set to 1 if pileup was detected.
|
inline |
Retrieve the hardware revision.
|
inline |
Retrieve the ADC frequency of the module.
|
inline |
Access the QDC data.
|
inline |
Access the QDC data.
|
inline |
Retrieve the slot that the module resided in.
|
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)\]
|
inline |
Retrieve the raw CFD time.
|
inline |
Retrieve most significant 16-bits of raw timestamp.
|
inline |
Retrieve least significant 32-bit of raw timestamp.
|
inline |
Access the trace data.
|
inline |
Access the trace data.
|
inline |
Retrieve trace length.
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.
void ddasfmt::DDASHit::setADCOverflowUnderflow | ( | bool | state | ) |
Set ADC over- or under-flow state.
state | The ADC under-/overflow state. True if the ADC under- or overflows the ADC. |
void ddasfmt::DDASHit::setADCResolution | ( | int | value | ) |
Set the value of the ADC resolution (bit depth) for the ADC which recorded this hit.
value | The ADC resolution. |
void ddasfmt::DDASHit::setCFDFailBit | ( | uint32_t | bit | ) |
Set the CFD fail bit.
bit | The 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.
void ddasfmt::DDASHit::setCFDTrigSourceBit | ( | uint32_t | bit | ) |
Set the CFD trigger source bit.
bit | The 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).
void ddasfmt::DDASHit::setChannelHeaderLength | ( | uint32_t | channelHeaderLength | ) |
Set the channel header length.
channelHeaderLength | Channel header length of this hit. |
void ddasfmt::DDASHit::setChannelID | ( | uint32_t | channel | ) |
Set the channel ID.
channel | Channel value for this hit. |
void ddasfmt::DDASHit::setChannelLength | ( | uint32_t | channelLength | ) |
Set the channel length.
channelLength | The length of the hit. |
void ddasfmt::DDASHit::setCoarseTime | ( | uint64_t | time | ) |
Set the coarse timestamp.
time | The 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:
void ddasfmt::DDASHit::setCrateID | ( | uint32_t | crate | ) |
Set the crate ID.
crate | Crate ID value for this hit. |
void ddasfmt::DDASHit::setEnergy | ( | uint32_t | energy | ) |
Set the energy for this hit.
energy | The energy for this hit. |
void ddasfmt::DDASHit::setEnergySums | ( | std::vector< uint32_t > | eneSums | ) |
Set the energy sum data from an existing set of sums.
eneSums | Vector of energy sums. |
void ddasfmt::DDASHit::setExternalTimestamp | ( | uint64_t | value | ) |
Set the value of the external timestamp.
value | The value of the external timestamp supplied to DDAS. |
void ddasfmt::DDASHit::setFinishCode | ( | bool | finishCode | ) |
Set the finish code.
finishCode | Finish code for this hit. |
void ddasfmt::DDASHit::setHardwareRevision | ( | int | value | ) |
Set the ADC hardware revision for the ADC which recorded this hit.
value | The hardware revision of the ADC. |
void ddasfmt::DDASHit::setModMSPS | ( | uint32_t | msps | ) |
Set the value of the ADC frequency in MSPS for the ADC which recorded this hit.
msps | The ADC frequency in MSPS. |
void ddasfmt::DDASHit::setQDCSums | ( | std::vector< uint32_t > | qdcSums | ) |
Set the QDC sum data from an existing set of sums.
qdcSums | Vector of QDC sums. |
void ddasfmt::DDASHit::setRawCFDTime | ( | uint32_t | data | ) |
Set the raw CFD time.
data | The raw CFD value from the data word. |
void ddasfmt::DDASHit::setSlotID | ( | uint32_t | slot | ) |
Set the slot ID.
slot | Slot value for this hit. |
void ddasfmt::DDASHit::setTime | ( | double | compTime | ) |
Set the hit time.
compTime | The computed time for this hit with the CFD correction applied. |
void ddasfmt::DDASHit::setTimeHigh | ( | uint32_t | datum | ) |
Set the higher 16 bits of the 48-bit timestamp.
datum | The higher 16 bits of the 48-bit timestamp extracted from the lower 16 bits of the 32-bit word passed to this function. |
void ddasfmt::DDASHit::setTimeLow | ( | uint32_t | datum | ) |
Set the lower 32 bits of the 48-bit timestamp.
datum | The lower 32 bits of the timestamp. |
void ddasfmt::DDASHit::setTrace | ( | std::vector< uint16_t > | trace | ) |
Set the trace data from an existing trace.
trace | The trace. |
void ddasfmt::DDASHit::setTraceLength | ( | uint32_t | length | ) |
Set the ADC trace length.
length | The length of the trace in 16-bit words (samples). |