|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Detector for the high-speed digitizer (detType hsd per drp.cc), configured through the Python module psdaq.configdb.hsd_config with the EPICS prefix from the hsd_epics_prefix kwarg. More...
#include <Digitizer.hh>
Inherits Drp::Detector.
Public Member Functions | |
| Digitizer (Parameters *para, MemPool *pool) | |
| Keep the hsd_epics_prefix kwarg and the strm_limit kwarg (default 1000000), import psdaq.configdb.hsd_config, call its hsd_init with the prefix and device, and create a PythonConfigScanner. | |
| ~Digitizer () | |
| Delete the config scanner and release the Python module. | |
| nlohmann::json | connectionInfo (const nlohmann::json &msg) override |
| Call hsd_connect in psdaq.configdb.hsd_config with msg as a JSON string, read paddr from the returned dict and return xpmInfo(paddr) (xpm_id and xpm_port). | |
| void | connect (const nlohmann::json &, const std::string &collectionId) override |
| Keep the connect message as a JSON string (passed to hsd_config by configure()) and set the readout group from body.drp.collectionId.det_info.readout of the message. | |
| unsigned | configure (const std::string &config_alias, XtcData::Xtc &xtc, const void *bufEnd) override |
| Call hsd_config in the Python module with the connect JSON, EPICS prefix, config_alias, detector name, segment and readout group, translate the returned JSON to XTC and append it to xtc, then add the L1Accept names (eventHeader, plus chan00 because the lane mask is fixed at 1). | |
| void | event (XtcData::Dgram &dgram, const void *bufEnd, PGPEvent *event, uint64_t l1count) override |
| Store the two TimingHeader words as eventHeader and copy each lane's payload (after the TimingHeader) into name index lane+1, then walk the stream headers of the payload. | |
| void | shutdown () override |
| Call hsd_unconfig in psdaq.configdb.hsd_config with the EPICS prefix; its return value is not checked. | |
| unsigned | configureScan (const nlohmann::json &stepInfo, XtcData::Xtc &xtc, const void *bufEnd) override |
| Pass the scan keys in stepInfo to PythonConfigScanner::configure (which calls the Python scan-keys function for the detector type) with names index UpdateNamesIndex, and return its result. | |
| unsigned | stepScan (const nlohmann::json &stepInfo, XtcData::Xtc &xtc, const void *bufEnd) override |
| Pass stepInfo to PythonConfigScanner::step (which calls the Python update function for the detector type) with names index UpdateNamesIndex, and return its result. | |
Public Member Functions inherited from Drp::Detector | |
| Detector (Parameters *para, MemPool *pool) | |
| Set nodeId to -1u and virtChan to 0, keep para and pool, and allocate a transition buffer of para->maxTrSize bytes. | |
| virtual | ~Detector () |
| Does nothing; empty body. | |
| virtual Gpu::Detector * | gpuDetector () |
| Return nullptr; Gpu::Detector overrides it to return itself. | |
| virtual void | connectionShutdown () |
| Does nothing unless overridden. | |
| virtual unsigned | beginrun (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &runInfo) |
| Return 0 without doing anything unless overridden. | |
| virtual unsigned | beginstep (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &stepInfo) |
| Return 0 without doing anything unless overridden. | |
| virtual unsigned | enable (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &info) |
| Return 0 without doing anything unless overridden. | |
| virtual unsigned | disable (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &info) |
| Return 0 without doing anything unless overridden. | |
| virtual void | slowupdate (XtcData::Xtc &xtc, const void *bufEnd) |
| Reset xtc to an empty Parent Xtc whose source is nodeId. | |
| virtual void | event (XtcData::Dgram &dgram, const void *bufEnd, const Pds::Eb::ResultDgram &result) |
| Does nothing unless overridden; called with the trigger result for an event. | |
| virtual XtcData::Shape | shapeCube (unsigned rawDefIndex, unsigned valueIndex, XtcData::DescData &rawData) |
| Return the shape in rawData of entry valueIndex of raw definition rawDefIndex (from rawDef()). | |
| virtual unsigned | addToCube (unsigned rawDefIndex, unsigned valueIndex, unsigned subIndex, double *dst, unsigned bin, XtcData::DescData &rawData) |
| Generic cube accumulation without calibration: add the value or array entry valueIndex of rawData, converted to double, into bin bin of dst (entries of any XTC numeric type). | |
| virtual unsigned | subIndices () |
| Return 0 unless overridden. | |
| virtual unsigned | rawNamesIndex () |
| Return 0 unless overridden. | |
| virtual unsigned | cubeNamesIndex () |
| Return 0 unless overridden. | |
| virtual unsigned | cubeBinBytes () |
| Return ten times the pebble buffer size unless overridden. | |
| virtual std::vector< XtcData::VarDef > & | rawDef () |
| Log an error and abort; detectors used for cube binning must override it. | |
| virtual unsigned | maxMonBufSize () |
| Return the pebble buffer size, times 10 when Parameters::nCubeWorkers is non-zero. | |
| virtual Pds::TimingHeader * | getTimingHeader (uint32_t index) const |
| Return the start of DMA buffer index as a TimingHeader pointer. | |
| virtual bool | scanEnabled () |
| Return false unless overridden. | |
| XtcData::Xtc & | transitionXtc () |
| Return the start of the transition buffer as an Xtc reference. | |
| const void * | trXtcBufEnd () |
| Return the end of the transition buffer. | |
| XtcData::NamesLookup & | namesLookup () |
| Return the names lookup table of this detector. | |
Additional Inherited Members | |
Public Attributes inherited from Drp::Detector | |
| unsigned | nodeId |
| Node ID used as the XTC source; -1u until set. | |
| unsigned | virtChan |
| Virtual channel number; 0 unless a subclass sets it. | |
Protected Attributes inherited from Drp::Detector | |
| Parameters * | m_para |
| MemPool * | m_pool |
| XtcData::NamesLookup | m_namesLookup |
| std::vector< char > | m_xtcbuf |
Detector for the high-speed digitizer (detType hsd per drp.cc), configured through the Python module psdaq.configdb.hsd_config with the EPICS prefix from the hsd_epics_prefix kwarg.
| Drp::Digitizer::Digitizer | ( | Parameters * | para, |
| MemPool * | pool | ||
| ) |
Keep the hsd_epics_prefix kwarg and the strm_limit kwarg (default 1000000), import psdaq.configdb.hsd_config, call its hsd_init with the prefix and device, and create a PythonConfigScanner.
Aborts on a Python error.
| Drp::Digitizer::~Digitizer | ( | ) |
Delete the config scanner and release the Python module.
|
overridevirtual |
Call hsd_config in the Python module with the connect JSON, EPICS prefix, config_alias, detector name, segment and readout group, translate the returned JSON to XTC and append it to xtc, then add the L1Accept names (eventHeader, plus chan00 because the lane mask is fixed at 1).
Returns 0; throws a C-string error if the JSON-to-XTC translation returns 0 or more than its 1 MiB buffer.
Implements Drp::Detector.
|
overridevirtual |
Pass the scan keys in stepInfo to PythonConfigScanner::configure (which calls the Python scan-keys function for the detector type) with names index UpdateNamesIndex, and return its result.
Reimplemented from Drp::Detector.
|
overridevirtual |
Keep the connect message as a JSON string (passed to hsd_config by configure()) and set the readout group from body.drp.collectionId.det_info.readout of the message.
Reimplemented from Drp::Detector.
|
overridevirtual |
Call hsd_connect in psdaq.configdb.hsd_config with msg as a JSON string, read paddr from the returned dict and return xpmInfo(paddr) (xpm_id and xpm_port).
Logs a critical message and aborts if paddr is 0, 0xffffffff, or its low byte is above 15.
Reimplemented from Drp::Detector.
|
overridevirtual |
Store the two TimingHeader words as eventHeader and copy each lane's payload (after the TimingHeader) into name index lane+1, then walk the stream headers of the payload.
Damage is increased (UserDefined) when bit 31 of the second word (JESD status, per the code comment) is clear, when a lane's size is at or above the strm_limit (that lane is skipped), or when a stream header reports unlocked; a stream header reporting overflow is logged as critical and aborts.
Implements Drp::Detector.
|
overridevirtual |
Call hsd_unconfig in psdaq.configdb.hsd_config with the EPICS prefix; its return value is not checked.
Reimplemented from Drp::Detector.
|
overridevirtual |
Pass stepInfo to PythonConfigScanner::step (which calls the Python update function for the detector type) with names index UpdateNamesIndex, and return its result.
Reimplemented from Drp::Detector.