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

ProfileBin2D.cpp

Go to the documentation of this file.
00001 #include "ProfileBin2D.h"
00002 
00003 Anaphe::AIDA_Histogram_native::ProfileBin2D::ProfileBin2D():
00004   Anaphe::AIDA_Histogram_native::ProfileBin1D(),
00005   m_sumOfWeightTimesCoordinate( 0 )
00006 {}
00007 
00008 
00009 bool
00010 Anaphe::AIDA_Histogram_native::ProfileBin2D::reset()
00011 {
00012   m_sumOfWeightTimesCoordinate = 0;
00013   return Anaphe::AIDA_Histogram_native::ProfileBin1D::reset();
00014 }
00015 
00016 
00017 bool
00018 Anaphe::AIDA_Histogram_native::ProfileBin2D::scale( double factor )
00019 {
00020   m_sumOfWeightTimesCoordinate *= factor;
00021   return Anaphe::AIDA_Histogram_native::ProfileBin1D::scale( factor );
00022 }
00023 
00024 
00025 bool
00026 Anaphe::AIDA_Histogram_native::ProfileBin2D::increment( const Anaphe::AIDA_Histogram_native::ProfileBin2D& otherBin )
00027 {
00028   m_sumOfWeightTimesCoordinate += otherBin.m_sumOfWeightTimesCoordinate;
00029   return Anaphe::AIDA_Histogram_native::ProfileBin1D::increment( static_cast< const Anaphe::AIDA_Histogram_native::ProfileBin1D& >( otherBin ) );
00030 }
00031 
00032 
00033 bool
00034 Anaphe::AIDA_Histogram_native::ProfileBin2D::increment( int extraEntries,
00035                                                         double extraHeight,
00036                                                         double extraError,
00037                                                         double extraSpread,
00038                                                         double extraCentreX,
00039                                                         double extraCentreY )
00040 {
00041   Anaphe::AIDA_Histogram_native::ProfileBin2D temporaryBin;
00042   temporaryBin.set( extraEntries, extraHeight, extraError, extraSpread, extraCentreX, extraCentreY );
00043   return this->increment( temporaryBin );
00044 }
00045 
00046 
00047 bool
00048 Anaphe::AIDA_Histogram_native::ProfileBin2D::set( int entriesNew,
00049                                                   double heightNew,
00050                                                   double errorNew,
00051                                                   double spreadNew,
00052                                                   double centreXNew,
00053                                                   double centreYNew )
00054 {
00055   m_sumOfWeightTimesCoordinate = centreYNew * heightNew;
00056   return Anaphe::AIDA_Histogram_native::ProfileBin1D::set( entriesNew, heightNew, errorNew, spreadNew, centreXNew );
00057 }
00058 
00059 
00060 double
00061 Anaphe::AIDA_Histogram_native::ProfileBin2D::centreOfGravityY() const
00062 {
00063   const double theHeight = sumOfWeights();
00064   if ( theHeight == 0 ) {
00065     return 0;
00066   }
00067   else {
00068     return ( m_sumOfWeightTimesCoordinate / theHeight );
00069   }
00070 }

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