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

Abstract base of the DRP detector classes: transition hooks (most default to doing nothing and returning 0), event handlers, cube binning hooks and a buffer for building transition XTC. More...

#include <Detector.hh>

Inherited by Drp::BEBDetector, Drp::Digitizer, Drp::Gpu::Detector, and Drp::XpmDetector.

Public Member Functions

 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 nlohmann::json connectionInfo (const nlohmann::json &msg)
 Return an empty JSON object unless overridden; msg is not used.
 
virtual void connectionShutdown ()
 Does nothing unless overridden.
 
virtual void connect (const nlohmann::json &, const std::string &collectionId)
 Does nothing unless overridden.
 
virtual unsigned configure (const std::string &config_alias, XtcData::Xtc &xtc, const void *bufEnd)=0
 Pure virtual: add the Configure data for config_alias to xtc; implementations return 0 on success.
 
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, 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 void shutdown ()
 Does nothing unless overridden.
 
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 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.
 

Public Attributes

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

Parameters * m_para
 
MemPool * m_pool
 
XtcData::NamesLookup m_namesLookup
 
std::vector< char > m_xtcbuf
 

Detailed Description

Abstract base of the DRP detector classes: transition hooks (most default to doing nothing and returning 0), event handlers, cube binning hooks and a buffer for building transition XTC.

Constructor & Destructor Documentation

◆ Detector()

Drp::Detector::Detector ( Parameters *  para,
MemPool *  pool 
)
inline

Set nodeId to -1u and virtChan to 0, keep para and pool, and allocate a transition buffer of para->maxTrSize bytes.

◆ ~Detector()

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

Does nothing; empty body.

Reimplemented in Drp::Gpu::Detector.

Member Function Documentation

◆ addToCube()

virtual unsigned Drp::Detector::addToCube ( unsigned  rawDefIndex,
unsigned  valueIndex,
unsigned  subIndex,
double *  dst,
unsigned  bin,
XtcData::DescData &  rawData 
)
virtual

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).

subIndex is not used. Returns the size of one bin entry in bytes.

Reimplemented in Drp::AreaDetector, and Drp::TimingSystem.

◆ beginrun()

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

Return 0 without doing anything unless overridden.

Reimplemented in Drp::Gpu::EpixUHRsim, Drp::AreaDetector, Drp::EpixHRemu, Drp::Jungfrau, Drp::JungfrauEmulator, Drp::Gpu::Detector, and Drp::Gpu::EpixUHRemu.

◆ beginstep()

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

Return 0 without doing anything unless overridden.

Reimplemented in Drp::TimingSystem, and Drp::Gpu::Detector.

◆ configure()

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

◆ configureScan()

virtual unsigned Drp::Detector::configureScan ( const nlohmann::json &  stepInfo,
XtcData::Xtc &  xtc,
const void *  bufEnd 
)
inlinevirtual

Return 1 (failure) unless overridden, per the code comment.

Reimplemented in Drp::TimingSystem, Drp::Jungfrau, Drp::BEBDetector, and Drp::Digitizer.

◆ connect()

virtual void Drp::Detector::connect ( const nlohmann::json &  ,
const std::string &  collectionId 
)
inlinevirtual

◆ connectionInfo()

virtual nlohmann::json Drp::Detector::connectionInfo ( const nlohmann::json &  msg)
inlinevirtual

Return an empty JSON object unless overridden; msg is not used.

Reimplemented in Drp::BEBDetector, Drp::Digitizer, Drp::EpixUHR3x2, Drp::XpmDetector, Drp::Gpu::Detector, and Drp::Gpu::SimDetector.

◆ connectionShutdown()

virtual void Drp::Detector::connectionShutdown ( )
inlinevirtual

Does nothing unless overridden.

Reimplemented in Drp::BEBDetector, Drp::XpmDetector, Drp::Gpu::Detector, and Drp::Gpu::SimDetector.

◆ cubeBinBytes()

virtual unsigned Drp::Detector::cubeBinBytes ( )
inlinevirtual

Return ten times the pebble buffer size unless overridden.

Reimplemented in Drp::AreaDetector.

◆ cubeNamesIndex()

virtual unsigned Drp::Detector::cubeNamesIndex ( )
inlinevirtual

Return 0 unless overridden.

Reimplemented in Drp::AreaDetector, and Drp::TimingSystem.

◆ disable()

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

Return 0 without doing anything unless overridden.

Reimplemented in Drp::PvDetector, Drp::Epix100, Drp::EpixHR2x2, Drp::EpixM320, Drp::EpixQuad, Drp::EpixUHR, Drp::EpixUHR3x2, Drp::Jungfrau, and Drp::Gpu::Detector.

◆ enable()

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

Return 0 without doing anything unless overridden.

Reimplemented in Drp::PvDetector, Drp::Epix100, Drp::EpixHR2x2, Drp::EpixM320, Drp::EpixQuad, Drp::EpixUHR, Drp::EpixUHR3x2, Drp::Jungfrau, and Drp::Gpu::Detector.

◆ event() [1/2]

virtual void Drp::Detector::event ( XtcData::Dgram &  dgram,
const void *  bufEnd,
const Pds::Eb::ResultDgram &  result 
)
inlinevirtual

Does nothing unless overridden; called with the trigger result for an event.

Reimplemented in Drp::AreaDetector, Drp::TimingSystem, and Drp::PvDetector.

◆ event() [2/2]

virtual void Drp::Detector::event ( XtcData::Dgram &  dgram,
const void *  bufEnd,
PGPEvent *  event,
uint64_t  count 
)
pure virtual

◆ getTimingHeader()

virtual Pds::TimingHeader * Drp::Detector::getTimingHeader ( uint32_t  index) const
inlinevirtual

Return the start of DMA buffer index as a TimingHeader pointer.

Reimplemented in Drp::BEBDetector, Drp::EpixHR2x2, Drp::EpixM320, Drp::EpixUHR, Drp::EpixUHR3x2, and Drp::Gpu::Detector.

◆ gpuDetector()

virtual Gpu::Detector * Drp::Detector::gpuDetector ( )
inlinevirtual

Return nullptr; Gpu::Detector overrides it to return itself.

Reimplemented in Drp::Gpu::Detector.

◆ maxMonBufSize()

virtual unsigned Drp::Detector::maxMonBufSize ( )
inlinevirtual

Return the pebble buffer size, times 10 when Parameters::nCubeWorkers is non-zero.

Reimplemented in Drp::TimingSystem.

◆ namesLookup()

XtcData::NamesLookup & Drp::Detector::namesLookup ( )
inline

Return the names lookup table of this detector.

◆ rawDef()

virtual std::vector< XtcData::VarDef > & Drp::Detector::rawDef ( )
virtual

Log an error and abort; detectors used for cube binning must override it.

Reimplemented in Drp::AreaDetector, and Drp::TimingSystem.

◆ rawNamesIndex()

virtual unsigned Drp::Detector::rawNamesIndex ( )
inlinevirtual

Return 0 unless overridden.

Reimplemented in Drp::AreaDetector, and Drp::TimingSystem.

◆ scanEnabled()

virtual bool Drp::Detector::scanEnabled ( )
inlinevirtual

◆ shapeCube()

virtual XtcData::Shape Drp::Detector::shapeCube ( unsigned  rawDefIndex,
unsigned  valueIndex,
XtcData::DescData &  rawData 
)
virtual

Return the shape in rawData of entry valueIndex of raw definition rawDefIndex (from rawDef()).

Reimplemented in Drp::TimingSystem.

◆ shutdown()

virtual void Drp::Detector::shutdown ( )
inlinevirtual

◆ slowupdate()

virtual void Drp::Detector::slowupdate ( XtcData::Xtc &  xtc,
const void *  bufEnd 
)
inlinevirtual

Reset xtc to an empty Parent Xtc whose source is nodeId.

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

◆ stepScan()

virtual unsigned Drp::Detector::stepScan ( const nlohmann::json &  stepInfo,
XtcData::Xtc &  xtc,
const void *  bufEnd 
)
inlinevirtual

Return 1 (failure) unless overridden.

Reimplemented in Drp::BEBDetector, Drp::Digitizer, Drp::Jungfrau, and Drp::TimingSystem.

◆ subIndices()

virtual unsigned Drp::Detector::subIndices ( )
inlinevirtual

Return 0 unless overridden.

Reimplemented in Drp::AreaDetector.

◆ transitionXtc()

XtcData::Xtc & Drp::Detector::transitionXtc ( )
inline

Return the start of the transition buffer as an Xtc reference.

◆ trXtcBufEnd()

const void * Drp::Detector::trXtcBufEnd ( )
inline

Return the end of the transition buffer.

Member Data Documentation

◆ m_namesLookup

XtcData::NamesLookup Drp::Detector::m_namesLookup
protected

◆ m_para

Parameters* Drp::Detector::m_para
protected

◆ m_pool

MemPool* Drp::Detector::m_pool
protected

◆ m_xtcbuf

std::vector<char> Drp::Detector::m_xtcbuf
protected

◆ nodeId

unsigned Drp::Detector::nodeId

Node ID used as the XTC source; -1u until set.

◆ virtChan

unsigned Drp::Detector::virtChan

Virtual channel number; 0 unless a subclass sets it.


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