Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DataCorr.h

Go to the documentation of this file.
00001 #ifndef ANP_DATACORR_H
00002 #define ANP_DATACORR_H
00003 
00004 // $Id: DataCorr.h,v 1.2 2007/12/14 02:40:27 rustem Exp $
00005 //
00006 // Compute linear correlation coefficients
00007 //
00008 
00009 // C++
00010 #include <map>
00011 
00012 // Local
00013 #include "PhysicsNtuple/DataItem.h"
00014 #include "PhysicsNtuple/KeyPair.h"
00015 
00016 namespace Anp
00017 {
00018    namespace Corr
00019    {
00020       struct Data
00021       {
00022          Data() : sum_x(0.0), sum_y(0.0), sum_xx(0.0), sum_xy(0.0), sum_yy(0.0) {}
00023          double sum_x;
00024          double sum_y;
00025          double sum_xx;
00026          double sum_xy;
00027          double sum_yy;
00028       };
00029 
00030       typedef KeyPair<short> Key;
00031       typedef std::map<Key, Data> DataMap;
00032       typedef std::map<Key, double> CorrMap;
00033    }
00034    
00035    class DataCorr
00036    {
00037    public:
00038       
00039       DataCorr();
00040       ~DataCorr();
00041 
00042       unsigned int Fill(DataIter ibeg, DataIter iend);
00043 
00044       unsigned int Size() const;
00045 
00046       const Corr::CorrMap GetCorrCoef() const;
00047 
00048       void Reset();
00049 
00050    private:
00051       
00052       unsigned int fSampleSize;
00053 
00054       Corr::DataMap fData;
00055    };
00056 
00057    //
00058    // Inlined member functions
00059    //
00060    
00061    inline unsigned int DataCorr::Size() const { return fSampleSize; }
00062 }
00063 
00064 #endif

Generated on Mon Feb 15 11:06:33 2010 for loon by  doxygen 1.3.9.1