35 #ifndef OPENMS_FILTERING_TRANSFORMERS_NEUTRALLOSSMARKER_H 
   36 #define OPENMS_FILTERING_TRANSFORMERS_NEUTRALLOSSMARKER_H 
   81     template <
typename SpectrumType>
 
   82     void apply(std::map<double, bool> & marked, SpectrumType & spectrum)
 
   85       double marks = (
double)param_.getValue(
"marks");
 
   86       double tolerance = (
double)param_.getValue(
"tolerance");
 
   87       std::map<double, SignedSize> ions_w_neutrallosses;
 
   88       spectrum.sortByPosition();
 
   89       for (
Size i = 0; i < spectrum.size(); ++i)
 
   91         double mz = spectrum[i].getPosition()[0];
 
   92         double intensity = spectrum[i].getIntensity();
 
   96           double curmz = spectrum[j].getPosition()[0];
 
   97           double curIntensity = spectrum[j].getIntensity();
 
  100           if (std::fabs(mz - curmz - 17) < tolerance || std::fabs(mz - curmz - 18) < tolerance)
 
  103             if (curIntensity < intensity)
 
  105               ions_w_neutrallosses[mz]++;
 
  112             if (mz - curmz > 18.3)
 
  121       for (std::map<double, SignedSize>::const_iterator cmit = ions_w_neutrallosses.begin(); cmit != ions_w_neutrallosses.end(); ++cmit)
 
  123         if (cmit->second >= marks)
 
  125           marked.insert(std::pair<double, bool>(cmit->first, 
true));
 
  134       return "NeutralLossMarker";
 
  142 #endif //OPENMS_FILTERING_TRANSFORMERS_NEUTRALLOSSMARKER_H 
A more convenient string class. 
Definition: String.h:56
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference. 
Definition: Types.h:151
static const String getProductName()
Definition: NeutralLossMarker.h:132
PeakMarker marks peaks that seem to fulfill some criterion. 
Definition: PeakMarker.h:48
void apply(std::map< double, bool > &marked, SpectrumType &spectrum)
Definition: NeutralLossMarker.h:82
static PeakMarker * create()
Definition: NeutralLossMarker.h:78
size_t Size
Size type e.g. used as variable which can hold result of size() 
Definition: Types.h:144
NeutralLossMarker marks peak pairs which could represent an ion an its neutral loss (water...
Definition: NeutralLossMarker.h:52