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

Timetool feature extraction for Piranha4 line data: extracts the signal region of interest, divides the averaged signal by a rolling reference, filters it and fits the edge. More...

#include <Piranha4TTFex.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

 Piranha4TTFex (Parameters *)
 Load the reference 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.
 
 ~Piranha4TTFex ()
 Save the accumulated reference to the reference file.
 
void configure (XtcData::ConfigIter &, unsigned)
 Read the fex settings from the configuration (FIR weights, optionally inverted, calibration polynomial, beam and laser event selections, signal minimum, prescales, convergence factors, pedestal from user.black_level minus fex.pedestal_adj, signal region and reference record mode) for a line whose pixel count is the unsigned argument, 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 pixel line.
 
bool write_image () const
 Return true if the image prescale (fex.prescale.image) is non-zero.
 
bool write_averages () const
 Return true if the averages prescale (fex.prescale.averages) is non-zero.
 
bool write_ref_image () const
 Return true if the reference record mode asks for reference images (mode 2).
 
bool write_ref_average () const
 Return true if the reference record mode asks for reference averages (mode 1).
 
bool write_evt_image ()
 Always returns true: the function returns before its prescale logic, which is dead code.
 
bool write_evt_averages ()
 Always returns false: the function returns before its prescale logic, which is dead code.
 
std::vector< double > & sig_average ()
 Return the rolling average of the signal.
 
std::vector< double > & ref_average ()
 Return the rolling average of the reference.
 
virtual void _monitor_raw_sig (std::vector< double > &)
 Hook called with the raw signal; prints samples only when built with DBUG2.
 
virtual void _monitor_ref_sig (std::vector< double > &)
 Hook called with the reference signal; 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 Piranha4 line data: extracts the signal region 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, signal, reference, peak or width check failed (3).

Constructor & Destructor Documentation

◆ Piranha4TTFex()

Drp::Piranha4TTFex::Piranha4TTFex ( Parameters *  )

Load the reference 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.

◆ ~Piranha4TTFex()

Drp::Piranha4TTFex::~Piranha4TTFex ( )

Save the accumulated reference to the reference file.

Member Function Documentation

◆ _monitor_flt_sig()

virtual void Drp::Piranha4TTFex::_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::Piranha4TTFex::_monitor_raw_sig ( std::vector< double > &  )
virtual

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

◆ _monitor_ref_sig()

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

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

◆ _monitor_sub_sig()

virtual void Drp::Piranha4TTFex::_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::Piranha4TTFex::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 pixel line.

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

◆ configure()

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

Read the fex settings from the configuration (FIR weights, optionally inverted, calibration polynomial, beam and laser event selections, signal minimum, prescales, convergence factors, pedestal from user.black_level minus fex.pedestal_adj, signal region and reference record mode) for a line whose pixel count is the unsigned argument, and reset the counters.

◆ ref_average()

std::vector< double > & Drp::Piranha4TTFex::ref_average ( )
inline

Return the rolling average of the reference.

◆ sig_average()

std::vector< double > & Drp::Piranha4TTFex::sig_average ( )
inline

Return the rolling average of the signal.

◆ unconfigure()

void Drp::Piranha4TTFex::unconfigure ( )

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

◆ write_averages()

bool Drp::Piranha4TTFex::write_averages ( ) const
inline

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

◆ write_evt_averages()

bool Drp::Piranha4TTFex::write_evt_averages ( )

Always returns false: the function returns before its prescale logic, which is dead code.

◆ write_evt_image()

bool Drp::Piranha4TTFex::write_evt_image ( )

Always returns true: the function returns before its prescale logic, which is dead code.

◆ write_image()

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

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

◆ write_ref_average()

bool Drp::Piranha4TTFex::write_ref_average ( ) const
inline

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

◆ write_ref_image()

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

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


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