search the mass database for explanations @param net_charge net charge of compomer @param mass_to_explain mass in Da that needs explanation @param mass_delta allowed deviation from exact mass @param thresh_log_p minimal log probability required @param firstExplanation begin range with candidates according to net_charge and mass @param lastExplanation end range
| 303 | /// @param firstExplanation begin range with candidates according to net_charge and mass |
| 304 | /// @param lastExplanation end range |
| 305 | SignedSize MassExplainer::query(const Int net_charge, |
| 306 | const float mass_to_explain, |
| 307 | const float mass_delta, |
| 308 | const float thresh_log_p, |
| 309 | std::vector<Compomer>::const_iterator& firstExplanation, |
| 310 | std::vector<Compomer>::const_iterator& lastExplanation) const |
| 311 | { |
| 312 | #ifdef DEBUG_FD |
| 313 | if (fabs(mass_to_explain) < 120.0) |
| 314 | { |
| 315 | std::cout << "query: qnet=" << net_charge << "; explain_mass=" << mass_to_explain << "; delta=+-" << mass_delta << "\n"; |
| 316 | } |
| 317 | #endif |
| 318 | |
| 319 | Compomer cmp_low(net_charge, static_cast<double>(mass_to_explain) - fabs(mass_delta), 1); |
| 320 | firstExplanation = lower_bound(explanations_.begin(), explanations_.end(), cmp_low); |
| 321 | |
| 322 | Compomer cmp_high(net_charge, static_cast<double>(mass_to_explain) + fabs(mass_delta), static_cast<double>(thresh_log_p)); |
| 323 | lastExplanation = lower_bound(explanations_.begin(), explanations_.end(), cmp_high); |
| 324 | |
| 325 | return std::distance(firstExplanation, lastExplanation); |
| 326 | } |
| 327 | |
| 328 | ///check if the generated compomer is valid judged by its probability, charges etc |
| 329 | bool MassExplainer::compomerValid_(const Compomer& cmp) const |
no test coverage detected