00001 #ifndef SCANPOINTS_H
00002 #define SCANPOINTS_H
00003
00004 #include <vector>
00005 #include <string>
00006 #include "Sct/Streamable.h"
00007 #include "Sct/Exception.h"
00008 #include "Sct/RangedVector.h"
00009
00010 using Sct::Streamable;
00011 using Sct::LogicError;
00012 using std::vector;
00013 using std::string;
00014
00015 class TAxis;
00016
00017 namespace SctData {
00018
00025 class ScanPoints : public virtual Streamable{
00026 public:
00034 ScanPoints(const unsigned nPoints,
00035 const float* points,
00036 const unsigned* nEvents,
00037 const unsigned* nErrorEvents) throw() ;
00038
00040 ScanPoints() throw() ;
00041
00043 virtual ~ScanPoints() throw() {}
00044
00046 unsigned getNPoints() const throw();
00047
00049 double getPoint(const unsigned i) const throw(LogicError);
00050
00052 double operator[] (const unsigned i) const throw(LogicError);
00053
00055 double& operator[] (const unsigned i) throw(LogicError);
00056
00058 unsigned getNEvents(const unsigned i) const throw(LogicError);
00059
00061 unsigned getNErrorEvents(const unsigned i) const throw(LogicError);
00062
00064 void addPoint(const double point, const unsigned nEvents, const unsigned nErrorEvents) throw() ;
00065
00071 double* getEdgesAscending() const throw(LogicError) ;
00072
00074 double getMin() const;
00076 double getMax() const;
00077
00081 bool ascending() const;
00082
00086 void setAxis(TAxis& axis) const throw(LogicError);
00087
00089 virtual string getClassName() const throw();
00090
00091 private:
00093 class ScanPoint{
00094 public:
00095 ScanPoint(const double point, const unsigned nEv, const unsigned nErr) throw() :
00096 point(point), nEvents(nEv), nErrorEvents(nErr) {}
00098 ~ScanPoint() throw() {}
00100 operator double&() throw() {return point;}
00102 operator const double() const throw() {return point;}
00103 double point;
00104 unsigned nEvents;
00105 unsigned nErrorEvents;
00106 };
00107
00108 Sct::RangedVector<ScanPoint> points;
00109 };
00110 }
00111 #endif //#ifndef SCANPOINTS_H