WireCellToolkit
Wire Cell Simulation, Signal Process and Reconstruction Toolki for Liquid Argon Detectors
WireCell::Waveform Namespace Reference

Typedefs

typedef float real_t
 The type for the signal in each bin. More...
 
typedef std::complex< float > complex_t
 The type for the spectrum in each bin. More...
 
template<typename Val >
using Sequence = std::vector< Val >
 
typedef Sequence< real_trealseq_t
 
typedef Sequence< complex_tcompseq_t
 A complex-valued sequence, eg for discrete spectrum powers. More...
 
typedef std::pair< int, int > BinRange
 A half-open range of bins (from first bin to one past last bin) More...
 
typedef std::vector< BinRangeBinRangeList
 A list of bin ranges. More...
 
typedef std::map< int, BinRangeListChannelMasks
 Map channel number to a vector of BinRanges. More...
 
typedef std::map< std::string, ChannelMasksChannelMaskMap
 Collect channel masks by some label. More...
 
typedef std::pair< double, double > Period
 A range of time. More...
 
typedef std::pair< double, double > Band
 A range of frequency. More...
 
typedef std::pair< double, double > Domain
 

Functions

BinRangeList merge (const BinRangeList &br)
 Return a new list with any overlaps formed into unions. More...
 
BinRangeList merge (const BinRangeList &br1, const BinRangeList &br2)
 Merge two bin range lists, forming a union from any overlapping ranges. More...
 
ChannelMasks merge (const ChannelMasks &one, const ChannelMasks &two)
 Return a new mapping which is the union of all same channel masks. More...
 
void merge (ChannelMaskMap &one, ChannelMaskMap &two, std::map< std::string, std::string > &name_map)
 
int sample_count (const Domain &domain, double width)
 Return the number of samples needed to cover the domain with sample size width. More...
 
double sample_width (const Domain &domain, int count)
 Return the sample size if domain is equally sampled with given number of samples. More...
 
std::pair< int, int > sub_sample (const Domain &domain, int nsamples, const Domain &subdomain)
 Return the begin/end sample numbers inside the a subdomain of a domain with nsamples total. More...
 
template<typename Val >
Sequence< Val > resample (const Sequence< Val > &wave, const Domain &domain, int nsamples, const Domain &newdomain)
 
realseq_t real (const compseq_t &seq)
 Return the real part of the sequence. More...
 
realseq_t imag (const compseq_t &seq)
 Return the imaginary part of the sequence. More...
 
realseq_t magnitude (const compseq_t &seq)
 Return the magnitude or absolute value of the sequence. More...
 
realseq_t phase (const compseq_t &seq)
 Return the phase or arg part of the sequence. More...
 
template<typename Val >
void increase (Sequence< Val > &seq, Val scalar)
 Increase (shift) sequence values by scalar. More...
 
void increase (Sequence< float > &seq, double scalar)
 
template<typename Val >
void increase (Sequence< Val > &seq, const Sequence< Val > &other)
 Increase (shift) sequence values by values in another sequence. More...
 
template<typename Val >
void scale (Sequence< Val > &seq, Val scalar)
 Scale (multiply) sequence values by scalar. More...
 
void scale (Sequence< float > &seq, double scalar)
 
template<typename Val >
void scale (Sequence< Val > &seq, const Sequence< Val > &other)
 Scale (multiply) seq values by values from the other sequence. More...
 
template<typename Val >
void shrink (Sequence< Val > &seq, const Sequence< Val > &other)
 Shrink (divide) seq values by values from the other sequence. More...
 
std::pair< int, int > edge (const realseq_t &wave)
 
template<typename Val >
Val sum (const Sequence< Val > &seq)
 Return sum of all entries in sequence. More...
 
template<typename Val >
Val sum2 (const Sequence< Val > &seq)
 Return sum of square of all entries in sequence. More...
 
std::pair< double, double > mean_rms (const realseq_t &wave)
 
real_t median (realseq_t wave)
 
real_t median_binned (realseq_t &wave)
 
real_t percentile (realseq_t wave, real_t percentage)
 
real_t percentile_binned (realseq_t &wave, real_t percentage)
 
compseq_t dft (realseq_t seq)
 
realseq_t linear_convolve (Waveform::realseq_t in1, Waveform::realseq_t in2, bool truncate=true)
 
realseq_t replace_convolve (Waveform::realseq_t wave, Waveform::realseq_t newres, Waveform::realseq_t oldres, bool truncate=true)
 
realseq_t idft (compseq_t spec)
 
short most_frequent (const std::vector< short > &vals)
 Return the smallest, most frequent value to appear in vector. More...
 

Typedef Documentation

◆ Band

typedef std::pair<double,double> WireCell::Waveform::Band

A range of frequency.

Definition at line 69 of file Waveform.h.

◆ BinRange

typedef std::pair<int,int> WireCell::Waveform::BinRange

A half-open range of bins (from first bin to one past last bin)

Definition at line 38 of file Waveform.h.

◆ BinRangeList

A list of bin ranges.

Definition at line 41 of file Waveform.h.

◆ ChannelMaskMap

typedef std::map<std::string, ChannelMasks> WireCell::Waveform::ChannelMaskMap

Collect channel masks by some label.

Definition at line 59 of file Waveform.h.

◆ ChannelMasks

Map channel number to a vector of BinRanges.

Definition at line 50 of file Waveform.h.

◆ complex_t

typedef std::complex<float> WireCell::Waveform::complex_t

The type for the spectrum in each bin.

Definition at line 21 of file Waveform.h.

◆ compseq_t

A complex-valued sequence, eg for discrete spectrum powers.

Definition at line 34 of file Waveform.h.

◆ Domain

typedef std::pair<double,double> WireCell::Waveform::Domain

A domain of a sequence is bounded by the time or frequency at the start of its first element and that at the end of its last.

Definition at line 75 of file Waveform.h.

◆ Period

typedef std::pair<double,double> WireCell::Waveform::Period

A range of time.

Definition at line 66 of file Waveform.h.

◆ real_t

The type for the signal in each bin.

Definition at line 18 of file Waveform.h.

◆ realseq_t

Definition at line 31 of file Waveform.h.

◆ Sequence

template<typename Val >
using WireCell::Waveform::Sequence = typedef std::vector<Val>

A sequence is an ordered array of values (real or complex). By itself it is not associated with a domain.

Definition at line 27 of file Waveform.h.

Function Documentation

◆ dft()

Waveform::compseq_t WireCell::Waveform::dft ( realseq_t  seq)

Discrete Fourier transform of real sequence. Returns full spectrum. No normalization scaling applied

Definition at line 143 of file Waveform.cxx.

Here is the caller graph for this function:

◆ edge()

std::pair< int, int > WireCell::Waveform::edge ( const realseq_t wave)

Return a pair of indices into wave which bound non-zero region. First index is of first non-zero sample, second index is one past last non-zero sample. If entire wave is empty then both are set to size().

Definition at line 123 of file Waveform.cxx.

Here is the caller graph for this function:

◆ idft()

Waveform::realseq_t WireCell::Waveform::idft ( compseq_t  spec)

Inverse, discrete Fourier transform. Expects full spectrum (twice Nyquist frequency). Applies the 1/Nsamples normalization.

Definition at line 151 of file Waveform.cxx.

Here is the caller graph for this function:

◆ imag()

Waveform::realseq_t WireCell::Waveform::imag ( const compseq_t seq)

Return the imaginary part of the sequence.

Definition at line 60 of file Waveform.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ increase() [1/3]

template<typename Val >
void WireCell::Waveform::increase ( Sequence< Val > &  seq,
Val  scalar 
)

Increase (shift) sequence values by scalar.

Definition at line 129 of file Waveform.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ increase() [2/3]

void WireCell::Waveform::increase ( Sequence< float > &  seq,
double  scalar 
)
inline

Definition at line 133 of file Waveform.h.

Here is the call graph for this function:

◆ increase() [3/3]

template<typename Val >
void WireCell::Waveform::increase ( Sequence< Val > &  seq,
const Sequence< Val > &  other 
)

Increase (shift) sequence values by values in another sequence.

Definition at line 139 of file Waveform.h.

Here is the call graph for this function:

◆ linear_convolve()

Waveform::realseq_t WireCell::Waveform::linear_convolve ( Waveform::realseq_t  in1,
Waveform::realseq_t  in2,
bool  truncate = true 
)

Definition at line 161 of file Waveform.cxx.

Here is the caller graph for this function:

◆ magnitude()

Waveform::realseq_t WireCell::Waveform::magnitude ( const compseq_t seq)

Return the magnitude or absolute value of the sequence.

Definition at line 65 of file Waveform.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mean_rms()

std::pair< double, double > WireCell::Waveform::mean_rms ( const realseq_t wave)

Definition at line 24 of file Waveform.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ median()

Waveform::real_t WireCell::Waveform::median ( Waveform::realseq_t  wave)

Definition at line 76 of file Waveform.cxx.

Here is the caller graph for this function:

◆ median_binned()

Waveform::real_t WireCell::Waveform::median_binned ( Waveform::realseq_t wave)

Definition at line 83 of file Waveform.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ merge() [1/4]

WireCell::Waveform::BinRangeList WireCell::Waveform::merge ( const BinRangeList br)

Return a new list with any overlaps formed into unions.

Definition at line 224 of file Waveform.cxx.

Here is the caller graph for this function:

◆ merge() [2/4]

WireCell::Waveform::BinRangeList WireCell::Waveform::merge ( const BinRangeList br1,
const BinRangeList br2 
)

Merge two bin range lists, forming a union from any overlapping ranges.

Definition at line 245 of file Waveform.cxx.

Here is the call graph for this function:

◆ merge() [3/4]

WireCell::Waveform::ChannelMasks WireCell::Waveform::merge ( const ChannelMasks one,
const ChannelMasks two 
)

Return a new mapping which is the union of all same channel masks.

Definition at line 260 of file Waveform.cxx.

Here is the call graph for this function:

◆ merge() [4/4]

void WireCell::Waveform::merge ( ChannelMaskMap one,
ChannelMaskMap two,
std::map< std::string, std::string > &  name_map 
)

Definition at line 272 of file Waveform.cxx.

Here is the call graph for this function:

◆ most_frequent()

short WireCell::Waveform::most_frequent ( const std::vector< short > &  vals)

Return the smallest, most frequent value to appear in vector.

Definition at line 291 of file Waveform.cxx.

Here is the caller graph for this function:

◆ percentile()

Waveform::real_t WireCell::Waveform::percentile ( Waveform::realseq_t  wave,
real_t  percentage 
)

Definition at line 89 of file Waveform.cxx.

Here is the caller graph for this function:

◆ percentile_binned()

Waveform::real_t WireCell::Waveform::percentile_binned ( Waveform::realseq_t wave,
real_t  percentage 
)

Definition at line 95 of file Waveform.cxx.

Here is the caller graph for this function:

◆ phase()

Waveform::realseq_t WireCell::Waveform::phase ( const compseq_t seq)

Return the phase or arg part of the sequence.

Definition at line 70 of file Waveform.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ real()

Waveform::realseq_t WireCell::Waveform::real ( const compseq_t seq)

Return the real part of the sequence.

Definition at line 55 of file Waveform.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ replace_convolve()

Waveform::realseq_t WireCell::Waveform::replace_convolve ( Waveform::realseq_t  wave,
Waveform::realseq_t  newres,
Waveform::realseq_t  oldres,
bool  truncate = true 
)

Definition at line 189 of file Waveform.cxx.

Here is the caller graph for this function:

◆ resample()

template<typename Val >
Sequence<Val> WireCell::Waveform::resample ( const Sequence< Val > &  wave,
const Domain domain,
int  nsamples,
const Domain newdomain 
)

Return a new sequence resampled and interpolated from the original wave defined over the domain to a new domain of nsamples.

Definition at line 92 of file Waveform.h.

Here is the call graph for this function:

◆ sample_count()

int WireCell::Waveform::sample_count ( const Domain domain,
double  width 
)
inline

Return the number of samples needed to cover the domain with sample size width.

Definition at line 77 of file Waveform.h.

◆ sample_width()

double WireCell::Waveform::sample_width ( const Domain domain,
int  count 
)
inline

Return the sample size if domain is equally sampled with given number of samples.

Definition at line 81 of file Waveform.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale() [1/3]

template<typename Val >
void WireCell::Waveform::scale ( Sequence< Val > &  seq,
Val  scalar 
)

Scale (multiply) sequence values by scalar.

Definition at line 146 of file Waveform.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale() [2/3]

void WireCell::Waveform::scale ( Sequence< float > &  seq,
double  scalar 
)
inline

Definition at line 150 of file Waveform.h.

Here is the call graph for this function:

◆ scale() [3/3]

template<typename Val >
void WireCell::Waveform::scale ( Sequence< Val > &  seq,
const Sequence< Val > &  other 
)

Scale (multiply) seq values by values from the other sequence.

Definition at line 156 of file Waveform.h.

Here is the call graph for this function:

◆ shrink()

template<typename Val >
void WireCell::Waveform::shrink ( Sequence< Val > &  seq,
const Sequence< Val > &  other 
)

Shrink (divide) seq values by values from the other sequence.

Definition at line 162 of file Waveform.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sub_sample()

std::pair< int, int > WireCell::Waveform::sub_sample ( const Domain domain,
int  nsamples,
const Domain subdomain 
)

Return the begin/end sample numbers inside the a subdomain of a domain with nsamples total.

Definition at line 15 of file Waveform.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sum()

template<typename Val >
Val WireCell::Waveform::sum ( const Sequence< Val > &  seq)

Return sum of all entries in sequence.

Definition at line 178 of file Waveform.h.

Here is the caller graph for this function:

◆ sum2()

template<typename Val >
Val WireCell::Waveform::sum2 ( const Sequence< Val > &  seq)

Return sum of square of all entries in sequence.

Definition at line 184 of file Waveform.h.

Here is the call graph for this function:
Here is the caller graph for this function: