00001
00002
00003
00004
00005
00006
00007 #ifndef INCLUDED_AIDADYNHIST1D_H
00008 #define INCLUDED_AIDADYNHIST1D_H 1
00009
00010
00011
00012 #include "Interfaces/IHistogram1D.h"
00013 #include <string>
00014 #include <vector>
00015 #if defined __sun && __SUNPRO_CC > 0x0500
00016 #include <utility>
00017 #else
00018 #include <pair.h>
00019 #endif
00020
00021
00022
00023
00024 #ifdef AIDA_STD
00025 #undef AIDA_STD
00026 #endif
00027 #ifdef AIDA_NOT_USE_STD
00028 #define AIDA_STD
00029 #else
00030 #define AIDA_STD std
00031 #endif
00032
00033
00034
00035
00036 namespace Anaphe {
00037
00038 class CHBookHisto;
00039 class IHistogramFactory;
00040 class IAnnotation;
00041 class IAnnotationFactory;
00042
00043 namespace AIDA_HBook {
00044
00045 class AIDAAxis;
00046
00047
00048 class AIDADynHist1D : virtual public IHistogram1D
00049 {
00050 public:
00051
00052 AIDADynHist1D(const char* name = "", const int& nBinsX = 100,
00053 IAnnotation* ann = 0, IHistogramFactory *f = 0);
00054 virtual ~AIDADynHist1D(void);
00055
00056 public:
00057 virtual AIDA_STD::string title(void) const;
00058 virtual void setTitle(const AIDA_STD::string& newTitle);
00059 IAnnotation* annotation(void);
00060 virtual int dimensions(void) const;
00061 virtual int entries(void) const;
00062 virtual int allEntries(void) const;
00063 virtual int extraEntries(void) const;
00064 virtual double equivalentBinEntries(void) const;
00065 virtual double sumBinHeights(void) const;
00066 virtual double sumAllBinHeights(void) const;
00067 virtual double sumExtraBinHeights(void) const;
00068 virtual int binEntries(int index) const;
00069 virtual double binHeight(int index) const;
00070 virtual double binError(int index) const;
00071 virtual double mean(void) const;
00072 virtual double rms(void) const;
00073 virtual double minBinHeight(void) const;
00074 virtual int minBin(void) const;
00075 virtual double maxBinHeight(void) const;
00076 virtual int maxBin(void) const;
00077 virtual IAxis* xAxis(void) const;
00078 virtual int coordToIndex(double coord) const;
00079 virtual void reset(void);
00080 virtual void fill(double x, double weight = 1.0);
00081
00082 virtual AIDA_STD::ostream& print(AIDA_STD::ostream& s) const;
00083 virtual AIDA_STD::ostream& write(AIDA_STD::ostream& s) const;
00084 virtual int write(const char* filename) const;
00085 virtual const CHBookHisto* representation(void) const;
00086 virtual int cacheSize(void) const;
00087 virtual bool setCacheSize(int);
00088
00089 private:
00090 virtual int checkIndex(int index) const;
00091 bool sync(void) const;
00092 void freeze(void) const;
00093 AIDA_STD::pair<double,double> chooseLimits(void) const;
00094 void notYetMessage(const AIDA_STD::string&) const;
00095 void frozenMessage(void) const;
00096 int myID(void) const;
00097 int getIntFromString(const AIDA_STD::string& str) const;
00098
00099 private:
00100 typedef AIDA_STD::vector<double> UwCache;
00101 typedef AIDA_STD::vector<AIDA_STD::pair<double,double> > WCache;
00102 typedef UwCache::const_iterator UwcIt;
00103 typedef WCache::const_iterator WcIt;
00104 static const int DEFAULT_MAX_CACHE_SIZE;
00105 static const int CACHE_SAFETY_LIMIT;
00106 static const double BIG_DOUBLE;
00107 mutable CHBookHisto* histo;
00108 mutable AIDAAxis* axis;
00109 IAnnotation* ann;
00110 int maxCacheSize;
00111 int nbins;
00112 AIDA_STD::string name;
00113 IHistogramFactory* factory;
00114 mutable UwCache unweightedCache;
00115 mutable WCache weightedCache;
00116 mutable UwcIt uwcIt;
00117 mutable WcIt wcIt;
00118 mutable bool frozen;
00119 mutable bool synchronised;
00120 mutable bool needsRebook;
00121 mutable double loVal;
00122 mutable double hiVal;
00123
00124 };
00125
00126 }
00127 }
00128
00129
00130
00131
00132 #endif // INCLUDED_AIDADYNHIST1D_H
00133
00134