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

Namespace of the psalg detector classes and types (Detector, AreaDetector and subclasses, AREADETTYPE, ...). More...

Classes

class  AreaDetector
 Base class for area detectors. More...
 
class  AreaDetectorCspad
 AreaDetector subclass for CSPAD, written like AreaDetectorJungfrau. More...
 
class  AreaDetectorEpix100a
 AreaDetector subclass for Epix100a with stub overrides of shape(evt) and size(evt); everything else comes from AreaDetector. More...
 
class  AreaDetectorJungfrau
 AreaDetector subclass for Jungfrau: reads module counts and per-module version and serial numbers from the config, and returns the data field "frame" as raw(). More...
 
class  AreaDetectorOpal
 AreaDetector subclass for Opal: finds the indexes of the Opal config and data fields by name, gives typed accessors for them, and provides raw() and pedestal-subtracted calib() arrays. More...
 
class  AreaDetectorPnccd
 AreaDetector subclass for pnCCD: finds the indexes of the config fields and of the per-module data fields (frame0_... to frame3_...) by name, gives typed accessors for them, and builds raw() and pedestal-subtracted calib() arrays from the module data. More...
 
class  DataSourceSimulator
 File-based data source for tests: detector() gets a Detector from getDetector() and events() iterates over array files in a directory. More...
 
class  Detector
 Base detector class holding a name and a DETTYPE. More...
 
class  EventIteratorSimulator
 DirFileIterator whose next() wraps the next matching file in an EventSimulator. More...
 
class  EventSimulator
 One simulated event: an ArrayIO<float> that loads a float array from a text file; nda() returns it. More...
 

Typedefs

typedef uint32_t shape_t
 uint32_t; element type of shape arrays (e.g.
 
typedef uint32_t size_t
 uint32_t.
 
typedef uint16_t raw_t
 uint16_t; element type of AreaDetector::raw(const event_t&).
 
typedef float event_t
 float; the type of the event argument of the AreaDetector accessors.
 
typedef float calib_t
 float; element type of AreaDetector::calib().
 
typedef float image_t
 float; element type of AreaDetector::image().
 
typedef uint64_t index_t
 uint64_t; the trailing comment says it is an index of data in the xtc data types.
 
typedef int64_t cfg_int64_t
 int64_t; marked DEPRICATED in the trailing comment.
 
typedef int16_t raw_cspad_t
 int16_t; element type of AreaDetectorCspad::raw() (trailing comment: raw DAQ data type of cspad).
 
typedef uint16_t raw_jungfrau_t
 uint16_t; element type of AreaDetectorJungfrau::raw() (trailing comment: raw DAQ data type of jungfrau).
 
typedef uint16_t opal_raw_t
 uint16_t; element type of AreaDetectorOpal::raw().
 
typedef float opal_calib_t
 float; element type of AreaDetectorOpal::calib().
 
typedef double opal_pedestals_t
 double; element type of the pedestals that calib() subtracts (loaded by load_calib_constants()).
 
typedef uint16_t pnccd_raw_t
 uint16_t; element type of AreaDetectorPnccd::raw() (trailing comment: raw type of pnccd data).
 
typedef float pnccd_calib_t
 float; element type of AreaDetectorPnccd::calib() (trailing comment: calib type of pnccd data).
 
typedef double pnccd_pedestals_t
 double; element type of the pedestals that calib() subtracts (trailing comment: pedestals type of pnccd data).
 

Enumerations

enum  CALIB_TYPE {
  PEDESTALS =0 , PIXEL_RMS , PIXEL_STATUS , PIXEL_GAIN ,
  PIXEL_OFFSET , PIXEL_MASK , PIXEL_BKGD , COMMON_MODE
}
 Calibration types (values 0..7). More...
 
enum  AREADETTYPE {
  UNDEFINED = 0 , CSPAD , CSPAD2X2 , PRINCETON ,
  PNCCD , TM6740 , OPAL1000 , OPAL2000 ,
  OPAL4000 , OPAL8000 , ORCAFL40 , EPIX ,
  EPIX10KA , EPIX10KA2M , EPIX100A , EPIXS ,
  EPIXUHR , FCCD960 , FCCD , ANDOR3D ,
  ANDOR , DUALANDOR , ACQIRIS , IMP ,
  QUARTZ4A150 , RAYONIX , EVR , TIMEPIX ,
  FLI , PIMAX , JUNGFRAU , ZYLA ,
  EPICSCAM , PIXIS , UXI , STREAKC7700 ,
  ARCHON
}
 Area detector types (0..36). More...
 
enum  DETTYPE {
  UNDEFINED_DETECTOR =0 , AREA_DETECTOR , CONTROL_DATA_DETECTOR , DDL_DETECTOR ,
  EPICS_DETECTOR , EVR_DETECTOR , WF_DETECTOR , IPIMB_DETECTOR ,
  OCEAN_DETECTOR , USDUSB_DETECTOR , TDC_DETECTOR
}
 Detector categories. More...
 

Functions

const AREADETTYPE find_area_dettype (const std::string &detname)
 Return the type of the first key of map_area_detname_to_dettype, in alphabetical key order, that occurs (case-sensitively) in detname, or UNDEFINED if none does.
 
void print_map_area_detname_to_dettype ()
 Log all entries of map_area_detname_to_dettype as one INFO message, one "key => value" line each.
 
AreaDetector * getAreaDetector (const std::string &detname, XtcData::ConfigIter &configo)
 Return a new AreaDetectorJungfrau(detname, configo) if find_area_dettype(detname) is JUNGFRAU; for any other type log a warning and return NULL.
 
AreaDetector * getAreaDetector (const std::string &detname)
 Return a new AreaDetectorEpix100a(detname) if find_area_dettype(detname) is EPIX100A; for any other type log a warning and return NULL.
 
Detector * getDetector (const std::string &detname)
 Return getAreaDetector(detname) if find_dettype(detname) is AREA_DETECTOR (logged at INFO); otherwise log a WARNING and return NULL.
 
const DETTYPE find_dettype (const std::string &detname)
 Return the type of the first key of map_detname_to_dettype (alphabetical key order) that occurs in detname, else the first such key of map_bldinfo_to_dettype, else UNDEFINED_DETECTOR.
 
const std::string & dettypename (const DETTYPE dettype)
 Return the enumerator name of dettype from map_dettype_to_typename; operator[] inserts an empty name for a value not in the map.
 
void print_map_detname_to_dettype ()
 Log all entries of map_detname_to_dettype as one INFO message, one "key => value" line each.
 
void print_map_bldinfo_to_dettype ()
 Log all entries of map_bldinfo_to_dettype as one INFO message, one "key => value" line each.
 
void fft (std::vector< std::complex< double > > &a, bool invert)
 Replace a with its discrete Fourier transform, computed in place by an iterative radix-2 algorithm (bit-reversal permutation, then butterflies).
 
XtcData::Names & configNames (XtcData::ConfigIter &configo)
 Return the Names that configo's NamesLookup holds for the NamesId of configo.shape(); NameIndex::names() throws if there is none.
 
std::string str_dg_info (const XtcData::Dgram *dg)
 Return a one-line description of dg: transition name, type, time (seconds.nanoseconds), env, payload size and extent.
 
void print_dg_info (const XtcData::Dgram *dg)
 Print str_dg_info(dg) followed by a newline to stdout.
 
std::string str_config_names (XtcData::ConfigIter &configo)
 Return a description of configo.shape()'s NamesId and Names: names id, detName, detType, detId, segment, number of names and alg name.
 
void print_config_names (XtcData::ConfigIter &configo)
 Print str_config_names(configo) to stdout; the string is passed to printf as the format string and no newline is added.
 

Variables

static std::map< std::string, AREADETTYPE > map_area_detname_to_dettype
 Map from a lower-case name fragment to AREADETTYPE, searched by find_area_dettype().
 
static std::map< DETTYPE, std::string > map_dettype_to_typename
 Map from DETTYPE to its enumerator name, used by dettypename().
 
static std::map< std::string, DETTYPE > map_detname_to_dettype
 Map from a detector-name fragment (e.g.
 
static std::map< std::string, DETTYPE > map_bldinfo_to_dettype
 Map from name fragments such as "EBeam", "FEEGasDetEnergy" or "XCS-IPM-01" to DETTYPE, searched by find_dettype() after map_detname_to_dettype.
 

Detailed Description

Namespace of the psalg detector classes and types (Detector, AreaDetector and subclasses, AREADETTYPE, ...).

Usage #include "psalg/detector/DetectorTypes.hh".

This factory does not have too much sense, because Detector base class does not cover any useful methods for any of underlying detectors, but other detector methods are not accessible...

Usage.

#include "psalg/detector/AreaDetectorStore.hh"

AreaDetector* det = getAreaDetector("Cspad."); NDArray<pedestals_t> peds = det->raw(); NDArray<pedestals_t> peds = det->pedestals();

Usage

#include "psalg/detector/DetectorStore.hh"

Detector* det = getDetector("Cspad."); // however methods of AreaDetector will not be accessible... AreaDetector* area_det = dynamic_cast<AreaDetector*>(getDetector("Epix100a")); NDArray<pedestals_t> peds = area_det->raw(); NDArray<pedestals_t> peds = area_det->pedestals();

#include <iostream> // cout, puts etc. std::cout << "Detector obj: " << *det << '
'; std::cout << "AreaDetector obj: " << *area_det << '
';

Typedef Documentation

◆ calib_t

typedef float detector::calib_t

float; element type of AreaDetector::calib().

◆ cfg_int64_t

int64_t; marked DEPRICATED in the trailing comment.

◆ event_t

typedef float detector::event_t

float; the type of the event argument of the AreaDetector accessors.

The trailing comment relates it to query_t.

◆ image_t

typedef float detector::image_t

float; element type of AreaDetector::image().

◆ index_t

uint64_t; the trailing comment says it is an index of data in the xtc data types.

◆ opal_calib_t

◆ opal_pedestals_t

double; element type of the pedestals that calib() subtracts (loaded by load_calib_constants()).

◆ opal_raw_t

◆ pnccd_calib_t

float; element type of AreaDetectorPnccd::calib() (trailing comment: calib type of pnccd data).

◆ pnccd_pedestals_t

double; element type of the pedestals that calib() subtracts (trailing comment: pedestals type of pnccd data).

◆ pnccd_raw_t

uint16_t; element type of AreaDetectorPnccd::raw() (trailing comment: raw type of pnccd data).

◆ raw_cspad_t

int16_t; element type of AreaDetectorCspad::raw() (trailing comment: raw DAQ data type of cspad).

◆ raw_jungfrau_t

uint16_t; element type of AreaDetectorJungfrau::raw() (trailing comment: raw DAQ data type of jungfrau).

◆ raw_t

typedef uint16_t detector::raw_t

uint16_t; element type of AreaDetector::raw(const event_t&).

◆ shape_t

typedef uint32_t detector::shape_t

uint32_t; element type of shape arrays (e.g.

AreaDetector::shape()).

◆ size_t

typedef uint32_t detector::size_t

uint32_t.

Inside namespace detector it hides the standard size_t (e.g. AreaDetector::size() returns this type).

Enumeration Type Documentation

◆ AREADETTYPE

Area detector types (0..36).

find_area_dettype() maps a detector name to one of them using map_area_detname_to_dettype.

Enumerator
UNDEFINED 

Value 0; map key "undefined".

CSPAD 

Value 1; map key "cspad-".

CSPAD2X2 

Value 2; map key "cspad2x2".

PRINCETON 

Value 3; map key "princeton".

PNCCD 

Value 4; map key "pnccd".

TM6740 

Value 5; map key "tm6740".

OPAL1000 

Value 6; map key "opal1000".

OPAL2000 

Value 7; map key "opal2000".

OPAL4000 

Value 8; map key "opal4000".

OPAL8000 

Value 9; map key "opal8000".

ORCAFL40 

Value 10; map key "orcafl40".

EPIX 

Value 11; has no key in map_area_detname_to_dettype, so find_area_dettype() never returns it.

EPIX10KA 

Value 12; map key "epix10ka".

EPIX10KA2M 

Value 13; map key "epix10ka2m", but find_area_dettype() matches the shorter key "epix10ka" first, so it never returns this value.

EPIX100A 

Value 14; map key "epix100a".

EPIXS 

Value 15; map key "epixs".

EPIXUHR 

Value 16; map key "epixuhr".

FCCD960 

Value 17; map key "fccd960", but find_area_dettype() matches the shorter key "fccd" first, so it never returns this value.

FCCD 

Value 18; map key "fccd".

ANDOR3D 

Value 19; map key "andor3d", but find_area_dettype() matches the shorter key "andor" first, so it never returns this value.

ANDOR 

Value 20; map key "andor".

DUALANDOR 

Value 21; map key "dualandor", but find_area_dettype() matches the shorter key "andor" first, so it never returns this value.

ACQIRIS 

Value 22; map key "acqiris".

IMP 

Value 23; map key "imp".

QUARTZ4A150 

Value 24; map key "quartz4a150".

RAYONIX 

Value 25; map key "rayonix".

EVR 

Value 26; map key "evr".

TIMEPIX 

Value 27; map key "timepix".

FLI 

Value 28; map key "fli".

PIMAX 

Value 29; map key "pimax".

JUNGFRAU 

Value 30; map key "jungfrau".

ZYLA 

Value 31; map key "zyla".

EPICSCAM 

Value 32; map key "controlscamera".

PIXIS 

Value 33; map key "pixis".

UXI 

Value 34; map key "uxi".

STREAKC7700 

Value 35; map key "streakc7700".

ARCHON 

Value 36; map key "archon".

◆ CALIB_TYPE

Calibration types (values 0..7).

Same name as calib::CALIB_TYPE but a shorter list, so COMMON_MODE is 7 here.

Enumerator
PEDESTALS 

Value 0.

PIXEL_RMS 

Value 1.

PIXEL_STATUS 

Value 2.

PIXEL_GAIN 

Value 3.

PIXEL_OFFSET 

Value 4.

PIXEL_MASK 

Value 5.

PIXEL_BKGD 

Value 6.

COMMON_MODE 

Value 7.

◆ DETTYPE

Detector categories.

find_dettype() maps detector names to them and dettypename() maps them to their enumerator names.

Enumerator
UNDEFINED_DETECTOR 

Value 0; returned by find_dettype() when no key matches (map key "NoDevice").

AREA_DETECTOR 

Value 1; map keys such as "Cspad", "Jungfrau", "pnCCD", "Opal1000".

CONTROL_DATA_DETECTOR 

Value 2; no map key gives this type.

DDL_DETECTOR 

Value 3; keys "Encoder" and "Gsc16ai" and several entries of map_bldinfo_to_dettype.

EPICS_DETECTOR 

Value 4; no map key gives this type.

EVR_DETECTOR 

Value 5; map key "Evr".

WF_DETECTOR 

Value 6; map key "Acqiris".

IPIMB_DETECTOR 

Value 7; map key "Ipimb" and the IPM entries of map_bldinfo_to_dettype.

OCEAN_DETECTOR 

Value 8; no map key gives this type.

USDUSB_DETECTOR 

Value 9; no map key gives this type.

TDC_DETECTOR 

Value 10; map key "AcqTDC".

Function Documentation

◆ configNames()

XtcData::Names & detector::configNames ( XtcData::ConfigIter &  configo)

Return the Names that configo's NamesLookup holds for the NamesId of configo.shape(); NameIndex::names() throws if there is none.

◆ dettypename()

const std::string & detector::dettypename ( const DETTYPE  dettype)
inline

Return the enumerator name of dettype from map_dettype_to_typename; operator[] inserts an empty name for a value not in the map.

◆ fft()

void detector::fft ( std::vector< std::complex< double > > &  a,
bool  invert 
)

Replace a with its discrete Fourier transform, computed in place by an iterative radix-2 algorithm (bit-reversal permutation, then butterflies).

The forward transform uses twiddle factors exp(+2*pi*i/len); invert=true uses exp(-2*pi*i/len) and divides every element by the size. The size is assumed to be a power of two (not checked).

◆ find_area_dettype()

const AREADETTYPE detector::find_area_dettype ( const std::string &  detname)

Return the type of the first key of map_area_detname_to_dettype, in alphabetical key order, that occurs (case-sensitively) in detname, or UNDEFINED if none does.

Because of this order a shorter key wins over a longer one that contains it (e.g. "epix10ka2m..." gives EPIX10KA).

◆ find_dettype()

const DETTYPE detector::find_dettype ( const std::string &  detname)

Return the type of the first key of map_detname_to_dettype (alphabetical key order) that occurs in detname, else the first such key of map_bldinfo_to_dettype, else UNDEFINED_DETECTOR.

Matching is a case-sensitive substring test.

◆ getAreaDetector() [1/2]

AreaDetector * detector::getAreaDetector ( const std::string &  detname)

Return a new AreaDetectorEpix100a(detname) if find_area_dettype(detname) is EPIX100A; for any other type log a warning and return NULL.

The caller owns the object.

◆ getAreaDetector() [2/2]

AreaDetector * detector::getAreaDetector ( const std::string &  detname,
XtcData::ConfigIter &  configo 
)

Return a new AreaDetectorJungfrau(detname, configo) if find_area_dettype(detname) is JUNGFRAU; for any other type log a warning and return NULL.

The caller owns the object.

◆ getDetector()

Detector * detector::getDetector ( const std::string &  detname)

Return getAreaDetector(detname) if find_dettype(detname) is AREA_DETECTOR (logged at INFO); otherwise log a WARNING and return NULL.

◆ print_config_names()

void detector::print_config_names ( XtcData::ConfigIter &  configo)

Print str_config_names(configo) to stdout; the string is passed to printf as the format string and no newline is added.

◆ print_dg_info()

void detector::print_dg_info ( const XtcData::Dgram *  dg)

Print str_dg_info(dg) followed by a newline to stdout.

◆ print_map_area_detname_to_dettype()

void detector::print_map_area_detname_to_dettype ( )

Log all entries of map_area_detname_to_dettype as one INFO message, one "key => value" line each.

◆ print_map_bldinfo_to_dettype()

void detector::print_map_bldinfo_to_dettype ( )

Log all entries of map_bldinfo_to_dettype as one INFO message, one "key => value" line each.

◆ print_map_detname_to_dettype()

void detector::print_map_detname_to_dettype ( )

Log all entries of map_detname_to_dettype as one INFO message, one "key => value" line each.

◆ str_config_names()

std::string detector::str_config_names ( XtcData::ConfigIter &  configo)

Return a description of configo.shape()'s NamesId and Names: names id, detName, detType, detId, segment, number of names and alg name.

◆ str_dg_info()

std::string detector::str_dg_info ( const XtcData::Dgram *  dg)

Return a one-line description of dg: transition name, type, time (seconds.nanoseconds), env, payload size and extent.

Variable Documentation

◆ map_area_detname_to_dettype

std::map<std::string, AREADETTYPE> detector::map_area_detname_to_dettype
static

Map from a lower-case name fragment to AREADETTYPE, searched by find_area_dettype().

Declared static in the header, so each translation unit has its own copy.

◆ map_bldinfo_to_dettype

std::map<std::string, DETTYPE> detector::map_bldinfo_to_dettype
static

Map from name fragments such as "EBeam", "FEEGasDetEnergy" or "XCS-IPM-01" to DETTYPE, searched by find_dettype() after map_detname_to_dettype.

Static in the header, so each translation unit has its own copy.

◆ map_detname_to_dettype

std::map<std::string, DETTYPE> detector::map_detname_to_dettype
static

Map from a detector-name fragment (e.g.

"Cspad", "Jungfrau", "Evr") to DETTYPE, searched first by find_dettype(). Static in the header, so each translation unit has its own copy.

◆ map_dettype_to_typename

std::map<DETTYPE, std::string> detector::map_dettype_to_typename
static
Initial value:
= {
{UNDEFINED_DETECTOR, "UNDEFINED_DETECTOR"},
{AREA_DETECTOR, "AREA_DETECTOR"},
{CONTROL_DATA_DETECTOR, "CONTROL_DATA_DETECTOR"},
{DDL_DETECTOR, "DDL_DETECTOR"},
{EPICS_DETECTOR, "EPICS_DETECTOR"},
{EVR_DETECTOR, "EVR_DETECTOR"},
{WF_DETECTOR, "WF_DETECTOR"},
{IPIMB_DETECTOR, "IPIMB_DETECTOR"},
{OCEAN_DETECTOR, "OCEAN_DETECTOR"},
{USDUSB_DETECTOR, "USDUSB_DETECTOR"},
{TDC_DETECTOR, "TDC_DETECTOR"}
}
@ IPIMB_DETECTOR
Value 7; map key "Ipimb" and the IPM entries of map_bldinfo_to_dettype.
Definition DetectorTypes.hh:29
@ UNDEFINED_DETECTOR
Value 0; returned by find_dettype() when no key matches (map key "NoDevice").
Definition DetectorTypes.hh:22
@ TDC_DETECTOR
Value 10; map key "AcqTDC".
Definition DetectorTypes.hh:32
@ OCEAN_DETECTOR
Value 8; no map key gives this type.
Definition DetectorTypes.hh:30
@ EPICS_DETECTOR
Value 4; no map key gives this type.
Definition DetectorTypes.hh:26
@ USDUSB_DETECTOR
Value 9; no map key gives this type.
Definition DetectorTypes.hh:31
@ DDL_DETECTOR
Value 3; keys "Encoder" and "Gsc16ai" and several entries of map_bldinfo_to_dettype.
Definition DetectorTypes.hh:25
@ AREA_DETECTOR
Value 1; map keys such as "Cspad", "Jungfrau", "pnCCD", "Opal1000".
Definition DetectorTypes.hh:23
@ WF_DETECTOR
Value 6; map key "Acqiris".
Definition DetectorTypes.hh:28
@ EVR_DETECTOR
Value 5; map key "Evr".
Definition DetectorTypes.hh:27

Map from DETTYPE to its enumerator name, used by dettypename().

Static in the header, so each translation unit has its own copy.