File indexing completed on 2024-04-06 11:56:54
0001
0002
0003 #ifndef ALIGNMENT_OFFLINEVALIDATION_JETHTPLOTCONFIGURATION_H
0004 #define ALIGNMENT_OFFLINEVALIDATION_JETHTPLOTCONFIGURATION_H
0005
0006
0007 #define BOOST_BIND_GLOBAL_PLACEHOLDERS
0008 #include "boost/property_tree/ptree.hpp"
0009 #include "boost/property_tree/json_parser.hpp"
0010 #include "boost/algorithm/string/replace.hpp"
0011
0012
0013 #include <cstdlib>
0014 #include <iostream>
0015 #include <regex>
0016 #include <string>
0017 #include <vector>
0018
0019
0020 #include "TString.h"
0021
0022 class JetHtPlotConfiguration {
0023 public:
0024
0025 enum enumHistogramType { kDz, kDzError, kDxy, kDxyError, knHistogramTypes };
0026
0027
0028 enum enumProfileType {
0029 kDzErrorVsPt,
0030 kDzErrorVsPhi,
0031 kDzErrorVsEta,
0032 kDxyErrorVsPt,
0033 kDxyErrorVsPhi,
0034 kDxyErrorVsEta,
0035 kDzErrorVsPtWide,
0036 kDxyErrorVsPtWide,
0037 knProfileTypes
0038 };
0039
0040
0041 enum enumTrendType { kDzErrorTrend, kDxyErrorTrend, knTrendTypes };
0042
0043
0044 static const int kMaxLegendColumns = 3;
0045
0046
0047 JetHtPlotConfiguration();
0048 JetHtPlotConfiguration(const JetHtPlotConfiguration& in);
0049 virtual ~JetHtPlotConfiguration();
0050 JetHtPlotConfiguration& operator=(const JetHtPlotConfiguration& obj);
0051
0052
0053 void readJsonFile(const std::string fileName);
0054
0055
0056 bool drawTrackQA() const;
0057 bool drawHistogram(const int iHistogram) const;
0058 bool drawProfile(const int iProfile) const;
0059 bool drawReferenceProfile() const;
0060 bool drawCentralEtaSummaryProfile() const;
0061 double profileZoomLow(const int iProfile) const;
0062 double profileZoomHigh(const int iProfile) const;
0063 bool drawTrend(const int iTrend) const;
0064 double trendZoomLow(const int iTrend) const;
0065 double trendZoomHigh(const int iTrend) const;
0066
0067 double profileLegendShiftTotalX() const;
0068 double profileLegendShiftTotalY() const;
0069 double profileLegendShiftColumnX(const int iColumn) const;
0070 double profileLegendShiftColumnY(const int iColumn) const;
0071 double profileLegendTextSize() const;
0072 int profileLegendTextFont() const;
0073
0074 double trendLegendShiftTotalX() const;
0075 double trendLegendShiftTotalY() const;
0076 double trendLegendTextSize() const;
0077 int trendLegendTextFont() const;
0078
0079 bool drawTrendTag() const;
0080 std::vector<std::string> trendTagText() const;
0081 std::vector<double> trendTagPositionX() const;
0082 std::vector<double> trendTagPositionY() const;
0083 double trendTagTextSize() const;
0084 int trendTagTextFont() const;
0085
0086 int trendCanvasHeight() const;
0087 int trendCanvasWidth() const;
0088 double trendMarginLeft() const;
0089 double trendMarginRight() const;
0090 double trendMarginTop() const;
0091 double trendMarginBottom() const;
0092 double trendTitleOffsetX() const;
0093 double trendTitleOffsetY() const;
0094 double trendTitleSizeX() const;
0095 double trendTitleSizeY() const;
0096 double trendLabelOffsetX() const;
0097 double trendLabelOffsetY() const;
0098 double trendLabelSizeX() const;
0099 double trendLabelSizeY() const;
0100
0101 int nInputFiles() const;
0102 std::string inputFile(const int iFile) const;
0103 std::vector<std::string> inputFiles() const;
0104
0105 std::string legendComment(const int iComment) const;
0106 int markerColor(const int iFile) const;
0107 int markerStyle(const int iFile) const;
0108 int markerSize(const int iFile) const;
0109 bool copyErrorColor(const int iFile) const;
0110
0111 const char* lumiPerIovFile() const;
0112 const char* iovListMode() const;
0113 bool drawYearLines() const;
0114 int yearLineColor() const;
0115 int yearLineWidth() const;
0116 int yearLineStyle() const;
0117 std::vector<int> runsForLines() const;
0118
0119 std::vector<double> widePtBinBorders() const;
0120
0121 std::string legendTextForAllRuns() const;
0122 bool drawPlotsForEachIOV() const;
0123 int nIovInOnePlot() const;
0124 bool useLuminosityForTrends() const;
0125 bool skipRunsWithNoData() const;
0126 bool normalizeQAplots() const;
0127
0128 const char* saveComment() const;
0129
0130 bool makeIovListForSlides() const;
0131 const char* iovListForSlides() const;
0132
0133
0134 void printConfiguration() const;
0135
0136 private:
0137
0138 void autoExpandEnvironmentVariables(std::string& text) const;
0139 std::string expandEnvironmentVariables(const std::string& input) const;
0140
0141
0142 std::string fJsonTrackQAname = "drawTrackQA";
0143 std::string fJsonCategoryNameHistogram = "drawHistograms";
0144 std::string fJsonNameHistogram[knHistogramTypes] = {"drawDz", "drawDzError", "drawDxy", "drawDxyError"};
0145 std::string fJsonCategoryNameProfile = "drawProfiles";
0146 std::string fJsonNameProfile[knProfileTypes] = {"drawDzErrorVsPt",
0147 "drawDzErrorVsPhi",
0148 "drawDzErrorVsEta",
0149 "drawDxyErrorVsPt",
0150 "drawDxyErrorVsPhi",
0151 "drawDxyErrorVsEta",
0152 "drawDzErrorVsPtWide",
0153 "drawDxyErrorVsPtWide"};
0154 std::string fJsonNameReferenceProfile = "drawReferenceProfile";
0155 std::string fJsonNameCentralEtaSummaryProfile = "drawCentralEtaSummaryProfile";
0156 std::string fJsonCategoryNameProfileZoom = "profileZoom";
0157 std::string fJsonNameProfileZoom[knProfileTypes] = {"ZoomPtProfileDz",
0158 "ZoomPhiProfileDz",
0159 "ZoomEtaProfileDz",
0160 "ZoomPtProfileDxy",
0161 "ZoomPhiProfileDxy",
0162 "ZoomEtaProfileDxy",
0163 "ZoomPtWideProfileDz",
0164 "ZoomPtWideProfileDxy"};
0165 std::string fJsonCategoryNameTrend = "drawTrends";
0166 std::string fJsonNameTrend[knHistogramTypes] = {"drawDzError", "drawDxyError"};
0167 std::string fJsonCategoryNameTrendZoom = "trendZoom";
0168 std::string fJsonNameTrendZoom[knHistogramTypes] = {"ZoomDzTrend", "ZoomDxyTrend"};
0169
0170 std::string fJsonNameLegendShiftTotalX = "legendShiftTotalX";
0171 std::string fJsonNameLegendShiftTotalY = "legendShiftTotalY";
0172 std::string fJsonNameLegendShiftColumnX = "legendShiftX";
0173 std::string fJsonNameLegendShiftColumnY = "legendShiftY";
0174 std::string fJsonNameLegendTextSize = "legendTextSize";
0175 std::string fJsonNameLegendTextFont = "legendTextFont";
0176 std::string fJsonNameLegendTextForAllRuns = "legendTextForAllRuns";
0177
0178 std::string fJsonNameCanvasHeight = "canvasHeight";
0179 std::string fJsonNameCanvasWidth = "canvasWidth";
0180 std::string fJsonNameMarginLeft = "marginLeft";
0181 std::string fJsonNameMarginRight = "marginRight";
0182 std::string fJsonNameMarginTop = "marginTop";
0183 std::string fJsonNameMarginBottom = "marginBottom";
0184 std::string fJsonNameTitleOffsetX = "titleOffsetX";
0185 std::string fJsonNameTitleOffsetY = "titleOffsetY";
0186 std::string fJsonNameTitleSizeX = "titleSizeX";
0187 std::string fJsonNameTitleSizeY = "titleSizeY";
0188 std::string fJsonNameLabelOffsetX = "labelOffsetX";
0189 std::string fJsonNameLabelOffsetY = "labelOffsetY";
0190 std::string fJsonNameLabelSizeX = "labelSizeX";
0191 std::string fJsonNameLabelSizeY = "labelSizeY";
0192
0193 std::string fJsonInputFileName = "inputFiles";
0194 std::string fJsonLegendComment = "legendText";
0195 std::string fJsonDrawPlotsForEachIOV = "drawPlotsForEachIOV";
0196 std::string fJsonNIovInOnePlot = "nIovInOnePlot";
0197 std::string fJsonUseLuminosityForTrends = "useLuminosityAxis";
0198 std::string fJsonSkipRunsWithNoData = "skipRunsWithNoData";
0199 std::string fJsonNormalizeQAplots = "normalizeQAplots";
0200 std::string fJsonSaveComment = "saveComment";
0201 std::string fJsonLumiPerIovFile = "lumiPerIovFile";
0202 std::string fJsonIovListMode = "lumiFileMode";
0203 std::string fJsonDrawYearLines = "drawYearLines";
0204 std::string fJsonYearLineColor = "yearLineColor";
0205 std::string fJsonYearLineWidth = "yearLineWidth";
0206 std::string fJsonYearLineStyle = "yearLineStyle";
0207 std::string fJsonRunsForLines = "runsForLines";
0208 std::string fJsonNameDrawTag = "drawTags";
0209 std::string fJsonNameTagInfo = "tagLabels";
0210 std::string fJsonNameTagTextSize = "tagTextSize";
0211 std::string fJsonNameTagTextFont = "tagTextFont";
0212 std::string fJsonWidePtBinBorders = "widePtBinBorders";
0213 std::string fJsonMakeIovListForSlides = "makeIovlistForSlides";
0214 std::string fJsonIovListForSlides = "iovListForSlides";
0215
0216 int fDebugLevel;
0217
0218 bool fDrawTrackQA;
0219 bool fDrawHistogram[knHistogramTypes];
0220 bool fDrawProfile[knProfileTypes];
0221 bool fDrawReferenceProfile;
0222 bool fDrawCentralEtaSummaryProfile;
0223 double fProfileLegendShiftTotalX;
0224 double fProfileLegendShiftTotalY;
0225 double fProfileLegendShiftColumnX[kMaxLegendColumns];
0226 double fProfileLegendShiftColumnY[kMaxLegendColumns];
0227 double fProfileLegendTextSize;
0228 int fProfileLegendTextFont;
0229 bool fDrawTrend[knTrendTypes];
0230 double fTrendLegendShiftTotalX;
0231 double fTrendLegendShiftTotalY;
0232 double fTrendLegendTextSize;
0233 int fTrendLegendTextFont;
0234
0235 bool fDrawTrendTag;
0236 std::vector<std::string> fTrendTagText;
0237 std::vector<double> fTrendTagPositionX;
0238 std::vector<double> fTrendTagPositionY;
0239 double fTrendTagTextSize;
0240 int fTrendTagTextFont;
0241
0242 int fTrendCanvasHeight;
0243 int fTrendCanvasWidth;
0244 double fTrendMarginLeft;
0245 double fTrendMarginRight;
0246 double fTrendMarginTop;
0247 double fTrendMarginBottom;
0248 double fTrendTitleOffsetX;
0249 double fTrendTitleOffsetY;
0250 double fTrendTitleSizeX;
0251 double fTrendTitleSizeY;
0252 double fTrendLabelOffsetX;
0253 double fTrendLabelOffsetY;
0254 double fTrendLabelSizeX;
0255 double fTrendLabelSizeY;
0256
0257 double fProfileZoomLow[knProfileTypes];
0258 double fProfileZoomHigh[knProfileTypes];
0259 double fTrendZoomLow[knTrendTypes];
0260 double fTrendZoomHigh[knTrendTypes];
0261
0262 std::vector<std::string> fInputFileNames;
0263 std::vector<std::string> fLegendComments;
0264 std::vector<int> fMarkerColor;
0265 std::vector<int> fMarkerStyle;
0266 std::vector<int> fMarkerSize;
0267 std::vector<bool> fCopyErrorColor;
0268 std::string fLegendTextForAllRuns;
0269 bool fDrawPlotsForEachIOV;
0270 int fNIovInOnePlot;
0271 bool fUseLuminosityForTrends;
0272 bool fSkipRunsWithNoData;
0273 bool fNormalizeQAplots;
0274 std::string fSaveComment;
0275
0276 std::string fLumiPerIovFile;
0277 std::string fIovListMode;
0278 bool fDrawYearLines;
0279 int fYearLineColor;
0280 int fYearLineWidth;
0281 int fYearLineStyle;
0282 std::vector<int> fRunsForLines;
0283 std::vector<double> fWidePtBinBorders;
0284
0285 bool fMakeIovListForSlides;
0286 std::string fIovListForSlides;
0287
0288
0289 int fDefaultColors[11] = {
0290 kBlue, kRed, kGreen + 2, kMagenta, kBlack, kCyan, kViolet + 3, kOrange, kPink - 7, kSpring + 3, kAzure - 7};
0291 int fDefaultStyle = 20;
0292 int fDefaultMarkerSize = 1;
0293 };
0294
0295 #endif