36 #ifndef OPENMS_FILTERING_CALIBRATION_TOFCALIBRATION_H
37 #define OPENMS_FILTERING_CALIBRATION_TOFCALIBRATION_H
48 #include <gsl/gsl_multifit.h>
49 #include <gsl/gsl_spline.h>
87 template <
typename PeakType>
96 template <
typename PeakType>
100 inline const std::vector<double> &
getML1s()
const {
return ml1s_; }
102 inline void setML1s(
const std::vector<double> & ml1s)
108 inline const std::vector<double> &
getML2s()
const {
return ml2s_; }
110 inline void setML2s(
const std::vector<double> & ml2s)
116 inline const std::vector<double> &
getML3s()
const {
return ml3s_; }
118 inline void setML3s(
const std::vector<double> & ml3s)
132 std::map<double, std::vector<double> >
errors_;
161 void getMonoisotopicPeaks_(
MSExperiment<> & calib_peaks, std::vector<std::vector<unsigned int> > & monoiso_peaks);
176 void matchMasses_(
MSExperiment<> & calib_peaks, std::vector<std::vector<unsigned int> > & monoiso_peaks, std::vector<unsigned int> & obs_masses, std::vector<double> & exp_masses,
unsigned int idx);
179 inline double mQ_(
double ft,
unsigned int spec)
181 return coeff_quad_fit_[3 * spec] + ft * coeff_quad_fit_[3 * spec + 1] + ft * ft * coeff_quad_fit_[3 * spec + 2];
187 return a_ + ft * b_ + ft * ft * c_;
191 void averageErrors_();
194 void averageCoefficients_();
197 template <
typename PeakType>
208 calibrate(p_calib_spectra, exp, exp_masses);
211 template <
typename PeakType>
217 for (
unsigned int spec = 0; spec < exp.
size(); ++spec)
219 for (
unsigned int peak = 0; peak < exp[spec].
size(); ++peak)
221 m =
mQAv_(exp[spec][peak].getMZ());
222 exp[spec][peak].setPos(m - gsl_spline_eval(
spline_, m,
acc_));
229 #endif // OPENMS_FILTERING_CALIBRATION_TOFCALIBRATION_H
void setML3s(const std::vector< double > &ml3s)
mutable access to the third calibration constant
Definition: TOFCalibration.h:118
This class implements an external calibration for TOF data using external calibrant spectra...
Definition: TOFCalibration.h:68
gsl_interp_accel * acc_
Definition: TOFCalibration.h:152
std::vector< double > coeff_quad_fit_
all coefficients of the quadratic fit
Definition: TOFCalibration.h:146
const std::vector< double > & getML2s() const
Non-mutable access to the second calibration constant.
Definition: TOFCalibration.h:108
Size size() const
Definition: MSExperiment.h:117
gsl_spline * spline_
Definition: TOFCalibration.h:154
Param param_
Container for current parameters.
Definition: DefaultParamHandler.h:148
std::vector< double > error_medians_
median errors
Definition: TOFCalibration.h:135
This class implements a peak picking algorithm using wavelet techniques.
Definition: PeakPickerCWT.h:77
std::vector< double > ml3s_
Definition: TOFCalibration.h:143
std::vector< double > ml2s_
Definition: TOFCalibration.h:142
void setML1s(const std::vector< double > &ml1s)
mutable access to the first calibration constant
Definition: TOFCalibration.h:102
void setParameters(const Param ¶m)
Sets the parameters.
std::vector< double > exp_masses_
the expected calibrant masses
Definition: TOFCalibration.h:129
std::vector< double > ml1s_
calibration constants from the instrument needed for the conversion of the calibrant spectra ...
Definition: TOFCalibration.h:141
Param copy(const String &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
double c_
Definition: TOFCalibration.h:149
const std::vector< double > & getML3s() const
Non-mutable access to the third calibration constant.
Definition: TOFCalibration.h:116
const std::vector< double > & getML1s() const
Non-mutable access to the first calibration constant.
Definition: TOFCalibration.h:100
void pickExperiment(const MSExperiment<> &input, MSExperiment<> &output)
Picks the peaks in an MSExperiment.
MSExperiment calib_peaks_ft_
the calibrant spectra still using flight times instead of m/z-values
Definition: TOFCalibration.h:125
void pickAndCalibrate(MSExperiment< Peak1D > &calib_spectra, MSExperiment< PeakType > &exp, std::vector< double > &exp_masses)
Definition: TOFCalibration.h:198
void calculateCalibCoeffs_(MSExperiment<> &calib_peaks_ft)
Calculates the coefficients of the quadratic fit used for external calibration.
std::map< double, std::vector< double > > errors_
error in ppm after quadratic fit
Definition: TOFCalibration.h:132
double mQ_(double ft, unsigned int spec)
Calculate the mass value for a given flight time using the coefficients of the quadratic fit in a spe...
Definition: TOFCalibration.h:179
std::vector< double > calib_masses_
Definition: TOFCalibration.h:138
Base class for all classes that want to report their progess.
Definition: ProgressLogger.h:56
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:90
void calibrate(MSExperiment< Peak1D > &calib_spectra, MSExperiment< PeakType > &exp, std::vector< double > &exp_masses)
Definition: TOFCalibration.h:212
double mQAv_(double ft)
Calculate the mass value for a given flight time using the averaged coefficients of the quadratic fit...
Definition: TOFCalibration.h:185
void setML2s(const std::vector< double > &ml2s)
mutable access to the second calibration constant
Definition: TOFCalibration.h:110