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

SpectObj.h

00001 #include <iterator>
00002 #include <map>
00003 #include <vector>
00004 #include <math.h>
00005 #ifndef SpectObj_H
00006 #define SpectObj_H
00007 
00020 class SpectObj
00021 {
00022  public:
00023   SpectObj(){;}
00024 
00032   SpectObj(double enmin, double enmax ,double enstep);
00033   
00034   
00039   SpectObj(std::map<double,double>::const_iterator start,
00040            std::map<double,double>::const_iterator end);
00041 
00042   ~SpectObj(){;}
00043   
00051   double integrated_E_Flux(double enmin, double enmax);
00052   
00060   double integrated_Flux(double enmin, double enmax);
00061   
00066   double binSize(std::map<double,double>::const_iterator it);
00067   
00070   inline double size()  { return m_spectrum.size(); }
00073   inline void   clear() { m_spectrum.clear();       }
00074    
00079   inline double getBinContent(double index) 
00080     {
00081       std::map<double,double>::const_iterator it = m_spectrum.begin();
00082       std::advance(it,index);
00083       return it->second;
00084     }
00085   
00090   inline double getBinValue(double index) 
00091     {
00092       std::map<double,double>::const_iterator it = m_spectrum.begin();
00093       std::advance(it,index);
00094       return it->first;
00095     }
00096   
00099   SpectObj operator+(const SpectObj inputObj);
00100   
00101   inline SpectObj operator+=(const SpectObj inputObj)
00102   {
00103     return (*this)+inputObj;
00104   }
00105 
00107   SpectObj operator*(const double value);
00108 
00109   inline SpectObj operator*=(const double value)
00110   {
00111     return (*this)*value;
00112   }
00114   SpectObj operator/(const double value);
00115   
00116   inline SpectObj operator/=(const double value)
00117   {
00118     return (*this)/value;
00119   }
00121 
00125   std::vector<double> getEnergyVector(const double value = 1.);
00126   
00130   std::vector<double> getBinVector(const double value = 1.);
00134   std::vector<double> getSpectrumVector(const double value = 1.);
00135   
00140   SpectObj extractSub(std::map<double,double>::const_iterator start,
00141                       std::map<double,double>::const_iterator end);
00142   
00147   SpectObj SetSpectrum(double energy, double spectrum);
00148   
00153   SpectObj SetSpectrum(std::vector<double> energy, std::vector<double> spectrum);
00154   
00155   
00156  private:
00158   std::map<double,double> m_spectrum;
00159   
00160 };
00161 #endif

Generated on Mon Jan 27 11:43:33 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001