File indexing completed on 2023-03-17 10:40:00
0001 #ifndef Alignment_OfflineValidation_GeometryComparisonPlotter_h
0002 #define Alignment_OfflineValidation_GeometryComparisonPlotter_h
0003
0004 #include <TROOT.h>
0005 #include <iostream>
0006 #include <fstream>
0007 #include <sstream>
0008 #include <vector>
0009
0010 #include "TString.h"
0011 #include "TStyle.h"
0012 #include "TAxis.h"
0013 #include "TGraph.h"
0014 #include "TF1.h"
0015 #include "TH1.h"
0016 #include "TH2.h"
0017 #include "TMultiGraph.h"
0018 #include "TFile.h"
0019 #include "TCanvas.h"
0020 #include "TLegend.h"
0021 #include "TTree.h"
0022 #include "TDirectory.h"
0023 #include "TMath.h"
0024 #include "TPaveText.h"
0025 #include "TLatex.h"
0026 #include "TList.h"
0027
0028 #include "boost/property_tree/ptree.hpp"
0029 namespace pt = boost::property_tree;
0030
0031 class GeometryComparisonPlotter {
0032
0033 #ifndef NB_SUBLEVELS
0034 #define NB_SUBLEVELS 6
0035 #endif
0036 TString _sublevel_names[NB_SUBLEVELS], _output_directory, _output_filename, _print_option, _module_plot_option,
0037 _alignment_name, _reference_name;
0038 bool _print, _legend, _write, _print_only_global, _make_profile_plots, _batchMode, _1dModule, _2dModule;
0039 int _levelCut, _grid_x, _grid_y, _window_width, _window_height,
0040 _canvas_index;
0041
0042
0043 std::map<TString, int> branch_i;
0044 std::map<TString, float> branch_f, _max, _min, _SF;
0045 std::map<TString, TString> _units;
0046
0047
0048 TFile *tree_file;
0049 TFile *output;
0050 TTree *data;
0051
0052
0053 TString LateXstyle(TString);
0054 TString LateXstyleTable(TString);
0055 TString ExtensionFromPrintOption(TString);
0056 TLegend *MakeLegend(double x1, double y1, double x2, double y2, int nPlottedSublevels, const TString title = "");
0057
0058 public:
0059 static int canvas_profile_index;
0060
0061
0062 GeometryComparisonPlotter(TString tree_file_name,
0063 TString outputDirname = "output/",
0064 TString modulesToPlot = "all",
0065 TString referenceName = "Ideal",
0066 TString alignmentName = "Alignment",
0067 bool plotOnlyGlobal = false,
0068 bool makeProfilePlots = false,
0069 int canvas_idx = 0);
0070 ~GeometryComparisonPlotter();
0071
0072
0073 void MakePlots(const std::vector<TString>, const std::vector<TString>, pt::ptree CFG);
0074
0075 void MakeTables(const std::vector<TString>, const std::vector<TString>, pt::ptree CFG);
0076
0077 void WriteTable(const std::vector<TString> x,
0078 unsigned int nLevelsTimesSlices,
0079 float meanValue[10][24],
0080 float RMS[10][24],
0081 const TString nDigits,
0082 const TString tableCaption,
0083 const TString tableFileName);
0084
0085
0086 void SetPrint(const bool);
0087 void SetLegend(const bool);
0088 void SetWrite(const bool);
0089 void Set1dModule(const bool);
0090 void Set2dModule(const bool);
0091 #define DEFAULT_LEVEL 1
0092 void SetLevelCut(const int);
0093 void SetBatchMode(const bool);
0094 void SetGrid(const int,
0095 const int);
0096 void SetBranchMax(const TString,
0097 const float);
0098 void SetBranchMin(const TString,
0099 const float);
0100 void SetBranchSF(const TString,
0101 const float);
0102 void SetBranchUnits(const TString,
0103 const TString);
0104 void SetOutputDirectoryName(const TString);
0105 void SetOutputFileName(const TString);
0106 void SetPrintOption(const Option_t *);
0107 #define DEFAULT_WINDOW_WIDTH 3508
0108 #define DEFAULT_WINDOW_HEIGHT 2480
0109 void SetCanvasSize(const int window_width = DEFAULT_WINDOW_WIDTH, const int window_height = DEFAULT_WINDOW_HEIGHT);
0110 };
0111 #endif