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

Declares utilsdetector pixel-calibration functions (pedestal subtraction and gain, several Jungfrau constant layouts) and a test singleton. More...

#include <cstddef>
#include <stdint.h>

Classes

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

Namespaces

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

Macros

#define NGRINDS   4
 4: number of gain-bit combinations, the first dimension of the static table filled by fill_CCSV3().
 
#define NPIXELS   16777216
 16777216: number of pixels per gain combination in the static table filled by fill_CCSV3().
 
#define NCTYPES   2
 2; not used anywhere else in psana.
 

Typedefs

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

Functions

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.
 
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.
 
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.
 
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].
 
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.
 
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.
 
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.
 
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].
 
time_t utilsdetector::calib_jungfrau_v4_empty ()
 Do nothing and return the time between two steady_clock reads, in microseconds.
 
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().
 

Detailed Description

Declares utilsdetector pixel-calibration functions (pedestal subtraction and gain, several Jungfrau constant layouts) and a test singleton.

Macro Definition Documentation

◆ NCTYPES

#define NCTYPES   2

2; not used anywhere else in psana.

◆ NGRINDS

#define NGRINDS   4

4: number of gain-bit combinations, the first dimension of the static table filled by fill_CCSV3().

◆ NPIXELS

#define NPIXELS   16777216

16777216: number of pixels per gain combination in the static table filled by fill_CCSV3().