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
55  void setName(std::string Name) { name = Name; }
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; }
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; }
88  void setSolidFillStyle(int Style) { solidFillStyle = Style; }
89  void setShadedLineColor(int Color) { shadedLineColor = Color; }
90  void setShadedFillColor(int Color) { shadedFillColor = Color; }
91  void setShadedFillStyle(int Style) { shadedFillStyle = Style; }
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
type
Definition: HCALResponse.h:21
int shadedFillStyle
Definition: HistoData.h:133
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 getBin() const
Definition: HistoData.h:20
bool doAllow2DRebinningY
Definition: HistoData.h:116
float getKSScore() const
Definition: HistoData.h:38
int passColor
Definition: HistoData.h:131
void setMaxProjectionsX(bool Num)
Definition: HistoData.h:73
bool getDoProjectionsX() const
Definition: HistoData.h:31
bool getDoAllow2DRebinningY() const
Definition: HistoData.h:30
PlotType
void setResult(bool Result)
float lowScore
Definition: HistoData.h:125
void dump()
int type
Definition: HistoData.h:105
void setDoAllow2DRebinningX(bool Toggle)
Definition: HistoData.h:65
std::string getName() const
Definition: HistoData.h:17
bool lineUseFillColor
Definition: HistoData.h:134
int maxProjectionsX
Definition: HistoData.h:117
void clear()
Definition: HistoData.h:95
int shadedLineColor
Definition: HistoData.h:133
int getShadedLineColor() const
Definition: HistoData.h:50
bool getDoAllow1DRebinning() const
Definition: HistoData.h:28
bool isEmpty
Definition: HistoData.h:128
void setResultTarget(std::string Target)
Definition: HistoData.h:60
TH1 * refHisto
Definition: HistoData.h:108
bool getDoDrawErrorBars() const
Definition: HistoData.h:27
std::string resultImage
Definition: HistoData.h:109
bool getLineUseFillColor() const
Definition: HistoData.h:46
TH1 * getRefHisto() const
Definition: HistoData.h:22
void setIsEmpty(bool Toggle)
Definition: HistoData.h:82
void setKSScore(float Score)
Definition: HistoData.h:77
void initialize()
void setMaxProjections(int Num)
Definition: HistoData.h:69
int getType() const
Definition: HistoData.h:19
int failColor
Definition: HistoData.h:131
void setShadedFillColor(int Color)
Definition: HistoData.h:90
int solidLineColor
Definition: HistoData.h:132
float getLowScore() const
Definition: HistoData.h:40
bool doAllow2DRebinningX
Definition: HistoData.h:115
int getSolidFillColor() const
Definition: HistoData.h:48
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
float getChi2Score() const
Definition: HistoData.h:39
TFile * Target
bool comparisonSuccess() const
Definition: HistoData.h:37
std::string name
Definition: HistoData.h:103
virtual ~HistoData()
Definition: HistoData.h:14
bool doAllow1DRebinning
Definition: HistoData.h:111
int getSolidFillStyle() const
Definition: HistoData.h:49
void drawResult(TH1 *Summary, bool Vertical=true, bool SetLabels=false)
bool getDoProjectionsY() const
Definition: HistoData.h:32
bool getIsEmpty() const
Definition: HistoData.h:43
int shadedFillColor
Definition: HistoData.h:133
void setResultImage(std::string Image)
Definition: HistoData.h:59
int solidFillColor
Definition: HistoData.h:132
bool getDoAllow2DRebinningX() const
Definition: HistoData.h:29
void setLineUseFillColor(bool Toggle)
Definition: HistoData.h:85
bool getResult() const
Definition: HistoData.h:42
int errorColor
Definition: HistoData.h:131
float getHighScore() const
Definition: HistoData.h:41
int getMaxProjectionsY() const
Definition: HistoData.h:34
void setChi2Score(float Score)
Definition: HistoData.h:78
void setName(std::string Name)
Definition: HistoData.h:55
TH1 * newHisto
Definition: HistoData.h:107
void setDoProjectionsX(bool Toggle)
Definition: HistoData.h:67
int getMaxProjectionsX() const
Definition: HistoData.h:33
void setBin(int Bin)
Definition: HistoData.h:58
bool result
Definition: HistoData.h:127
int getSolidLineColor() const
Definition: HistoData.h:47
void setHighScore(float Score)
Definition: HistoData.h:80
int getShadedFillStyle() const
Definition: HistoData.h:52
void setDoAllow2DRebinningY(bool Toggle)
Definition: HistoData.h:66
void setShadedFillStyle(int Style)
Definition: HistoData.h:91
TH1 * getNewHisto() const
Definition: HistoData.h:21
std::string getResultImage() const
Definition: HistoData.h:23
std::string getResultTarget() const
Definition: HistoData.h:24
bool doProjectionsY
Definition: HistoData.h:120
float chi2Score
Definition: HistoData.h:124
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
bool doDrawErrorBars
Definition: HistoData.h:112
int getShadedFillColor() const
Definition: HistoData.h:51
void setSolidFillStyle(int Style)
Definition: HistoData.h:88
void setSolidLineColor(int Color)
Definition: HistoData.h:86