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

Timetool feature extraction for Opal camera images: projects the signal (and optional reference and sideband) regions of interest, divides the averaged signal by a rolling reference, filters it and fits the edge. More...

#include <OpalTTFex.hh>

Public Types

enum  TTResult { VALID , NOBEAM , NOLASER , INVALID }
 Outcome of analyze(); for results other than VALID the negated value is also stored in the amplitude slot. More...
 

Public Member Functions

 OpalTTFex (Parameters *)
 Load the reference projection from the file named by the ttreffile kwarg (default detName.ttref; relative names are taken under $HOME, or /tmp if HOME is unset), if that file exists.
 
 ~OpalTTFex ()
 Save the accumulated reference projection to the reference file.
 
void configure (XtcData::ConfigIter &, unsigned, unsigned)
 Read the fex settings from the configuration (FIR weights, optionally inverted, calibration polynomial, beam and laser event selections, projection axis and minimum, prescales, convergence factors, pedestal from user.black_level minus fex.pedestal_adj, regions of interest and reference record mode) for an image whose columns and rows are the two unsigned arguments, and reset the counters.
 
void unconfigure ()
 Print the fraction of calls cut at each stage, if analyze() was called.
 
std::pair< std::vector< double >, TTResult > analyze (std::vector< XtcData::Array< uint8_t > > &subframes, std::vector< double > &sigout, std::vector< double > &refout)
 Analyze one event: subframes[3] holds the EventInfo and subframes[2] the image.
 
bool write_image () const
 Return true if the image prescale (fex.prescale.image) is non-zero.
 
bool write_projections () const
 Return true if the projection prescale (fex.prescale.projections) is non-zero.
 
bool write_ref_image () const
 Return true if the reference record mode asks for reference images (mode 2).
 
bool write_ref_projection () const
 Return true if the reference record mode asks for reference projections (mode 1).
 
bool write_evt_image ()
 Return true, and restart the count, once the number of images analyzed since the last true reaches the image prescale.
 
bool write_evt_projections ()
 Return true, and restart the count, once the number of projections made since the last true reaches the projection prescale.
 
std::vector< double > & sig_projection ()
 Return the rolling average of the signal projection.
 
std::vector< double > & ref_projection ()
 Return the rolling average of the reference projection.
 
virtual void _monitor_raw_sig (std::vector< double > &)
 Hook called with the raw signal projection; prints samples only when built with DBUG2.
 
virtual void _monitor_ref_sig (std::vector< double > &)
 Hook called with the reference projection; prints samples only when built with DBUG2.
 
virtual void _monitor_sub_sig (std::vector< double > &)
 Hook called with the reference-normalized signal; prints samples only when built with DBUG2.
 
virtual void _monitor_flt_sig (std::vector< double > &)
 Hook called with the filtered signal; prints samples only when built with DBUG2.
 

Detailed Description

Timetool feature extraction for Opal camera images: projects the signal (and optional reference and sideband) regions of interest, divides the averaged signal by a rolling reference, filters it and fits the edge.

The reference is loaded from and saved to a file.

Member Enumeration Documentation

◆ TTResult

Outcome of analyze(); for results other than VALID the negated value is also stored in the amplitude slot.

Enumerator
VALID 

An edge was fitted (0).

NOBEAM 

Beam not selected; the reference was updated instead (1).

NOLASER 

Laser not selected; nothing else was done (2).

INVALID 

A frame, projection, reference, peak or width check failed (3).

Constructor & Destructor Documentation

◆ OpalTTFex()

Drp::OpalTTFex::OpalTTFex ( Parameters *  )

Load the reference projection from the file named by the ttreffile kwarg (default detName.ttref; relative names are taken under $HOME, or /tmp if HOME is unset), if that file exists.

◆ ~OpalTTFex()

Drp::OpalTTFex::~OpalTTFex ( )

Save the accumulated reference projection to the reference file.

Member Function Documentation

◆ _monitor_flt_sig()

virtual void Drp::OpalTTFex::_monitor_flt_sig ( std::vector< double > &  )
virtual

Hook called with the filtered signal; prints samples only when built with DBUG2.

◆ _monitor_raw_sig()

virtual void Drp::OpalTTFex::_monitor_raw_sig ( std::vector< double > &  )
virtual

Hook called with the raw signal projection; prints samples only when built with DBUG2.

◆ _monitor_ref_sig()

virtual void Drp::OpalTTFex::_monitor_ref_sig ( std::vector< double > &  )
virtual

Hook called with the reference projection; prints samples only when built with DBUG2.

◆ _monitor_sub_sig()

virtual void Drp::OpalTTFex::_monitor_sub_sig ( std::vector< double > &  )
virtual

Hook called with the reference-normalized signal; prints samples only when built with DBUG2.

◆ analyze()

std::pair< std::vector< double >, TTResult > Drp::OpalTTFex::analyze ( std::vector< XtcData::Array< uint8_t > > &  subframes,
std::vector< double > &  sigout,
std::vector< double > &  refout 
)

Analyze one event: subframes[3] holds the EventInfo and subframes[2] the image.

Returns six values (filtered position, calibrated position, amplitude, next amplitude, reference amplitude, FWHM) with a TTResult; sigout receives the signal projection (divided by the reference if that stage is reached) and refout a copy of the reference average when it is used.

◆ configure()

void Drp::OpalTTFex::configure ( XtcData::ConfigIter &  ,
unsigned  ,
unsigned   
)

Read the fex settings from the configuration (FIR weights, optionally inverted, calibration polynomial, beam and laser event selections, projection axis and minimum, prescales, convergence factors, pedestal from user.black_level minus fex.pedestal_adj, regions of interest and reference record mode) for an image whose columns and rows are the two unsigned arguments, and reset the counters.

◆ ref_projection()

std::vector< double > & Drp::OpalTTFex::ref_projection ( )
inline

Return the rolling average of the reference projection.

◆ sig_projection()

std::vector< double > & Drp::OpalTTFex::sig_projection ( )
inline

Return the rolling average of the signal projection.

◆ unconfigure()

void Drp::OpalTTFex::unconfigure ( )

Print the fraction of calls cut at each stage, if analyze() was called.

◆ write_evt_image()

bool Drp::OpalTTFex::write_evt_image ( )

Return true, and restart the count, once the number of images analyzed since the last true reaches the image prescale.

◆ write_evt_projections()

bool Drp::OpalTTFex::write_evt_projections ( )

Return true, and restart the count, once the number of projections made since the last true reaches the projection prescale.

◆ write_image()

bool Drp::OpalTTFex::write_image ( ) const
inline

Return true if the image prescale (fex.prescale.image) is non-zero.

◆ write_projections()

bool Drp::OpalTTFex::write_projections ( ) const
inline

Return true if the projection prescale (fex.prescale.projections) is non-zero.

◆ write_ref_image()

bool Drp::OpalTTFex::write_ref_image ( ) const
inline

Return true if the reference record mode asks for reference images (mode 2).

◆ write_ref_projection()

bool Drp::OpalTTFex::write_ref_projection ( ) const
inline

Return true if the reference record mode asks for reference projections (mode 1).


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