54 template <
typename SpectrumType>
58 double marks = (double)param_.getValue(
"marks");
59 double tolerance = (double)param_.getValue(
"tolerance");
60 std::map<double, SignedSize> ions_w_neutrallosses;
62 for (
Size i = 0; i < spectrum.size(); ++i)
64 double mz = spectrum[i].getPosition()[0];
65 double intensity = spectrum[i].getIntensity();
69 double curmz = spectrum[j].getPosition()[0];
70 double curIntensity = spectrum[j].getIntensity();
73 if (std::fabs(mz - curmz - 17) < tolerance || std::fabs(mz - curmz - 18) < tolerance)
76 if (curIntensity < intensity)
78 ions_w_neutrallosses[mz]++;
85 if (mz - curmz > 18.3)
94 for (std::map<double, SignedSize>::const_iterator cmit = ions_w_neutrallosses.begin(); cmit != ions_w_neutrallosses.end(); ++cmit)
96 if (cmit->second >= marks)
98 marked.insert(std::pair<double, bool>(cmit->first,
true));
107 return "NeutralLossMarker";
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
void sortByPosition()
Lexicographically sorts the peaks by their position.
NeutralLossMarker marks peak pairs which could represent an ion an its neutral loss (water,...
Definition: NeutralLossMarker.h:27
NeutralLossMarker(const NeutralLossMarker &source)
copy constructor
NeutralLossMarker()
default constructor
NeutralLossMarker & operator=(const NeutralLossMarker &source)
assignment operator
static PeakMarker * create()
Definition: NeutralLossMarker.h:51
void apply(std::map< double, bool > &marked, SpectrumType &spectrum)
Definition: NeutralLossMarker.h:55
~NeutralLossMarker() override
destructor
static const String getProductName()
Definition: NeutralLossMarker.h:105
PeakMarker marks peaks that seem to fulfill some criterion.
Definition: PeakMarker.h:23
A more convenient string class.
Definition: String.h:34
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:108
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22