Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

IsotopeWavelet.h (Maintainer: Rene Hussong)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2007 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Rene Hussong$
00025 // --------------------------------------------------------------------------
00026 
00027 #ifndef OPENMS_TRANSFORMATIONS_FEATUREFINDER_ISOTOPEWAVELET_H
00028 #define OPENMS_TRANSFORMATIONS_FEATUREFINDER_ISOTOPEWAVELET_H
00029 
00030 
00031 #ifndef NEUTRON_MASS
00032 #define NEUTRON_MASS 1.00866491578 
00033 #define HALF_NEUTRON_MASS 0.5043325
00034 #define QUARTER_NEUTRON_MASS 0.252166228
00035 #define WAVELET_PERIODICITY 6.229209734
00036 #endif
00037 
00038 #ifndef PROTON_MASS
00039 #define PROTON_MASS 1.00727646688
00040 #endif
00041 
00042 #ifndef LAMBDA_L_0
00043 //Linear Fit (standard)
00044 #define LAMBDA_L_0 -0.472998839574110749e-1
00045 #define LAMBDA_L_1 0.743579753540513913e-3
00046 #endif
00047 
00048 #ifndef LAMBDA_Q_0
00049 //Quadratic Fit (maybe a overkill, since the dependency looks quite linear, at least in moderate mass ranges)
00050 #define LAMBDA_Q_0 -0.137152573151174711
00051 #define LAMBDA_Q_1 0.851289601785403817e-3
00052 #define LAMBDA_Q_2 -0.2834469691e-7
00053 #endif
00054 
00055 #ifndef OPENMS_64BIT_ARCHITECTURE 
00056 #ifndef SHIFT_PARAMETERS
00057 //Internal parameters used for fast computation of the power function
00058 //Please do not modify
00059 #define SHIFT_PARAMETERS
00060 #define SHIFT23 (1<<23)
00061 #define SHIFT23_00 (1.0/(1<<23))
00062 #define LOG_CONST 0.346607f;
00063 #define POW_CONST 0.33971f;
00064 #endif
00065 #endif
00066 
00067 
00068 #include <OpenMS/KERNEL/DRawDataPoint.h>
00069 #include <OpenMS/KERNEL/MSSpectrum.h>
00070 #include <OpenMS/CHEMISTRY/IsotopeDistribution.h>
00071 #include<vector>
00072 
00073 
00074 namespace OpenMS
00075 {
00087   class IsotopeWavelet
00088   {
00089     public:
00090   
00092         static IsotopeWavelet* init (const DoubleReal max_m, const UInt max_charge) throw ();
00093         
00095         static IsotopeWavelet* getInstance () throw ()
00096         {
00097           return (me_);
00098         }
00099         
00101         virtual ~IsotopeWavelet () throw();
00102 
00112         static DoubleReal getValueByMass (const DoubleReal t, const DoubleReal m, const UInt z, const Int mode=+1) throw ()
00113         {     
00114           return (getValueByLambda (getLambdaQ(m*z-z*mode*PROTON_MASS), t*z+1));
00115         }
00116   
00125         static DoubleReal getValueByLambda (const DoubleReal lambda, const DoubleReal tz1) throw ();
00126 
00139         static DoubleReal getValueByLambdaExtrapol (const DoubleReal lambda, const DoubleReal tz1) throw ();
00140 
00142         static UInt getMaxCharge () throw ()
00143         { 
00144           return (max_charge_); 
00145         }     
00146       
00148         static void setMaxCharge (const UInt max_charge) throw ()
00149         { 
00150           max_charge_ = max_charge; 
00151         } 
00152     
00157         static DoubleReal getTableSteps () throw ()
00158         { 
00159           return (table_steps_); 
00160         }     
00161         
00163         static void setTableSteps (const DoubleReal table_steps) throw ()
00164         {
00165           inv_table_steps_ = 1./table_steps;
00166           table_steps_ = table_steps; 
00167         }
00168 
00169 
00172         static DoubleReal getLambdaL (const DoubleReal m) throw ();
00173 
00176         static DoubleReal getLambdaQ (const DoubleReal m) throw ();   
00177 
00178 
00183         static const IsotopeDistribution::ContainerType& getAveragine (const DoubleReal m, UInt* size=NULL) throw ();
00184 
00185 
00186     protected:
00187 
00189         static IsotopeWavelet* me_; 
00190 
00192         IsotopeWavelet () throw();        
00193 
00197         IsotopeWavelet (const DoubleReal max_m, const UInt max_charge) throw ();
00198         
00199 
00208         static void preComputeExpensiveFunctions_ (const DoubleReal max_m) throw ();
00209 
00210 
00213         static void computeIsotopeDistributionSize_ (const DoubleReal max_m) throw ();
00214 
00215 
00218         static float myPow_ (float a, float b) throw ();      
00219         
00220         #ifndef OPENMS_64BIT_ARCHITECTURE 
00221 
00225           static float myPow2_ (float i) throw ();
00226       
00231           static float myLog2_ (float i) throw ();
00232 
00234           union fi_
00235           {
00236             Int i;
00237             float f;
00238           };
00239         #endif
00240       
00242         static UInt max_charge_;        
00243 
00245         static DoubleReal table_steps_, inv_table_steps_;
00246 
00248         static std::vector<DoubleReal> gamma_table_;
00249         
00251         static std::vector<DoubleReal> exp_table_;
00252 
00254         static IsotopeDistribution averagine_;
00255   };
00256 
00257 } //namespace
00258 
00259 #endif 

Generated Tue Apr 1 15:36:35 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1