CMS 3D CMS Logo

JetHtPlotConfiguration.h
Go to the documentation of this file.
1 // Class for histograms needed in the dijet analysis
2 
3 #ifndef ALIGNMENT_OFFLINEVALIDATION_JETHTPLOTCONFIGURATION_H
4 #define ALIGNMENT_OFFLINEVALIDATION_JETHTPLOTCONFIGURATION_H
5 
6 // Boost libraries for reading JSON files
7 #define BOOST_BIND_GLOBAL_PLACEHOLDERS // This suppresses some warning message. It is annoying so just not seeing it makes me happy.
8 #include "boost/property_tree/ptree.hpp"
9 #include "boost/property_tree/json_parser.hpp"
10 #include "boost/algorithm/string/replace.hpp"
11 
12 // C++ includes
13 #include <cstdlib>
14 #include <iostream>
15 #include <regex>
16 #include <string>
17 #include <vector>
18 
19 // Root includes
20 #include "TString.h"
21 
23 public:
24  // Enumeration for histogram types
26 
27  // Enumeration for profile types
38  };
39 
40  // Enumeration for trend types
42 
43  // Other constants
44  static const int kMaxLegendColumns = 3; // Maximum allowed number of colums in a legend
45 
46  // Constructors and destructor
47  JetHtPlotConfiguration(); // Default constructor
48  JetHtPlotConfiguration(const JetHtPlotConfiguration& in); // Copy constructor
49  virtual ~JetHtPlotConfiguration(); // Destructor
50  JetHtPlotConfiguration& operator=(const JetHtPlotConfiguration& obj); // Equal sign operator
51 
52  // Read a json configuration file
53  void readJsonFile(const std::string fileName);
54 
55  // Getters for the configuration
56  bool drawTrackQA() const;
57  bool drawHistogram(const int iHistogram) const;
58  bool drawProfile(const int iProfile) const;
59  bool drawReferenceProfile() const;
60  bool drawCentralEtaSummaryProfile() const;
61  double profileZoomLow(const int iProfile) const;
62  double profileZoomHigh(const int iProfile) const;
63  bool drawTrend(const int iTrend) const;
64  double trendZoomLow(const int iTrend) const;
65  double trendZoomHigh(const int iTrend) const;
66 
67  double profileLegendShiftTotalX() const;
68  double profileLegendShiftTotalY() const;
69  double profileLegendShiftColumnX(const int iColumn) const;
70  double profileLegendShiftColumnY(const int iColumn) const;
71  double profileLegendTextSize() const;
72  int profileLegendTextFont() const;
73 
74  double trendLegendShiftTotalX() const;
75  double trendLegendShiftTotalY() const;
76  double trendLegendTextSize() const;
77  int trendLegendTextFont() const;
78 
79  bool drawTrendTag() const;
80  std::vector<std::string> trendTagText() const;
81  std::vector<double> trendTagPositionX() const;
82  std::vector<double> trendTagPositionY() const;
83  double trendTagTextSize() const;
84  int trendTagTextFont() const;
85 
86  int trendCanvasHeight() const;
87  int trendCanvasWidth() const;
88  double trendMarginLeft() const;
89  double trendMarginRight() const;
90  double trendMarginTop() const;
91  double trendMarginBottom() const;
92  double trendTitleOffsetX() const;
93  double trendTitleOffsetY() const;
94  double trendTitleSizeX() const;
95  double trendTitleSizeY() const;
96  double trendLabelOffsetX() const;
97  double trendLabelOffsetY() const;
98  double trendLabelSizeX() const;
99  double trendLabelSizeY() const;
100 
101  int nInputFiles() const;
102  std::string inputFile(const int iFile) const;
103  std::vector<std::string> inputFiles() const;
104 
105  std::string legendComment(const int iComment) const;
106  int markerColor(const int iFile) const;
107  int markerStyle(const int iFile) const;
108  int markerSize(const int iFile) const;
109  bool copyErrorColor(const int iFile) const;
110 
111  const char* lumiPerIovFile() const;
112  const char* iovListMode() const;
113  bool drawYearLines() const;
114  int yearLineColor() const;
115  int yearLineWidth() const;
116  int yearLineStyle() const;
117  std::vector<int> runsForLines() const;
118 
119  std::vector<double> widePtBinBorders() const;
120 
122  bool drawPlotsForEachIOV() const;
123  int nIovInOnePlot() const;
124  bool useLuminosityForTrends() const;
125  bool skipRunsWithNoData() const;
126  bool normalizeQAplots() const;
127 
128  const char* saveComment() const;
129 
130  bool makeIovListForSlides() const;
131  const char* iovListForSlides() const;
132 
133  // Print the current configuration to console
134  void printConfiguration() const;
135 
136 private:
137  // Methods to expand environtental variables in the configuration
140 
141  // Strings correcponding to configuration in the JSON file
142  std::string fJsonTrackQAname = "drawTrackQA";
144  std::string fJsonNameHistogram[knHistogramTypes] = {"drawDz", "drawDzError", "drawDxy", "drawDxyError"};
147  "drawDzErrorVsPhi",
148  "drawDzErrorVsEta",
149  "drawDxyErrorVsPt",
150  "drawDxyErrorVsPhi",
151  "drawDxyErrorVsEta",
152  "drawDzErrorVsPtWide",
153  "drawDxyErrorVsPtWide"};
154  std::string fJsonNameReferenceProfile = "drawReferenceProfile";
155  std::string fJsonNameCentralEtaSummaryProfile = "drawCentralEtaSummaryProfile";
158  "ZoomPhiProfileDz",
159  "ZoomEtaProfileDz",
160  "ZoomPtProfileDxy",
161  "ZoomPhiProfileDxy",
162  "ZoomEtaProfileDxy",
163  "ZoomPtWideProfileDz",
164  "ZoomPtWideProfileDxy"};
166  std::string fJsonNameTrend[knHistogramTypes] = {"drawDzError", "drawDxyError"};
168  std::string fJsonNameTrendZoom[knHistogramTypes] = {"ZoomDzTrend", "ZoomDxyTrend"};
169 
176  std::string fJsonNameLegendTextForAllRuns = "legendTextForAllRuns";
177 
192 
195  std::string fJsonDrawPlotsForEachIOV = "drawPlotsForEachIOV";
196  std::string fJsonNIovInOnePlot = "nIovInOnePlot";
198  std::string fJsonSkipRunsWithNoData = "skipRunsWithNoData";
199  std::string fJsonNormalizeQAplots = "normalizeQAplots";
200  std::string fJsonSaveComment = "saveComment";
201  std::string fJsonLumiPerIovFile = "lumiPerIovFile";
202  std::string fJsonIovListMode = "lumiFileMode";
203  std::string fJsonDrawYearLines = "drawYearLines";
204  std::string fJsonYearLineColor = "yearLineColor";
205  std::string fJsonYearLineWidth = "yearLineWidth";
206  std::string fJsonYearLineStyle = "yearLineStyle";
207  std::string fJsonRunsForLines = "runsForLines";
212  std::string fJsonWidePtBinBorders = "widePtBinBorders";
213  std::string fJsonMakeIovListForSlides = "makeIovlistForSlides";
214  std::string fJsonIovListForSlides = "iovListForSlides";
215 
217 
234 
236  std::vector<std::string> fTrendTagText;
237  std::vector<double> fTrendTagPositionX;
238  std::vector<double> fTrendTagPositionY;
241 
256 
261 
262  std::vector<std::string> fInputFileNames;
263  std::vector<std::string> fLegendComments;
264  std::vector<int> fMarkerColor;
265  std::vector<int> fMarkerStyle;
266  std::vector<int> fMarkerSize;
267  std::vector<bool> fCopyErrorColor;
275 
282  std::vector<int> fRunsForLines;
283  std::vector<double> fWidePtBinBorders;
284 
287 
288  // Default marker styles that are used if not configured in json
289  int fDefaultColors[11] = {
290  kBlue, kRed, kGreen + 2, kMagenta, kBlack, kCyan, kViolet + 3, kOrange, kPink - 7, kSpring + 3, kAzure - 7};
291  int fDefaultStyle = 20; // Full circle
293 };
294 
295 #endif
double fProfileLegendShiftColumnY[kMaxLegendColumns]
std::vector< std::string > trendTagText() const
std::string fJsonNameHistogram[knHistogramTypes]
bool drawProfile(const int iProfile) const
double profileLegendShiftColumnY(const int iColumn) const
void autoExpandEnvironmentVariables(std::string &text) const
std::vector< double > trendTagPositionX() const
std::string fJsonNameTrend[knHistogramTypes]
std::vector< bool > fCopyErrorColor
std::string fJsonNameTrendZoom[knHistogramTypes]
std::vector< std::string > inputFiles() const
std::string fJsonNameProfileZoom[knProfileTypes]
std::vector< int > fMarkerColor
std::string expandEnvironmentVariables(const std::string &input) const
std::vector< int > runsForLines() const
std::vector< int > fRunsForLines
double trendZoomLow(const int iTrend) const
static const int kMaxLegendColumns
double fProfileZoomLow[knProfileTypes]
bool copyErrorColor(const int iFile) const
int markerStyle(const int iFile) const
const char * iovListForSlides() const
std::vector< double > fWidePtBinBorders
static std::string const input
Definition: EdmProvDump.cc:50
double trendZoomHigh(const int iTrend) const
double fProfileLegendShiftColumnX[kMaxLegendColumns]
std::vector< int > fMarkerSize
double fTrendZoomLow[knTrendTypes]
double fProfileZoomHigh[knProfileTypes]
std::vector< double > fTrendTagPositionX
bool drawTrend(const int iTrend) const
std::string legendComment(const int iComment) const
std::string fJsonNameProfile[knProfileTypes]
bool fDrawProfile[knProfileTypes]
std::vector< std::string > fTrendTagText
std::vector< int > fMarkerStyle
bool drawHistogram(const int iHistogram) const
int markerColor(const int iFile) const
const char * lumiPerIovFile() const
int markerSize(const int iFile) const
bool fDrawHistogram[knHistogramTypes]
double fTrendZoomHigh[knTrendTypes]
std::string fJsonNameCentralEtaSummaryProfile
std::vector< std::string > fLegendComments
double profileLegendShiftColumnX(const int iColumn) const
std::string legendTextForAllRuns() const
const char * iovListMode() const
std::vector< double > fTrendTagPositionY
double profileZoomHigh(const int iProfile) const
const char * saveComment() const
JetHtPlotConfiguration & operator=(const JetHtPlotConfiguration &obj)
std::vector< double > widePtBinBorders() const
std::vector< std::string > fInputFileNames
void readJsonFile(const std::string fileName)
std::vector< double > trendTagPositionY() const
double profileZoomLow(const int iProfile) const
std::string inputFile(const int iFile) const