CMS 3D CMS Logo

PlotCompareUtility.h
Go to the documentation of this file.
1 #ifndef PLOT_COMPARE_UTILITY__H
2 #define PLOT_COMPARE_UTILITY__H
3 
4 #include "HistoData.h"
5 
6 #include <map>
7 #include <string>
8 #include <vector>
9 
10 #ifndef HTML1D
11 #define HTML1D
12 #endif
13 
14 class TFile;
15 class TH1;
16 
18 public:
19  // BasePath = the path to data in the DQM root file (eg.,
20  // "DQMData/METTask/ECAL/data") Prefix = the prefix common to all histograms
21  // in area (eg., "METTask_" or "")
23  std::string New,
24  std::string NewBasePath,
25  std::string NewPrefix = "",
26  std::string RefBasePath = "",
27  std::string RefPrefix = "");
28  virtual ~PlotCompareUtility();
29 
30  // Axis Conventions (For Specifying Profiles, Projections, etc.)
31  enum Axis { axisX, axisY /*, axisZ -- maybe later? */ };
32 
33  // Getters for HistoData Information
34  std::vector<HistoData> *getHistos() { return &histos; }
35  std::vector<HistoData> *getProjectionsX(HistoData *HD) { return &projectionsX[HD]; }
36  std::vector<HistoData> *getProjectionsY(HistoData *HD) { return &projectionsY[HD]; }
37  int getNumHistos() const { return histos.size(); }
38  // int getNumProjectionsX(HistoData *HD) const { return
39  // projectionsX[HD].size(); } int getNumProjectionsY(HistoData *HD) const {
40  // return projectionsY[HD].size(); }
41 
42  // Getters for Statistical Comparisons
43  double getKSThreshold() const { return ksThreshold; }
44  double getChi2Threshold() const { return chi2Threshold; }
45  double getThreshold() const; // the lowest non-zero test threshold
46  bool getFinalResult() const { return finalResult; }
47 
48  // Getters for Drawing Options
49  int getSummaryWidth() const { return summaryWidth; }
50  int getSummaryHeight() const { return summaryHeight; }
52  int getSummaryTopMargin() const { return summaryTopMargin; }
53  int getSummaryLeftMargin() const { return summaryLeftMargin; }
54  int getSummaryRightMargin() const { return summaryRightMargin; }
56  int getProjectionsHeight() const { return projectionsHeight; }
57  int getProjectionsWidth() const { return projectionsWidth; }
63  int getPlotsHeight() const { return plotsHeight; }
64  int getPlotsWidth() const { return plotsWidth; }
65  int getPlotsTopMargin() const { return plotsTopMargin; }
66  int getPlotsLeftMargin() const { return plotsLeftMargin; }
67  int getPlotsRightMargin() const { return plotsRightMargin; }
68  int getPlotsBottomMargin() const { return plotsBottomMargin; }
69 
70  // Setters for Statistical Comparisons
73 
74  // Setters for Drawing Options
75  void setSummaryWidth(int Pixels) { summaryWidth = Pixels; }
76  void setSummaryHeight(int Pixels) { summaryHeight = Pixels; }
77  void setSummaryBarsThickness(int Pixels) { summaryBarsThickness = Pixels; }
78  void setSummaryTopMargin(int Pixels) { summaryTopMargin = Pixels; }
79  void setSummaryLeftMargin(int Pixels) { summaryLeftMargin = Pixels; }
80  void setSummaryRightMargin(int Pixels) { summaryRightMargin = Pixels; }
81  void setSummaryBottomMargin(int Pixels) { summaryBottomMargin = Pixels; }
82  void setProjectionsiWidth(int Pixels) { projectionsWidth = Pixels; }
83  void setProjectionsHeight(int Pixels) { projectionsHeight = Pixels; }
85  void setProjectionsTopMargin(int Pixels) { projectionsTopMargin = Pixels; }
86  void setProjectionsLeftMargin(int Pixels) { projectionsLeftMargin = Pixels; }
87  void setProjectionsRightMargin(int Pixels) { projectionsRightMargin = Pixels; }
88  void setProjectionsBottomMargin(int Pixels) { projectionsBottomMargin = Pixels; }
89  void setPlotsHeight(int Pixels) { plotsHeight = Pixels; }
90  void setPlotsWidth(int Pixels) { plotsWidth = Pixels; }
91  void setPlotsTopMargin(int Pixels) { plotsTopMargin = Pixels; }
92  void setPlotsLeftMargin(int Pixels) { plotsLeftMargin = Pixels; }
93  void setPlotsRightMargin(int Pixels) { plotsRightMargin = Pixels; }
94  void setPlotsBottomMargin(int Pixels) { plotsBottomMargin = Pixels; }
95 
96  // Add HistoData Objects for Comparison
97  HistoData *addHistoData(std::string NewName, std::string RefName, int PlotType);
100  HistoData *Parent, std::string Name, int PlotType, int Bin, TH1 *NewHisto, TH1 *RefHisto);
102  HistoData *Parent, std::string Name, int PlotType, int Bin, TH1 *NewHisto, TH1 *RefHisto);
103  void clearHistos() { histos.clear(); }
104  void clearProjectionsX(HistoData *Parent) { projectionsX[Parent].clear(); }
105  void clearProjectionsY(HistoData *Parent) { projectionsY[Parent].clear(); }
106 
107  // Misc. Utilities
108  bool compare(HistoData *);
109  void makeDefaultPlots();
110  void makePlots(HistoData *);
111  void makeHTML(HistoData *);
115  // void makeProjectionsSummary();
116  // void makeProjectionsSummaryPlots();
117  // void makeProjectionsSummaryHTML();
118  bool isValid() const;
119  void dump();
120 
121 private:
122  // data holders for histogram types
123  std::vector<HistoData> histos;
124  std::map<HistoData *, std::vector<HistoData>> projectionsX;
125  std::map<HistoData *, std::vector<HistoData>> projectionsY;
126 
127  // file pointers and file organization
128  TFile *refFile;
129  TFile *newFile;
134 
135  // statistical thresholds
136  double ksThreshold;
138 
139  // private (implementation/helper) functions
140  template <int PlotType>
141  bool compare(HistoData *);
142  template <int PlotType>
143  void makePlots(HistoData *);
144  template <int PlotType>
145  void makeHTML(HistoData *);
146  void centerRebin(TH1 *, TH1 *);
147  void renormalize(TH1 *, TH1 *);
148 
149  // summary settings
150  int summaryWidth; // user defined
151  int summaryHeight; // set by plotter
157 
158  // 2d projections summary settings
159  int projectionsWidth; // set by plotter
160  int projectionsHeight; // user defined
166 
167  // 1d distribution plots settings
168  int plotsWidth; // user defined
169  int plotsHeight; // user defined
174 
175  // true if all run tests pass, false if any fail
177 };
178 
179 #endif // PLOT_COMPARE_UTILITY__H
PlotCompareUtility::projectionsTopMargin
int projectionsTopMargin
Definition: PlotCompareUtility.h:162
PlotCompareUtility::getProjectionsBarsThickness
int getProjectionsBarsThickness() const
Definition: PlotCompareUtility.h:58
PlotCompareUtility::setPlotsLeftMargin
void setPlotsLeftMargin(int Pixels)
Definition: PlotCompareUtility.h:92
PlotCompareUtility::setKSThreshold
void setKSThreshold(double Threshold)
Definition: PlotCompareUtility.h:71
PlotCompareUtility::getSummaryBottomMargin
int getSummaryBottomMargin() const
Definition: PlotCompareUtility.h:55
PlotCompareUtility::projectionsBottomMargin
int projectionsBottomMargin
Definition: PlotCompareUtility.h:165
PlotCompareUtility::ksThreshold
double ksThreshold
Definition: PlotCompareUtility.h:136
PlotCompareUtility::getProjectionsHeight
int getProjectionsHeight() const
Definition: PlotCompareUtility.h:56
SiStripClientConfig_Tier0_cff.Name
Name
Definition: SiStripClientConfig_Tier0_cff.py:13
PlotCompareUtility::makeSummary
void makeSummary(std::string Name)
PlotCompareUtility::setSummaryBarsThickness
void setSummaryBarsThickness(int Pixels)
Definition: PlotCompareUtility.h:77
PlotCompareUtility::makeSummaryHTML
void makeSummaryHTML(std::string Name)
PlotCompareUtility::centerRebin
void centerRebin(TH1 *, TH1 *)
PlotCompareUtility::clearProjectionsX
void clearProjectionsX(HistoData *Parent)
Definition: PlotCompareUtility.h:104
PlotCompareUtility::makePlots
void makePlots(HistoData *)
PlotCompareUtility::setSummaryWidth
void setSummaryWidth(int Pixels)
Definition: PlotCompareUtility.h:75
PlotCompareUtility::newBasePath
std::string newBasePath
Definition: PlotCompareUtility.h:130
PlotCompareUtility::setPlotsWidth
void setPlotsWidth(int Pixels)
Definition: PlotCompareUtility.h:90
PlotCompareUtility::projectionsLeftMargin
int projectionsLeftMargin
Definition: PlotCompareUtility.h:163
PlotCompareUtility::projectionsWidth
int projectionsWidth
Definition: PlotCompareUtility.h:159
PlotCompareUtility::histos
std::vector< HistoData > histos
Definition: PlotCompareUtility.h:123
PlotCompareUtility::getSummaryLeftMargin
int getSummaryLeftMargin() const
Definition: PlotCompareUtility.h:53
PlotCompareUtility::plotsHeight
int plotsHeight
Definition: PlotCompareUtility.h:169
PlotCompareUtility::axisX
Definition: PlotCompareUtility.h:31
PlotCompareUtility::getPlotsRightMargin
int getPlotsRightMargin() const
Definition: PlotCompareUtility.h:67
PlotCompareUtility::setProjectionsLeftMargin
void setProjectionsLeftMargin(int Pixels)
Definition: PlotCompareUtility.h:86
PlotCompareUtility::axisY
Definition: PlotCompareUtility.h:31
PlotCompareUtility::clearHistos
void clearHistos()
Definition: PlotCompareUtility.h:103
PlotCompareUtility::getSummaryTopMargin
int getSummaryTopMargin() const
Definition: PlotCompareUtility.h:52
PlotCompareUtility::setPlotsRightMargin
void setPlotsRightMargin(int Pixels)
Definition: PlotCompareUtility.h:93
PlotCompareUtility::getPlotsBottomMargin
int getPlotsBottomMargin() const
Definition: PlotCompareUtility.h:68
PlotCompareUtility::summaryWidth
int summaryWidth
Definition: PlotCompareUtility.h:150
PlotCompareUtility::projectionsBarsThickness
int projectionsBarsThickness
Definition: PlotCompareUtility.h:161
PlotCompareUtility::getFinalResult
bool getFinalResult() const
Definition: PlotCompareUtility.h:46
PlotCompareUtility::summaryLeftMargin
int summaryLeftMargin
Definition: PlotCompareUtility.h:154
PlotCompareUtility
Definition: PlotCompareUtility.h:17
PlotCompareUtility::projectionsX
std::map< HistoData *, std::vector< HistoData > > projectionsX
Definition: PlotCompareUtility.h:124
PlotCompareUtility::refFile
TFile * refFile
Definition: PlotCompareUtility.h:128
PlotCompareUtility::setSummaryLeftMargin
void setSummaryLeftMargin(int Pixels)
Definition: PlotCompareUtility.h:79
PlotCompareUtility::projectionsHeight
int projectionsHeight
Definition: PlotCompareUtility.h:160
PlotCompareUtility::summaryHeight
int summaryHeight
Definition: PlotCompareUtility.h:151
PlotCompareUtility::setProjectionsBottomMargin
void setProjectionsBottomMargin(int Pixels)
Definition: PlotCompareUtility.h:88
PlotCompareUtility::setProjectionsHeight
void setProjectionsHeight(int Pixels)
Definition: PlotCompareUtility.h:83
PlotCompareUtility::newPrefix
std::string newPrefix
Definition: PlotCompareUtility.h:131
PlotCompareUtility::makeDefaultPlots
void makeDefaultPlots()
HLT_2018_cff.Threshold
Threshold
Definition: HLT_2018_cff.py:10302
PlotCompareUtility::getProjectionsY
std::vector< HistoData > * getProjectionsY(HistoData *HD)
Definition: PlotCompareUtility.h:36
PlotCompareUtility::refPrefix
std::string refPrefix
Definition: PlotCompareUtility.h:133
PlotCompareUtility::plotsLeftMargin
int plotsLeftMargin
Definition: PlotCompareUtility.h:171
PlotCompareUtility::refBasePath
std::string refBasePath
Definition: PlotCompareUtility.h:132
PlotCompareUtility::plotsTopMargin
int plotsTopMargin
Definition: PlotCompareUtility.h:170
PlotCompareUtility::summaryTopMargin
int summaryTopMargin
Definition: PlotCompareUtility.h:153
PlotCompareUtility::setProjectionsBarsThickness
void setProjectionsBarsThickness(int Pixels)
Definition: PlotCompareUtility.h:84
PlotCompareUtility::newFile
TFile * newFile
Definition: PlotCompareUtility.h:129
PlotCompareUtility::setSummaryHeight
void setSummaryHeight(int Pixels)
Definition: PlotCompareUtility.h:76
PlotCompareUtility::getSummaryHeight
int getSummaryHeight() const
Definition: PlotCompareUtility.h:50
PlotCompareUtility::getChi2Threshold
double getChi2Threshold() const
Definition: PlotCompareUtility.h:44
PlotCompareUtility::plotsBottomMargin
int plotsBottomMargin
Definition: PlotCompareUtility.h:173
PlotCompareUtility::addProjectionXData
HistoData * addProjectionXData(HistoData *Parent, std::string Name, int PlotType, int Bin, TH1 *NewHisto, TH1 *RefHisto)
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PlotCompareUtility::getProjectionsX
std::vector< HistoData > * getProjectionsX(HistoData *HD)
Definition: PlotCompareUtility.h:35
PlotCompareUtility::getProjectionsWidth
int getProjectionsWidth() const
Definition: PlotCompareUtility.h:57
PlotCompareUtility::addHistoData
HistoData * addHistoData(std::string Name, int PlotType)
Definition: PlotCompareUtility.h:98
PlotCompareUtility::getKSThreshold
double getKSThreshold() const
Definition: PlotCompareUtility.h:43
PlotCompareUtility::getSummaryBarsThickness
int getSummaryBarsThickness() const
Definition: PlotCompareUtility.h:51
PlotCompareUtility::getPlotsTopMargin
int getPlotsTopMargin() const
Definition: PlotCompareUtility.h:65
PlotCompareUtility::plotsRightMargin
int plotsRightMargin
Definition: PlotCompareUtility.h:172
PlotCompareUtility::summaryBarsThickness
int summaryBarsThickness
Definition: PlotCompareUtility.h:152
PlotCompareUtility::getHistos
std::vector< HistoData > * getHistos()
Definition: PlotCompareUtility.h:34
PlotCompareUtility::setSummaryBottomMargin
void setSummaryBottomMargin(int Pixels)
Definition: PlotCompareUtility.h:81
PlotCompareUtility::finalResult
bool finalResult
Definition: PlotCompareUtility.h:176
HistoData
Definition: HistoData.h:9
PlotCompareUtility::getThreshold
double getThreshold() const
PlotCompareUtility::makeHTML
void makeHTML(HistoData *)
PlotCompareUtility::dump
void dump()
PlotCompareUtility::summaryRightMargin
int summaryRightMargin
Definition: PlotCompareUtility.h:155
PlotCompareUtility::setPlotsHeight
void setPlotsHeight(int Pixels)
Definition: PlotCompareUtility.h:89
PlotCompareUtility::setSummaryTopMargin
void setSummaryTopMargin(int Pixels)
Definition: PlotCompareUtility.h:78
PlotCompareUtility::setChi2Threshold
void setChi2Threshold(double Threshold)
Definition: PlotCompareUtility.h:72
PlotCompareUtility::projectionsRightMargin
int projectionsRightMargin
Definition: PlotCompareUtility.h:164
PlotCompareUtility::getProjectionsTopMargin
int getProjectionsTopMargin() const
Definition: PlotCompareUtility.h:59
PlotCompareUtility::Axis
Axis
Definition: PlotCompareUtility.h:31
PlotCompareUtility::chi2Threshold
double chi2Threshold
Definition: PlotCompareUtility.h:137
PlotCompareUtility::setProjectionsRightMargin
void setProjectionsRightMargin(int Pixels)
Definition: PlotCompareUtility.h:87
PlotCompareUtility::getPlotsLeftMargin
int getPlotsLeftMargin() const
Definition: PlotCompareUtility.h:66
HistoData.h
PlotCompareUtility::projectionsY
std::map< HistoData *, std::vector< HistoData > > projectionsY
Definition: PlotCompareUtility.h:125
PlotCompareUtility::getProjectionsBottomMargin
int getProjectionsBottomMargin() const
Definition: PlotCompareUtility.h:62
PlotCompareUtility::plotsWidth
int plotsWidth
Definition: PlotCompareUtility.h:168
PlotCompareUtility::makeSummaryPlot
void makeSummaryPlot(std::string Name)
PlotCompareUtility::setProjectionsTopMargin
void setProjectionsTopMargin(int Pixels)
Definition: PlotCompareUtility.h:85
PlotCompareUtility::getSummaryWidth
int getSummaryWidth() const
Definition: PlotCompareUtility.h:49
PlotCompareUtility::addHistoData
HistoData * addHistoData(std::string NewName, std::string RefName, int PlotType)
PlotCompareUtility::getProjectionsRightMargin
int getProjectionsRightMargin() const
Definition: PlotCompareUtility.h:61
PlotCompareUtility::clearProjectionsY
void clearProjectionsY(HistoData *Parent)
Definition: PlotCompareUtility.h:105
PlotCompareUtility::setSummaryRightMargin
void setSummaryRightMargin(int Pixels)
Definition: PlotCompareUtility.h:80
PlotCompareUtility::addProjectionYData
HistoData * addProjectionYData(HistoData *Parent, std::string Name, int PlotType, int Bin, TH1 *NewHisto, TH1 *RefHisto)
PlotCompareUtility::getProjectionsLeftMargin
int getProjectionsLeftMargin() const
Definition: PlotCompareUtility.h:60
PlotCompareUtility::isValid
bool isValid() const
PlotCompareUtility::compare
bool compare(HistoData *)
PlotCompareUtility::~PlotCompareUtility
virtual ~PlotCompareUtility()
PlotCompareUtility::setPlotsBottomMargin
void setPlotsBottomMargin(int Pixels)
Definition: PlotCompareUtility.h:94
PlotCompareUtility::setProjectionsiWidth
void setProjectionsiWidth(int Pixels)
Definition: PlotCompareUtility.h:82
PlotType
PlotType
Definition: trackSplitPlot.h:33
PlotCompareUtility::getNumHistos
int getNumHistos() const
Definition: PlotCompareUtility.h:37
PlotCompareUtility::summaryBottomMargin
int summaryBottomMargin
Definition: PlotCompareUtility.h:156
PlotCompareUtility::setPlotsTopMargin
void setPlotsTopMargin(int Pixels)
Definition: PlotCompareUtility.h:91
PlotCompareUtility::renormalize
void renormalize(TH1 *, TH1 *)
PlotCompareUtility::PlotCompareUtility
PlotCompareUtility(std::string Reference, std::string New, std::string NewBasePath, std::string NewPrefix="", std::string RefBasePath="", std::string RefPrefix="")
TrajectoryFactories_cff.Reference
Reference
Definition: TrajectoryFactories_cff.py:123
PlotCompareUtility::getPlotsHeight
int getPlotsHeight() const
Definition: PlotCompareUtility.h:63
PlotCompareUtility::getSummaryRightMargin
int getSummaryRightMargin() const
Definition: PlotCompareUtility.h:54
PlotCompareUtility::getPlotsWidth
int getPlotsWidth() const
Definition: PlotCompareUtility.h:64