CMS 3D CMS Logo

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 };
GeometryComparisonPlotter::_make_profile_plots
bool _make_profile_plots
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::~GeometryComparisonPlotter
~GeometryComparisonPlotter()
Definition: GeometryComparisonPlotter.cc:180
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
GeometryComparisonPlotter::SetOutputFileName
void SetOutputFileName(const TString)
Definition: GeometryComparisonPlotter.cc:1392
GeometryComparisonPlotter::SetBranchUnits
void SetBranchUnits(const TString, const TString)
Definition: GeometryComparisonPlotter.cc:1386
GeometryComparisonPlotter::_alignment_name
TString _alignment_name
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::LateXstyle
TString LateXstyle(TString)
Definition: GeometryComparisonPlotter.cc:1397
GeometryComparisonPlotter::GeometryComparisonPlotter
GeometryComparisonPlotter(TString tree_file_name, TString outputDirname="output/", TString modulesToPlot="all", TString referenceName="Ideal", TString alignmentName="Alignment", bool plotOnlyGlobal=false, bool makeProfilePlots=false)
Definition: GeometryComparisonPlotter.cc:26
GeometryComparisonPlotter::_print_only_global
bool _print_only_global
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::SetWrite
void SetWrite(const bool)
Definition: GeometryComparisonPlotter.cc:1372
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
GeometryComparisonPlotter::_grid_x
int _grid_x
Definition: GeometryComparisonPlotter.h:47
GeometryComparisonPlotter::canvas_index
static int canvas_index
Definition: GeometryComparisonPlotter.h:77
GeometryComparisonPlotter::_units
map< TString, TString > _units
Definition: GeometryComparisonPlotter.h:57
GeometryComparisonPlotter::_sublevel_names
TString _sublevel_names[6]
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::_print
bool _print
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::_max
map< TString, float > _max
Definition: GeometryComparisonPlotter.h:55
GeometryComparisonPlotter::_2dModule
bool _2dModule
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::branch_f
map< TString, float > branch_f
Definition: GeometryComparisonPlotter.h:55
GeometryComparisonPlotter::Set2dModule
void Set2dModule(const bool)
Definition: GeometryComparisonPlotter.cc:1374
DDAxes::x
GeometryComparisonPlotter::LateXstyleTable
TString LateXstyleTable(TString)
Definition: GeometryComparisonPlotter.cc:1410
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
GeometryComparisonPlotter::output
TFile * output
Definition: GeometryComparisonPlotter.h:61
GeometryComparisonPlotter::MakeTables
void MakeTables(const vector< TString >, const vector< TString >, const vector< float >, const vector< float >)
Definition: GeometryComparisonPlotter.cc:1083
GeometryComparisonPlotter::SetOutputDirectoryName
void SetOutputDirectoryName(const TString)
Definition: GeometryComparisonPlotter.cc:1393
GeometryComparisonPlotter::SetPrintOption
void SetPrintOption(const Option_t *)
Definition: GeometryComparisonPlotter.cc:1388
GeometryComparisonPlotter::ExtensionFromPrintOption
TString ExtensionFromPrintOption(TString)
Definition: GeometryComparisonPlotter.cc:1423
DEFAULT_WINDOW_WIDTH
#define DEFAULT_WINDOW_WIDTH
Definition: GeometryComparisonPlotter.h:133
GeometryComparisonPlotter::SetBranchSF
void SetBranchSF(const TString, const float)
Definition: GeometryComparisonPlotter.cc:1384
GeometryComparisonPlotter::SetPrint
void SetPrint(const bool)
Definition: GeometryComparisonPlotter.cc:1370
RMS
Definition: trackSplitPlot.h:34
GeometryComparisonPlotter::_window_width
int _window_width
Definition: GeometryComparisonPlotter.h:47
GeometryComparisonPlotter::tree_file
TFile * tree_file
Definition: GeometryComparisonPlotter.h:60
GeometryComparisonPlotter::WriteTable
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)
Definition: GeometryComparisonPlotter.cc:1470
GeometryComparisonPlotter::branch_i
map< TString, int > branch_i
Definition: GeometryComparisonPlotter.h:54
GeometryComparisonPlotter::SetGrid
void SetGrid(const int, const int)
Definition: GeometryComparisonPlotter.cc:1377
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
GeometryComparisonPlotter::SetBatchMode
void SetBatchMode(const bool)
Definition: GeometryComparisonPlotter.cc:1376
GeometryComparisonPlotter::canvas_profile_index
static int canvas_profile_index
Definition: GeometryComparisonPlotter.h:78
GeometryComparisonPlotter::Set1dModule
void Set1dModule(const bool)
Definition: GeometryComparisonPlotter.cc:1373
GeometryComparisonPlotter::_1dModule
bool _1dModule
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::_levelCut
int _levelCut
Definition: GeometryComparisonPlotter.h:47
GeometryComparisonPlotter::SetLevelCut
void SetLevelCut(const int)
Definition: GeometryComparisonPlotter.cc:1375
GeometryComparisonPlotter::_reference_name
TString _reference_name
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::_grid_y
int _grid_y
Definition: GeometryComparisonPlotter.h:47
GeometryComparisonPlotter::SetLegend
void SetLegend(const bool)
Definition: GeometryComparisonPlotter.cc:1371
GeometryComparisonPlotter::_batchMode
bool _batchMode
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::SetCanvasSize
void SetCanvasSize(const int window_width=3508, const int window_height=2480)
Definition: GeometryComparisonPlotter.cc:1389
GeometryComparisonPlotter::MakePlots
void MakePlots(const vector< TString >, const vector< TString >, const vector< float >, const vector< float >)
Definition: GeometryComparisonPlotter.cc:192
GeometryComparisonPlotter::_module_plot_option
TString _module_plot_option
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::_output_filename
TString _output_filename
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::MakeLegend
TLegend * MakeLegend(double x1, double y1, double x2, double y2, int nPlottedSublevels, const TString title="")
Definition: GeometryComparisonPlotter.cc:1445
GeometryComparisonPlotter::_write
bool _write
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::SetBranchMin
void SetBranchMin(const TString, const float)
Definition: GeometryComparisonPlotter.cc:1382
NB_SUBLEVELS
#define NB_SUBLEVELS
Definition: GeometryComparisonPlotter.h:30
GeometryComparisonPlotter::_legend
bool _legend
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::SetBranchMax
void SetBranchMax(const TString, const float)
Definition: GeometryComparisonPlotter.cc:1380
GeometryComparisonPlotter
Definition: GeometryComparisonPlotter.h:26
GeometryComparisonPlotter::_min
map< TString, float > _min
Definition: GeometryComparisonPlotter.h:55
GeometryComparisonPlotter::_SF
map< TString, float > _SF
Definition: GeometryComparisonPlotter.h:55
GeometryComparisonPlotter::_print_option
TString _print_option
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::_window_height
int _window_height
Definition: GeometryComparisonPlotter.h:47
GeometryComparisonPlotter::_output_directory
TString _output_directory
Definition: GeometryComparisonPlotter.h:32
DEFAULT_WINDOW_HEIGHT
#define DEFAULT_WINDOW_HEIGHT
Definition: GeometryComparisonPlotter.h:134
GeometryComparisonPlotter::data
TTree * data
Definition: GeometryComparisonPlotter.h:62