Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

VariableBinAxis.cpp

Go to the documentation of this file.
00001 #include "VariableBinAxis.h"
00002 #include "AIDA/IConstants.h"
00003 
00004 #ifdef NONUMERICLIMITS
00005 static const double positive_infinity = 1.7976931348623157e+308;
00006 static const double negative_infinity = -1.7976931348623157e+308;
00007 #else
00008 #include <limits>
00009 static const double positive_infinity = std::numeric_limits<double>::max();
00010 static const double negative_infinity = -positive_infinity;
00011 #endif
00012 
00013 Anaphe::AIDA_Histogram_native::VariableBinAxis::VariableBinAxis( const std::vector< double> & edges ):
00014   m_binEdges( edges )
00015 {
00016   double currentEdge = m_binEdges[ 0 ];
00017   m_binUpperEdges.insert( std::make_pair( currentEdge, static_cast< int >( AIDA::IAxis::UNDERFLOW_BIN ) ) );
00018   for ( unsigned int i = 1; i < m_binEdges.size(); ++i ) {
00019     m_binUpperEdges.insert( std::make_pair( m_binEdges[ i ], static_cast< int >( i - 1 ) ) );
00020   }
00021   m_binUpperEdges.insert( std::make_pair( positive_infinity, static_cast< int >( AIDA::IAxis::OVERFLOW_BIN ) ) );
00022 }
00023 
00024 double
00025 Anaphe::AIDA_Histogram_native::VariableBinAxis::binLowerEdge( int index ) const
00026 {
00027   if ( index >= 0 ) {
00028     return m_binEdges[ index ];
00029   }
00030   else if ( index == static_cast< int >( AIDA::IAxis::UNDERFLOW_BIN ) ) return negative_infinity;
00031   else return m_binEdges.back();
00032 }
00033 
00034 double
00035 Anaphe::AIDA_Histogram_native::VariableBinAxis::binUpperEdge( int index ) const
00036 {
00037   if ( index >= 0 ) {
00038     return m_binEdges[ index + 1];
00039   }
00040   else if ( index == static_cast< int >( AIDA::IAxis::UNDERFLOW_BIN ) ) return m_binEdges.front();
00041   else return positive_infinity;
00042 }
00043 
00044 double
00045 Anaphe::AIDA_Histogram_native::VariableBinAxis::binWidth( int index ) const
00046 {
00047   if ( index >= 0 ) {
00048     return m_binEdges[ index + 1 ] - m_binEdges[ index ];
00049   }
00050   else {
00051     return positive_infinity;
00052   };
00053 }

Generated on Tue Nov 19 12:32:17 2002 for AIDA_Histogram_native by doxygen1.2.16