79 template <
typename SpectrumType>
82 if (spectrum.size() < 2)
86 double tolerance = (
double)param_.getValue(
"tolerance");
87 double parentmass = 0.0;
94 Size j = spectrum.size() - 1;
95 for (
Size i = 0; i < spectrum.size() && i <= j; )
97 double sum = spectrum[i].getPosition()[0] + spectrum[j].getPosition()[0];
99 if (std::fabs(
sum - parentmass) < tolerance)
101 result += spectrum[i].getIntensity() + spectrum[j].getIntensity();
104 if (
sum < parentmass)
110 if (
sum > parentmass)
123 return "ComplementFilter";
A more convenient string class.
Definition: String.h:57
static double sum(IteratorType begin, IteratorType end)
Calculates the sum of a range of values.
Definition: StatisticFunctions.h:121
void sortByPosition()
Lexicographically sorts the peaks by their position.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
double apply(SpectrumType &spectrum)
returns the total intensity of peak pairs which could result from complementing fragments ...
Definition: ComplementFilter.h:80
A FilterFunctor extracts some spectrum characteristics for quality assessment.
Definition: FilterFunctor.h:44
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
total intensity of peak pairs that could result from complementing fragments of charge state 1 ...
Definition: ComplementFilter.h:51
static FilterFunctor * create()
Definition: ComplementFilter.h:76
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
static const String getProductName()
returns the name for registration at the factory
Definition: ComplementFilter.h:121