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

XpmDetector for timing-system data. More...

#include <TimingSystem.hh>

Inherits Drp::XpmDetector.

Public Member Functions

 TimingSystem (Parameters *para, MemPool *pool)
 Construct the XpmDetector base, import the module psdaq.configdb.
 
 ~TimingSystem ()
 Delete the config scanner and release the module reference.
 
void connect (const nlohmann::json &msg, const std::string &collectionId) override
 Call XpmDetector::connect(), then call ts_connect() of the module with the connect JSON, which is kept for configure().
 
unsigned configure (const std::string &config_alias, XtcData::Xtc &xtc, const void *bufEnd) override
 Call XpmDetector::configure() (returning 1 if it fails), append the configuration returned by ts_config() of the module as XTC (also taking serNo from its detId:RO entry), and declare the names of the L1Accept timing data (TimingDef) and of the trigger info (one UINT32 data field).
 
unsigned configureScan (const nlohmann::json &scan_keys, XtcData::Xtc &xtc, const void *bufEnd) override
 Pass scan_keys to PythonConfigScanner::configure() with the update names ID and return its result.
 
unsigned beginstep (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &stepInfo) override
 Print stepInfo to stdout and return 0.
 
unsigned stepScan (const nlohmann::json &stepInfo, XtcData::Xtc &xtc, const void *bufEnd) override
 Pass stepInfo to PythonConfigScanner::step() with the update names ID and return its result.
 
bool scanEnabled () override
 Return true; per the code comment this makes the detector record scan information.
 
void event (XtcData::Dgram &dgram, const void *bufEnd, PGPEvent *event, uint64_t l1count) override
 Describe the timing record that follows the TimingHeader in the DMA buffer of the first lane set in event->mask (TimingDef::describeData()); l1count is not used.
 
void event (XtcData::Dgram &dgram, const void *bufEnd, const Pds::Eb::ResultDgram &result) override
 Add the trigger result word (result.data()) as the triginfo data value.
 
XtcData::Shape shapeCube (unsigned rawDefIndex, unsigned valueIndex, XtcData::DescData &rawData) override
 Return the cube shape for raw definition 0: 288 event-code bins for valueIndex 0 or 8 inhibit counts for valueIndex 1.
 
unsigned addToCube (unsigned rawDefIndex, unsigned valueIndex, unsigned subIndex, double *dst, unsigned bin, XtcData::DescData &rawData) override
 Accumulate into cube bin bin: valueIndex 0 counts each set event-code bit of the 18 sequence words into 288 slots, valueIndex 1 adds the 8 inhibit counts.
 
unsigned rawNamesIndex () override
 Return the names index of the L1Accept data (EventNamesIndex, value 1).
 
unsigned cubeNamesIndex () override
 Return the names index of the cube data (CubeNamesIndex, value 4).
 
std::vector< XtcData::VarDef > & rawDef () override
 Return a one-element list of raw definitions used for cube binning: eventcodes (UINT8 array) and inhibitCounts (UINT32 array).
 
unsigned maxMonBufSize () override
 Return the pebble buffer size when Parameters::nCubeWorkers is 0, otherwise 0x40000.
 
- 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 beginrun (XtcData::Xtc &xtc, const void *bufEnd, const nlohmann::json &runInfo)
 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 unsigned subIndices ()
 Return 0 unless overridden.
 
virtual unsigned cubeBinBytes ()
 Return ten times the pebble buffer size unless overridden.
 
virtual Pds::TimingHeader * getTimingHeader (uint32_t index) const
 Return the start of DMA buffer index as a TimingHeader pointer.
 
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 for timing-system data.

Configuration comes from the Python module psdaq.configdb.{detType}_config; L1Accept data is the timing record that follows the TimingHeader in the DMA buffer, described with TimingDef.

Constructor & Destructor Documentation

◆ TimingSystem()

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

Construct the XpmDetector base, import the module psdaq.configdb.

{detType}_config and create a PythonConfigScanner for it. Throws a C string if the import fails.

◆ ~TimingSystem()

Drp::TimingSystem::~TimingSystem ( )

Delete the config scanner and release the module reference.

Member Function Documentation

◆ addToCube()

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

Accumulate into cube bin bin: valueIndex 0 counts each set event-code bit of the 18 sequence words into 288 slots, valueIndex 1 adds the 8 inhibit counts.

Case 0 has no break and falls through into case 1. Returns arraySize * sizeof(double_t) as left by the last case run (8 for valueIndex 0 or 1, 0 otherwise); aborts if rawDefIndex is not 0.

Reimplemented from Drp::Detector.

◆ beginstep()

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

Print stepInfo to stdout and return 0.

Reimplemented from Drp::Detector.

◆ configure()

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

Call XpmDetector::configure() (returning 1 if it fails), append the configuration returned by ts_config() of the module as XTC (also taking serNo from its detId:RO entry), and declare the names of the L1Accept timing data (TimingDef) and of the trigger info (one UINT32 data field).

Returns 0.

Implements Drp::Detector.

◆ configureScan()

unsigned Drp::TimingSystem::configureScan ( const nlohmann::json &  scan_keys,
XtcData::Xtc &  xtc,
const void *  bufEnd 
)
overridevirtual

Pass scan_keys to PythonConfigScanner::configure() with the update names ID and return its result.

Reimplemented from Drp::Detector.

◆ connect()

void Drp::TimingSystem::connect ( const nlohmann::json &  msg,
const std::string &  collectionId 
)
overridevirtual

Call XpmDetector::connect(), then call ts_connect() of the module with the connect JSON, which is kept for configure().

Reimplemented from Drp::Detector.

◆ cubeNamesIndex()

unsigned Drp::TimingSystem::cubeNamesIndex ( )
overridevirtual

Return the names index of the cube data (CubeNamesIndex, value 4).

Reimplemented from Drp::Detector.

◆ event() [1/2]

void Drp::TimingSystem::event ( XtcData::Dgram &  dgram,
const void *  bufEnd,
const Pds::Eb::ResultDgram &  result 
)
overridevirtual

Add the trigger result word (result.data()) as the triginfo data value.

Reimplemented from Drp::Detector.

◆ event() [2/2]

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

Describe the timing record that follows the TimingHeader in the DMA buffer of the first lane set in event->mask (TimingDef::describeData()); l1count is not used.

Implements Drp::Detector.

◆ maxMonBufSize()

unsigned Drp::TimingSystem::maxMonBufSize ( )
overridevirtual

Return the pebble buffer size when Parameters::nCubeWorkers is 0, otherwise 0x40000.

Reimplemented from Drp::Detector.

◆ rawDef()

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

Return a one-element list of raw definitions used for cube binning: eventcodes (UINT8 array) and inhibitCounts (UINT32 array).

Reimplemented from Drp::Detector.

◆ rawNamesIndex()

unsigned Drp::TimingSystem::rawNamesIndex ( )
overridevirtual

Return the names index of the L1Accept data (EventNamesIndex, value 1).

Reimplemented from Drp::Detector.

◆ scanEnabled()

bool Drp::TimingSystem::scanEnabled ( )
overridevirtual

Return true; per the code comment this makes the detector record scan information.

Reimplemented from Drp::Detector.

◆ shapeCube()

XtcData::Shape Drp::TimingSystem::shapeCube ( unsigned  rawDefIndex,
unsigned  valueIndex,
XtcData::DescData &  rawData 
)
overridevirtual

Return the cube shape for raw definition 0: 288 event-code bins for valueIndex 0 or 8 inhibit counts for valueIndex 1.

Aborts for any other combination.

Reimplemented from Drp::Detector.

◆ stepScan()

unsigned Drp::TimingSystem::stepScan ( const nlohmann::json &  stepInfo,
XtcData::Xtc &  xtc,
const void *  bufEnd 
)
overridevirtual

Pass stepInfo to PythonConfigScanner::step() with the update names ID and return its result.

Reimplemented from Drp::Detector.


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