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

Pixel calibration helpers (pedestal subtraction and gain) for raw detector data, and a test singleton class. More...

Classes

class  CalibConsSingleton
 Test singleton: instance() creates the single object (the private constructor prints a message) and print() prints the class name. More...
 
struct  ccstruct
 Pedestal and gain of one pixel for one gain-bit combination, as stored in the static table of fill_CCSV3(). More...
 

Typedefs

typedef double time_t
 double; type of the execution times in microseconds returned by the calib_* functions.
 
typedef uint16_t rawd_t
 uint16_t; raw data element type.
 
typedef float peds_t
 float; pedestal element type.
 
typedef float gain_t
 float; gain element type.
 
typedef float out_t
 float; output element type.
 
typedef float cc_t
 float; element type of the combined calibration-constant arrays (pedestals and gains).
 
typedef uint8_t mask_t
 uint8_t; mask element type (multiplied into the result by calib_std() and calib_jungfrau_v0()).
 
typedef uint32_t sizeb_t
 uint32_t; size and index type.
 

Functions

void fill_CCSV3 (const cc_t *cc)
 On the first call only, copy cc, laid out as [NGRINDS][NPIXELS][2] (pedestal, gain), into the static table used by calib_jungfrau_v3_struct(), printing progress and the first five pixels of each combination to stdout.
 
void calib_jungrfau_blk_v1 (const rawd_t *raw, const cc_t *cc, const sizeb_t &size_blk, out_t *out)
 For each of size_blk pixels compute out[i] = ((raw[i] & 0x3fff) - cc[8*i+g]) * cc[8*i+g+4], where g = raw[i] >> 14; cc holds 4 pedestals then 4 gains per pixel.
 
time_t calib_std (const rawd_t *raw, const peds_t *peds, const gain_t *gain, const mask_t *mask, const sizeb_t &size, const rawd_t databits, out_t *out)
 Compute out[i] = ((raw[i] & databits) - peds[i]) * gain[i] * mask[i] for size elements.
 
time_t calib_jungfrau_v0 (const rawd_t *raw, const peds_t *peds, const gain_t *gain, const mask_t *mask, const sizeb_t &size, out_t *out)
 For each pixel take g = raw[i] >> 14 (values above 1 become 2) and compute out[i] = ((raw[i] & 0x3fff) - peds[g*size+i]) * gain[g*size+i] * mask[i].
 
time_t calib_jungfrau_v1 (const rawd_t *raw, const cc_t *cc, const sizeb_t &size, const sizeb_t &size_blk, out_t *out)
 Apply calib_jungrfau_blk_v1() to consecutive blocks of size_blk pixels, with cc holding 8 values per pixel; the last size % size_blk pixels are not processed.
 
time_t calib_jungfrau_v2 (const rawd_t *raw, const cc_t *cc, const sizeb_t &size, const sizeb_t &size_blk, out_t *out)
 Compute out[i] = ((raw[i] & 0x3fff) - cc[i+size*g]) * cc[i+size*g+4*size] with g = raw[i] >> 14, i.e.
 
time_t calib_jungfrau_v3 (const rawd_t *raw, const cc_t *cc, const sizeb_t &npix, const sizeb_t &size_blk, out_t *out)
 Compute out[i] = ((raw[i] & 0x3fff) - cc[2*(i+npix*g)]) * cc[2*(i+npix*g)+1] with g = raw[i] >> 14, i.e.
 
time_t calib_jungfrau_v3_struct (const rawd_t *raw, const cc_t *cc, const sizeb_t &size, const sizeb_t &size_blk, out_t *out)
 Fill the static table from cc on the first call (fill_CCSV3(), which always reads NPIXELS pixels per combination), then compute out[i] = ((raw[i] & 0x3fff) - pedestal) * gain from table entry [raw[i] >> 14][i].
 
time_t calib_jungfrau_v4_empty ()
 Do nothing and return the time between two steady_clock reads, in microseconds.
 
time_t calib_jungfrau_v5_empty (const rawd_t *raw, const cc_t *cc, const sizeb_t &npix, const sizeb_t &size_blk, out_t *out)
 Ignore all arguments and return calib_jungfrau_v4_empty().
 

Detailed Description

Pixel calibration helpers (pedestal subtraction and gain) for raw detector data, and a test singleton class.

Typedef Documentation

◆ cc_t

typedef float utilsdetector::cc_t

float; element type of the combined calibration-constant arrays (pedestals and gains).

◆ gain_t

typedef float utilsdetector::gain_t

float; gain element type.

◆ mask_t

typedef uint8_t utilsdetector::mask_t

uint8_t; mask element type (multiplied into the result by calib_std() and calib_jungfrau_v0()).

◆ out_t

typedef float utilsdetector::out_t

float; output element type.

◆ peds_t

typedef float utilsdetector::peds_t

float; pedestal element type.

◆ rawd_t

typedef uint16_t utilsdetector::rawd_t

uint16_t; raw data element type.

◆ sizeb_t

typedef uint32_t utilsdetector::sizeb_t

uint32_t; size and index type.

◆ time_t

typedef double utilsdetector::time_t

double; type of the execution times in microseconds returned by the calib_* functions.

Inside utilsdetector it hides the standard time_t.

Function Documentation

◆ calib_jungfrau_v0()

time_t utilsdetector::calib_jungfrau_v0 ( const rawd_t *  raw,
const peds_t *  peds,
const gain_t *  gain,
const mask_t *  mask,
const sizeb_t &  size,
out_t *  out 
)

For each pixel take g = raw[i] >> 14 (values above 1 become 2) and compute out[i] = ((raw[i] & 0x3fff) - peds[g*size+i]) * gain[g*size+i] * mask[i].

Returns
Execution time in microseconds.

◆ calib_jungfrau_v1()

time_t utilsdetector::calib_jungfrau_v1 ( const rawd_t *  raw,
const cc_t *  cc,
const sizeb_t &  size,
const sizeb_t &  size_blk,
out_t *  out 
)

Apply calib_jungrfau_blk_v1() to consecutive blocks of size_blk pixels, with cc holding 8 values per pixel; the last size % size_blk pixels are not processed.

Returns
Execution time in microseconds.

◆ calib_jungfrau_v2()

time_t utilsdetector::calib_jungfrau_v2 ( const rawd_t *  raw,
const cc_t *  cc,
const sizeb_t &  size,
const sizeb_t &  size_blk,
out_t *  out 
)

Compute out[i] = ((raw[i] & 0x3fff) - cc[i+size*g]) * cc[i+size*g+4*size] with g = raw[i] >> 14, i.e.

cc laid out as [2][4][size] (pedestals, then gains). size_blk is not used.

Returns
Execution time in microseconds.

◆ calib_jungfrau_v3()

time_t utilsdetector::calib_jungfrau_v3 ( const rawd_t *  raw,
const cc_t *  cc,
const sizeb_t &  npix,
const sizeb_t &  size_blk,
out_t *  out 
)

Compute out[i] = ((raw[i] & 0x3fff) - cc[2*(i+npix*g)]) * cc[2*(i+npix*g)+1] with g = raw[i] >> 14, i.e.

cc laid out as [4][npix][2]. size_blk is not used.

Returns
Execution time in microseconds.

◆ calib_jungfrau_v3_struct()

time_t utilsdetector::calib_jungfrau_v3_struct ( const rawd_t *  raw,
const cc_t *  cc,
const sizeb_t &  size,
const sizeb_t &  size_blk,
out_t *  out 
)

Fill the static table from cc on the first call (fill_CCSV3(), which always reads NPIXELS pixels per combination), then compute out[i] = ((raw[i] & 0x3fff) - pedestal) * gain from table entry [raw[i] >> 14][i].

size_blk is not used.

Returns
Execution time in microseconds, including the table fill.

◆ calib_jungfrau_v4_empty()

time_t utilsdetector::calib_jungfrau_v4_empty ( )

Do nothing and return the time between two steady_clock reads, in microseconds.

◆ calib_jungfrau_v5_empty()

time_t utilsdetector::calib_jungfrau_v5_empty ( const rawd_t *  raw,
const cc_t *  cc,
const sizeb_t &  npix,
const sizeb_t &  size_blk,
out_t *  out 
)

Ignore all arguments and return calib_jungfrau_v4_empty().

◆ calib_jungrfau_blk_v1()

void utilsdetector::calib_jungrfau_blk_v1 ( const rawd_t *  raw,
const cc_t *  cc,
const sizeb_t &  size_blk,
out_t *  out 
)

For each of size_blk pixels compute out[i] = ((raw[i] & 0x3fff) - cc[8*i+g]) * cc[8*i+g+4], where g = raw[i] >> 14; cc holds 4 pedestals then 4 gains per pixel.

◆ calib_std()

time_t utilsdetector::calib_std ( const rawd_t *  raw,
const peds_t *  peds,
const gain_t *  gain,
const mask_t *  mask,
const sizeb_t &  size,
const rawd_t  databits,
out_t *  out 
)

Compute out[i] = ((raw[i] & databits) - peds[i]) * gain[i] * mask[i] for size elements.

Returns
Execution time in microseconds (steady_clock).

◆ fill_CCSV3()

void utilsdetector::fill_CCSV3 ( const cc_t *  cc)

On the first call only, copy cc, laid out as [NGRINDS][NPIXELS][2] (pedestal, gain), into the static table used by calib_jungfrau_v3_struct(), printing progress and the first five pixels of each combination to stdout.

Later calls return at once.