CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GeometryComparisonPlotter.h
Go to the documentation of this file.
1 #include <TROOT.h>
2 #include <iostream>
3 #include <fstream>
4 #include <sstream>
5 #include <vector>
6 
7 #include <TString.h>
8 #include <TStyle.h>
9 #include <TAxis.h>
10 #include <TGraph.h>
11 #include <TF1.h>
12 #include <TH1.h>
13 #include <TH2.h>
14 #include <TMultiGraph.h>
15 #include <TFile.h>
16 #include <TCanvas.h>
17 #include <TLegend.h>
18 #include <TTree.h>
19 #include <TDirectory.h>
20 #include <TMath.h>
21 #include <TPaveText.h>
22 #include <TLatex.h>
23 #include <TList.h>
24 
25 
27 {
28  // internal variables
29 #ifndef NB_SUBLEVELS
30 #define NB_SUBLEVELS 6
31 #endif
39  bool _print,
40  _legend,
41  _write,
44  _batchMode,
45  _1dModule,
46  _2dModule;
47  int _levelCut,
48  _grid_x,
49  _grid_y,
52 
53  // branches
54  map<TString, int> branch_i;
55  map<TString, float> branch_f,
56  _max, _min, _SF;
57  map<TString, TString> _units;
58 
59  // variables of external objects
60  TFile * tree_file;
61  TFile * output;
62  TTree * data;
63 
64  // methods
65  TString LateXstyle (TString);
66  TString LateXstyleTable (TString);
67  TString ExtensionFromPrintOption (TString);
68  TLegend * MakeLegend (double x1,
69  double y1,
70  double x2,
71  double y2,
72  int nPlottedSublevels,
73  const TString title = "");
74 
75 public:
76 
77  static int canvas_index; // to append to the name of the canvases in case of duplication
78  static int canvas_profile_index; // to append to the name of the canvases in case of duplication
79 
80  // constructor and destructor
81  GeometryComparisonPlotter(TString tree_file_name,
82  TString outputDirname = "output/",
83  TString modulesToPlot="all",
84  TString referenceName="Ideal",
85  TString alignmentName="Alignment",
86  bool plotOnlyGlobal=false,
87  bool makeProfilePlots=false);
89 
90  // main methods
91  void MakePlots (const vector<TString>,
92  const vector<TString>,
93  const vector<float>,
94  const vector<float>
95  );
96 
97  void MakeTables (const vector<TString>,
98  const vector<TString>,
99  const vector<float>,
100  const vector<float>);
101 
102  void WriteTable (const vector<TString> x,
103  unsigned int nLevelsTimesSlices,
104  float meanValue[10][24],
105  float RMS[10][24],
106  const TString nDigits,
107  const TString tableCaption,
108  const TString tableFileName);
109 
110 
111  // option methods
112  void SetPrint (const bool); // activates the printing of the individual and global pdf
113  void SetLegend (const bool); // activates the legends
114  void SetWrite (const bool); // activates the writing into a Root file
115  void Set1dModule (const bool); // cut to include 1D modules
116  void Set2dModule (const bool); // cut to include 2D modules
117 #define DEFAULT_LEVEL 1
118  void SetLevelCut (const int); // module level: level=1 (default)
119  void SetBatchMode (const bool); // activates the display of the canvases
120  void SetGrid (const int, // activates the display of the grids
121  const int);
122  void SetBranchMax (const TString, // sets a max value for the variable
123  const float); // by giving the name and the value
124  void SetBranchMin (const TString, // sets a min value for the variable
125  const float); // by giving the name and the value
126  void SetBranchSF (const TString, // sets a rescaling factor for the variable
127  const float); // by giving the name and the value
128  void SetBranchUnits (const TString, // writes de units next on the axis
129  const TString);
130  void SetOutputDirectoryName (const TString); // sets the output name of the directory
131  void SetOutputFileName (const TString); // sets the name of the root file (if applicable)
132  void SetPrintOption (const Option_t *); // litteraly the print option of the TPad::Print()
133 #define DEFAULT_WINDOW_WIDTH 3508
134 #define DEFAULT_WINDOW_HEIGHT 2480
135  void SetCanvasSize (const int window_width = DEFAULT_WINDOW_WIDTH,
136  const int window_height = DEFAULT_WINDOW_HEIGHT);
137 };
void WriteTable(const vector< TString > x, unsigned int nLevelsTimesSlices, float meanValue[10][24], float RMS[10][24], const TString nDigits, const TString tableCaption, const TString tableFileName)
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)
void SetBranchMax(const TString, const float)
void SetBranchUnits(const TString, const TString)
#define DEFAULT_WINDOW_WIDTH
map< TString, TString > _units
void SetBranchSF(const TString, const float)
#define NB_SUBLEVELS
void MakeTables(const vector< TString >, const vector< TString >, const vector< float >, const vector< float >)
TLegend * MakeLegend(double x1, double y1, double x2, double y2, int nPlottedSublevels, const TString title="")
#define DEFAULT_WINDOW_HEIGHT
void SetBranchMin(const TString, const float)
GeometryComparisonPlotter(TString tree_file_name, TString outputDirname="output/", TString modulesToPlot="all", TString referenceName="Ideal", TString alignmentName="Alignment", bool plotOnlyGlobal=false, bool makeProfilePlots=false)