35 #ifndef OPENMS_FILTERING_TRANSFORMERS_COMPLEMENTFILTER_H 36 #define OPENMS_FILTERING_TRANSFORMERS_COMPLEMENTFILTER_H 80 template <
typename SpectrumType>
83 if (spectrum.size() < 2)
87 double tolerance = (
double)param_.getValue(
"tolerance");
88 double parentmass = 0.0;
95 Size j = spectrum.size() - 1;
96 for (
Size i = 0; i < spectrum.size() && i <= j; )
98 double sum = spectrum[i].getPosition()[0] + spectrum[j].getPosition()[0];
100 if (std::fabs(sum - parentmass) < tolerance)
102 result += spectrum[i].getIntensity() + spectrum[j].getIntensity();
105 if (sum < parentmass)
111 if (sum > parentmass)
124 return "ComplementFilter";
131 #endif // OPENMS_FILTERING_TRANSFORMERS_COMPLEMENTFILTER_H 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:122
void sortByPosition()
Lexicographically sorts the peaks by their position.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
double apply(SpectrumType &spectrum)
returns the total intensity of peak pairs which could result from complementing fragments ...
Definition: ComplementFilter.h:81
A FilterFunctor extracts some spectrum characteristics for quality assessment.
Definition: FilterFunctor.h:45
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:52
static FilterFunctor * create()
Definition: ComplementFilter.h:77
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
static const String getProductName()
returns the name for registration at the factory
Definition: ComplementFilter.h:122