CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GeometryComparisonPlotter.h
Go to the documentation of this file.
1 #include <TROOT.h>
2 #include <iostream>
3 #include <vector>
4 
5 #include <TString.h>
6 #include <TStyle.h>
7 #include <TAxis.h>
8 #include <TGraph.h>
9 #include <TH2.h>
10 #include <TMultiGraph.h>
11 #include <TFile.h>
12 #include <TCanvas.h>
13 #include <TLegend.h>
14 #include <TTree.h>
15 #include <TDirectory.h>
16 #include <TMath.h>
17 #include <TPaveText.h>
18 #include <TLatex.h>
19 #include <TList.h>
20 
21 using namespace std;
22 
24 {
25  // internal variables
26 #ifndef NB_SUBLEVELS
27 #define NB_SUBLEVELS 6
28 #endif
29  TString _sublevel_names[NB_SUBLEVELS],
30  _output_directory,
31  _output_filename,
32  _print_option,
33  _module_plot_option,
34  _alignment_name,
35  _reference_name,
36  _print_only_global;
37  bool _print,
38  _legend,
39  _write,
40  _batchMode,
41  _1dModule,
42  _2dModule;
43  int _levelCut,
44  _grid_x,
45  _grid_y,
47  _window_height;
48 
49  // branches
50  map<TString, int> branch_i;
51  map<TString, float> branch_f,
52  _max, _min, _SF;
53  map<TString, TString> _units;
54 
55  // variables of external objects
56  TFile * tree_file;
57  TFile * output;
58  TTree * data;
59 
60  // methods
61  TString LateXstyle (TString);
62  TString ExtensionFromPrintOption (TString);
63  TLegend * MakeLegend (double x1,
64  double y1,
65  double x2,
66  double y2,
67  const TString title = "");
68 
69 public:
70 
71  static int canvas_index; // to append to the name of the canvases in case of duplication
72 
73  // constructor and destructor
74  GeometryComparisonPlotter(TString tree_file_name,
75  TString outputDirname = "output/",
76  TString modulesToPlot="all",
77  TString referenceName="Ideal",
78  TString alignmentName="Alignment",
79  TString plotOnlyGlobal="false");
81 
82  // main methods
83  void MakePlots (const vector<TString>,
84  const vector<TString>,
85  const vector<float>,
86  const vector<float>
87  );
88 
89  // option methods
90  void SetPrint (const bool); // activates the printing of the individual and global pdf
91  void SetLegend (const bool); // activates the legends
92  void SetWrite (const bool); // activates the writing into a Root file
93  void Set1dModule (const bool); // cut to include 1D modules
94  void Set2dModule (const bool); // cut to include 2D modules
95 #define DEFAULT_LEVEL 1
96  void SetLevelCut (const int); // module level: level=1 (default)
97  void SetBatchMode (const bool); // activates the display of the canvases
98  void SetGrid (const int, // activates the display of the grids
99  const int);
100  void SetBranchMax (const TString, // sets a max value for the variable
101  const float); // by giving the name and the value
102  void SetBranchMin (const TString, // sets a min value for the variable
103  const float); // by giving the name and the value
104  void SetBranchSF (const TString, // sets a rescaling factor for the variable
105  const float); // by giving the name and the value
106  void SetBranchUnits (const TString, // writes de units next on the axis
107  const TString);
108  void SetOutputDirectoryName (const TString); // sets the output name of the directory
109  void SetOutputFileName (const TString); // sets the name of the root file (if applicable)
110  void SetPrintOption (const Option_t *); // litteraly the print option of the TPad::Print()
111 #define DEFAULT_WINDOW_WIDTH 3508
112 #define DEFAULT_WINDOW_HEIGHT 2480
113  void SetCanvasSize (const int window_width = DEFAULT_WINDOW_WIDTH,
114  const int window_height = DEFAULT_WINDOW_HEIGHT);
115 };
#define DEFAULT_WINDOW_WIDTH
map< TString, TString > _units
#define NB_SUBLEVELS
#define DEFAULT_WINDOW_HEIGHT