11#ifndef ALICEO2_EMCAL_RCUTRAILER_H
12#define ALICEO2_EMCAL_RCUTRAILER_H
79 class Error :
public std::exception
104 const
char*
what() const noexcept
override {
return mErrorMessage.data(); }
112 std::string mErrorMessage;
381 std::vector<uint32_t>
encode()
const;
407 uint32_t mSecondBaselineCorrection : 1;
432 struct ErrorCounters {
439 uint32_t mNumChannelAddressMismatch : 12;
440 uint32_t mNumChannelLengthMismatch : 13;
453 ErrorCounters mErrorCounter = {0, 0};
456 AltroConfig mAltroConfig = {0, 0};
457 bool mIsInitialized =
false;
unsigned short int uint16_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
std::vector< uint16_t > nsamples
Error handling of the RCU trailer.
Error(ErrorType_t errtype, const char *message)
Constructor.
const char * what() const noexcept override
Access to the error message.
ErrorType_t
Error codes for different error types.
@ SIZE_INVALID
Invalid trailer size.
@ SAMPLINGFREQ_INVALID
Invalid sampling frequency.
@ DECODING_INVALID
Invalid words during decoding.
@ L1PHASE_INVALID
Invalid L1 phase.
~Error() noexcept override=default
Destructor.
ErrorType_t getErrorType() const noexcept
Access to error code.
Information stored in the RCU trailer.
void reset()
Reset the RCU trailer.
void setNumberOfNonZeroSuppressedPostsamples(uint16_t npostsamples)
Set the number of postsamples before zero suppression.
uint32_t getErrorsG3() const
Get value stored in error counter register 3.
void setPayloadSize(uint32_t size)
set the payload size in number of DDL (32-bit) words
uint16_t getNumberOfChannelAddressMismatch() const
Get the number of channels with address mismatch.
uint32_t getTrailerWordCorruptions() const
Get number of corrupted trailer words (undefined trailer word code)
bool hasZeroSuppression() const
Check whether zero suppression has been applied.
void setTimeSamplePhaseNS(uint64_t triggertime, uint64_t timesample)
Set the time sample length and L1 phase based on the trigger time.
void setNumberOfNonZeroSuppressedPresamples(uint16_t npresamples)
Set the number of presamples after zero suppression.
void setNumberOfChannelAddressMismatch(uint16_t nchannel)
Set the number of channels with address mismatch.
static RCUTrailer constructFromPayloadWords(const gsl::span< const uint32_t > payloadwords)
Decode RCU trailer from payload.
void setErrorsG3(uint32_t value)
Set error counter register 3.
void setFECErrorsB(uint32_t value)
uint16_t getNumberOfPostsamples() const
Get the number of postsamples (after zero suppression)
uint16_t getBaselineCorrection() const
Get baseline correction method.
uint16_t getNumberOfSamplesPerChannel() const
Get the number of samples per channel.
void printStream(std::ostream &stream) const
Prints the contents of the RCU trailer data.
uint16_t getErrorsG2() const
Get value stored in error counter register 2.
void setSparseReadout(bool isSparse)
Set sparse readout mode.
uint32_t getFECErrorsB() const
bool hasSecondBaselineCorr() const
Check if second baseline correction is applied.
uint16_t getNumberOfPretriggerSamples() const
Get the number of pretrigger samples.
BufferMode_t
Handler for encoding of the number of ALTRO buffers in the configuration.
@ NBUFFERS8
8 ALTRO buffers
@ NBUFFERS4
4 ALTRO buffers
void setNumberOfAltroBuffers(BufferMode_t bufmode)
Set the number of ALTRO buffers.
uint16_t getGlitchFilter() const
Get the glitch filter.
uint32_t getPayloadSize() const
Get size of the payload as number of DDL (32-bit) words.
RCUTrailer()=default
Constructor.
void setNumberOfPretriggerSamples(uint16_t nsamples)
Set the number of pretrigger samples.
uint32_t getFECErrorsA() const
uint8_t getFirmwareVersion() const
Get the firmware version.
uint32_t getAltroCFGReg1() const
Get value stored in ALTRO config register 1.
static bool checkLastTrailerWord(uint32_t trailerword)
Check whether the word is a valid last trailer word.
void setBaselineCorrection(uint16_t baselineCorrection)
Set baseline correction method.
uint32_t getAltroCFGReg2() const
Get value stored in ALTRO config register 1.
void setSecondBaselineCorrection(bool doHave)
Specify whether second basedline correction has been applied.
~RCUTrailer()=default
destructor
void constructFromRawPayload(const gsl::span< const uint32_t > payloadwords)
Decode RCU trailer from the 32-bit words in the raw buffer.
void setGlitchFilter(uint16_t glitchfilter)
Set the glitch filter.
void setActiveFECsA(uint16_t value)
uint16_t getNumberOfNonZeroSuppressedPresamples() const
Get the number of presamples before zero suppression.
uint32_t getTrailerSize() const
Get the trailer size in number of DDL (32 bit) words.
int getRCUID() const
Get index of the RCU the trailer belongs to.
void setActiveFECsB(uint16_t value)
void setAltroCFGReg2(uint32_t value)
Set ALTRO config register 2.
void setZeroSuppression(bool doHave)
Specify whether zero suppression has been applied.
double getL1PhaseNS() const
Access to the L1 phase.
bool isSparseReadout() const
Check whether readout is in sparse mode.
void setFirmwareVersion(uint8_t version)
Set the firmware version.
uint16_t getNumberOfAltroBuffers() const
Get the number of ALTRO buffers.
uint16_t getActiveFECsA() const
double getTimeSampleNS() const
Access to the sampling time.
std::vector< uint32_t > encode() const
Encode RCU trailer as array of DDL (32-bit) words.
void setNumberOfSamplesPerChannel(uint16_t nsamples)
Set the number of samples per channel.
void setNumberOfChannelLengthMismatch(uint8_t nchannel)
Set the number of channels with length mismatch.
bool getPolarity() const
Check polarity setting.
void setFECErrorsA(uint32_t value)
uint16_t getActiveFECsB() const
void setRCUID(int rcuid)
Set the ID of the RCU.
uint16_t getNumberOfNonZeroSuppressedPostsamples() const
Get the number of postsamples before zero suppression.
uint16_t getNumberOfPresamples() const
Get the number of presamples (after zero suppression)
uint16_t getNumberOfChannelLengthMismatch() const
Get the number of channels with length mismatch.
bool isInitialized() const
checlks whether the RCU trailer is initialzied
void setPolarity(bool doSet)
Set the polarity.
void setNumberOfPostsamples(uint16_t npostsamples)
Set the number of postsamples (after zero suppression)
void setErrorsG2(uint16_t value)
Set error counter register 2.
void setNumberOfPresamples(uint16_t npresamples)
Set the number of presamples (after zero suppression)
void setAltroCFGReg1(uint32_t value)
Set ALTRO config register 1.
GLsizei const GLfloat * value
GLuint GLsizei const GLchar * message
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...