36 #ifndef OPENMS_FILTERING_CALIBRATION_TOFCALIBRATION_H 37 #define OPENMS_FILTERING_CALIBRATION_TOFCALIBRATION_H 86 template <
typename PeakType>
95 template <
typename PeakType>
99 inline const std::vector<double> &
getML1s()
const {
return ml1s_; }
101 inline void setML1s(
const std::vector<double> & ml1s)
107 inline const std::vector<double> &
getML2s()
const {
return ml2s_; }
109 inline void setML2s(
const std::vector<double> & ml2s)
115 inline const std::vector<double> &
getML3s()
const {
return ml3s_; }
117 inline void setML3s(
const std::vector<double> & ml3s)
131 std::map<double, std::vector<double> >
errors_;
156 void getMonoisotopicPeaks_(
MSExperiment<> & calib_peaks, std::vector<std::vector<unsigned int> > & monoiso_peaks);
171 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);
174 inline double mQ_(
double ft,
unsigned int spec)
176 return coeff_quad_fit_[3 * spec] + ft * coeff_quad_fit_[3 * spec + 1] + ft * ft * coeff_quad_fit_[3 * spec + 2];
182 return a_ + ft * b_ + ft * ft * c_;
186 void averageErrors_();
189 void averageCoefficients_();
192 template <
typename PeakType>
203 calibrate(p_calib_spectra, exp, exp_masses);
206 template <
typename PeakType>
209 exp_masses_ = exp_masses;
210 calculateCalibCoeffs_(calib_spectra);
214 #ifdef DEBUG_CALIBRATION 215 std::cout <<
"fehler nach spline fitting" << std::endl;
217 for (
unsigned int spec = 0; spec < calib_peaks_ft_.size(); ++spec)
220 std::vector<double> exp_masses;
221 std::vector<unsigned int> monoiso;
222 matchMasses_(calib_spectra, monoiso_peaks, monoiso, exp_masses, spec);
223 for (
unsigned int p = 0; p < monoiso.size(); ++p)
225 double xi = mQ_(calib_peaks_ft_[spec][monoiso[p]].getMZ(), spec);
226 if (xi > calib_masses[error_medians_.size() - 1])
228 if (xi < calib_masses[0])
230 std::cout << exp_masses[p] <<
"\t" 231 << (xi - exp_masses[p] - spline(xi)) / exp_masses[p] * 1e6
240 std::cout <<
"interpolation \n\n";
241 for (xi = calib_masses[0]; xi < calib_masses[error_medians_.size() - 1]; xi += 0.01)
244 std::cout << xi <<
"\t" << yi << std::endl;
246 std::cout <<
"--------------\nend interpolation \n\n";
253 for (
unsigned int spec = 0; spec < exp.
size(); ++spec)
255 for (
unsigned int peak = 0; peak < exp[spec].
size(); ++peak)
257 m = mQAv_(exp[spec][peak].getMZ());
258 exp[spec][peak].setPos(m - spline.
eval(m));
265 #endif // OPENMS_FILTERING_CALIBRATION_TOFCALIBRATION_H void setML3s(const std::vector< double > &ml3s)
mutable access to the third calibration constant
Definition: TOFCalibration.h:117
This class implements an external calibration for TOF data using external calibrant spectra...
Definition: TOFCalibration.h:67
std::vector< double > coeff_quad_fit_
all coefficients of the quadratic fit
Definition: TOFCalibration.h:145
Wrapper for Spline interpolation.
Definition: Spline2d.h:52
const std::vector< double > & getML2s() const
Non-mutable access to the second calibration constant.
Definition: TOFCalibration.h:107
Size size() const
Definition: MSExperiment.h:117
std::vector< double > error_medians_
median errors
Definition: TOFCalibration.h:134
This class implements a peak picking algorithm using wavelet techniques.
Definition: PeakPickerCWT.h:78
std::vector< double > ml3s_
Definition: TOFCalibration.h:142
std::vector< double > ml2s_
Definition: TOFCalibration.h:141
void setML1s(const std::vector< double > &ml1s)
mutable access to the first calibration constant
Definition: TOFCalibration.h:101
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
void setParameters(const Param ¶m)
Sets the parameters.
std::vector< double > exp_masses_
the expected calibrant masses
Definition: TOFCalibration.h:128
std::vector< double > ml1s_
calibration constants from the instrument needed for the conversion of the calibrant spectra ...
Definition: TOFCalibration.h:140
ValType eval(ValType x) const
Definition: Spline2d.h:103
double c_
Definition: TOFCalibration.h:148
const std::vector< double > & getML3s() const
Non-mutable access to the third calibration constant.
Definition: TOFCalibration.h:115
const std::vector< double > & getML1s() const
Non-mutable access to the first calibration constant.
Definition: TOFCalibration.h:99
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:124
void pickAndCalibrate(MSExperiment< Peak1D > &calib_spectra, MSExperiment< PeakType > &exp, std::vector< double > &exp_masses)
Definition: TOFCalibration.h:193
std::map< double, std::vector< double > > errors_
error in ppm after quadratic fit
Definition: TOFCalibration.h:131
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:174
std::vector< double > calib_masses_
Definition: TOFCalibration.h:137
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
void calibrate(MSExperiment< Peak1D > &calib_spectra, MSExperiment< PeakType > &exp, std::vector< double > &exp_masses)
Definition: TOFCalibration.h:207
double mQAv_(double ft)
Calculate the mass value for a given flight time using the averaged coefficients of the quadratic fit...
Definition: TOFCalibration.h:180
void setML2s(const std::vector< double > &ml2s)
mutable access to the second calibration constant
Definition: TOFCalibration.h:109