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

Base of the GPU DRP detectors (Drp::Gpu::Detector). More...

#include <Detector.hh>

Inherits Drp::Detector.

Inherited by Drp::Gpu::AreaDetector, Drp::Gpu::EpixUHRemu, Drp::Gpu::EpixUHRsim, and Drp::Gpu::SimDetector.

Public Member Functions

 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.
 
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 &connect_json, const std::string &collectionId) override
 If there is a wrapped detector, copy nodeId to it and call its connect(connect_json, collectionId).
 
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.
 
void shutdown () override
 Call shutdown() on the wrapped detector, if any.
 
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 void issuePhase2 (XtcData::TransitionId::Value)
 Start phase 2 of a transition; PGPDetectorApp calls it after phase 1 only in simulator mode (device /dev/null).
 
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.
 

Protected Member Functions

template<typename T >
void _initialize (Parameters &para, MemPoolGpu &pool)
 

Protected Attributes

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
 

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

Base of the GPU DRP detectors (Drp::Gpu::Detector).

The transition methods forward to a wrapped Drp::Detector for the PGP device when one was created with _initialize(); the pure virtual methods give the Reader calibration kernel its constants.

Constructor & Destructor Documentation

◆ Detector()

Drp::Gpu::Detector::Detector ( Parameters *  para,
MemPoolGpu *  pool 
)
inline

Pass para and pool to Drp::Detector; no wrapped detector until _initialize() is called.

◆ ~Detector()

virtual Drp::Gpu::Detector::~Detector ( )
inlinevirtual

Delete the wrapped detector, if any.

Reimplemented from Drp::Detector.

Member Function Documentation

◆ _initialize()

template<typename T >
void Drp::Gpu::Detector::_initialize ( Parameters &  para,
MemPoolGpu &  pool 
)
inlineprotected

◆ beginrun()

unsigned Drp::Gpu::Detector::beginrun ( XtcData::Xtc &  xtc,
const void *  bufEnd,
const nlohmann::json &  runInfo 
)
overridevirtual

Call beginrun() on the wrapped detector, logging an error if it returns non-zero.

Returns its result, or 0 if there is no wrapped detector.

Reimplemented from Drp::Detector.

Reimplemented in Drp::Gpu::EpixUHRsim, and Drp::Gpu::EpixUHRemu.

◆ beginstep()

unsigned Drp::Gpu::Detector::beginstep ( XtcData::Xtc &  xtc,
const void *  bufEnd,
const nlohmann::json &  stepInfo 
)
overridevirtual

Call beginstep() on the wrapped detector, logging an error if it returns non-zero.

Returns its result, or 0 if there is no wrapped detector.

Reimplemented from Drp::Detector.

◆ configure()

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

Call configure() on the wrapped detector, logging an error if it returns non-zero.

Returns its result, or 0 if there is no wrapped detector.

Implements Drp::Detector.

Reimplemented in Drp::Gpu::EpixUHRemu, and Drp::Gpu::EpixUHRsim.

◆ connect()

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

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

Reimplemented from Drp::Detector.

Reimplemented in Drp::Gpu::SimDetector.

◆ connectionInfo()

nlohmann::json Drp::Gpu::Detector::connectionInfo ( const nlohmann::json &  msg)
overridevirtual

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

Reimplemented from Drp::Detector.

Reimplemented in Drp::Gpu::SimDetector.

◆ connectionShutdown()

void Drp::Gpu::Detector::connectionShutdown ( )
overridevirtual

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

Reimplemented from Drp::Detector.

Reimplemented in Drp::Gpu::SimDetector.

◆ disable()

unsigned Drp::Gpu::Detector::disable ( XtcData::Xtc &  xtc,
const void *  bufEnd,
const nlohmann::json &  info 
)
overridevirtual

Call disable() on the wrapped detector, logging an error if it returns non-zero.

Returns its result, or 0 if there is no wrapped detector.

Reimplemented from Drp::Detector.

◆ enable()

unsigned Drp::Gpu::Detector::enable ( XtcData::Xtc &  xtc,
const void *  bufEnd,
const nlohmann::json &  info 
)
overridevirtual

Call enable() on the wrapped detector, logging an error if it returns non-zero.

Returns its result, or 0 if there is no wrapped detector.

Reimplemented from Drp::Detector.

◆ gains_d()

virtual float const * Drp::Gpu::Detector::gains_d ( ) const
pure virtual

Pure virtual: return the device array of gains, laid out like pedestals_d().

Implemented in Drp::Gpu::AreaDetector, Drp::Gpu::EpixUHRemu, and Drp::Gpu::EpixUHRsim.

◆ getTimingHeader()

Pds::TimingHeader * Drp::Gpu::Detector::getTimingHeader ( uint32_t  index) const
inlineoverridevirtual

Return the address just past the DmaDsc at the start of host write buffer index of the MemPoolGpu (hostWrtBufs()), as a TimingHeader pointer.

Reimplemented from Drp::Detector.

◆ gpuDetector()

Gpu::Detector * Drp::Gpu::Detector::gpuDetector ( )
inlineoverridevirtual

Return this object.

Reimplemented from Drp::Detector.

◆ issuePhase2()

virtual void Drp::Gpu::Detector::issuePhase2 ( XtcData::TransitionId::Value  )
inlinevirtual

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

Does nothing here.

Reimplemented in Drp::Gpu::EpixUHRsim, and Drp::Gpu::SimDetector.

◆ pedestals_d()

virtual float const * Drp::Gpu::Detector::pedestals_d ( ) const
pure virtual

Pure virtual: return the device array of pedestals, one set per gain range of one value per pixel.

The Reader kernel computes (data - pedestal) * gain.

Implemented in Drp::Gpu::AreaDetector, Drp::Gpu::EpixUHRemu, and Drp::Gpu::EpixUHRsim.

◆ rangeBits()

virtual unsigned Drp::Gpu::Detector::rangeBits ( ) const
pure virtual

Pure virtual: return the width in bits of the gain range field.

Implemented in Drp::Gpu::AreaDetector, Drp::Gpu::EpixUHRemu, and Drp::Gpu::EpixUHRsim.

◆ rangeOffset()

virtual unsigned Drp::Gpu::Detector::rangeOffset ( ) const
pure virtual

Pure virtual: return the bit position of the gain range field in a raw 16-bit value.

The Reader calibration kernel uses the bits below it as the data value.

Implemented in Drp::Gpu::AreaDetector, Drp::Gpu::EpixUHRemu, and Drp::Gpu::EpixUHRsim.

◆ referenceBufCnt()

virtual unsigned Drp::Gpu::Detector::referenceBufCnt ( ) const
inlinevirtual

Return the number of reference buffers; 0 here.

Reimplemented in Drp::Gpu::EpixUHRsim.

◆ referenceBuffers()

virtual float const * Drp::Gpu::Detector::referenceBuffers ( ) const
inlinevirtual

Return device buffers of reference calibrated data for checking (used in simulator mode only, per the code comment); null here.

Reimplemented in Drp::Gpu::EpixUHRsim.

◆ shutdown()

void Drp::Gpu::Detector::shutdown ( )
overridevirtual

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

Reimplemented from Drp::Detector.

Reimplemented in Drp::Gpu::SimDetector.

Member Data Documentation

◆ m_det

Drp::Detector* Drp::Gpu::Detector::m_det
protected

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