nidas v1.2.3
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
nidas::core::PolyA2DConverter Class Reference

A2DConverter for applying a polynomial conversion to A2D counts values. More...

#include <A2DConverter.h>

Inheritance diagram for nidas::core::PolyA2DConverter:
Inheritance graph
[legend]

Public Member Functions

 PolyA2DConverter (int nchan, int ncoefs)
 
 ~PolyA2DConverter ()
 
float convert (int ichan, float counts) const
 Convert a count to a floating point value.
 
void set (int ichan, const float *d, int nd)
 Set the initial polynomial conversion for a channel.
 
void get (int ichan, float *d, int nd) const
 
void setNAN (int ichan)
 
void setNAN ()
 
int getMaxNumChannels () const
 Maximum possible number of channels.
 
int getNumConfigChannels () const
 One plus the index of the last active channel.
 
int getGain (int ichan) const
 Gain of each channel.
 
void setGain (int ichan, int val)
 
int getBipolar (int ichan) const
 
void setBipolar (int ichan, int val)
 
void readCalFile (CalFile *cf, dsm_time_t tt)
 Read records from a CalFile for calibration coefficients with time tags less than or equal to tt, assuming they are in increasingg order in the file.
 

Protected Attributes

int _maxNumChannels
 How many channels on the A2D.
 
int _numConfigChannels
 A configured channel has a gain > 0.
 
int _ncoefs
 Number of coefficients in the conversion.
 
int_gain
 Gain setting of each channel.
 
int_bipolar
 Polarity setting, 1=bi-polar.
 

Private Member Functions

 PolyA2DConverter (const PolyA2DConverter &x)
 No copy.
 
PolyA2DConverteroperator= (const PolyA2DConverter &x)
 No assign.
 

Private Attributes

float ** _d
 

Detailed Description

A2DConverter for applying a polynomial conversion to A2D counts values.

Constructor & Destructor Documentation

◆ PolyA2DConverter() [1/2]

PolyA2DConverter::PolyA2DConverter ( int nchan,
int ncoefs )

◆ ~PolyA2DConverter()

PolyA2DConverter::~PolyA2DConverter ( )

◆ PolyA2DConverter() [2/2]

nidas::core::PolyA2DConverter::PolyA2DConverter ( const PolyA2DConverter & x)
private

No copy.

Member Function Documentation

◆ convert()

float PolyA2DConverter::convert ( int ichan,
float counts ) const
virtual

Convert a count to a floating point value.

Implements nidas::core::A2DConverter.

References _d, nidas::core::A2DConverter::_ncoefs, and nidas::core::getSample().

◆ get()

void PolyA2DConverter::get ( int ichan,
float * d,
int nd ) const
virtual

◆ getBipolar()

int A2DConverter::getBipolar ( int ichan) const
inherited

◆ getGain()

int A2DConverter::getGain ( int ichan) const
inherited

Gain of each channel.

An A2DConverter needs to know the gain and bipolarity because it reads the cal file and there are typically cal records for each gain and polarity.

References nidas::core::A2DConverter::_gain, nidas::core::A2DConverter::_maxNumChannels, and nidas::core::getSample().

Referenced by nidas::dynld::raf::A2D_Serial::getGain().

◆ getMaxNumChannels()

int nidas::core::A2DConverter::getMaxNumChannels ( ) const
inlineinherited

Maximum possible number of channels.

References nidas::core::A2DConverter::_maxNumChannels.

◆ getNumConfigChannels()

int nidas::core::A2DConverter::getNumConfigChannels ( ) const
inlineinherited

One plus the index of the last active channel.

An active channel has a gain > 0.

References nidas::core::A2DConverter::_numConfigChannels.

Referenced by nidas::core::A2DConverter::readCalFile().

◆ operator=()

PolyA2DConverter & nidas::core::PolyA2DConverter::operator= ( const PolyA2DConverter & x)
private

No assign.

◆ readCalFile()

void A2DConverter::readCalFile ( CalFile * cf,
dsm_time_t tt )
inherited

Read records from a CalFile for calibration coefficients with time tags less than or equal to tt, assuming they are in increasingg order in the file.

Each record has a gain and bipolar value after the time, followed by coefficients for each channel.

A calibration record is used for a channel if its gain and bipolar fields match the values for the configured channel. A gain value of -1 in the file is a wildcard, matching any configured gain for a channel, and likewise for the bipolar value.

readCalFile() expects there to be getNumConfigChannels() X _ncoefs number of coefficients after the time, gain and bipolar fields in each CalFile record. If there are less than the expected number, a warning is logged, and missing coefficients are set to floatNAN.

Exceptions

EOFException, IOException, ParseException

References nidas::core::A2DConverter::_bipolar, nidas::core::A2DConverter::_gain, nidas::core::A2DConverter::_ncoefs, nidas::core::A2DConverter::getNumConfigChannels(), nidas::core::getSample(), LOG_WARNING, nidas::core::A2DConverter::set(), and nidas::core::A2DConverter::setNAN().

Referenced by nidas::dynld::raf::A2D_Serial::process().

◆ set()

void PolyA2DConverter::set ( int ichan,
const float * d,
int nd )
virtual

Set the initial polynomial conversion for a channel.

Implements nidas::core::A2DConverter.

References _d, nidas::core::A2DConverter::_maxNumChannels, nidas::core::A2DConverter::_ncoefs, and nidas::core::getSample().

◆ setBipolar()

void A2DConverter::setBipolar ( int ichan,
int val )
inherited

◆ setGain()

void A2DConverter::setGain ( int ichan,
int val )
inherited

◆ setNAN() [1/2]

void PolyA2DConverter::setNAN ( )
virtual

◆ setNAN() [2/2]

void PolyA2DConverter::setNAN ( int ichan)
virtual

Member Data Documentation

◆ _bipolar

int* nidas::core::A2DConverter::_bipolar
protectedinherited

◆ _d

float** nidas::core::PolyA2DConverter::_d
private

◆ _gain

int* nidas::core::A2DConverter::_gain
protectedinherited

◆ _maxNumChannels

int nidas::core::A2DConverter::_maxNumChannels
protectedinherited

◆ _ncoefs

int nidas::core::A2DConverter::_ncoefs
protectedinherited

Number of coefficients in the conversion.

Referenced by convert(), get(), PolyA2DConverter(), nidas::core::A2DConverter::readCalFile(), set(), and setNAN().

◆ _numConfigChannels

int nidas::core::A2DConverter::_numConfigChannels
protectedinherited

A configured channel has a gain > 0.

The number of configured channels is the index of the last configured channel plus one.

Referenced by nidas::core::A2DConverter::getNumConfigChannels(), and nidas::core::A2DConverter::setGain().


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