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

Simulated GPU DRP detector for detType epixuhrsim (registered in PGPDetectorApp). More...

#include <EpixUHRsim.hh>

Inherits Drp::Gpu::Detector.

Public Member Functions

 EpixUHRsim (Parameters &para, MemPoolGpu &pool)
 Create the wrapped simulator and generate its 10 events, create the calibration buffers for NPixels pixels and device arrays of NRanges times NPixels pedestals and gains.
 
virtual ~EpixUHRsim () override
 Free the pedestal and gain arrays and destroy the calibration buffers.
 
unsigned configure (const std::string &config_alias, XtcData::Xtc &, const void *bufEnd) override
 Call configure on the wrapped simulator (logging an error if it fails), then add names for one UINT8 rank-1 array named array_raw under EventNamesIndex.
 
unsigned beginrun (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &info) override
 Call beginrun on the wrapped simulator (logging an error if it fails), fill the device pedestal and gain arrays with rand() values scaled to 0 through 16383 for every range and pixel, and have the simulator compute its reference calibrated data from them.
 
void event (XtcData::Dgram &dgram, const void *bufEnd, PGPEvent *event, uint64_t count) override
 Increase the damage of dgram when the lane 0 DMA size minus the TimingHeader is below NPixels 16-bit values (MissingData) or equals the DMA buffer size (Truncated); no data is added.
 
unsigned rangeOffset () const override
 Return RangeOffset (14).
 
unsigned rangeBits () const override
 Return RangeBits (2).
 
float const * pedestals_d () const override
 Return the device pedestal array (NRanges sets of NPixels values); beginrun() fills it with random values below 2^14.
 
float const * gains_d () const override
 Return the device gain array, laid out like pedestals_d(); beginrun() fills it with random values below 2^14.
 
void issuePhase2 (XtcData::TransitionId::Value tid) override
 Forward the transition to the wrapped simulator, which queues it for its event thread.
 
float const * referenceBuffers () const override
 Return the simulator's device buffers of reference calibrated data, one per generated event, computed at BeginRun.
 
unsigned referenceBufCnt () const override
 Return the number of reference buffers (the 10 generated events).
 
- 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.
 
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 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.
 
- 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, 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.
 

Static Public Attributes

static const unsigned NumAsics { 6 }
 Number of ASICs (6).
 
static const unsigned NumRows { 192 }
 Rows per ASIC (192).
 
static const unsigned NumCols { 168 }
 Columns per ASIC (168).
 
static const unsigned NPixels { NumAsics*NumRows*NumCols }
 Total number of pixels, NumAsics * NumRows * NumCols (193536).
 
static const unsigned RangeOffset { 14 }
 Bit position of the gain range field in a raw 16-bit value (14); the bits below it hold the data value.
 
static const unsigned RangeBits { 2 }
 Width of the gain range field (2 bits).
 
static const unsigned NRanges { 4 }
 Number of gain ranges with their own pedestal and gain arrays (4).
 

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::Gpu::Detector
template<typename T >
void _initialize (Parameters &para, MemPoolGpu &pool)
 
- 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

Simulated GPU DRP detector for detType epixuhrsim (registered in PGPDetectorApp).

It wraps a SimDetector that replays 10 randomly generated events with random gain ranges, sets random pedestals and gains at BeginRun, and keeps reference calibrated results for checking.

Constructor & Destructor Documentation

◆ EpixUHRsim()

Drp::Gpu::EpixUHRsim::EpixUHRsim ( Parameters &  para,
MemPoolGpu &  pool 
)

Create the wrapped simulator and generate its 10 events, create the calibration buffers for NPixels pixels and device arrays of NRanges times NPixels pedestals and gains.

Asserts that NPixels 16-bit values fit in a DMA buffer after the DMA descriptor and TimingHeader.

◆ ~EpixUHRsim()

virtual Drp::Gpu::EpixUHRsim::~EpixUHRsim ( )
overridevirtual

Free the pedestal and gain arrays and destroy the calibration buffers.

Member Function Documentation

◆ beginrun()

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

Call beginrun on the wrapped simulator (logging an error if it fails), fill the device pedestal and gain arrays with rand() values scaled to 0 through 16383 for every range and pixel, and have the simulator compute its reference calibrated data from them.

Returns the wrapped detector's result.

Reimplemented from Drp::Gpu::Detector.

◆ configure()

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

Call configure on the wrapped simulator (logging an error if it fails), then add names for one UINT8 rank-1 array named array_raw under EventNamesIndex.

Returns the wrapped detector's result.

Reimplemented from Drp::Gpu::Detector.

◆ event()

void Drp::Gpu::EpixUHRsim::event ( XtcData::Dgram &  dgram,
const void *  bufEnd,
PGPEvent *  event,
uint64_t  count 
)
overridevirtual

Increase the damage of dgram when the lane 0 DMA size minus the TimingHeader is below NPixels 16-bit values (MissingData) or equals the DMA buffer size (Truncated); no data is added.

Implements Drp::Detector.

◆ gains_d()

float const * Drp::Gpu::EpixUHRsim::gains_d ( ) const
inlineoverridevirtual

Return the device gain array, laid out like pedestals_d(); beginrun() fills it with random values below 2^14.

Implements Drp::Gpu::Detector.

◆ issuePhase2()

void Drp::Gpu::EpixUHRsim::issuePhase2 ( XtcData::TransitionId::Value  tid)
overridevirtual

Forward the transition to the wrapped simulator, which queues it for its event thread.

Reimplemented from Drp::Gpu::Detector.

◆ pedestals_d()

float const * Drp::Gpu::EpixUHRsim::pedestals_d ( ) const
inlineoverridevirtual

Return the device pedestal array (NRanges sets of NPixels values); beginrun() fills it with random values below 2^14.

Implements Drp::Gpu::Detector.

◆ rangeBits()

unsigned Drp::Gpu::EpixUHRsim::rangeBits ( ) const
inlineoverridevirtual

Return RangeBits (2).

Implements Drp::Gpu::Detector.

◆ rangeOffset()

unsigned Drp::Gpu::EpixUHRsim::rangeOffset ( ) const
inlineoverridevirtual

Return RangeOffset (14).

Implements Drp::Gpu::Detector.

◆ referenceBufCnt()

unsigned Drp::Gpu::EpixUHRsim::referenceBufCnt ( ) const
overridevirtual

Return the number of reference buffers (the 10 generated events).

Reimplemented from Drp::Gpu::Detector.

◆ referenceBuffers()

float const * Drp::Gpu::EpixUHRsim::referenceBuffers ( ) const
overridevirtual

Return the simulator's device buffers of reference calibrated data, one per generated event, computed at BeginRun.

Reimplemented from Drp::Gpu::Detector.

Member Data Documentation

◆ NPixels

const unsigned Drp::Gpu::EpixUHRsim::NPixels { NumAsics*NumRows*NumCols }
static

Total number of pixels, NumAsics * NumRows * NumCols (193536).

◆ NRanges

const unsigned Drp::Gpu::EpixUHRsim::NRanges { 4 }
static

Number of gain ranges with their own pedestal and gain arrays (4).

◆ NumAsics

const unsigned Drp::Gpu::EpixUHRsim::NumAsics { 6 }
static

Number of ASICs (6).

◆ NumCols

const unsigned Drp::Gpu::EpixUHRsim::NumCols { 168 }
static

Columns per ASIC (168).

◆ NumRows

const unsigned Drp::Gpu::EpixUHRsim::NumRows { 192 }
static

Rows per ASIC (192).

◆ RangeBits

const unsigned Drp::Gpu::EpixUHRsim::RangeBits { 2 }
static

Width of the gain range field (2 bits).

◆ RangeOffset

const unsigned Drp::Gpu::EpixUHRsim::RangeOffset { 14 }
static

Bit position of the gain range field in a raw 16-bit value (14); the bits below it hold the data value.


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