00001 #ifndef BDSHISTOGRAM_H
00002 #define BDSHISTOGRAM_H
00003
00004 #include "globals.hh"
00005 #include <vector>
00006 #include <utility>
00007 #include <ostream>
00008
00009 #include "BDSBin.hh"
00010
00016 class BDSHistogram1D
00017 {
00018 public:
00019 BDSHistogram1D(G4double xmin,
00020 G4double xmax,
00021 G4int nbins,
00022 G4String nameIn="histogram",
00023 G4String titleIn="histogram");
00024 BDSHistogram1D(std::vector<G4double> binEdges,
00025 G4String name="histogram",
00026 G4String titleIn="histogram");
00027 ~BDSHistogram1D();
00028
00029 void Empty();
00030 void Fill(G4double x);
00031 void Fill(G4double x, G4double weight);
00032 std::vector<BDSBin*> GetBins() const;
00033 std::vector<G4double> GetBinValues() const;
00034 std::vector<std::pair<G4double, G4double> > GetBinXMeansAndTotals() const;
00035 std::vector<G4double> GetBinLowerEdges() const;
00037 void PrintBins() const;
00038 std::pair<BDSBin*,BDSBin*> GetUnderOverFlowBins() const;
00039 std::pair<G4double,G4double> GetUnderOverFlowBinValues() const;
00040 BDSBin* GetUnderflowBin() const;
00041 BDSBin* GetOverflowBin() const;
00042 BDSBin* GetFirstBin() const;
00043 BDSBin* GetLastBin() const;
00044 G4String GetName() const;
00045 G4String GetTitle() const;
00046 size_t GetNBins() const;
00047 G4int GetNEntries() const;
00048
00049
00050 BDSBin* currentBin();
00051 void first();
00052 G4bool isLastBin();
00053 G4bool isDone();
00054 void next();
00055
00057 friend std::ostream& operator<< (std::ostream &out, BDSHistogram1D const &hist);
00058
00059 private:
00060 BDSHistogram1D();
00061
00065 std::vector<BDSBin*> bins;
00066 BDSBin* overflow;
00067 BDSBin* underflow;
00068 G4String name;
00069 G4String title;
00070 G4int entries;
00071
00072 std::vector<BDSBin*>::const_iterator _iterBins;
00073 };
00074
00075 #endif