20 using namespace kome::objects;
25 #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
26 #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
32 : m_left( -1.0, -1.0 ), m_right( -1.0, -1.0 ), m_apex( -1.0, -1.0 )
49 : m_left( -1.0, -1.0 ), m_right( -1.0, -1.0 ), m_apex( -1.0, -1.0 )
68 : m_x( x ), m_y( y ), m_left( x, 0.0 ), m_right( x, 0.0 ), m_apex( x, y )
213 for(
int i = idx0; i <= idx1; i++ ) {
214 const double x = xyData.
getX( i );
215 const double y = xyData.
getY( i );
217 if( y > apexY || apexX < 0.0 ) {
251 return (
m_area > -1000.0 );
265 const double w = rx - lx;
266 if( w < 0.0000001 ) {
270 const double a = ( ry - ly ) / w;
276 for(
int i = idx0; i < idx1 - 1; i++ ) {
278 const double x0 = xyData.
getX( i );
279 const double x1 = xyData.
getX( i + 1 );
280 const double y0 = xyData.
getY( i ) - ( a * ( x0 - lx ) + ly );
281 const double y1 = xyData.
getY( i + 1 ) - ( a * ( x1 - lx ) + ly );
283 if( y0 >= 0.0 && y1 >= 0.0 ) {
284 s += ( y0 + y1 ) * ( x1 - x0 ) / 2.0;
287 else if( y0 > 0.0 ) {
288 s += - y0 * y0 * ( x1 - x0 ) / ( y1 - y0 ) / 2.0;
290 else if( y1 > 0.0 ) {
291 s += y1 * y1 * ( x1 - x0 ) / ( y1 - y0 ) / 2.0;
317 return (
m_fwhm > -1000.0 );
335 const double height = ay / 2.0;
338 if( idx < 0 || ax >= (
double)xyData.
getLength() ) {
346 for(
int i = idx - 1; i >= 0 && lx < 0.0; i-- ) {
347 const double x = xyData.
getX( i );
348 const double y = xyData.
getY( i );
350 if( prevY >= height && y <= height ) {
351 if( fabs( y - prevY ) < 0.00001 ) {
355 lx = ( prevX * ( y - height ) + x * ( height - prevY ) ) / ( y - prevY );
374 for(
int i = idx + 1; i < (int)xyData.
getLength() && rx < 0.0; i++ ) {
375 const double x = xyData.
getX( i );
376 const double y = xyData.
getY( i );
378 if( prevY >= height && y <= height ) {
379 if( fabs( y - prevY ) < 0.00001 ) {
383 rx = ( prevX * ( y - height ) + x * ( height - prevY ) ) / ( y - prevY );
398 fwhm = fabs( rx - lx );
double calcFwhm(kome::core::XYData &xyData)
calculates FWHM
abstraction class of two dimention coordinate data
double getArea()
gets peak area
int issueId(PeakElement *peakElement)
to issue the peak id
void setX(const double x)
sets x element value
bool hasFwhm()
judges whether this peak has FWHM value of not
double getX(const unsigned int index)
gets x coordinate
void setRight(const double x, const double y)
sets peak right
void searchApex(kome::core::XYData &xyData)
searches apex
void calcArea()
calculates area
virtual ~PeakElement()
destructor
double calcArea(kome::core::XYData &xyData)
calculates area
kome::core::Point< double > m_left
void setArea(const double area)
sets area
double getRightX()
gets x element of peak right
double getY(const unsigned int index)
gets y coordinate
double getRightY()
gets y elemtn of peak right
void setFwhm(const double fwhm)
sets the FWHM
interfaces of Peaks class
void setCharge(const int charge)
sets the charge state
interfaces of PeakElement class
double getLeftX()
gets x element of peak left
double getApexX()
gets x element of peak apex
double getY()
gets y element value
kome::core::Point< double > m_apex
double getApexY()
gets y element of peak apex
bool hasApex()
judges whether this peak has apex information or not.
void setId(int id)
sets peak ID
void setApex(const double x, const double y)
sets peak apex
void setLeft(const double x, const double y)
sets peak left
double getX()
gets x element value
bool hasArea()
judges whether this peak has area value or not
double getFwhm()
gets the FWHM
kome::core::Point< double > m_right
void setY(const double y)
sets y element value
int getNearestIndex(const double x)
gets nearest index
int getCharge()
gets the charge state
int searchIndex(const double x)
searches index of specified x value.
unsigned int getLength()
gets the number of points @return the number of points
double getLeftY()
gets y element of peak left