|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Accumulates the detector raw data (Detector::rawDef()) into nbins bins. More...
#include <CubeData.hh>
Public Member Functions | |
| CubeData (Detector &det, unsigned nbins, unsigned poolBufferSize) | |
| Take the raw definitions and names indices from det, split the nbins bins over enough buffers to keep each below 2 GiB, allocate those buffers, and allocate a separate buffer (sized for one bin plus poolBufferSize) used by copyBins(). | |
| ~CubeData () | |
| Free the cube buffers and the bin buffer. | |
| void | initialize (XtcData::Src &src, const SDV &rawData, int threadNum=1) |
| Lay out each cube buffer as a datagram with source src: per raw definition, bin indices, zeroed entry counts and zeroed sums, with array shapes taken from Detector::shapeCube() for rawData. | |
| void | flush (const std::vector< unsigned > &bins) |
| Zero the entry count and all sums of each bin in bins. | |
| void | addNames (unsigned detSegment, XtcData::Dgram *dgram, const void *bufEnd) |
| Add cube Names (algorithm cube 2.0.0, with the detector name, type and ID of the raw names) for each raw definition to dgram and register them in the detector's names lookup. | |
| void | add (unsigned bin, const SDV &rawData) |
| Add one event to bin: increment its entry count and call Detector::addToCube() (subIndex 0) for every raw value; raw definitions with no data in rawData are skipped. | |
| void | addSub (unsigned bin, unsigned subDet, const SDV &rawData) |
| Like add() for sub-detector subDet (passed to Detector::addToCube() as subIndex), without incrementing the entry count. | |
| Pds::EbDgram * | copyBins (const std::vector< unsigned > &bins, SDV &rawDataV, Pds::EbDgram *dg) |
| Copy dg into the bin buffer and append, per raw definition, a cube entry holding the given bins (indices, entry counts and sums) copied from the cube; the new ShapesData pointers are appended to rawDataV. | |
| void | addBins (const std::vector< unsigned > &bins, const SDV &rawDataV, Pds::EbDgram *dg) |
| Add the entry counts and sums of the given bins of the cube into the entries described by rawDataV (as produced by copyBins()); dg is not used. | |
| std::vector< XtcData::Dgram * > | dgram (XtcData::Dgram *, XtcData::TransitionId::Value) |
| Overwrite the transition header of every cube buffer with the type, time and env of dgram and transition ID transitionId (bit 16 of env is set on all but the last buffer) and return the buffers as datagrams. | |
| void | add (std::vector< XtcData::Dgram * > &) |
| Add the entry counts and sums of every bin of this cube into the matching cube datagrams in the argument (one per buffer). | |
Accumulates the detector raw data (Detector::rawDef()) into nbins bins.
The cube is stored as one or more datagrams (each below 2 GiB) holding, per raw definition, the bin indices, entry counts and double-valued sums.
| Drp::CubeData::CubeData | ( | Detector & | det, |
| unsigned | nbins, | ||
| unsigned | poolBufferSize | ||
| ) |
Take the raw definitions and names indices from det, split the nbins bins over enough buffers to keep each below 2 GiB, allocate those buffers, and allocate a separate buffer (sized for one bin plus poolBufferSize) used by copyBins().
| Drp::CubeData::~CubeData | ( | ) |
Free the cube buffers and the bin buffer.
| void Drp::CubeData::add | ( | std::vector< XtcData::Dgram * > & | ) |
Add the entry counts and sums of every bin of this cube into the matching cube datagrams in the argument (one per buffer).
| void Drp::CubeData::add | ( | unsigned | bin, |
| const SDV & | rawData | ||
| ) |
Add one event to bin: increment its entry count and call Detector::addToCube() (subIndex 0) for every raw value; raw definitions with no data in rawData are skipped.
| void Drp::CubeData::addBins | ( | const std::vector< unsigned > & | bins, |
| const SDV & | rawDataV, | ||
| Pds::EbDgram * | dg | ||
| ) |
Add the entry counts and sums of the given bins of the cube into the entries described by rawDataV (as produced by copyBins()); dg is not used.
| void Drp::CubeData::addNames | ( | unsigned | detSegment, |
| XtcData::Dgram * | dgram, | ||
| const void * | bufEnd | ||
| ) |
Add cube Names (algorithm cube 2.0.0, with the detector name, type and ID of the raw names) for each raw definition to dgram and register them in the detector's names lookup.
| void Drp::CubeData::addSub | ( | unsigned | bin, |
| unsigned | subDet, | ||
| const SDV & | rawData | ||
| ) |
Like add() for sub-detector subDet (passed to Detector::addToCube() as subIndex), without incrementing the entry count.
| Pds::EbDgram * Drp::CubeData::copyBins | ( | const std::vector< unsigned > & | bins, |
| SDV & | rawDataV, | ||
| Pds::EbDgram * | dg | ||
| ) |
Copy dg into the bin buffer and append, per raw definition, a cube entry holding the given bins (indices, entry counts and sums) copied from the cube; the new ShapesData pointers are appended to rawDataV.
Returns the copy; aborts if it would overflow the bin buffer.
| std::vector< XtcData::Dgram * > Drp::CubeData::dgram | ( | XtcData::Dgram * | , |
| XtcData::TransitionId::Value | |||
| ) |
Overwrite the transition header of every cube buffer with the type, time and env of dgram and transition ID transitionId (bit 16 of env is set on all but the last buffer) and return the buffers as datagrams.
| void Drp::CubeData::flush | ( | const std::vector< unsigned > & | bins | ) |
Zero the entry count and all sums of each bin in bins.
| void Drp::CubeData::initialize | ( | XtcData::Src & | src, |
| const SDV & | rawData, | ||
| int | threadNum = 1 |
||
| ) |
Lay out each cube buffer as a datagram with source src: per raw definition, bin indices, zeroed entry counts and zeroed sums, with array shapes taken from Detector::shapeCube() for rawData.
Aborts if array data is needed but rawData is missing, or if a buffer would overflow. threadNum only controls logging (the comment says debugging only).