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