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

Declares the waveform edge finder psalg::find_edges() and its helper _add_edge(). More...

#include <vector>
#include <cstdint>

Namespaces

namespace  psalg
 Usage.
 

Typedefs

typedef uint32_t psalg::index_t
 uint32_t; index type of the find_edges() results.
 
typedef double psalg::wfdata_t
 double.
 

Functions

template<typename T >
void psalg::_add_edge (const std::vector< T > &v, bool rising, double fraction, double deadtime, T peak, index_t start, double &last, index_t &ipk, T *pkvals, index_t *pkinds)
 From sample start, find the first sample i where v reaches the level fraction (an absolute level: upward if rising, downward otherwise) and interpolate the edge position linearly between samples i-1 and i (0 if i is 0).
 
template<typename T >
index_t psalg::find_edges (index_t npkmax, T *pkvals, index_t *pkinds, const std::vector< T > &wf, double baseline, double threshold, double fraction, double deadtime, bool leading_edge)
 Find pulses in wf that go beyond threshold (above it if threshold > baseline, else below) for more than deadtime samples; for each, store its extreme value in pkvals and the interpolated index of the edge at level fraction*(peak-baseline)+baseline in pkinds (leading edge, or with leading_edge false the trailing edge searched from the peak).
 

Detailed Description

Declares the waveform edge finder psalg::find_edges() and its helper _add_edge().