CMS 3D CMS Logo

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 
23 {
24  // internal variables
25 #ifndef NB_SUBLEVELS
26 #define NB_SUBLEVELS 6
27 #endif
36  bool _print,
37  _legend,
38  _write,
39  _batchMode,
40  _1dModule,
41  _2dModule;
42  int _levelCut,
43  _grid_x,
44  _grid_y,
47 
48  // branches
49  map<TString, int> branch_i;
50  map<TString, float> branch_f,
51  _max, _min, _SF;
52  map<TString, TString> _units;
53 
54  // variables of external objects
55  TFile * tree_file;
56  TFile * output;
57  TTree * data;
58 
59  // methods
60  TString LateXstyle (TString);
61  TString ExtensionFromPrintOption (TString);
62  TLegend * MakeLegend (double x1,
63  double y1,
64  double x2,
65  double y2,
66  const TString title = "");
67 
68 public:
69 
70  static int canvas_index; // to append to the name of the canvases in case of duplication
71 
72  // constructor and destructor
73  GeometryComparisonPlotter(TString tree_file_name,
74  TString outputDirname = "output/",
75  TString modulesToPlot="all",
76  TString referenceName="Ideal",
77  TString alignmentName="Alignment",
78  TString plotOnlyGlobal="false");
80 
81  // main methods
82  void MakePlots (const vector<TString>,
83  const vector<TString>,
84  const vector<float>,
85  const vector<float>
86  );
87 
88  // option methods
89  void SetPrint (const bool); // activates the printing of the individual and global pdf
90  void SetLegend (const bool); // activates the legends
91  void SetWrite (const bool); // activates the writing into a Root file
92  void Set1dModule (const bool); // cut to include 1D modules
93  void Set2dModule (const bool); // cut to include 2D modules
94 #define DEFAULT_LEVEL 1
95  void SetLevelCut (const int); // module level: level=1 (default)
96  void SetBatchMode (const bool); // activates the display of the canvases
97  void SetGrid (const int, // activates the display of the grids
98  const int);
99  void SetBranchMax (const TString, // sets a max value for the variable
100  const float); // by giving the name and the value
101  void SetBranchMin (const TString, // sets a min value for the variable
102  const float); // by giving the name and the value
103  void SetBranchSF (const TString, // sets a rescaling factor for the variable
104  const float); // by giving the name and the value
105  void SetBranchUnits (const TString, // writes de units next on the axis
106  const TString);
107  void SetOutputDirectoryName (const TString); // sets the output name of the directory
108  void SetOutputFileName (const TString); // sets the name of the root file (if applicable)
109  void SetPrintOption (const Option_t *); // litteraly the print option of the TPad::Print()
110 #define DEFAULT_WINDOW_WIDTH 3508
111 #define DEFAULT_WINDOW_HEIGHT 2480
112  void SetCanvasSize (const int window_width = DEFAULT_WINDOW_WIDTH,
113  const int window_height = DEFAULT_WINDOW_HEIGHT);
114 };
void SetCanvasSize(const int window_width=3508, const int window_height=2480)
void MakePlots(const vector< TString >, const vector< TString >, const vector< float >, const vector< float >)
void SetGrid(const int, const int)
GeometryComparisonPlotter(TString tree_file_name, TString outputDirname="output/", TString modulesToPlot="all", TString referenceName="Ideal", TString alignmentName="Alignment", TString plotOnlyGlobal="false")
void SetBranchMax(const TString, const float)
void SetBranchUnits(const TString, const TString)
#define DEFAULT_WINDOW_WIDTH
TLegend * MakeLegend(double x1, double y1, double x2, double y2, const TString title="")
void SetOutputDirectoryName(const TString)
void SetPrintOption(const Option_t *)
map< TString, TString > _units
void SetBranchSF(const TString, const float)
#define NB_SUBLEVELS
#define DEFAULT_WINDOW_HEIGHT
void SetBranchMin(const TString, const float)