pxar
 All Classes Namespaces Functions Variables Typedefs Friends
Public Member Functions | Public Attributes | List of all members
pxar::pxarCore Class Reference

#include <api.h>

Public Member Functions

 pxarCore (std::string usbId="*", std::string logLevel="WARNING")
 
 ~pxarCore ()
 
std::string getVersion ()
 
bool initTestboard (std::vector< std::pair< std::string, uint8_t > > sig_delays, std::vector< std::pair< std::string, double > > power_settings, std::vector< std::pair< std::string, uint8_t > > pg_setup)
 
void setTestboardPower (std::vector< std::pair< std::string, double > > power_settings)
 
void setTestboardDelays (std::vector< std::pair< std::string, uint8_t > > sig_delays)
 
void setPatternGenerator (std::vector< std::pair< std::string, uint8_t > > pg_setup)
 
bool initDUT (uint8_t hubId, std::string tbmtype, std::vector< std::vector< std::pair< std::string, uint8_t > > > tbmDACs, std::string roctype, std::vector< std::vector< std::pair< std::string, uint8_t > > > rocDACs, std::vector< std::vector< pixelConfig > > rocPixels, std::vector< uint8_t > rocI2Cs)
 
bool initDUT (uint8_t hubid, std::string tbmtype, std::vector< std::vector< std::pair< std::string, uint8_t > > > tbmDACs, std::string roctype, std::vector< std::vector< std::pair< std::string, uint8_t > > > rocDACs, std::vector< std::vector< pixelConfig > > rocPixels)
 
bool programDUT ()
 
bool flashTB (std::string filename)
 
double getTBia ()
 
double getTBva ()
 
double getTBid ()
 
double getTBvd ()
 
void HVoff ()
 
void HVon ()
 
void Pon ()
 
void Poff ()
 
bool SignalProbe (std::string probe, std::string name)
 
std::vector< uint16_t > daqADC (std::string signal, uint8_t gain, uint16_t nSample, uint8_t source, uint8_t start)
 
bool setDAC (std::string dacName, uint8_t dacValue, uint8_t rocI2C)
 
bool setDAC (std::string dacName, uint8_t dacValue)
 
uint8_t getDACRange (std::string dacName)
 
bool setTbmReg (std::string regName, uint8_t regValue, uint8_t tbmid)
 
bool setTbmReg (std::string regName, uint8_t regValue)
 
std::vector< std::pair
< uint8_t, std::vector< pixel > > > 
getPulseheightVsDAC (std::string dacName, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::vector< pixel > > > 
getPulseheightVsDAC (std::string dacName, uint8_t dacStep, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTrigger)
 
std::vector< std::pair
< uint8_t, std::vector< pixel > > > 
getEfficiencyVsDAC (std::string dacName, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::vector< pixel > > > 
getEfficiencyVsDAC (std::string dacName, uint8_t dacStep, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::vector< pixel > > > 
getThresholdVsDAC (std::string dacName, std::string dac2name, uint8_t dac2min, uint8_t dac2max, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::vector< pixel > > > 
getThresholdVsDAC (std::string dac1name, uint8_t dac1step, uint8_t dac1min, uint8_t dac1max, std::string dac2name, uint8_t dac2step, uint8_t dac2min, uint8_t dac2max, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::vector< pixel > > > 
getThresholdVsDAC (std::string dac1name, uint8_t dac1step, uint8_t dac1min, uint8_t dac1max, std::string dac2name, uint8_t dac2step, uint8_t dac2min, uint8_t dac2max, uint8_t threshold, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::pair< uint8_t,
std::vector< pixel > > > > 
getPulseheightVsDACDAC (std::string dac1name, uint8_t dac1min, uint8_t dac1max, std::string dac2name, uint8_t dac2min, uint8_t dac2max, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::pair< uint8_t,
std::vector< pixel > > > > 
getPulseheightVsDACDAC (std::string dac1name, uint8_t dac1step, uint8_t dac1min, uint8_t dac1max, std::string dac2name, uint8_t dac2step, uint8_t dac2min, uint8_t dac2max, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::pair< uint8_t,
std::vector< pixel > > > > 
getEfficiencyVsDACDAC (std::string dac1name, uint8_t dac1min, uint8_t dac1max, std::string dac2name, uint8_t dac2min, uint8_t dac2max, uint16_t flags, uint16_t nTriggers)
 
std::vector< std::pair
< uint8_t, std::pair< uint8_t,
std::vector< pixel > > > > 
getEfficiencyVsDACDAC (std::string dac1name, uint8_t dac1step, uint8_t dac1min, uint8_t dac1max, std::string dac2name, uint8_t dac2step, uint8_t dac2min, uint8_t dac2max, uint16_t flags, uint16_t nTriggers)
 
std::vector< pixelgetPulseheightMap (uint16_t flags, uint16_t nTriggers)
 
std::vector< pixelgetEfficiencyMap (uint16_t flags, uint16_t nTriggers)
 
std::vector< pixelgetThresholdMap (std::string dacName, uint8_t dacStep, uint8_t dacMin, uint8_t dacMax, uint16_t flags, uint16_t nTriggers)
 
std::vector< pixelgetThresholdMap (std::string dacName, uint8_t dacStep, uint8_t dacMin, uint8_t dacMax, uint8_t threshold, uint16_t flags, uint16_t nTriggers)
 
std::vector< pixelgetThresholdMap (std::string dacName, uint16_t flags, uint16_t nTriggers)
 
bool setExternalClock (bool enable)
 
void setClockStretch (uint8_t src, uint16_t delay, uint16_t width)
 
void setSignalMode (std::string signal, uint8_t mode)
 
bool daqStart ()
 
bool daqStart (const int bufsize, const bool init)
 
bool daqStatus ()
 
bool daqStatus (uint8_t &perFull)
 
Event daqGetEvent ()
 
rawEvent daqGetRawEvent ()
 
uint16_t daqTrigger (uint32_t nTrig=1, uint16_t period=0)
 
uint16_t daqTriggerLoop (uint16_t period=1000)
 
void daqTriggerLoopHalt ()
 
bool daqStop ()
 
bool daqStop (const bool init)
 
std::vector< rawEventdaqGetRawEventBuffer ()
 
std::vector< uint16_t > daqGetBuffer ()
 
std::vector< EventdaqGetEventBuffer ()
 
std::vector< std::vector
< uint16_t > > 
daqGetReadback ()
 
statistics getStatistics ()
 
bool status ()
 
uint16_t GetADC (uint8_t rpc_par1)
 
void SetCalibrateBits (bool enable)
 

Public Attributes

dut_dut
 

Detailed Description

pxar API class definition

this is the central API through which all calls from tests and user space functions have to be routed in order to interact with the hardware.

The API level aims to provide a set of high-level function from which the "user" (or test implementation) can choose. This approach allows to hide hardware specific functions and calls from the user space code and automatize e.g. startup procedures.

All input from user space is checked before programming it to the devices. Register addresses have an internal lookup mechanism so the user only hast to provide e.g. the DAC name to be programmed as a std::string.

Unless otherwise specified (some DAQ functions allow this) all data returned from API functions is fully decoded and stored in C++ structures using std::vectors and std::pairs to ease its handling. Most functions will return a std::vector containing pxar::pixel elements storing the readout data.

Another concept implemented is the Device Under Test (DUT) which is a class (pxar::dut) representing the attached hardware to be tested. In order to change its configuration the user space code interacts with the _dut object and alters its settings. This is programmed into the devices automatically before the next test is executed. This approach allows both the efficient execution of many RPC calls at once and reading back the actual device configuration at any time during the tests.

Calls to test functions are automatically expanded in a way that they cover the full device in the most efficient way available. Instead of scanning 4160 pixels after another the code will select the function to scan a full ROC in one go automatically.

Definition at line 146 of file api.h.

Constructor & Destructor Documentation

pxarCore::pxarCore ( std::string  usbId = "*",
std::string  logLevel = "WARNING" 
)

Default constructor for the libpxar API

Fetches a new pxar::hal instance and opens the connection to the testboard specified in the "usbId" parameter. An asterisk as "usbId" acts as wildcard. If only one DTB is connected the algorithm will automatically connect to this board, if several are connected it will give a warning.

On issues with the USB connection, a pxar::UsbConnectionError is thrown. If the firmware on the DTB does not match the expected version for pxar, a pxar::FirmwareVersionMismatch exception is thrown.

Definition at line 19 of file api.cc.

pxarCore::~pxarCore ( )

Default destructor for libpxar API

Will power down the DTB, disconnect properly from the testboard, and destroy the pxar::hal object.

Definition at line 38 of file api.cc.

Member Function Documentation

std::vector< uint16_t > pxarCore::daqGetBuffer ( )

Function to return the full currently available raw data buffer from the testboard RAM. Neither decoding nor splitting is performed, this function returns the raw data blob from either of the deserializer modules.

Definition at line 1263 of file api.cc.

Event pxarCore::daqGetEvent ( )

Function to read out the earliest pxar::Event in buffer from the current data acquisition session. If no Event is buffered, the function will wait for the next Event to arrive and then return it.

This function can throw a pxar::DataDecodingError exception in case severe problems were encountered during the readout.

Definition at line 1300 of file api.cc.

std::vector< Event > pxarCore::daqGetEventBuffer ( )

Function to return the full currently available pxar::Event buffer from the testboard RAM. All data is decoded and the function returns decoded pixels separated in pxar::Events with additional header information available.

This function can throw a pxar::DataDecodingError exception in case severe problems were encountered during the readout.

Definition at line 1285 of file api.cc.

rawEvent pxarCore::daqGetRawEvent ( )

Function to read out the earliest raw data record in buffer from the current data acquisition session. If no Event is buffered, the function will wait for the next Event to arrive and then return it.

Definition at line 1312 of file api.cc.

std::vector< rawEvent > pxarCore::daqGetRawEventBuffer ( )

Function to return the full currently available raw event buffer from the testboard RAM. No decoding is performed, the data stream is just split into single pxar::rawEvent objects. This function returns the raw events from either of the deserializer modules.

Definition at line 1270 of file api.cc.

std::vector< std::vector< uint16_t > > pxarCore::daqGetReadback ( )

Function to return the full currently available ROC slow readback value buffer. The data is stored until a new DAQ session or test is called and can be fetched once (deleted at read time). The return vector contains one vector of readback values for every ROC found in the readout chain.

Definition at line 1126 of file api.cc.

bool pxarCore::daqStart ( )

Function to set up and initialize a new data acquisition session (DAQ). This function also programs all attached devices. Pixel configurations which are changed after calling this function will not be written to the devices, so make sure to mask/unmask and set test bits for all pixels in question before calling pxar::daqStart()!

Definition at line 1139 of file api.cc.

bool pxarCore::daqStatus ( )

Function to get back the DAQ status

For a running DAQ with free buffer memory left, this function returns TRUE. In case of a problem with the DAQ (not started, buffer overflow or full...) it returns FALSE.

Definition at line 1191 of file api.cc.

bool pxarCore::daqStatus ( uint8_t &  perFull)

Same Function as pxar::daqStatus() but provides additional parameter (pass-by-reference) to inform about the current fill status of the DAQ buffer in percent.

Definition at line 1200 of file api.cc.

bool pxarCore::daqStop ( )

Function to stop the running data acquisition

Definition at line 1324 of file api.cc.

uint16_t pxarCore::daqTrigger ( uint32_t  nTrig = 1,
uint16_t  period = 0 
)

Function to fire the previously defined pattern command list "nTrig" times, the function parameter defaults to 1. The function returns the triggering period actually used after cross-check with the pattern generator cycle length.

Definition at line 1222 of file api.cc.

uint16_t pxarCore::daqTriggerLoop ( uint16_t  period = 1000)

Function to fire the previously defined pattern command list continuously every "period" clock cycles (default: 1000) The function returns the triggering period actually used after cross-check with the pattern generator cycle length.

Definition at line 1239 of file api.cc.

void pxarCore::daqTriggerLoopHalt ( )

Function to halt the pattern generator loop which has been started using daqTriggerLoop(). This stops triggering the devices.

Definition at line 1257 of file api.cc.

bool pxarCore::flashTB ( std::string  filename)

Function to flash a new firmware onto the DTB via the USB connection.

Definition at line 397 of file api.cc.

uint16_t pxarCore::GetADC ( uint8_t  rpc_par1)

Get ADC value

Definition at line 2222 of file api.cc.

uint8_t pxarCore::getDACRange ( std::string  dacName)

Get the valid range of a given DAC

Definition at line 619 of file api.cc.

std::vector< pixel > pxarCore::getEfficiencyMap ( uint16_t  flags,
uint16_t  nTriggers 
)

Method to get a map of the efficiency

Returns a vector of pixels, with the value of the pxar::pixel struct being the number of hits in that pixel. Efficiency == 1 for nhits == nTriggers

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 1048 of file api.cc.

std::vector< std::pair< uint8_t, std::vector< pixel > > > pxarCore::getEfficiencyVsDAC ( std::string  dacName,
uint8_t  dacMin,
uint8_t  dacMax,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a DAC range and measure the efficiency

Returns a vector of pairs containing set dac value and pixels, with the value of the pxar::pixel struct being the number of hits in that pixel. Efficiency == 1 for nhits == nTriggers

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 733 of file api.cc.

std::vector< std::pair< uint8_t, std::vector< pixel > > > pxarCore::getEfficiencyVsDAC ( std::string  dacName,
uint8_t  dacStep,
uint8_t  dacMin,
uint8_t  dacMax,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a DAC range and measure the efficiency

Returns a vector of pairs containing set dac value and pixels, with the value of the pxar::pixel struct being the number of hits in that pixel. Efficiency == 1 for nhits == nTriggers The dacStep parameter can be used to set the increment of the DAC scan, i.e. only sparsely scanning every nth DAC.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 739 of file api.cc.

std::vector< std::pair< uint8_t, std::pair< uint8_t, std::vector< pixel > > > > pxarCore::getEfficiencyVsDACDAC ( std::string  dac1name,
uint8_t  dac1min,
uint8_t  dac1max,
std::string  dac2name,
uint8_t  dac2min,
uint8_t  dac2max,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a 2D DAC-Range (DAC1 vs. DAC2) and measure the efficiency

Returns a vector containing pairs of DAC1 values and pais of DAC2 values with a pxar::pixel vector. The value of the pxar::pixel struct is the number of hits in that pixel. Efficiency == 1 for nhits == nTriggers

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 951 of file api.cc.

std::vector< std::pair< uint8_t, std::pair< uint8_t, std::vector< pixel > > > > pxarCore::getEfficiencyVsDACDAC ( std::string  dac1name,
uint8_t  dac1step,
uint8_t  dac1min,
uint8_t  dac1max,
std::string  dac2name,
uint8_t  dac2step,
uint8_t  dac2min,
uint8_t  dac2max,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a 2D DAC-Range (DAC1 vs. DAC2) and measure the efficiency

Returns a vector containing pairs of DAC1 values and pais of DAC2 values with a pxar::pixel vector. The value of the pxar::pixel struct is the number of hits in that pixel. Efficiency == 1 for nhits == nTriggers The dacStep parameters can be used to set the increment of the DAC scan, i.e. only sparsely scanning every nth DAC. Increment can be set independently for both scanning dimensions.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 957 of file api.cc.

std::vector< pixel > pxarCore::getPulseheightMap ( uint16_t  flags,
uint16_t  nTriggers 
)

Method to get a map of the pulse height

Returns a vector of pixels, with the value of the pxar::pixel struct being the averaged pulse height over "nTriggers" triggers

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 1024 of file api.cc.

std::vector< std::pair< uint8_t, std::vector< pixel > > > pxarCore::getPulseheightVsDAC ( std::string  dacName,
uint8_t  dacMin,
uint8_t  dacMax,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a DAC range and measure the pulse height

Returns a vector of pairs containing set dac value and a pxar::pixel vector, with the value of the pxar::pixel struct being the averaged pulse height over "nTriggers" triggers.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 675 of file api.cc.

std::vector< std::pair< uint8_t, std::vector< pixel > > > pxarCore::getPulseheightVsDAC ( std::string  dacName,
uint8_t  dacStep,
uint8_t  dacMin,
uint8_t  dacMax,
uint16_t  flags,
uint16_t  nTrigger 
)

Method to scan a DAC range and measure the pulse height

Returns a vector of pairs containing set dac value and a pxar::pixel vector, with the value of the pxar::pixel struct being the averaged pulse height over "nTriggers" triggers. The dacStep parameter can be used to set the increment of the DAC scan, i.e. only sparsely scanning every nth DAC.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 681 of file api.cc.

std::vector< std::pair< uint8_t, std::pair< uint8_t, std::vector< pixel > > > > pxarCore::getPulseheightVsDACDAC ( std::string  dac1name,
uint8_t  dac1min,
uint8_t  dac1max,
std::string  dac2name,
uint8_t  dac2min,
uint8_t  dac2max,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a 2D DAC-Range (DAC1 vs. DAC2) and measure the pulse height

Returns a vector containing pairs of DAC1 values and pais of DAC2 values with a pxar::pixel vector. The value of the pxar::pixel struct is the averaged pulse height over "nTriggers" triggers.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 878 of file api.cc.

std::vector< std::pair< uint8_t, std::pair< uint8_t, std::vector< pixel > > > > pxarCore::getPulseheightVsDACDAC ( std::string  dac1name,
uint8_t  dac1step,
uint8_t  dac1min,
uint8_t  dac1max,
std::string  dac2name,
uint8_t  dac2step,
uint8_t  dac2min,
uint8_t  dac2max,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a 2D DAC-Range (DAC1 vs. DAC2) and measure the pulse height

Returns a vector containing pairs of DAC1 values and pais of DAC2 values with a pxar::pixel vector. The value of the pxar::pixel struct is the averaged pulse height over "nTriggers" triggers. The dacStep parameters can be used to set the increment of the DAC scan, i.e. only sparsely scanning every nth DAC. Increment can be set independently for both scanning dimensions.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 884 of file api.cc.

statistics pxarCore::getStatistics ( )

Function that returns a class object of the type pxar::statistics containing all collected error statistics from the last (non-raw) DAQ readout or API test call. Statistics can be fetched once and are then reset.

Definition at line 538 of file api.cc.

double pxarCore::getTBia ( )

Function to read out analog DUT supply current on the testboard The current will be returned in SI units of Ampere

Definition at line 424 of file api.cc.

double pxarCore::getTBid ( )

Function to read out digital DUT supply current on the testboard The current will be returned in SI units of Ampere

Definition at line 434 of file api.cc.

double pxarCore::getTBva ( )

Function to read out analog DUT supply voltage on the testboard The voltage will be returned in SI units of Volts

Definition at line 429 of file api.cc.

double pxarCore::getTBvd ( )

Function to read out digital DUT supply voltage on the testboard The voltage will be returned in SI units of Volts

Definition at line 439 of file api.cc.

std::vector< pixel > pxarCore::getThresholdMap ( std::string  dacName,
uint8_t  dacStep,
uint8_t  dacMin,
uint8_t  dacMax,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to get a map of the pixel threshold

Returns a vector of pixels, with the value of the pxar::pixel struct being the threshold value of that pixel.

This function allows to specify a range for the threshold DAC to be searched, this can be used to speed up the procedure by limiting the range. The dacStep parameter can be used to set the increment of the DAC scan, i.e. only sparsely scanning every nth DAC. The threshold value returned is the lower bound (upper bound for FLAG_RISING_EDGE) of the interval in which the true threshold is found.

The threshold is calculated as the 0.5 value of the s-curve of the pixel.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 1080 of file api.cc.

std::vector< pixel > pxarCore::getThresholdMap ( std::string  dacName,
uint8_t  dacStep,
uint8_t  dacMin,
uint8_t  dacMax,
uint8_t  threshold,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to get a map of the pixel threshold

Returns a vector of pixels, with the value of the pxar::pixel struct being the threshold value of that pixel.

This function allows to specify a range for the threshold DAC to be searched, this can be used to speed up the procedure by limiting the range. The dacStep parameter can be used to set the increment of the DAC scan, i.e. only sparsely scanning every nth DAC. The threshold value returned is the lower bound (upper bound for FLAG_RISING_EDGE) of the interval in which the true threshold is found.

The threshold can be adjusted to a percentage of efficienciy (i.e. threshold = 50 is the 50% efficiency niveau of the pixel).

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 1086 of file api.cc.

std::vector< pixel > pxarCore::getThresholdMap ( std::string  dacName,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to get a map of the pixel threshold

Returns a vector of pixels, with the value of the pxar::pixel struct being the threshold value of that pixel.

The threshold is calculated as the 0.5 value of the s-curve of the pixel.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 1072 of file api.cc.

std::vector< std::pair< uint8_t, std::vector< pixel > > > pxarCore::getThresholdVsDAC ( std::string  dacName,
std::string  dac2name,
uint8_t  dac2min,
uint8_t  dac2max,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a DAC range and measure the pixel threshold

Returns a vector of pairs containing set dac value and pixels, with the value of the pxar::pixel struct being the threshold value of that pixel.

The threshold is calculated as the 0.5 value of the s-curve of the pixel.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 789 of file api.cc.

std::vector< std::pair< uint8_t, std::vector< pixel > > > pxarCore::getThresholdVsDAC ( std::string  dac1name,
uint8_t  dac1step,
uint8_t  dac1min,
uint8_t  dac1max,
std::string  dac2name,
uint8_t  dac2step,
uint8_t  dac2min,
uint8_t  dac2max,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a DAC range and measure the pixel threshold

Returns a vector of pairs containing set dac value and pixels, with the value of the pxar::pixel struct being the threshold value of that pixel.

This function allows to specify a range for the threshold DAC to be searched, this can be used to speed up the procedure by limiting the range. The dacstep parameters can be used to set the increments of the 2D DAC scan, i.e. only sparsely scanning every nth DAC. The threshold value returned is the lower bound (upper bound for FLAG_RISING_EDGE) of the interval in which the true threshold is found. The increment can be set independently for both scanning dimensions.

The threshold is calculated as the 0.5 value of the s-curve of the pixel.

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 797 of file api.cc.

std::vector< std::pair< uint8_t, std::vector< pixel > > > pxarCore::getThresholdVsDAC ( std::string  dac1name,
uint8_t  dac1step,
uint8_t  dac1min,
uint8_t  dac1max,
std::string  dac2name,
uint8_t  dac2step,
uint8_t  dac2min,
uint8_t  dac2max,
uint8_t  threshold,
uint16_t  flags,
uint16_t  nTriggers 
)

Method to scan a DAC range and measure the pixel threshold

Returns a vector of pairs containing set dac value and pixels, with the value of the pxar::pixel struct being the threshold value of that pixel.

This function allows to specify a range for the threshold DAC to be searched, this can be used to speed up the procedure by limiting the range. The dacstep parameters can be used to set the increments of the 2D DAC scan, i.e. only sparsely scanning every nth DAC. The threshold value returned is the lower bound (upper bound for FLAG_RISING_EDGE) of the interval in which the true threshold is found. The increment can be set independently for both scanning dimensions.

The threshold can be adjusted to a percentage of efficienciy (i.e. threshold = 50 is the 50% efficiency niveau of the pixel).

If the readout of the DTB is corrupt, a pxar::DataMissingEvent is thrown.

Definition at line 803 of file api.cc.

std::string pxarCore::getVersion ( )

Returns the version string for the pxar API.

When using a git checkout the version number will be calculated at compile time from the latest tagged version plus the number of commits on top of that. In this case the version number also contains the commit hash of the latest commit for reference.

In case of a tarball install the version number is hardcoded in the CMakeLists.txt file.

Definition at line 43 of file api.cc.

void pxarCore::HVoff ( )

turn off HV

Definition at line 445 of file api.cc.

void pxarCore::HVon ( )

turn on HV

Definition at line 449 of file api.cc.

bool pxarCore::initDUT ( uint8_t  hubId,
std::string  tbmtype,
std::vector< std::vector< std::pair< std::string, uint8_t > > >  tbmDACs,
std::string  roctype,
std::vector< std::vector< std::pair< std::string, uint8_t > > >  rocDACs,
std::vector< std::vector< pixelConfig > >  rocPixels,
std::vector< uint8_t >  rocI2Cs 
)

Initializer method for the DUT (attached devices)

This function requires the types and DAC settings for all TBMs and ROCs contained in the setup. All values will be checked for validity (DAC ranges, position and number of pixels, etc.) and an pxar::InvalidConfig exception is thrown if any errors are encountered.

All parameters are supplied via vectors, the size of the vector represents the number of devices. DAC names and device types should be provided as strings. The respective register addresses will be looked up internally. Strings are checked case-insensitive, old and new DAC names are both supported.

In case of USB communication problems, pxar::UsbConnectionError is thrown.

Definition at line 108 of file api.cc.

bool pxarCore::initDUT ( uint8_t  hubid,
std::string  tbmtype,
std::vector< std::vector< std::pair< std::string, uint8_t > > >  tbmDACs,
std::string  roctype,
std::vector< std::vector< std::pair< std::string, uint8_t > > >  rocDACs,
std::vector< std::vector< pixelConfig > >  rocPixels 
)

Alternative initializer method for the DUT (attached devices).

As above, but automatically assumes consecutively numbered I2C addresses for all attached ROCs, starting from zero.

Definition at line 98 of file api.cc.

bool pxarCore::initTestboard ( std::vector< std::pair< std::string, uint8_t > >  sig_delays,
std::vector< std::pair< std::string, double > >  power_settings,
std::vector< std::pair< std::string, uint8_t > >  pg_setup 
)

Initializer method for the testboard

Initializes the testboard with signal delay settings, and voltage/current limit settings (power_settings) and the initial pattern generator setup (pg_setup), all provided via vectors of pairs with descriptive name. The name lookup is performed via the central API dictionaries. Multiple pattern generator signals at once can be sent by separating their names with a semicolon.

All user inputs are checked for sanity. This includes range checks on the current limits set, a sanity check for the pattern generator command list (including a check for delay = 0 at the end of the list). If the settings are found to be out-of-range, a pxar::InvalidConfig exception is thrown.

In case of USB communication problems, pxar::UsbConnectionError is thrown.

Definition at line 45 of file api.cc.

void pxarCore::Poff ( )

turn off power

Definition at line 453 of file api.cc.

void pxarCore::Pon ( )

turn on power

Definition at line 459 of file api.cc.

bool pxarCore::programDUT ( )

Programming method for the DUT (attached devices)

This function requires the DUT structure to be filled (initialized).

All parameters are taken from the DUT struct, the enabled devices are programmed. This function needs to be called after power cycling the testboard output (using Poff, Pon).

A DUT flag is set which prevents test functions to be executed if not programmed.

Definition at line 299 of file api.cc.

void pxarCore::SetCalibrateBits ( bool  enable)

Helper function to setup the attached devices for operation using calibrate pulses.

It sets the Pixel Unit Cell (PUC) Calibrate bit for every pixels enabled in the test range (those for which the "enable" flag has been set using the dut::testPixel() functions)

Disclaimer: use at your own risk, don't rely on this method staying public

Definition at line 2016 of file api.cc.

void pxarCore::setClockStretch ( uint8_t  src,
uint16_t  delay,
uint16_t  width 
)

Set the clock stretch. FIXME missing documentation A width of 0 disables the clock stretch

Definition at line 2215 of file api.cc.

bool pxarCore::setDAC ( std::string  dacName,
uint8_t  dacValue,
uint8_t  rocI2C 
)

Set a DAC value on the DUT for one specific ROC

The "rocID" parameter can be used to select a specific ROC to program. The ROC is identified by its ID (counting all ROCs up from 0).

This function will both update the bookkeeping value in the pxar::dut struct and program the actual device.

Definition at line 546 of file api.cc.

bool pxarCore::setDAC ( std::string  dacName,
uint8_t  dacValue 
)

Set a DAC value on the DUT for all enabled ROC

This function will both update the bookkeeping value in the pxar::dut struct and program the actual device.

Definition at line 588 of file api.cc.

bool pxarCore::setExternalClock ( bool  enable)

Enable or disable the external clock source of the DTB. This function will return "false" if no external clock is present, clock is then left on internal.

Definition at line 2188 of file api.cc.

void pxarCore::setPatternGenerator ( std::vector< std::pair< std::string, uint8_t > >  pg_setup)

Update method for testboard pattern generator. This method requires the testboard to be initialized once using pxar::initTestboard All user inputs are checked for sanity. This includes a full sanity check for the pattern generator command list, including a check for the total pattern length supplied as well as the delay = 0 at the end of the list. If the settings are found to be out-of-range, a pxar::InvalidConfig exception is thrown. The new settings are stored in the pxar::dut object for later reference. Multiple pattern generator signals at once can be sent by separating their names with a semicolon, e.g. "token;sync".

Definition at line 78 of file api.cc.

void pxarCore::setSignalMode ( std::string  signal,
uint8_t  mode 
)

Set Signal Mode. Define any testboard signal (e.g. clk) to the state constant high, constant low, or normal oscillation. signal: "clk", "ctr", "sda", or "tin" mode: 0 (normal), 1 (low) or 2 (high)

Definition at line 2204 of file api.cc.

bool pxarCore::setTbmReg ( std::string  regName,
uint8_t  regValue,
uint8_t  tbmid 
)

Set a register value on a specific TBM of the DUT

The "tbmid" parameter can be used to select a specific TBM to program. This function will both update the bookkeeping value in the pxar::dut struct and program the actual device.

This function will set the respective register in the TBM core specified by the "tbmid". Be aware of the fact that TBM Alpha cores are numbered with even IDs (0,2,...) and TBM Beta cores with odd IDs (1,3,...).

Definition at line 633 of file api.cc.

bool pxarCore::setTbmReg ( std::string  regName,
uint8_t  regValue 
)

Set a register value on all TBMs of the DUT

This function will both update the bookkeeping value in the pxar::dut struct and program the actual device.

This function will set the respective register in the TBM core specified by the "tbmid". Be aware of the fact that TBM Alpha cores are numbered with even IDs (0,2,...) and TBM Beta cores with odd IDs (1,3,...).

Definition at line 667 of file api.cc.

void pxarCore::setTestboardDelays ( std::vector< std::pair< std::string, uint8_t > >  sig_delays)

Update method for testboard signal delay settings. This method requires the testboard to be initialized once using pxar::initTestboard All user inputs are checked for sanity. This includes a register name lookup and range checks on the register values. If the settings are found to be out-of-range, a pxar::InvalidConfig exception is thrown. The new settings are stored in the pxar::dut object for later reference.

Definition at line 68 of file api.cc.

void pxarCore::setTestboardPower ( std::vector< std::pair< std::string, double > >  power_settings)

Update method for testboard voltages and current limits. This method requires the testboard to be initialized once using pxar::initTestboard All user inputs are checked for sanity. This includes range checks on the current limits set. If the settings are found to be out-of-range, a pxar::InvalidConfig exception is thrown. The new settings are stored in the pxar::dut object for later reference.

Definition at line 88 of file api.cc.

bool pxarCore::SignalProbe ( std::string  probe,
std::string  name 
)

Selects "signal" as output for the DTB probe channel "probe" (digital or analog). Valid probe values are the names written on the case of the DTB, next to the respective outputs.

The signal identifier is checked against a dictionary to be valid. In case of an invalid signal identifier the output is turned off.

Definition at line 465 of file api.cc.

bool pxarCore::status ( )

Status function for the API

Returns true if everything is setup correctly for operation

Definition at line 339 of file api.cc.

Member Data Documentation

dut* pxar::pxarCore::_dut

DUT object for book keeping of settings

Definition at line 728 of file api.h.


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