00001 #ifndef JETUNCERTAINTIES_UNCERTAINTYHISTOGRAM_H
00002 #define JETUNCERTAINTIES_UNCERTAINTYHISTOGRAM_H
00003
00004 #include "AsgTools/AsgMessaging.h"
00005
00006 #include "TString.h"
00007 #include "TH1.h"
00008
00009 class TFile;
00010 class TAxis;
00011
00012 namespace jet
00013 {
00014
00015 class UncertaintyHistogram : public asg::AsgMessaging
00016 {
00017 public:
00018
00019 UncertaintyHistogram(const std::string& histName, const bool interpolate);
00020 UncertaintyHistogram(const TString histName, const bool interpolate);
00021 UncertaintyHistogram(const char* histName, const bool interpolate);
00022 UncertaintyHistogram(const UncertaintyHistogram& toCopy);
00023 virtual ~UncertaintyHistogram();
00024 virtual StatusCode initialize(TFile* histFile);
00025
00026
00027 const TString& getName() const { return m_name; }
00028 const TH1* getHisto() const { return m_histo; }
00029 bool getInterp() const { return m_interpolate; }
00030 int getNumDim() const { return m_nDim; }
00031
00032
00033 double getValue(const double var1) const;
00034 double getValue(const double var1, const double var2) const;
00035 double getValue(const double var1, const double var2, const double var3) const;
00036
00037 private:
00038
00039 bool m_isInit;
00040 const TString m_name;
00041 const bool m_interpolate;
00042 TH1* m_histo;
00043 int m_nDim;
00044
00045
00046 double readHisto(const double var1, const double var2=0, const double var3=0) const;
00047 double checkBoundaries(const TAxis* axis, const int numBins, const double valInput) const;
00048
00049
00050 double Interpolate(const TH1* histo, const double x) const;
00051 double Interpolate(const TH1* histo, const double x, const double y) const;
00052 double Interpolate(const TH1* histo, const double x, const double y, const double z) const;
00053 Int_t FindBin(const TAxis* axis, const double x) const;
00054
00055 double Interpolate2D(const TH1* histo, const double x, const double y, const int xAxis=1, const int yAxis=2, const int otherDimBin=-1) const;
00056 };
00057
00058 }
00059
00060
00061 #endif
00062