File indexing completed on 2024-04-06 12:33:13
0001 #ifndef __Validation_RecoParticleFlow_Comparator__
0002 #define __Validation_RecoParticleFlow_Comparator__
0003
0004 #include <cmath>
0005
0006 #include <TF1.h>
0007 #include <TFile.h>
0008 #include <TH1.h>
0009 #include <TLegend.h>
0010
0011
0012
0013 class Style;
0014
0015 class Comparator {
0016 public:
0017 enum Mode { NORMAL, SCALE, RATIO, GRAPH, EFF };
0018
0019 Comparator() : rebin_(-1), xMin_(0), xMax_(0), resetAxis_(false), s0_(nullptr), s1_(nullptr), legend_(0, 0, 1, 1) {}
0020
0021 Comparator(const char *file0, const char *dir0, const char *file1, const char *dir1)
0022 : rebin_(-1), xMin_(0), xMax_(0), resetAxis_(false), s0_(nullptr), s1_(nullptr), legend_(0, 0, 1, 1) {
0023 SetDirs(file0, dir0, file1, dir1);
0024 }
0025
0026
0027
0028 void SetDirs(const char *file0, const char *dir0, const char *file1, const char *dir1);
0029
0030
0031 void SetAxis(int rebin, float xmin, float xmax) {
0032 rebin_ = rebin;
0033 xMin_ = xmin;
0034 xMax_ = xmax;
0035 resetAxis_ = true;
0036 }
0037
0038
0039 void SetAxis(int rebin) {
0040 rebin_ = rebin;
0041 resetAxis_ = false;
0042 }
0043
0044
0045 void DrawSlice(const char *key, int binxmin, int binxmax, Mode mode);
0046
0047 void DrawMeanSlice(const char *key, const int rebinFactor, Mode mode);
0048 void DrawSigmaSlice(const char *key, const int rebinFactor, Mode mode);
0049 void DrawGaussSigmaSlice(const char *key, const int rebinFactor, Mode mode);
0050 void DrawGaussSigmaSlice(
0051 const char *key, const int rebinFactor, const int binxmin, const int binxmax, const bool cst_binning, Mode mode);
0052 void DrawGaussSigmaOverMeanXSlice(
0053 const char *key, const int rebinFactor, const int binxmin, const int binxmax, const bool cst_binning, Mode mode);
0054 void DrawGaussSigmaOverMeanSlice(const char *key, const char *key2, const int rebinFactor, Mode mode);
0055
0056 void Draw(const char *key, Mode mode);
0057
0058 void Draw(const char *key0, const char *key1, Mode mode);
0059
0060
0061
0062 TH1 *h0() { return h0_; }
0063 TH1 *h1() { return h1_; }
0064
0065 TLegend &Legend() { return legend_; }
0066 const TLegend &Legend() const { return legend_; }
0067
0068
0069 void SetStyles(Style *s0, Style *s1, const char *leg0, const char *leg1);
0070
0071 TH1 *Histo(const char *key, unsigned dirIndex);
0072
0073 TDirectory *dir0() { return dir0_; }
0074 TDirectory *dir1() { return dir1_; }
0075
0076 private:
0077
0078
0079
0080
0081
0082 void Draw(TH1 *h0, TH1 *h1, Mode mode);
0083
0084 int rebin_;
0085 float xMin_;
0086 float xMax_;
0087 bool resetAxis_;
0088
0089 TFile *file0_;
0090 TDirectory *dir0_;
0091 TFile *file1_;
0092 TDirectory *dir1_;
0093
0094 TH1 *h0_;
0095 TH1 *h1_;
0096
0097 Style *s0_;
0098 Style *s1_;
0099
0100 TLegend legend_;
0101 };
0102
0103 #endif