File indexing completed on 2024-04-06 12:33:13
0001 #ifndef __Validation_RecoParticleFlow_TH2Analyzer__
0002 #define __Validation_RecoParticleFlow_TH2Analyzer__
0003
0004 #include <vector>
0005
0006 #include <TObject.h>
0007
0008 class TH2;
0009 class TH1D;
0010 class TH2D;
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 class TH2Analyzer : public TObject {
0021 public:
0022 TH2Analyzer(const TH2 *h, int rebin = 1)
0023 : hist2D_(h),
0024 rebinnedHist2D_(nullptr),
0025 average_(nullptr),
0026 RMS_(nullptr),
0027 sigmaGauss_(nullptr),
0028 meanXslice_(nullptr) {
0029 Eval(rebin);
0030 }
0031
0032 TH2Analyzer(const TH2 *h, const int binxmin, const int binxmax, const int rebin, const bool cst_binning = true)
0033 : hist2D_(h),
0034 rebinnedHist2D_(nullptr),
0035 average_(nullptr),
0036 RMS_(nullptr),
0037 sigmaGauss_(nullptr),
0038 meanXslice_(nullptr) {
0039 Eval(rebin, binxmin, binxmax, cst_binning);
0040 }
0041
0042 ~TH2Analyzer() override { Reset(); }
0043
0044 void Reset();
0045
0046 void SetHisto(const TH2 *h) { hist2D_ = h; }
0047
0048 void Eval(const int rebinFactor);
0049 void Eval(const int rebinFactor, const int binxmin, const int binxmax, const bool cst_binning);
0050
0051 TH1D *Average() { return average_; }
0052 TH1D *RMS() { return RMS_; }
0053 TH1D *SigmaGauss() { return sigmaGauss_; }
0054 TH1D *MeanX() { return meanXslice_; }
0055
0056
0057
0058
0059
0060 private:
0061 void ProcessSlices(const TH2D *histo);
0062
0063
0064 void ProcessSlice(const int i, TH1D *histo) const;
0065
0066 const TH2 *hist2D_;
0067 TH2D *rebinnedHist2D_;
0068 TH1D *average_;
0069 TH1D *RMS_;
0070 TH1D *sigmaGauss_;
0071 TH1D *meanXslice_;
0072
0073
0074
0075 ClassDefOverride(TH2Analyzer, 1);
0076 };
0077
0078 #endif