CMS 3D CMS Logo

HistoData.h
Go to the documentation of this file.
1 #ifndef HISTO_DATA__H
2 #define HISTO_DATA__H
3 
4 #include <TFile.h>
5 #include <TH1.h>
6 #include <cstring>
7 #include <string>
8 
9 class HistoData {
10 public:
11  HistoData(
12  std::string Name, int PlotType, int Bin, std::string NewPath, TFile *NewFile, std::string RefPath, TFile *RefFile);
13  HistoData(std::string Name, int PlotType, int Bin, TH1 *NewHisto, TH1 *RefHisto);
14  virtual ~HistoData() {}
15 
16  // Get General Information
17  std::string getName() const { return name; }
18  // PlotType getType() const { return type; }
19  int getType() const { return type; }
20  int getBin() const { return bin; }
21  TH1 *getNewHisto() const { return newHisto; }
22  TH1 *getRefHisto() const { return refHisto; }
25 
26  // Projections/Rebinning Getters
27  bool getDoDrawErrorBars() const { return doDrawErrorBars; }
28  bool getDoAllow1DRebinning() const { return doAllow1DRebinning; }
31  bool getDoProjectionsX() const { return doProjectionsX; }
32  bool getDoProjectionsY() const { return doProjectionsY; }
33  int getMaxProjectionsX() const { return maxProjectionsX; }
34  int getMaxProjectionsY() const { return maxProjectionsY; }
35 
36  // Get Test Results
37  bool comparisonSuccess() const { return lowScore != 10 && !isEmpty; }
38  float getKSScore() const { return ksScore; }
39  float getChi2Score() const { return chi2Score; }
40  float getLowScore() const { return lowScore; }
41  float getHighScore() const { return highScore; }
42  bool getResult() const { return result; }
43  bool getIsEmpty() const { return isEmpty; }
44 
45  // Get Visual Attributes
46  bool getLineUseFillColor() const { return lineUseFillColor; }
48  int getSolidFillColor() const { return solidFillColor; }
49  int getSolidFillStyle() const { return solidFillStyle; }
51  int getShadedFillColor() const { return shadedFillColor; }
52  int getShadedFillStyle() const { return shadedFillStyle; }
53 
54  // Set General Information
56  // void setType(PlotType Type) { type = Type; }
57  void setType(int PlotType) { type = PlotType; }
58  void setBin(int Bin) { bin = Bin; }
59  void setResultImage(std::string Image) { resultImage = Image; }
60  void setResultTarget(std::string Target) { resultTarget = Target; }
61 
62  // Projections/Rebinning Setters
63  void setDoDrawErrorBars(bool Toggle) { doDrawErrorBars = Toggle; }
64  void setDoAllow1DRebinning(bool Toggle) { doAllow1DRebinning = Toggle; }
65  void setDoAllow2DRebinningX(bool Toggle) { doAllow2DRebinningX = Toggle; }
66  void setDoAllow2DRebinningY(bool Toggle) { doAllow2DRebinningY = Toggle; }
67  void setDoProjectionsX(bool Toggle) { doProjectionsX = Toggle; }
68  void setDoProjectionsY(bool Toggle) { doProjectionsY = Toggle; }
69  void setMaxProjections(int Num) {
70  maxProjectionsX = Num;
71  maxProjectionsY = Num;
72  }
73  void setMaxProjectionsX(bool Num) { maxProjectionsX = Num; }
74  void setMaxProjectionsY(bool Num) { maxProjectionsY = Num; }
75 
76  // Set Test Results
77  void setKSScore(float Score) { ksScore = Score; }
78  void setChi2Score(float Score) { chi2Score = Score; }
79  void setLowScore(float Score) { lowScore = Score; }
80  void setHighScore(float Score) { highScore = Score; }
81  void setResult(bool Result); // also sets display colors
82  void setIsEmpty(bool Toggle) { isEmpty = Toggle; }
83 
84  // Set Visual Attributes
85  void setLineUseFillColor(bool Toggle) { lineUseFillColor = Toggle; }
86  void setSolidLineColor(int Color) { solidLineColor = Color; }
87  void setSolidFillColor(int Color) { solidFillColor = Color; }
89  void setShadedLineColor(int Color) { shadedLineColor = Color; }
90  void setShadedFillColor(int Color) { shadedFillColor = Color; }
92 
93  // Misc Functions
94  void drawResult(TH1 *Summary, bool Vertical = true, bool SetLabels = false);
95  void clear() {
96  newHisto->Clear();
97  refHisto->Clear();
98  };
99  inline void dump();
100 
101 private:
102  // Misc. Data
104  // PlotType type;
105  int type;
106  int bin;
107  TH1 *newHisto;
108  TH1 *refHisto;
113 
114  // 2D data members
121 
122  // Scores/Results
123  float ksScore;
124  float chi2Score;
125  float lowScore;
126  float highScore;
127  bool result;
128  bool isEmpty;
129 
130  // Attributes of Results Display
135 
136  // Implementation Function
137  void initialize();
138 };
139 
140 #endif // HISTO_DATA__H
int solidFillStyle
Definition: HistoData.h:132
void setDoAllow1DRebinning(bool Toggle)
Definition: HistoData.h:64
bool getDoAllow1DRebinning() const
Definition: HistoData.h:28
int shadedFillStyle
Definition: HistoData.h:133
float getHighScore() const
Definition: HistoData.h:41
void setDoProjectionsY(bool Toggle)
Definition: HistoData.h:68
void setSolidFillColor(int Color)
Definition: HistoData.h:87
bool doProjectionsX
Definition: HistoData.h:119
float ksScore
Definition: HistoData.h:123
void setType(int PlotType)
Definition: HistoData.h:57
int maxProjectionsY
Definition: HistoData.h:118
int getMaxProjectionsX() const
Definition: HistoData.h:33
int getShadedFillColor() const
Definition: HistoData.h:51
bool doAllow2DRebinningY
Definition: HistoData.h:116
int passColor
Definition: HistoData.h:131
void setMaxProjectionsX(bool Num)
Definition: HistoData.h:73
PlotType
void setResult(bool Result)
bool getResult() const
Definition: HistoData.h:42
float lowScore
Definition: HistoData.h:125
void dump()
bool getDoAllow2DRebinningY() const
Definition: HistoData.h:30
int getMaxProjectionsY() const
Definition: HistoData.h:34
int type
Definition: HistoData.h:105
void setDoAllow2DRebinningX(bool Toggle)
Definition: HistoData.h:65
bool lineUseFillColor
Definition: HistoData.h:134
int maxProjectionsX
Definition: HistoData.h:117
void clear()
Definition: HistoData.h:95
int shadedLineColor
Definition: HistoData.h:133
bool isEmpty
Definition: HistoData.h:128
float getChi2Score() const
Definition: HistoData.h:39
void setResultTarget(std::string Target)
Definition: HistoData.h:60
TH1 * refHisto
Definition: HistoData.h:108
std::string resultImage
Definition: HistoData.h:109
bool getIsEmpty() const
Definition: HistoData.h:43
int getSolidFillStyle() const
Definition: HistoData.h:49
void setIsEmpty(bool Toggle)
Definition: HistoData.h:82
void setKSScore(float Score)
Definition: HistoData.h:77
void initialize()
TH1 * getNewHisto() const
Definition: HistoData.h:21
void setMaxProjections(int Num)
Definition: HistoData.h:69
int failColor
Definition: HistoData.h:131
void setShadedFillColor(int Color)
Definition: HistoData.h:90
int getSolidFillColor() const
Definition: HistoData.h:48
int solidLineColor
Definition: HistoData.h:132
bool getDoDrawErrorBars() const
Definition: HistoData.h:27
bool doAllow2DRebinningX
Definition: HistoData.h:115
void setMaxProjectionsY(bool Num)
Definition: HistoData.h:74
void setShadedLineColor(int Color)
Definition: HistoData.h:89
float highScore
Definition: HistoData.h:126
void setDoDrawErrorBars(bool Toggle)
Definition: HistoData.h:63
Definition: Style.py:1
bool getDoProjectionsY() const
Definition: HistoData.h:32
TH1 * getRefHisto() const
Definition: HistoData.h:22
bool getLineUseFillColor() const
Definition: HistoData.h:46
std::string getName() const
Definition: HistoData.h:17
std::string name
Definition: HistoData.h:103
virtual ~HistoData()
Definition: HistoData.h:14
std::string getResultImage() const
Definition: HistoData.h:23
bool doAllow1DRebinning
Definition: HistoData.h:111
bool getDoProjectionsX() const
Definition: HistoData.h:31
void drawResult(TH1 *Summary, bool Vertical=true, bool SetLabels=false)
int shadedFillColor
Definition: HistoData.h:133
bool comparisonSuccess() const
Definition: HistoData.h:37
void setResultImage(std::string Image)
Definition: HistoData.h:59
int solidFillColor
Definition: HistoData.h:132
void setLineUseFillColor(bool Toggle)
Definition: HistoData.h:85
int getSolidLineColor() const
Definition: HistoData.h:47
int errorColor
Definition: HistoData.h:131
int getType() const
Definition: HistoData.h:19
void setChi2Score(float Score)
Definition: HistoData.h:78
void setName(std::string Name)
Definition: HistoData.h:55
float getKSScore() const
Definition: HistoData.h:38
TH1 * newHisto
Definition: HistoData.h:107
void setDoProjectionsX(bool Toggle)
Definition: HistoData.h:67
void setBin(int Bin)
Definition: HistoData.h:58
bool result
Definition: HistoData.h:127
int getShadedLineColor() const
Definition: HistoData.h:50
void setHighScore(float Score)
Definition: HistoData.h:80
float getLowScore() const
Definition: HistoData.h:40
void setDoAllow2DRebinningY(bool Toggle)
Definition: HistoData.h:66
void setShadedFillStyle(int Style)
Definition: HistoData.h:91
bool doProjectionsY
Definition: HistoData.h:120
float chi2Score
Definition: HistoData.h:124
std::string getResultTarget() const
Definition: HistoData.h:24
int getShadedFillStyle() const
Definition: HistoData.h:52
bool getDoAllow2DRebinningX() const
Definition: HistoData.h:29
HistoData(std::string Name, int PlotType, int Bin, std::string NewPath, TFile *NewFile, std::string RefPath, TFile *RefFile)
std::string resultTarget
Definition: HistoData.h:110
void setLowScore(float Score)
Definition: HistoData.h:79
int getBin() const
Definition: HistoData.h:20
bool doDrawErrorBars
Definition: HistoData.h:112
void setSolidFillStyle(int Style)
Definition: HistoData.h:88
void setSolidLineColor(int Color)
Definition: HistoData.h:86