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