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

Base of simulated GPU detectors (EpixUHRsim uses it). More...

#include <SimDetector.hh>

Inherits Drp::Gpu::Detector.

Protected Member Functions

 SimDetector (Parameters *para, MemPoolGpu *pool, unsigned len=100)
 
virtual ~SimDetector ()
 
void shutdown () override
 Call shutdown() on the wrapped detector, if any.
 
nlohmann::json connectionInfo (const nlohmann::json &msg) override
 Return the wrapped detector's connectionInfo(msg), or a default-constructed (null) JSON value if there is no wrapped detector.
 
void connectionShutdown () override
 Call connectionShutdown() on the wrapped detector, if any.
 
void connect (const nlohmann::json &, const std::string &collectionId) override
 If there is a wrapped detector, copy nodeId to it and call its connect(connect_json, collectionId).
 
void issuePhase2 (XtcData::TransitionId::Value) override
 Start phase 2 of a transition; PGPDetectorApp calls it after phase 1 only in simulator mode (device /dev/null).
 
virtual size_t _genL1Payload (uint8_t **buffer, size_t index, size_t bufSize)=0
 
- Protected Member Functions inherited from Drp::Gpu::Detector
template<typename T >
void _initialize (Parameters &para, MemPoolGpu &pool)
 

Additional Inherited Members

- Public Member Functions inherited from Drp::Gpu::Detector
 Detector (Parameters *para, MemPoolGpu *pool)
 Pass para and pool to Drp::Detector; no wrapped detector until _initialize() is called.
 
virtual ~Detector ()
 Delete the wrapped detector, if any.
 
Gpu::Detector * gpuDetector () override
 Return this object.
 
unsigned configure (const std::string &config_alias, XtcData::Xtc &xtc, const void *bufEnd) override
 Call configure() on the wrapped detector, logging an error if it returns non-zero.
 
unsigned beginrun (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &runInfo) override
 Call beginrun() on the wrapped detector, logging an error if it returns non-zero.
 
unsigned beginstep (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &stepInfo) override
 Call beginstep() on the wrapped detector, logging an error if it returns non-zero.
 
unsigned enable (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &info) override
 Call enable() on the wrapped detector, logging an error if it returns non-zero.
 
unsigned disable (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &info) override
 Call disable() on the wrapped detector, logging an error if it returns non-zero.
 
Pds::TimingHeader * getTimingHeader (uint32_t index) const override
 Return the address just past the DmaDsc at the start of host write buffer index of the MemPoolGpu (hostWrtBufs()), as a TimingHeader pointer.
 
virtual unsigned rangeOffset () const =0
 Pure virtual: return the bit position of the gain range field in a raw 16-bit value.
 
virtual unsigned rangeBits () const =0
 Pure virtual: return the width in bits of the gain range field.
 
virtual float const * pedestals_d () const =0
 Pure virtual: return the device array of pedestals, one set per gain range of one value per pixel.
 
virtual float const * gains_d () const =0
 Pure virtual: return the device array of gains, laid out like pedestals_d().
 
virtual float const * referenceBuffers () const
 Return device buffers of reference calibrated data for checking (used in simulator mode only, per the code comment); null here.
 
virtual unsigned referenceBufCnt () const
 Return the number of reference buffers; 0 here.
 
- 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 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, PGPEvent *event, uint64_t count)=0
 Pure virtual: add the L1Accept data of event (the DMA buffers of its lanes) to dgram.
 
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 unsigned configureScan (const nlohmann::json &stepInfo, XtcData::Xtc &xtc, const void *bufEnd)
 Return 1 (failure) unless overridden, per the code comment.
 
virtual unsigned stepScan (const nlohmann::json &stepInfo, XtcData::Xtc &xtc, const void *bufEnd)
 Return 1 (failure) unless overridden.
 
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.
 
- 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::Gpu::Detector
Drp::Detector * m_det
 
- Protected Attributes inherited from Drp::Detector
Parameters * m_para
 
MemPool * m_pool
 
XtcData::NamesLookup m_namesLookup
 
std::vector< char > m_xtcbuf
 

Detailed Description

Base of simulated GPU detectors (EpixUHRsim uses it).

A thread started by connectionInfo() writes a TimingHeader, and for L1Accepts the payload from _genL1Payload() (copied only if the sim_l1_verify kwarg is present; its size is always counted), into the GPU DMA buffers for each transition queued by issuePhase2(). After Enable it keeps generating L1Accepts (every sim_l1_delay us, default 1 s) and SlowUpdates (sim_su_rate per second, default 1).

Constructor & Destructor Documentation

◆ SimDetector()

Drp::Gpu::SimDetector::SimDetector ( Parameters *  para,
MemPoolGpu *  pool,
unsigned  len = 100 
)
protected

◆ ~SimDetector()

virtual Drp::Gpu::SimDetector::~SimDetector ( )
protectedvirtual

Member Function Documentation

◆ _genL1Payload()

virtual size_t Drp::Gpu::SimDetector::_genL1Payload ( uint8_t **  buffer,
size_t  index,
size_t  bufSize 
)
protectedpure virtual

◆ connect()

void Drp::Gpu::SimDetector::connect ( const nlohmann::json &  connect_json,
const std::string &  collectionId 
)
overrideprotectedvirtual

If there is a wrapped detector, copy nodeId to it and call its connect(connect_json, collectionId).

Reimplemented from Drp::Gpu::Detector.

◆ connectionInfo()

nlohmann::json Drp::Gpu::SimDetector::connectionInfo ( const nlohmann::json &  msg)
overrideprotectedvirtual

Return the wrapped detector's connectionInfo(msg), or a default-constructed (null) JSON value if there is no wrapped detector.

Reimplemented from Drp::Gpu::Detector.

◆ connectionShutdown()

void Drp::Gpu::SimDetector::connectionShutdown ( )
overrideprotectedvirtual

Call connectionShutdown() on the wrapped detector, if any.

Reimplemented from Drp::Gpu::Detector.

◆ issuePhase2()

void Drp::Gpu::SimDetector::issuePhase2 ( XtcData::TransitionId::Value  )
overrideprotectedvirtual

Start phase 2 of a transition; PGPDetectorApp calls it after phase 1 only in simulator mode (device /dev/null).

Does nothing here.

Reimplemented from Drp::Gpu::Detector.

◆ shutdown()

void Drp::Gpu::SimDetector::shutdown ( )
overrideprotectedvirtual

Call shutdown() on the wrapped detector, if any.

Reimplemented from Drp::Gpu::Detector.


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