lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Drp::BEBDetector Class Referenceabstract

Detector base for devices whose event data is formatted by the AxiStreamBatcherEventBuilder firmware (per the header comment). More...

#include <BEBDetector.hh>

Inherits Drp::Detector.

Inherited by Drp::Epix100, Drp::EpixHR2x2, Drp::EpixM320, Drp::EpixQuad, Drp::EpixUHR, Drp::EpixUHR3x2, Drp::HREncoder, Drp::Jungfrau, Drp::Opal, Drp::Piranha4, Drp::TimeTool, Drp::TimingBEB, and Drp::Wave8.

Public Member Functions

 BEBDetector (Parameters *para, MemPool *pool)
 Construct the Detector base with virtual channel 1 and no Python module yet; subclasses must call _init() (or their own variant).
 
virtual ~BEBDetector ()
 Delete the config scanner and release the Python module.
 
nlohmann::json connectionInfo (const nlohmann::json &msg) override
 Call {detType}_connectionInfo in Python with the device handle and msg, store its paddr entry (aborting if it is 0, 0xffffffff or has a low byte above 15), pass the result to _connectionInfo() and return xpmInfo(paddr).
 
void connectionShutdown () override
 Call {detType}_connectionShutdown in Python if the module defines it.
 
void connect (const nlohmann::json &, const std::string &collectionId) override
 Keep the connect message and the readout group of this DRP (det_info.readout of entry collectionId).
 
unsigned configure (const std::string &config_alias, XtcData::Xtc &xtc, const void *bufEnd) override
 Call {detType}_config in Python (with segment and serial numbers in multi-segment mode), translate the returned JSON, or list of JSON per segment, into configuration XTC, let the subclass _configure() add its names, append the configuration to xtc and return the _configure() result.
 
void event (XtcData::Dgram &dgram, const void *bufEnd, PGPEvent *event, uint64_t l1count) override
 Split the DMA buffer of each lane in event->mask into batcher subframes (one more batcher level is unwrapped when m_debatch is set), keep all subframes of the first lane that has more than 2 and subframe 2 of each later one, and pass them to _event().
 
void shutdown () override
 Call {detType}_unconfig in Python with the device handle.
 
unsigned configureScan (const nlohmann::json &stepInfo, XtcData::Xtc &xtc, const void *bufEnd) override
 Pass stepInfo to PythonConfigScanner::configure() with the update names ID and return its result.
 
unsigned stepScan (const nlohmann::json &stepInfo, XtcData::Xtc &xtc, const void *bufEnd) override
 Pass stepInfo to PythonConfigScanner::step() with the update names ID and return its result.
 
Pds::TimingHeader * getTimingHeader (uint32_t index) const override
 Return the timing header of DMA buffer index: the data after the first batcher header, or after the second one when m_debatch is set.
 
- 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 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 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.
 

Static Public Member Functions

static PyObject * _check (PyObject *)
 Return obj; if it is null, print the Python error, log it and abort.
 

Protected Member Functions

virtual void _connectionInfo (PyObject *)
 
virtual unsigned _configure (XtcData::Xtc &, const void *bufEnd, XtcData::ConfigIter &)=0
 
virtual void _event (XtcData::Xtc &, const void *bufEnd, uint64_t l1count, std::vector< XtcData::Array< uint8_t > > &)
 
void _init (const char *)
 
void _init_feb ()
 
std::vector< XtcData::Array< uint8_t > > _subframes (void *buffer, unsigned length)
 
std::vector< XtcData::Array< uint8_t > > _subframes (void *buffer, unsigned length, size_t nsubhint)
 

Static Protected Member Functions

static std::string _string_from_PyDict (PyObject *, const char *key)
 

Protected Attributes

std::string m_connect_json
 
unsigned m_readoutGroup
 
PyObject * m_module
 
PyObject * m_root
 
unsigned m_paddr
 
PythonConfigScanner * m_configScanner
 
bool m_debatch
 
bool m_multiSegment = false
 
std::string m_segNoStr {""}
 
- Protected Attributes inherited from Drp::Detector
Parameters * m_para
 
MemPool * m_pool
 
XtcData::NamesLookup m_namesLookup
 
std::vector< char > m_xtcbuf
 

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.
 

Detailed Description

Detector base for devices whose event data is formatted by the AxiStreamBatcherEventBuilder firmware (per the header comment).

Configuration and control go through the Python module psdaq.configdb.{detType}_config, and each event is split into batcher subframes that are passed to the subclass _event().

Constructor & Destructor Documentation

◆ BEBDetector()

Drp::BEBDetector::BEBDetector ( Parameters *  para,
MemPool *  pool 
)

Construct the Detector base with virtual channel 1 and no Python module yet; subclasses must call _init() (or their own variant).

◆ ~BEBDetector()

virtual Drp::BEBDetector::~BEBDetector ( )
virtual

Delete the config scanner and release the Python module.

Member Function Documentation

◆ _check()

static PyObject * Drp::BEBDetector::_check ( PyObject *  )
static

Return obj; if it is null, print the Python error, log it and abort.

◆ _configure()

virtual unsigned Drp::BEBDetector::_configure ( XtcData::Xtc &  ,
const void *  bufEnd,
XtcData::ConfigIter &   
)
protectedpure virtual

◆ _connectionInfo()

virtual void Drp::BEBDetector::_connectionInfo ( PyObject *  )
inlineprotectedvirtual

◆ _event()

virtual void Drp::BEBDetector::_event ( XtcData::Xtc &  ,
const void *  bufEnd,
uint64_t  l1count,
std::vector< XtcData::Array< uint8_t > > &   
)
inlineprotectedvirtual

◆ _init()

void Drp::BEBDetector::_init ( const char *  )
protected

◆ _init_feb()

void Drp::BEBDetector::_init_feb ( )
protected

◆ _string_from_PyDict()

static std::string Drp::BEBDetector::_string_from_PyDict ( PyObject *  ,
const char *  key 
)
staticprotected

◆ _subframes() [1/2]

std::vector< XtcData::Array< uint8_t > > Drp::BEBDetector::_subframes ( void *  buffer,
unsigned  length 
)
protected

◆ _subframes() [2/2]

std::vector< XtcData::Array< uint8_t > > Drp::BEBDetector::_subframes ( void *  buffer,
unsigned  length,
size_t  nsubhint 
)
protected

◆ configure()

unsigned Drp::BEBDetector::configure ( const std::string &  config_alias,
XtcData::Xtc &  xtc,
const void *  bufEnd 
)
overridevirtual

Call {detType}_config in Python (with segment and serial numbers in multi-segment mode), translate the returned JSON, or list of JSON per segment, into configuration XTC, let the subclass _configure() add its names, append the configuration to xtc and return the _configure() result.

Returns -1 (as unsigned) if translation fails; throws a C string if the result exceeds maxTrSize.

Implements Drp::Detector.

◆ configureScan()

unsigned Drp::BEBDetector::configureScan ( const nlohmann::json &  stepInfo,
XtcData::Xtc &  xtc,
const void *  bufEnd 
)
overridevirtual

Pass stepInfo to PythonConfigScanner::configure() with the update names ID and return its result.

Reimplemented from Drp::Detector.

Reimplemented in Drp::Jungfrau.

◆ connect()

void Drp::BEBDetector::connect ( const nlohmann::json &  ,
const std::string &  collectionId 
)
overridevirtual

Keep the connect message and the readout group of this DRP (det_info.readout of entry collectionId).

Reimplemented from Drp::Detector.

Reimplemented in Drp::TimingBEB.

◆ connectionInfo()

nlohmann::json Drp::BEBDetector::connectionInfo ( const nlohmann::json &  msg)
overridevirtual

Call {detType}_connectionInfo in Python with the device handle and msg, store its paddr entry (aborting if it is 0, 0xffffffff or has a low byte above 15), pass the result to _connectionInfo() and return xpmInfo(paddr).

Reimplemented from Drp::Detector.

Reimplemented in Drp::EpixUHR3x2.

◆ connectionShutdown()

void Drp::BEBDetector::connectionShutdown ( )
overridevirtual

Call {detType}_connectionShutdown in Python if the module defines it.

Reimplemented from Drp::Detector.

◆ event()

void Drp::BEBDetector::event ( XtcData::Dgram &  dgram,
const void *  bufEnd,
PGPEvent *  event,
uint64_t  l1count 
)
overridevirtual

Split the DMA buffer of each lane in event->mask into batcher subframes (one more batcher level is unwrapped when m_debatch is set), keep all subframes of the first lane that has more than 2 and subframe 2 of each later one, and pass them to _event().

Implements Drp::Detector.

◆ getTimingHeader()

Pds::TimingHeader * Drp::BEBDetector::getTimingHeader ( uint32_t  index) const
overridevirtual

Return the timing header of DMA buffer index: the data after the first batcher header, or after the second one when m_debatch is set.

Reimplemented from Drp::Detector.

Reimplemented in Drp::EpixHR2x2, Drp::EpixM320, Drp::EpixUHR, and Drp::EpixUHR3x2.

◆ shutdown()

void Drp::BEBDetector::shutdown ( )
overridevirtual

Call {detType}_unconfig in Python with the device handle.

Reimplemented from Drp::Detector.

Reimplemented in Drp::Epix100, Drp::EpixHR2x2, Drp::EpixM320, Drp::EpixQuad, Drp::EpixUHR, Drp::EpixUHR3x2, Drp::Opal, Drp::Piranha4, and Drp::TimingBEB.

◆ stepScan()

unsigned Drp::BEBDetector::stepScan ( const nlohmann::json &  stepInfo,
XtcData::Xtc &  xtc,
const void *  bufEnd 
)
overridevirtual

Pass stepInfo to PythonConfigScanner::step() with the update names ID and return its result.

Reimplemented from Drp::Detector.

Reimplemented in Drp::Jungfrau.

Member Data Documentation

◆ m_configScanner

PythonConfigScanner* Drp::BEBDetector::m_configScanner
protected

◆ m_connect_json

std::string Drp::BEBDetector::m_connect_json
protected

◆ m_debatch

bool Drp::BEBDetector::m_debatch
protected

◆ m_module

PyObject* Drp::BEBDetector::m_module
protected

◆ m_multiSegment

bool Drp::BEBDetector::m_multiSegment = false
protected

◆ m_paddr

unsigned Drp::BEBDetector::m_paddr
protected

◆ m_readoutGroup

unsigned Drp::BEBDetector::m_readoutGroup
protected

◆ m_root

PyObject* Drp::BEBDetector::m_root
protected

◆ m_segNoStr

std::string Drp::BEBDetector::m_segNoStr {""}
protected

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