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

XpmDetector that records the payloads of the active PGP lanes as a raw UINT16 image (with a UINT32 value), adds a fixed 3x3 FEX array, and can bin the raw image into a cube with placeholder pedestals and gains. More...

#include <AreaDetector.hh>

Inherits Drp::XpmDetector.

Public Member Functions

 AreaDetector (Parameters *para, MemPool *pool)
 Construct the XpmDetector base; no calibration constants are allocated yet.
 
unsigned configure (const std::string &config_alias, XtcData::Xtc &xtc, const void *bufEnd) override
 Call XpmDetector::configure() (returning 1 if it fails), then declare the fex names (array_fex, UINT16, rank 2) and the raw names (value UINT32, array_raw UINT16 rank 2).
 
unsigned beginrun (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &runInfo) override
 (Re)allocate the pedestal and gain arrays, one double per 16-bit sample of all lanes (length from the sw_sim_length kwarg or the configured length), and fill them with 0.5 and 1.0.
 
void event (XtcData::Dgram &dgram, const void *bufEnd, PGPEvent *event, uint64_t l1count) override
 Add a 3x3 FEX array with values i + j, and a raw entry: value 9 followed by the DMA payload of each active lane after its 32-byte header (or sw_sim_length 32-bit words per lane if that kwarg is set), shaped as lanes by 16-bit samples.
 
virtual unsigned addToCube (unsigned rawDefIndex, unsigned valueIndex, unsigned subIndex, double *dst, unsigned bin, XtcData::DescData &rawData) override
 Accumulate raw data into cube bin bin: the value entry (only for subIndex 0) or, for array_raw, gain * (raw - pedestal) for each sample.
 
virtual unsigned subIndices () override
 Return 0; the lane-count variant is compiled only when USE_SUB_INDEX is defined.
 
virtual unsigned rawNamesIndex () override
 Return the raw names index (RawNamesIndex, value 0).
 
virtual unsigned cubeNamesIndex () override
 Return the cube names index (CubeNamesIndex, value 2).
 
virtual unsigned cubeBinBytes () override
 Return five times the pebble buffer size (the code comment notes the uint16_t to double conversion).
 
virtual std::vector< XtcData::VarDef > & rawDef () override
 Return a one-element list holding the raw definition (value and array_raw).
 
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.
 
- 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 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 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 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 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 Member Functions inherited from Drp::XpmDetector
 XpmDetector (Parameters *para, MemPool *pool, unsigned len=100)
 
nlohmann::json connectionInfo (const nlohmann::json &msg) override
 Return an empty JSON object unless overridden; msg is not used.
 
void connect (const nlohmann::json &, const std::string &collectionId) override
 Does nothing unless overridden.
 
unsigned configure (const std::string &config_alias, XtcData::Xtc &xtc, const void *bufEnd) override
 Pure virtual: add the Configure data for config_alias to xtc; implementations return 0 on success.
 
void shutdown () override
 Does nothing unless overridden.
 
void connectionShutdown () override
 Does nothing unless overridden.
 
- Protected Attributes inherited from Drp::XpmDetector
unsigned m_length
 
- Protected Attributes inherited from Drp::Detector
Parameters * m_para
 
MemPool * m_pool
 
XtcData::NamesLookup m_namesLookup
 
std::vector< char > m_xtcbuf
 

Detailed Description

XpmDetector that records the payloads of the active PGP lanes as a raw UINT16 image (with a UINT32 value), adds a fixed 3x3 FEX array, and can bin the raw image into a cube with placeholder pedestals and gains.

Constructor & Destructor Documentation

◆ AreaDetector()

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

Construct the XpmDetector base; no calibration constants are allocated yet.

Member Function Documentation

◆ addToCube()

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

Accumulate raw data into cube bin bin: the value entry (only for subIndex 0) or, for array_raw, gain * (raw - pedestal) for each sample.

Returns the entry size in bytes; note that dst is advanced by bin times that byte count in units of doubles. Aborts on an unknown valueIndex.

Reimplemented from Drp::Detector.

◆ beginrun()

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

(Re)allocate the pedestal and gain arrays, one double per 16-bit sample of all lanes (length from the sw_sim_length kwarg or the configured length), and fill them with 0.5 and 1.0.

Returns 0.

Reimplemented from Drp::Detector.

◆ configure()

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

Call XpmDetector::configure() (returning 1 if it fails), then declare the fex names (array_fex, UINT16, rank 2) and the raw names (value UINT32, array_raw UINT16 rank 2).

Returns 0.

Implements Drp::Detector.

◆ cubeBinBytes()

virtual unsigned Drp::AreaDetector::cubeBinBytes ( )
inlineoverridevirtual

Return five times the pebble buffer size (the code comment notes the uint16_t to double conversion).

Reimplemented from Drp::Detector.

◆ cubeNamesIndex()

virtual unsigned Drp::AreaDetector::cubeNamesIndex ( )
inlineoverridevirtual

Return the cube names index (CubeNamesIndex, value 2).

Reimplemented from Drp::Detector.

◆ event() [1/3]

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 from Drp::Detector.

◆ event() [2/3]

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

Pure virtual: add the L1Accept data of event (the DMA buffers of its lanes) to dgram.

Implements Drp::Detector.

◆ event() [3/3]

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

Add a 3x3 FEX array with values i + j, and a raw entry: value 9 followed by the DMA payload of each active lane after its 32-byte header (or sw_sim_length 32-bit words per lane if that kwarg is set), shaped as lanes by 16-bit samples.

l1count is not used.

Implements Drp::Detector.

◆ rawDef()

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

Return a one-element list holding the raw definition (value and array_raw).

Reimplemented from Drp::Detector.

◆ rawNamesIndex()

virtual unsigned Drp::AreaDetector::rawNamesIndex ( )
inlineoverridevirtual

Return the raw names index (RawNamesIndex, value 0).

Reimplemented from Drp::Detector.

◆ subIndices()

virtual unsigned Drp::AreaDetector::subIndices ( )
overridevirtual

Return 0; the lane-count variant is compiled only when USE_SUB_INDEX is defined.

Reimplemented from Drp::Detector.


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