CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
GeometryComparisonPlotter Class Reference

#include <GeometryComparisonPlotter.h>

Public Member Functions

 GeometryComparisonPlotter (TString tree_file_name, TString outputDirname="output/", TString modulesToPlot="all", TString referenceName="Ideal", TString alignmentName="Alignment", bool plotOnlyGlobal=false, bool makeProfilePlots=false)
 
void MakePlots (const vector< TString >, const vector< TString >, const vector< float >, const vector< float >)
 
void MakeTables (const vector< TString >, const vector< TString >, const vector< float >, const vector< float >)
 
void Set1dModule (const bool)
 
void Set2dModule (const bool)
 
void SetBatchMode (const bool)
 
void SetBranchMax (const TString, const float)
 
void SetBranchMin (const TString, const float)
 
void SetBranchSF (const TString, const float)
 
void SetBranchUnits (const TString, const TString)
 
void SetCanvasSize (const int window_width=3508, const int window_height=2480)
 
void SetGrid (const int, const int)
 
void SetLegend (const bool)
 
void SetLevelCut (const int)
 
void SetOutputDirectoryName (const TString)
 
void SetOutputFileName (const TString)
 
void SetPrint (const bool)
 
void SetPrintOption (const Option_t *)
 
void SetWrite (const bool)
 
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)
 
 ~GeometryComparisonPlotter ()
 

Static Public Attributes

static int canvas_index
 
static int canvas_profile_index
 

Private Member Functions

TString ExtensionFromPrintOption (TString)
 
TString LateXstyle (TString)
 
TString LateXstyleTable (TString)
 
TLegend * MakeLegend (double x1, double y1, double x2, double y2, int nPlottedSublevels, const TString title="")
 

Private Attributes

bool _1dModule
 
bool _2dModule
 
TString _alignment_name
 
bool _batchMode
 
int _grid_x
 
int _grid_y
 
bool _legend
 
int _levelCut
 
bool _make_profile_plots
 
map< TString, float > _max
 
map< TString, float > _min
 
TString _module_plot_option
 
TString _output_directory
 
TString _output_filename
 
bool _print
 
bool _print_only_global
 
TString _print_option
 
TString _reference_name
 
map< TString, float > _SF
 
TString _sublevel_names [6]
 
map< TString, TString > _units
 
int _window_height
 
int _window_width
 
bool _write
 
map< TString, float > branch_f
 
map< TString, int > branch_i
 
TTree * data
 
TFile * output
 
TFile * tree_file
 

Detailed Description

Definition at line 26 of file GeometryComparisonPlotter.h.

Constructor & Destructor Documentation

◆ 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 at line 28 of file GeometryComparisonPlotter.cc.

35  : _output_directory(output_directory + TString(output_directory.EndsWith("/") ? "" : "/")),
36  _output_filename("comparison.root"),
37  _print_option("pdf"),
38  _module_plot_option(modulesToPlot),
39  _alignment_name(alignmentName),
40  _reference_name(referenceName),
41  _print_only_global(printOnlyGlobal),
42  _make_profile_plots(makeProfilePlots),
43  _print(true), // print the graphs in a file (e.g. pdf)
44  _legend(true), // print the graphs in a file (e.g. pdf)
45  _write(true), // write the graphs in a root file
46  _batchMode(
47 #ifdef DEBUG
48  false // false = display canvases (very time- and resource-consuming)
49 #else
50  true // true = no canvases
51 #endif
52  ),
53  _1dModule(true), // cut on 1d modules
54  _2dModule(true), // cut on 2d modules
55  _levelCut(DEFAULT_LEVEL), // module level (see branch of same name)
56  _grid_x(0), // by default no display the grid in the canvases
57  _grid_y(0), // by default no display the grid in the canvases
60 #ifdef TALKATIVE
61  cout << ">>> TALKATIVE MODE ACTIVATED <<<" << endl;
62 #endif
63 #ifdef DEBUG
64  cout << ">>> DEBUG MODE ACTIVATED <<<" << endl;
65  cout << __FILE__ << ":" << __LINE__ << ":Info: inside constructor of GeometryComparisonPlotter utility" << endl;
66 #endif
67 
68  //_sublevel_names = {"PXB", "PXF", "TIB", "TID", "TOB", "TEC"}; // C++11
69  _sublevel_names[0] = TString("PXB");
70  _sublevel_names[1] = TString("PXF");
71  _sublevel_names[2] = TString("TIB");
72  _sublevel_names[3] = TString("TID");
73  _sublevel_names[4] = TString("TOB");
74  _sublevel_names[5] = TString("TEC");
75  // TO DO: handle other structures
76 
77  // read tree
78  tree_file = new TFile(tree_file_name, "UPDATE");
79  data = (TTree *)tree_file->Get("alignTree");
80  // int branches
81  data->SetBranchAddress("id", &branch_i["id"]);
82  data->SetBranchAddress("inModuleList", &branch_i["inModuleList"]);
83  data->SetBranchAddress("badModuleQuality", &branch_i["badModuleQuality"]);
84  data->SetBranchAddress("mid", &branch_i["mid"]);
85  data->SetBranchAddress("level", &branch_i["level"]);
86  data->SetBranchAddress("mlevel", &branch_i["mlevel"]);
87  data->SetBranchAddress("sublevel", &branch_i["sublevel"]);
88  data->SetBranchAddress("useDetId", &branch_i["useDetId"]);
89  data->SetBranchAddress("detDim", &branch_i["detDim"]);
90  // float branches
91  data->SetBranchAddress("x", &branch_f["x"]);
92  data->SetBranchAddress("y", &branch_f["y"]);
93  data->SetBranchAddress("z", &branch_f["z"]);
94  data->SetBranchAddress("alpha", &branch_f["alpha"]);
95  data->SetBranchAddress("beta", &branch_f["beta"]);
96  data->SetBranchAddress("gamma", &branch_f["gamma"]);
97  data->SetBranchAddress("phi", &branch_f["phi"]);
98  data->SetBranchAddress("eta", &branch_f["eta"]);
99  data->SetBranchAddress("r", &branch_f["r"]);
100  data->SetBranchAddress("dx", &branch_f["dx"]);
101  data->SetBranchAddress("dy", &branch_f["dy"]);
102  data->SetBranchAddress("dz", &branch_f["dz"]);
103  data->SetBranchAddress("dphi", &branch_f["dphi"]);
104  data->SetBranchAddress("dr", &branch_f["dr"]);
105  data->SetBranchAddress("dalpha", &branch_f["dalpha"]);
106  data->SetBranchAddress("dbeta", &branch_f["dbeta"]);
107  data->SetBranchAddress("dgamma", &branch_f["dgamma"]);
108  if (data->GetBranch("rdphi") ==
109  0x0) // in the case of rdphi branch not existing, it is created from r and dphi branches
110  {
111 #ifdef TALKATIVE
112  cout << __FILE__ << ":" << __LINE__
113  << ":Info: computing the rdphi branch from r and dphi branches (assuming they exist...)" << endl;
114 #endif
115  TBranch *br_rdphi = data->Branch("rdphi", &branch_f["rdphi"], "rdphi/F");
116  for (unsigned int ientry = 0; ientry < data->GetEntries(); ientry++) {
117  data->GetEntry(ientry);
118  branch_f["rdphi"] = branch_f["r"] * branch_f["dphi"];
119  br_rdphi->Fill();
120  }
121  } else
122  data->SetBranchAddress("rdphi", &branch_f["rdphi"]);
123 
124 #ifdef DEBUG
125  cout << __FILE__ << ":" << __LINE__ << ":Info: branch addresses set" << endl;
126 #endif
127 
128  // style
129  gROOT->Reset();
130 
131  data->SetMarkerSize(0.5);
132  data->SetMarkerStyle(6);
133 
134  gStyle->SetOptStat("emr");
135  gStyle->SetTitleAlign(22);
136  gStyle->SetTitleX(0.5);
137  gStyle->SetTitleY(0.97);
138  gStyle->SetTitleFont(62);
139  //gStyle->SetOptTitle(0);
140 
141  gStyle->SetTextFont(132);
142  gStyle->SetTextSize(0.08);
143  gStyle->SetLabelFont(132, "x");
144  gStyle->SetLabelFont(132, "y");
145  gStyle->SetLabelFont(132, "z");
146  gStyle->SetTitleSize(0.08, "x");
147  gStyle->SetTitleSize(0.08, "y");
148  gStyle->SetTitleSize(0.08, "z");
149  gStyle->SetLabelSize(0.08, "x");
150  gStyle->SetLabelSize(0.08, "y");
151  gStyle->SetLabelSize(0.08, "z");
152 
153  gStyle->SetMarkerStyle(8);
154  gStyle->SetHistLineWidth(2);
155  gStyle->SetLineStyleString(2, "[12 12]"); // postscript dashes
156 
157  gStyle->SetFrameBorderMode(0);
158  gStyle->SetCanvasBorderMode(0);
159  gStyle->SetPadBorderMode(0);
160  gStyle->SetPadColor(0);
161  gStyle->SetCanvasColor(0);
162  gStyle->SetTitleColor(1);
163  gStyle->SetStatColor(0);
164  gStyle->SetStatBorderSize(1);
165  gStyle->SetFrameFillColor(0);
166 
167  gStyle->SetPadTickX(1);
168  gStyle->SetPadTickY(1);
169 
170  gStyle->SetPadTopMargin(0.1);
171  gStyle->SetPadRightMargin(0.05);
172  gStyle->SetPadBottomMargin(0.16);
173  gStyle->SetPadLeftMargin(0.18);
174 
175 #ifdef DEBUG
176  cout << __FILE__ << ":" << __LINE__ << ":Info: end of constructor" << endl;
177 #endif
178 }

References _sublevel_names, branch_f, branch_i, gather_cfg::cout, data, and tree_file.

◆ ~GeometryComparisonPlotter()

GeometryComparisonPlotter::~GeometryComparisonPlotter ( )

Definition at line 180 of file GeometryComparisonPlotter.cc.

180  {
181 #ifdef DEBUG
182  cout << __FILE__ << ":" << __LINE__ << ":Info: in destructor of the GeometryComparisonPlotter utility" << endl;
183 #endif
184  tree_file->Close();
185 #ifdef DEBUG
186  cout << __FILE__ << ":" << __LINE__ << ":Info: ending." << endl;
187 #endif
188 }

References gather_cfg::cout, and tree_file.

Member Function Documentation

◆ ExtensionFromPrintOption()

TString GeometryComparisonPlotter::ExtensionFromPrintOption ( TString  print_option)
private

Definition at line 1481 of file GeometryComparisonPlotter.cc.

1481  {
1482  if (print_option.Contains("pdf"))
1483  return TString(".pdf");
1484  else if (print_option.Contains("eps"))
1485  return TString(".eps");
1486  else if (print_option.Contains("ps"))
1487  return TString(".ps");
1488  else if (print_option.Contains("svg"))
1489  return TString(".svg");
1490  else if (print_option.Contains("tex"))
1491  return TString(".tex");
1492  else if (print_option.Contains("gif"))
1493  return TString(".gif");
1494  else if (print_option.Contains("xpm"))
1495  return TString(".xpm");
1496  else if (print_option.Contains("png"))
1497  return TString(".png");
1498  else if (print_option.Contains("jpg"))
1499  return TString(".jpg");
1500  else if (print_option.Contains("tiff"))
1501  return TString(".tiff");
1502  else if (print_option.Contains("cxx"))
1503  return TString(".cxx");
1504  else if (print_option.Contains("xml"))
1505  return TString(".xml");
1506  else if (print_option.Contains("root"))
1507  return TString(".root");
1508  else {
1509  cout << __FILE__ << ":" << __LINE__ << ":Warning: unknown format. Returning .pdf, but possibly wrong..." << endl;
1510  return TString(".pdf");
1511  }
1512 }

References gather_cfg::cout.

Referenced by MakePlots().

◆ LateXstyle()

TString GeometryComparisonPlotter::LateXstyle ( TString  word)
private

Definition at line 1443 of file GeometryComparisonPlotter.cc.

1443  {
1444  word.ToLower();
1445  if (word.BeginsWith("d"))
1446  word.ReplaceAll("d", "#Delta");
1447  if (word == TString("rdphi"))
1448  word = "r#Delta#phi"; // TO DO: find something less ad hoc...
1449  else if (word.EndsWith("phi"))
1450  word.ReplaceAll("phi", "#phi");
1451  else if (word.EndsWith("alpha"))
1452  word.ReplaceAll("alpha", "#alpha");
1453  else if (word.EndsWith("beta"))
1454  word.ReplaceAll("beta", "#beta");
1455  else if (word.EndsWith("gamma"))
1456  word.ReplaceAll("gamma", "#gamma");
1457  else if (word.EndsWith("eta"))
1458  word.ReplaceAll("eta", "#eta");
1459  return word;
1460 }

Referenced by MakePlots().

◆ LateXstyleTable()

TString GeometryComparisonPlotter::LateXstyleTable ( TString  word)
private

Definition at line 1462 of file GeometryComparisonPlotter.cc.

1462  {
1463  word.ToLower();
1464  if (word.BeginsWith("d"))
1465  word.ReplaceAll("d", "$\\Delta$");
1466  if (word == TString("rdphi"))
1467  word = "r$\\Delta\\phi$"; // TO DO: find something less ad hoc...
1468  else if (word.EndsWith("phi"))
1469  word.ReplaceAll("phi", "$\\phi$");
1470  else if (word.EndsWith("alpha"))
1471  word.ReplaceAll("alpha", "$\\alpha$");
1472  else if (word.EndsWith("beta"))
1473  word.ReplaceAll("beta", "$\\beta$");
1474  else if (word.EndsWith("gamma"))
1475  word.ReplaceAll("gamma", "#$\\gamma$");
1476  else if (word.EndsWith("eta"))
1477  word.ReplaceAll("eta", "$\\eta$");
1478  return word;
1479 }

Referenced by WriteTable().

◆ MakeLegend()

TLegend * GeometryComparisonPlotter::MakeLegend ( double  x1,
double  y1,
double  x2,
double  y2,
int  nPlottedSublevels,
const TString  title = "" 
)
private

Definition at line 1514 of file GeometryComparisonPlotter.cc.

1515  {
1516  TLegend *legend = new TLegend(x1, y1, x2, y2, title.Data(), "NBNDC");
1517  legend->SetNColumns(nPlottedSublevels);
1518  legend->SetFillColor(0);
1519  legend->SetLineColor(0); // redundant with option
1520  legend->SetLineWidth(0); // redundant with option
1521  for (int isublevel = 0; isublevel < nPlottedSublevels;
1522  isublevel++) // nPlottedSublevels is either NB_SUBLEVELS for the tracker or 2 for the pixel
1523  {
1524  TGraph *g = new TGraph(0);
1525  g->SetMarkerColor(COLOR_CODE(isublevel));
1526  g->SetFillColor(COLOR_CODE(isublevel));
1527  g->SetMarkerStyle(kFullSquare);
1528  g->SetMarkerSize(10);
1529  legend->AddEntry(g, _sublevel_names[isublevel], "p");
1530  }
1531  return legend;
1532 }

References _sublevel_names, COLOR_CODE, g, listHistos::legend, runGCPTkAlMap::title, testProducerWithPsetDescEmpty_cfi::x1, testProducerWithPsetDescEmpty_cfi::x2, testProducerWithPsetDescEmpty_cfi::y1, and testProducerWithPsetDescEmpty_cfi::y2.

Referenced by MakePlots().

◆ MakePlots()

void GeometryComparisonPlotter::MakePlots ( const vector< TString >  x,
const vector< TString >  y,
const vector< float >  dyMin,
const vector< float >  dyMax 
)

-1) check that only existing branches are called

0) min and max values

1) declare TGraphs and Histograms for profile plots if these are to be plotted

2) loop on the TTree data

3) merge TGraph objects into TMultiGraph objects, then draw, print and write (according to the options _batchMode, _print and _write respectively)

TRACKER and PIXEL

SUBLEVELS (1..6)

TRACKER

PIXEL

SUBLEVELS (1..6)

Definition at line 191 of file GeometryComparisonPlotter.cc.

196 {
198  // (we use a macro to avoid copy/paste)
199 #define CHECK_BRANCHES(branchname_vector) \
200  for (unsigned int i = 0; i < branchname_vector.size(); i++) { \
201  if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \
202  cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." \
203  << endl; \
204  return; \
205  } \
206  }
207  CHECK_BRANCHES(x);
208  CHECK_BRANCHES(y);
209 
210  const unsigned int nentries = data->GetEntries();
211 
212 #ifdef TALKATIVE
213  cout << __FILE__ << ":" << __LINE__ << ":Info: ";
214  INSIDE_VECTOR(x);
215  cout << endl << __FILE__ << ":" << __LINE__ << ":Info: ";
216  INSIDE_VECTOR(y);
217  cout << endl;
218 #endif
219 
221  // the max and min of the graphs are computed from the tree if they have not been manually input yet
222  // (we use a macro to avoid copy/paste)
223 #define LIMITS(axes_vector) \
224  for (unsigned int i = 0; i < axes_vector.size(); i++) { \
225  if (_SF.find(axes_vector[i]) == _SF.end()) \
226  _SF[axes_vector[i]] = 1.; \
227  if (_min.find(axes_vector[i]) == _min.end()) \
228  _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \
229  if (_max.find(axes_vector[i]) == _max.end()) \
230  _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \
231  }
232  LIMITS(x);
233  LIMITS(y);
234 
235 #ifdef TALKATIVE
236  CHECK_MAP_CONTENT(_min, float);
237  CHECK_MAP_CONTENT(_max, float);
238  CHECK_MAP_CONTENT(_SF, float);
239 #endif
240 
242  // the idea is to produce at the end a table of 8 TMultiGraphs and histograms:
243  // - 0=Tracker, with color code for the different sublevels
244  // - 1..6=different sublevels, with color code for z < or > 0
245  // - 7=only pixel with color code for BPIX and FPIX
246 
247  // (convention: the six first (resp. last) correspond to z>0 (resp. z<0))
248  // Modules with bad quality and in a list of modules that is given
249  // by the user (e.g. list of bad/untouched modules, default: empty list)
250  // are stored in seperate graphs and might be plotted (depends on the module
251  // plot option, default: all modules plotted)
252  // This means that 3*2*6 TGraphs will be filled during the loop on the TTree,
253  // and will be arranged differently with different color codes in the TMultiGraphs
254 
255  // For the profile plots
256  // Either all modules, only good modules or good modules + those in a given list will be plotted
257  // This means that 2*6 TH2F will be filled during the loop on the TTree,
258  // and will be arranged differently with different color codes in the Histograms
259 #ifndef NB_SUBLEVELS
260 #define NB_SUBLEVELS 6
261 #endif
262 #define NB_Z_SLICES 2
263 #define NB_MODULE_QUALITY 3
264 #define COLOR_CODE(icolor) int(icolor / 4) + icolor + 1
265 
266  TGraph *graphs[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY];
267  long int ipoint[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY];
268 
269  TMultiGraph
270  *mgraphs[x.size()][y.size()]
271  [2 + NB_SUBLEVELS]; // the 0th is for global plots, the 1..6th for sublevel plots, 7th for pixel only
272  TCanvas *c[x.size()][y.size()][2 + NB_SUBLEVELS], *c_global[2 + NB_SUBLEVELS];
273  canvas_index++; // this static index is a safety used in case the MakePlots method is used several times to avoid overloading
274 
275  // histograms for profile plots,
276  // 2D-hists to store the data
277  // 1D-hists to calculate mean and sigma of y-values for each x-bin of the 2D-hists and for the final profile hist
278  TH2F *histos2D[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES];
279  TH1F *histos[x.size()][y.size()][NB_SUBLEVELS * NB_Z_SLICES];
280  TH1F *histosYValues[x.size()][y.size()]
281  [NB_SUBLEVELS * NB_Z_SLICES]; // Used to calculate the mean and RMS for each x-bin of the 2D-hist
282  TH1F *histosTracker
283  [x.size()][y.size()]
284  [NB_SUBLEVELS *
285  NB_Z_SLICES]; // for the tracker plots all histos are copied to avoid using the same hists in different canvas
286 
287  TCanvas *c_hist[x.size()][y.size()][2 + NB_SUBLEVELS], *c_global_hist[2 + NB_SUBLEVELS];
288 
289  unsigned int nXBins; // Sensible number of x-bins differs depending on the variable
290 
291  for (unsigned int ic = 0; ic <= NB_SUBLEVELS + 1; ic++) {
292  c_global[ic] = new TCanvas(
293  TString::Format(
294  "global_%s_%d", ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data()), canvas_index),
295  TString::Format("Global overview of the %s variables",
296  ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data())),
299  c_global[ic]->Divide(x.size(), y.size());
300 
301  if (_make_profile_plots) {
302  c_global_hist[ic] =
303  new TCanvas(TString::Format("global_profile_plots_%s_%d",
304  ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data()),
305  canvas_index),
306  TString::Format("Global overview profile plots of the %s variables",
307  ic == 0 ? "tracker" : (ic == 7 ? "pixel" : _sublevel_names[ic - 1].Data())),
310  c_global_hist[ic]->Divide(x.size(), y.size());
311  }
312  }
313 
314  for (unsigned int ix = 0; ix < x.size(); ix++) {
315  for (unsigned int iy = 0; iy < y.size(); iy++) {
316  //if (x[ix] == y[iy]) continue; // do not plot graphs like (r,r) or (phi,phi)
317  for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY; igraph++) {
318  // declaring
319  ipoint[ix][iy][igraph] =
320  0; // the purpose of an index for every graph is to avoid thousands of points at the origin of each
321  graphs[ix][iy][igraph] = new TGraph();
322 
323  graphs[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph));
324  graphs[ix][iy][igraph]->SetMarkerStyle(6);
325  // pimping
326  graphs[ix][iy][igraph]->SetName(
327  x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] +
328  TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n"
329  : "p") // graphs for negative/positive z
330  + TString(igraph >= NB_SUBLEVELS * NB_Z_SLICES ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? "bad" : "list")
331  : "good")); // graphs for good, bad modules and from a list
332  graphs[ix][iy][igraph]->SetTitle(
333  _sublevel_names[igraph % NB_SUBLEVELS] +
334  TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? " at z<0" : " at z>=0") +
335  TString(igraph >= NB_SUBLEVELS * NB_Z_SLICES
336  ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? " bad modules" : " in list")
337  : " good modules") +
338  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) + " /" +
339  _units[y[iy]]);
340  graphs[ix][iy][igraph]->SetMarkerStyle(
341  igraph >= NB_SUBLEVELS * NB_Z_SLICES
342  ? (igraph >= 2 * NB_SUBLEVELS * NB_Z_SLICES ? 4 : 5)
343  : 6); // empty circle for bad modules, X for those in list, dot for good ones
344  }
345  }
346  }
347 
348  // Use seperate loop for the profile histograms since we do not produce histograms for the different module qualities
349  if (_make_profile_plots) {
350  for (unsigned int ix = 0; ix < x.size(); ix++) {
351  if (x[ix] == "phi")
352  nXBins = 10;
353  else
354  nXBins = 40;
355 
356  for (unsigned int iy = 0; iy < y.size(); iy++) {
357  for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES; igraph++) {
358  // declaring
359  histos2D[ix][iy][igraph] =
360  new TH2F("2Dhist" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] +
361  TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") +
362  TString(std::to_string(canvas_index)),
363  "",
364  nXBins,
365  _min[x[ix]],
366  _max[x[ix]],
367  1000,
368  _min[y[iy]],
369  _max[y[iy]] + 1.);
370  }
371  }
372  }
373  }
374 
375 #ifdef DEBUG
376  cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TGraph[" << x.size() << "][" << y.size() << "]["
377  << NB_SUBLEVELS * NB_Z_SLICES * NB_MODULE_QUALITY << "] ended." << endl;
378 #endif
379 
381 #ifdef DEBUG
382  cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl;
383 #endif
384 #ifdef TALKATIVE
385  unsigned int progress = 0;
386  cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl;
387 #endif
388  for (unsigned int ientry = 0; ientry < nentries; ientry++) {
389 #ifdef TALKATIVE
390  if (10 * ientry / nentries != progress) {
391  progress = 10 * ientry / nentries;
392  cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10 * progress << "%" << endl;
393  }
394 #endif
395  // load current tree entry
396  data->GetEntry(ientry);
397 
398  // CUTS on entry
399  if (branch_i["level"] != _levelCut)
400  continue;
401  if (!_1dModule && branch_i["detDim"] == 1)
402  continue;
403  if (!_2dModule && branch_i["detDim"] == 2)
404  continue;
405 
406  // loop on the different couples of variables to plot in a graph
407  for (unsigned int ix = 0; ix < x.size(); ix++) {
408  // CUTS on x[ix]
409  if (_SF[x[ix]] * branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]] * branch_f[x[ix]] < _min[x[ix]]) {
410  //#ifdef DEBUG
411  // cout << "branch_f[x[ix]]=" << branch_f[x[ix]] << endl;
412  //#endif
413  continue;
414  }
415 
416  for (unsigned int iy = 0; iy < y.size(); iy++) {
417  // CUTS on y[iy]
418  //if (x[ix] == y[iy]) continue; // TO DO: handle display when such a case occurs
419  if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS)
420  continue;
421 
422  // FILLING histograms take even those outside the plotted range into account
423  if (_make_profile_plots) {
424  if (_module_plot_option == "all") {
425  const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS);
426  histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
427  } else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0) {
428  const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS);
429  histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
430  } else if (_module_plot_option == "list" &&
431  (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0)) {
432  const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS);
433  histos2D[ix][iy][igraph]->Fill(_SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
434  }
435  }
436 
437  // restrict scatter plots to chosen range
438  if (_SF[y[iy]] * branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]] * branch_f[y[iy]] < _min[y[iy]]) {
439  //#ifdef DEBUG
440  // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl;
441  //#endif
442  continue;
443  }
444 
445  // FILLING GRAPH
446  if (y.size() >= x.size()) {
447  if (branch_i["inModuleList"] == 0 && branch_i["badModuleQuality"] == 0) {
448  const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS);
449  graphs[ix][iy][igraph]->SetPoint(
450  ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
451  ipoint[ix][iy][igraph]++;
452  }
453  if (branch_i["inModuleList"] > 0) {
454  const short int igraph =
455  (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + NB_SUBLEVELS * NB_Z_SLICES;
456  graphs[ix][iy][igraph]->SetPoint(
457  ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
458  ipoint[ix][iy][igraph]++;
459  }
460  if (branch_i["badModuleQuality"] > 0) {
461  const short int igraph =
462  (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + 2 * NB_SUBLEVELS * NB_Z_SLICES;
463  graphs[ix][iy][igraph]->SetPoint(
464  ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
465  ipoint[ix][iy][igraph]++;
466  }
467  } else {
468  if (branch_i["inModuleList"] == 0 && branch_i["badModuleQuality"] == 0) {
469  const short int igraph = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS);
470  graphs[iy][ix][igraph]->SetPoint(
471  ipoint[iy][ix][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
472  ipoint[iy][ix][igraph]++;
473  }
474  if (branch_i["inModuleList"] > 0) {
475  const short int igraph =
476  (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + NB_SUBLEVELS * NB_Z_SLICES;
477  graphs[iy][ix][igraph]->SetPoint(
478  ipoint[iy][ix][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
479  ipoint[iy][ix][igraph]++;
480  }
481  if (branch_i["badModuleQuality"] > 0) {
482  const short int igraph =
483  (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) + 2 * NB_SUBLEVELS * NB_Z_SLICES;
484  graphs[iy][ix][igraph]->SetPoint(
485  ipoint[ix][iy][igraph], _SF[x[ix]] * branch_f[x[ix]], _SF[y[iy]] * branch_f[y[iy]]);
486  ipoint[iy][ix][igraph]++;
487  }
488  }
489  }
490  }
491  }
492 #ifdef TALKATIVE
493  cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl;
494 #endif
495 
497  gROOT->SetBatch(_batchMode); // if true, then equivalent to "root -b", i.e. no canvas
498  if (_write) { // opening the file to write the graphs
499  output = new TFile(_output_directory + TString(_output_filename),
500  "UPDATE"); // possibly existing file will be updated, otherwise created
501  if (output->IsZombie()) {
502  cout << __FILE__ << ":" << __LINE__ << ":Error: Opening of " << _output_directory + TString(_output_filename)
503  << " failed" << endl;
504  exit(-1);
505  }
506 #ifdef TALKATIVE
507  cout << __FILE__ << ":" << __LINE__ << ":Info: output file is " << _output_directory + TString(_output_filename)
508  << endl;
509 #endif
510  }
511  // declaring TMultiGraphs and TCanvas
512  // Usually more y variables than x variables
513  // creating TLegend
514  TLegend *legend = MakeLegend(.1, .92, .9, 1., NB_SUBLEVELS);
515  if (_write)
516  legend->Write();
517 
518  // check which modules are supposed to be plotted
519  unsigned int n_module_types = 1;
520  if (_module_plot_option == "all") {
521  n_module_types = 3; //plot all modules (good, list and bad )
522  } else if (_module_plot_option == "list") {
523  n_module_types = 2; // plot good modules and those in the list
524  } else if (_module_plot_option == "good") {
525  n_module_types = 1; // only plot the modules that are neither bad or in the list
526  }
527 
528 #define INDEX_IN_GLOBAL_CANVAS(i1, i2) 1 + i1 + i2 *x.size()
529  // running on the TGraphs to produce the TMultiGraph and draw/print them
530  for (unsigned int ix = 0; ix < x.size(); ix++) {
531 #ifdef DEBUG
532  cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]=" << x[ix] << endl;
533 #endif
534 
535  // looping on Y axes
536  for (unsigned int iy = 0; iy < y.size(); iy++) {
537 #ifdef DEBUG
538  cout << __FILE__ << ":" << __LINE__ << ":Info: x[" << ix << "]=" << x[ix] << " and y[" << iy << "]=" << y[iy]
539  << "\t-> creating TMultiGraph" << endl;
540 #endif
541  mgraphs[ix][iy][0] = new TMultiGraph(
542  TString::Format("mgr_%s_vs_%s_tracker_%d",
543  x[ix].Data(),
544  y[iy].Data(),
545  canvas_index), // name
546  //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title
547  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title
548  + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title
549 
550  mgraphs[ix][iy][7] = new TMultiGraph(
551  TString::Format("mgr_%s_vs_%s_pixel_%d",
552  x[ix].Data(),
553  y[iy].Data(),
554  canvas_index), // name
555  //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for Tracker") // graph title
556  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title
557  + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title
558 
560  // fixing ranges and filling TMultiGraph
561  // for (unsigned short int jgraph = NB_SUBLEVELS*NB_Z_SLICES-1 ; jgraph >= 0 ; --jgraph)
562  for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES * n_module_types; jgraph++) {
563  unsigned short int igraph =
564  NB_SUBLEVELS * NB_Z_SLICES * n_module_types - jgraph -
565  1; // reverse counting for humane readability (one of the sublevel takes much more place than the others)
566 
567 #ifdef DEBUG
568  cout << __FILE__ << ":" << __LINE__ << ":Info: writing TGraph to file" << endl;
569 #endif
570  // write into root file
571  if (_write)
572  graphs[ix][iy][igraph]->Write();
573  if (graphs[ix][iy][igraph]->GetN() == 0) {
574 #ifdef TALKATIVE
575  cout << __FILE__ << ":" << __LINE__ << ":Info: " << graphs[ix][iy][igraph]->GetName() << " is empty." << endl;
576 #endif
577  continue;
578  }
579 #ifdef DEBUG
580  cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph "
581  << _sublevel_names[igraph % NB_SUBLEVELS] << (igraph >= NB_SUBLEVELS ? "(z<0)" : "(z>0)")
582  << " to global TMultiGraph" << endl;
583 #endif
584  // clone to prevent any injure on the graph
585  TGraph *gr = (TGraph *)graphs[ix][iy][igraph]->Clone();
586  // color
587  gr->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS));
588  mgraphs[ix][iy][0]->Add(gr, "P"); //, (mgraphs[ix][iy][0]->GetListOfGraphs()==0?"AP":"P"));
589 
590  if (igraph % NB_SUBLEVELS == 0 || igraph % NB_SUBLEVELS == 1)
591  mgraphs[ix][iy][7]->Add(gr, "P"); // Add BPIX (0) and FPIX (1) to pixel plot
592  }
593 
595  for (unsigned int isublevel = 1; isublevel <= NB_SUBLEVELS; isublevel++) {
596 #ifdef DEBUG
597  cout << __FILE__ << ":" << __LINE__ << ":Info: cloning, coloring and adding TGraph "
598  << _sublevel_names[isublevel - 1] << " to sublevel TMultiGraph" << endl;
599 #endif
600  mgraphs[ix][iy][isublevel] =
601  new TMultiGraph(TString::Format("%s_vs_%s_%s_%d",
602  x[ix].Data(),
603  y[iy].Data(),
604  _sublevel_names[isublevel - 1].Data(),
605  canvas_index), // name
606  //LateXstyle(x[ix]) + TString(" vs. ") + LateXstyle(y[iy]) + TString(" for ") +
607  _sublevel_names[isublevel - 1] // graph title
608  + TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] // x axis title
609  + TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]); // y axis title
610 
611  graphs[ix][iy][isublevel - 1]->SetMarkerColor(kBlack);
612  graphs[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed);
613  graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kGray + 1);
614  graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed - 7);
615  graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kGray + 1);
616  graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed - 7);
617  if (graphs[ix][iy][isublevel - 1]->GetN() > 0)
618  mgraphs[ix][iy][isublevel]->Add(
619  graphs[ix][iy][isublevel - 1],
620  "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z>0
621 #ifdef TALKATIVE
622  else
623  cout << __FILE__ << ":" << __LINE__
624  << ":Info: graphs[ix][iy][isublevel-1]=" << graphs[ix][iy][isublevel - 1]->GetName()
625  << " is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl;
626 #endif
627  if (graphs[ix][iy][NB_SUBLEVELS + isublevel - 1]->GetN() > 0)
628  mgraphs[ix][iy][isublevel]->Add(
629  graphs[ix][iy][NB_SUBLEVELS + isublevel - 1],
630  "P"); //(mgraphs[ix][iy][isublevel-1]->GetListOfGraphs()==0?"AP":"P")); // z<0
631 #ifdef TALKATIVE
632  else
633  cout << __FILE__ << ":" << __LINE__ << ":Info: graphs[ix][iy][NB_SUBLEVEL+isublevel-1]="
634  << graphs[ix][iy][NB_Z_SLICES + isublevel - 1]->GetName() << " is empty -> not added into "
635  << mgraphs[ix][iy][isublevel]->GetName() << endl;
636 #endif
637 #if NB_Z_SLICES != 2
638  cout << __FILE__ << ":" << __LINE__ << ":Error: color code incomplete for Z slices..." << endl;
639 #endif
640  if (_module_plot_option == "all") {
641  if (graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0)
642  mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1], "P");
643  if (graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0)
644  mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1], "P");
645  if (graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0)
646  mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][4 * NB_SUBLEVELS + isublevel - 1], "P");
647  if (graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0)
648  mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][5 * NB_SUBLEVELS + isublevel - 1], "P");
649  }
650  if (_module_plot_option == "list") {
651  if (graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0)
652  mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][2 * NB_SUBLEVELS + isublevel - 1], "P");
653  if (graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1]->GetN() > 0)
654  mgraphs[ix][iy][isublevel]->Add(graphs[ix][iy][3 * NB_SUBLEVELS + isublevel - 1], "P");
655  }
656  }
657 
658  // fixing ranges, saving, and drawing of TMultiGraph (tracker AND sublevels AND pixel, i.e. 2+NB_SUBLEVELS objects)
659  // the individual canvases are saved, but the global are just drawn and will be saved later
660  for (unsigned short int imgr = 0; imgr <= NB_SUBLEVELS + 1; imgr++) {
661 #ifdef DEBUG
662  cout << __FILE__ << ":" << __LINE__ << ":Info: treating individual canvases." << endl;
663 #endif
664  // drawing into individual canvas and printing it (including a legend for the tracker canvas)
665  c[ix][iy][imgr] = new TCanvas(
666  TString::Format("c_%s_vs_%s_%s_%d",
667  x[ix].Data(),
668  y[iy].Data(),
669  imgr == 0 ? "tracker" : (imgr == 7 ? "pixel" : _sublevel_names[imgr - 1].Data()),
670  canvas_index),
671  TString::Format("%s vs. %s at %s level",
672  x[ix].Data(),
673  y[iy].Data(),
674  imgr == 0 ? "tracker" : (imgr == 7 ? "pixel" : _sublevel_names[imgr - 1].Data())),
677  c[ix][iy][imgr]->SetGrid(_grid_x, _grid_y); // grid
678 
679  if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) {
680  if (dyMin[iy] != -99999) {
681  mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]);
682  }
683  if (dyMax[iy] != -99999) {
684  mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]);
685  }
686  mgraphs[ix][iy][imgr]->Draw("A");
687  }
688  if (imgr == 0 && _legend)
689  legend->Draw(); // only for the tracker
690  if (_print && !_print_only_global)
691  c[ix][iy][imgr]->Print(
692  _output_directory + mgraphs[ix][iy][imgr]->GetName() + ExtensionFromPrintOption(_print_option),
693  _print_option);
694 
695  // writing into root file
696  if (_write)
697  mgraphs[ix][iy][imgr]->Write();
698 
699  // drawing into global canvas
700  c_global[imgr]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy));
701  c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent
702  c_global[imgr]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid
703  if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) {
704  if (dyMin[iy] != -99999) {
705  mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]);
706  }
707  if (dyMax[iy] != -99999) {
708  mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]);
709  }
710  mgraphs[ix][iy][imgr]->Draw("A");
711  }
712  // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy
713  }
714  } // end of loop on y
715  } // end of loop on x
716 
717  // CUSTOMISATION
718  gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases
719  // -> instead, we will write it in the upper part in a TPaveText or in a TLegend
720  for (unsigned int ic = 0; ic <= NB_SUBLEVELS + 1; ic++) {
721  c_global[ic]->Draw();
722 
723  // setting legend to tracker canvases
724  if (!_legend)
725  break;
726  TCanvas *c_temp = (TCanvas *)c_global[ic]->Clone(c_global[ic]->GetTitle() + TString("_sub"));
727  c_temp->Draw();
728  c_global[ic] = new TCanvas(
729  c_temp->GetName() + TString("_final"), c_temp->GetTitle(), c_temp->GetWindowWidth(), c_temp->GetWindowHeight());
730  c_global[ic]->Draw();
731  TPad *p_up = new TPad(TString("legend_") + c_temp->GetName(),
732  "",
733  0.,
734  0.9,
735  1.,
736  1., // relative position
737  -1,
738  0,
739  0), // display options
740  *p_down = new TPad(TString("main_") + c_temp->GetName(), "", 0., 0., 1., 0.9, -1, 0, 0);
741  // in the lower part, draw the plots
742  p_down->Draw();
743  p_down->cd();
744  c_temp->DrawClonePad();
745  c_global[ic]->cd();
746  // in the upper part, pimp the canvas :p
747  p_up->Draw();
748  p_up->cd();
749  if (ic == 0) // tracker
750  {
751  TLegend *global_legend = MakeLegend(.05, .1, .7, .8, NB_SUBLEVELS); //, "brNDC");
752  global_legend->Draw();
753  TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB");
754  pt_geom->SetFillColor(0);
755  pt_geom->SetTextSize(0.25);
756  pt_geom->AddText(TString("x: ") + _reference_name);
757  pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name);
758  pt_geom->Draw();
759  } else if (ic == 7) // pixel
760  {
761  TLegend *global_legend = MakeLegend(.05, .1, .7, .8, 2); //, "brNDC");
762  global_legend->Draw();
763  TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB");
764  pt_geom->SetFillColor(0);
765  pt_geom->SetTextSize(0.25);
766  pt_geom->AddText(TString("x: ") + _reference_name);
767  pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name);
768  pt_geom->Draw();
769  } else // sublevels
770  {
771  TPaveText *pt = new TPaveText(.05, .1, .7, .8, "NB");
772  pt->SetFillColor(0);
773  pt->AddText(_sublevel_names[ic - 1]);
774  pt->Draw();
775  TPaveText *pt_geom = new TPaveText(.6, .1, .95, .8, "NB");
776  pt_geom->SetFillColor(0);
777  pt_geom->SetTextSize(0.3);
778  pt_geom->AddText(TString("x: ") + _reference_name);
779  pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name);
780  pt_geom->Draw();
781  }
782  // printing
783  if (_print)
784  c_global[ic]->Print(_output_directory + c_global[ic]->GetName() + ExtensionFromPrintOption(_print_option),
785  _print_option);
786  if (_write)
787  c_global[ic]->Write();
788  }
789 
790  // printing global canvases
791  if (_write)
792  output->Close();
793 
794  // Now produce the profile plots if the option is chosen
795  // Use seperate loops since no seperate plots are produced for different module qualities
796  if (_make_profile_plots) {
797  // Fill Content of 2D-hists into 1D-hists for the profile plots
798  // Loop over all y-bins for a certain x-bin, calculate mean and RMS as entries of the 1D-hists
799  bool entries = false;
800  for (unsigned int ix = 0; ix < x.size(); ix++) {
801  for (unsigned int iy = 0; iy < y.size(); iy++) {
802  for (unsigned int igraph = 0; igraph < NB_SUBLEVELS * NB_Z_SLICES; igraph++) {
803  // Declare hists which will be plotted for the profile plots
804  histos[ix][iy][igraph] =
805  new TH1F("1Dhist" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] +
806  TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") +
807  TString(std::to_string(canvas_index)),
808  "",
809  histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(),
810  _min[x[ix]],
811  _max[x[ix]]);
812  histos[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph));
813  histos[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph));
814  histos[ix][iy][igraph]->StatOverflows(kTRUE);
815 
816  // Loop over x bins
817  for (int binx = 0; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(); binx++) {
818  entries = false;
819  // Declare y-histogram for each x bin
820  histosYValues[ix][iy][igraph] =
821  new TH1F("1Dhist_Y-Values" + x[ix] + y[iy] + _sublevel_names[igraph % NB_SUBLEVELS] +
822  TString(igraph % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "n" : "p") +
823  TString(std::to_string(canvas_index)) + TString(std::to_string(binx)),
824  "",
825  histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(),
826  _min[y[iy]],
827  _max[y[iy]] + 1.);
828  histosYValues[ix][iy][igraph]->StatOverflows(kTRUE);
829  // Loop over y-bins for each x-bin of the 2D histogram and put it into the 1-d y histograms
830  // Take overflow bin into account
831  for (int biny = 0; biny <= histos2D[ix][iy][igraph]->GetYaxis()->GetNbins() + 1; biny++) {
832  if (histos2D[ix][iy][igraph]->GetBinContent(binx, biny) > 1.) {
833  histosYValues[ix][iy][igraph]->SetBinContent(biny, histos2D[ix][iy][igraph]->GetBinContent(binx, biny));
834  entries = true;
835  }
836  }
837  if (entries) {
838  histos[ix][iy][igraph]->SetBinContent(binx, histosYValues[ix][iy][igraph]->GetMean());
839  histos[ix][iy][igraph]->SetBinError(binx, histosYValues[ix][iy][igraph]->GetRMS());
840  } else
841  histos[ix][iy][igraph]->SetBinContent(binx, -999999.);
842  }
843  }
844 
845  // Customize and print the histograms
846 
848  // fixing ranges and draw profile plot histos
849 
850  c_hist[ix][iy][0] =
851  new TCanvas(TString::Format("c_hist_%s_vs_%s_tracker_%d", x[ix].Data(), y[iy].Data(), canvas_index),
852  TString::Format("Profile plot %s vs. %s at tracker level", x[ix].Data(), y[iy].Data()),
855  c_hist[ix][iy][0]->SetGrid(_grid_x, _grid_y); // grid
856  // Draw the frame that will contain the histograms
857  // One needs to specify the binning and title
858  c_hist[ix][iy][0]->GetPad(0)->DrawFrame(_min[x[ix]],
859  dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]],
860  _max[x[ix]],
861  dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]],
862  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") +
863  LateXstyle(y[iy]) + " /" + _units[y[iy]]);
864  if (_legend)
865  legend->Draw("same");
866 
867  for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) {
868  unsigned short int igraph =
869  NB_SUBLEVELS * NB_Z_SLICES - jgraph -
870  1; // reverse counting for humane readability (one of the sublevel takes much more place than the others)
871 
872  // clone to prevent any injure on the graph
873  histosTracker[ix][iy][igraph] = (TH1F *)histos[ix][iy][igraph]->Clone();
874  // color
875  histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS));
876  histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph % NB_SUBLEVELS));
877  histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
878  histosTracker[ix][iy][igraph]->Draw("same pe0");
879  }
880 
881  if (_print && !_print_only_global)
882  c_hist[ix][iy][0]->Print(
884  TString::Format("Profile_plot_%s_vs_%s_tracker_%d", x[ix].Data(), y[iy].Data(), canvas_index) +
886  _print_option);
887 
888  //Draw into profile hists global tracker canvas
889  c_global_hist[0]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy));
890  c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent
891  c_global_hist[0]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid
892  c_global_hist[0]
893  ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))
894  ->DrawFrame(_min[x[ix]],
895  dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]],
896  _max[x[ix]],
897  dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]],
898  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) +
899  " /" + _units[y[iy]]);
900 
901  for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) {
902  unsigned short int igraph =
903  NB_SUBLEVELS * NB_Z_SLICES - jgraph -
904  1; // reverse counting for humane readability (one of the sublevel takes much more place than the others)
905  histosTracker[ix][iy][igraph]->Draw("same pe0");
906  }
907 
909  // fixing ranges and draw profile plot histos
910 
911  c_hist[ix][iy][7] =
912  new TCanvas(TString::Format("c_hist_%s_vs_%s_pixel_%d", x[ix].Data(), y[iy].Data(), canvas_index),
913  TString::Format("Profile plot %s vs. %s at pixel level", x[ix].Data(), y[iy].Data()),
916  c_hist[ix][iy][7]->SetGrid(_grid_x, _grid_y); // grid
917  // Draw the frame that will contain the histograms
918  // One needs to specify the binning and title
919  c_hist[ix][iy][7]->GetPad(0)->DrawFrame(_min[x[ix]],
920  dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]],
921  _max[x[ix]],
922  dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]],
923  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") +
924  LateXstyle(y[iy]) + " /" + _units[y[iy]]);
925  if (_legend)
926  legend->Draw("same");
927 
928  for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) {
929  unsigned short int igraph =
930  NB_SUBLEVELS * NB_Z_SLICES - jgraph -
931  1; // reverse counting for humane readability (one of the sublevel takes much more place than the others)
932 
933  if (igraph % NB_SUBLEVELS == 0 || igraph % NB_SUBLEVELS == 1) //Only BPIX and FPIX
934  {
935  // clone to prevent any injure on the graph
936  histosTracker[ix][iy][igraph] = (TH1F *)histos[ix][iy][igraph]->Clone();
937  // color
938  histosTracker[ix][iy][igraph]->SetMarkerColor(COLOR_CODE(igraph % NB_SUBLEVELS));
939  histosTracker[ix][iy][igraph]->SetLineColor(COLOR_CODE(igraph % NB_SUBLEVELS));
940  histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
941  histosTracker[ix][iy][igraph]->Draw("same pe0");
942  }
943  }
944 
945  if (_print && !_print_only_global)
946  c_hist[ix][iy][7]->Print(
948  TString::Format("Profile_plot_%s_vs_%s_pixel_%d", x[ix].Data(), y[iy].Data(), canvas_index) +
950  _print_option);
951 
952  //Draw into profile hists global tracker canvas
953  c_global_hist[7]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy));
954  c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetFillStyle(4000); // make the pad transparent
955  c_global_hist[7]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid
956  c_global_hist[7]
957  ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))
958  ->DrawFrame(_min[x[ix]],
959  dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]],
960  _max[x[ix]],
961  dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]],
962  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) +
963  " /" + _units[y[iy]]);
964 
965  for (unsigned short int jgraph = 0; jgraph < NB_SUBLEVELS * NB_Z_SLICES; jgraph++) {
966  unsigned short int igraph =
967  NB_SUBLEVELS * NB_Z_SLICES - jgraph -
968  1; // reverse counting for humane readability (one of the sublevel takes much more place than the others)
969  histosTracker[ix][iy][igraph]->Draw("same pe0");
970  }
971  // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy
973  for (unsigned int isublevel = 1; isublevel <= NB_SUBLEVELS; isublevel++) {
974  // Draw and print profile histograms
975  c_hist[ix][iy][isublevel] =
976  new TCanvas(TString::Format("c_hist_%s_vs_%s_%s_%d",
977  x[ix].Data(),
978  y[iy].Data(),
979  isublevel == 0 ? "tracker" : _sublevel_names[isublevel - 1].Data(),
980  canvas_index),
981  TString::Format("Profile plot %s vs. %s at %s level",
982  x[ix].Data(),
983  y[iy].Data(),
984  isublevel == 0 ? "tracker" : _sublevel_names[isublevel - 1].Data()),
987  c_hist[ix][iy][isublevel]->SetGrid(_grid_x, _grid_y); // grid
988  c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(_min[x[ix]],
989  dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]],
990  _max[x[ix]],
991  dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]],
992  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] +
993  TString(";") + LateXstyle(y[iy]) + " /" + _units[y[iy]]);
994 
995  histos[ix][iy][isublevel - 1]->SetMarkerColor(kBlack);
996  histos[ix][iy][isublevel - 1]->SetLineColor(kBlack);
997  histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetMarkerColor(kRed);
998  histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->SetLineColor(kRed);
999 
1000  histos[ix][iy][isublevel - 1]->Draw("same pe0");
1001  histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->Draw("same pe0");
1002 
1003  if (_print && !_print_only_global)
1004  c_hist[ix][iy][isublevel]->Print(_output_directory +
1005  TString::Format("Profile_plot_%s_vs_%s_%s_%d",
1006  x[ix].Data(),
1007  y[iy].Data(),
1008  _sublevel_names[isublevel - 1].Data(),
1009  canvas_index) +
1011  _print_option);
1012 
1013  // draw into global canvas
1014  // printing will be performed after customisation (e.g. legend or title) just after the loops on ix and iy
1015  c_global_hist[isublevel]->cd(INDEX_IN_GLOBAL_CANVAS(ix, iy));
1016  c_global_hist[isublevel]
1017  ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))
1018  ->SetFillStyle(4000); // make the pad transparent
1019  c_global_hist[isublevel]->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))->SetGrid(_grid_x, _grid_y); // grid
1020  c_global_hist[isublevel]
1021  ->GetPad(INDEX_IN_GLOBAL_CANVAS(ix, iy))
1022  ->DrawFrame(_min[x[ix]],
1023  dyMin[iy] != -99999 ? dyMin[iy] : _min[y[iy]],
1024  _max[x[ix]],
1025  dyMax[iy] != -99999 ? dyMax[iy] : _max[y[iy]],
1026  TString(";") + LateXstyle(x[ix]) + " /" + _units[x[ix]] + TString(";") + LateXstyle(y[iy]) +
1027  " /" + _units[y[iy]]);
1028 
1029  histos[ix][iy][isublevel - 1]->Draw("same pe0");
1030  histos[ix][iy][NB_SUBLEVELS + isublevel - 1]->Draw("same pe0");
1031  }
1032 
1033  } // end of loop on y
1034  } // end of loop on x
1035 
1036  // CUSTOMISATION
1037  gStyle->SetOptTitle(0); // otherwise, the title is repeated in every pad of the global canvases
1038  // -> instead, we will write it in the upper part in a TPaveText or in a TLegend
1039  for (unsigned int ic = 0; ic <= NB_SUBLEVELS; ic++) {
1040  // setting legend to tracker canvases
1041  if (!_legend)
1042  break;
1043 
1044  // setting legend to tracker canvases
1045  if (!_legend)
1046  break;
1047  TCanvas *c_temp_hist = (TCanvas *)c_global_hist[ic]->Clone(c_global_hist[ic]->GetTitle() + TString("_sub"));
1048  c_temp_hist->Draw();
1049  c_global_hist[ic] = new TCanvas(c_temp_hist->GetName() + TString("_final"),
1050  c_temp_hist->GetTitle(),
1051  c_temp_hist->GetWindowWidth(),
1052  c_temp_hist->GetWindowHeight());
1053  c_global_hist[ic]->Draw();
1054  TPad *p_up = new TPad(TString("legend_") + c_temp_hist->GetName(),
1055  "",
1056  0.,
1057  0.9,
1058  1.,
1059  1., // relative position
1060  -1,
1061  0,
1062  0), // display options
1063  *p_down = new TPad(TString("main_") + c_temp_hist->GetName(), "", 0., 0., 1., 0.9, -1, 0, 0);
1064  // in the lower part, draw the plots
1065  p_down->Draw();
1066  p_down->cd();
1067  c_temp_hist->DrawClonePad();
1068  c_global_hist[ic]->cd();
1069  // in the upper part, pimp the canvas :p
1070  p_up->Draw();
1071  p_up->cd();
1072  if (ic == 0) // tracker
1073  {
1074  TLegend *global_legend = MakeLegend(.05, .1, .7, .8, NB_SUBLEVELS); //, "brNDC");
1075  global_legend->Draw();
1076  TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB");
1077  pt_geom->SetFillColor(0);
1078  pt_geom->SetTextSize(0.25);
1079  pt_geom->AddText(TString("x: ") + _reference_name);
1080  pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name);
1081  pt_geom->Draw();
1082  } else if (ic == 7) // pixel
1083  {
1084  TLegend *global_legend = MakeLegend(.05, .1, .7, .8, 2); //, "brNDC");
1085  global_legend->Draw();
1086  TPaveText *pt_geom = new TPaveText(.75, .1, .95, .8, "NB");
1087  pt_geom->SetFillColor(0);
1088  pt_geom->SetTextSize(0.25);
1089  pt_geom->AddText(TString("x: ") + _reference_name);
1090  pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name);
1091  pt_geom->Draw();
1092  } else // sublevels
1093  {
1094  TPaveText *pt = new TPaveText(.05, .1, .7, .8, "NB");
1095  pt->SetFillColor(0);
1096  pt->AddText(_sublevel_names[ic - 1]);
1097  pt->Draw();
1098  TPaveText *pt_geom = new TPaveText(.6, .1, .95, .8, "NB");
1099  pt_geom->SetFillColor(0);
1100  pt_geom->SetTextSize(0.3);
1101  pt_geom->AddText(TString("x: ") + _reference_name);
1102  pt_geom->AddText(TString("y: ") + _alignment_name + TString(" - ") + _reference_name);
1103  pt_geom->Draw();
1104  }
1105  // printing
1106  if (_print)
1107  c_global_hist[ic]->Print(
1108  _output_directory + c_global_hist[ic]->GetName() + ExtensionFromPrintOption(_print_option), _print_option);
1109  }
1110  }
1111 
1112 #ifdef TALKATIVE
1113  cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakePlots method" << endl;
1114 #endif
1115 }

References _1dModule, _2dModule, _alignment_name, _batchMode, _grid_x, _grid_y, _legend, _levelCut, _make_profile_plots, _max, _min, _module_plot_option, _output_directory, _output_filename, _print, _print_only_global, _print_option, _reference_name, _SF, _sublevel_names, _units, _window_height, _window_width, _write, branch_f, branch_i, c, canvas_index, CHECK_BRANCHES, CHECK_MAP_CONTENT, COLOR_CODE, gather_cfg::cout, data, beamvalidation::exit(), ExtensionFromPrintOption(), cuy::graphs, combine::histos, INDEX_IN_GLOBAL_CANVAS, INSIDE_VECTOR, plotBeamSpotDB::ipoint, LateXstyle(), listHistos::legend, LIMITS, MakeLegend(), NB_MODULE_QUALITY, NB_SUBLEVELS, NB_Z_SLICES, output, DiDispStaMuonMonitor_cfi::pt, x, and y.

◆ MakeTables()

void GeometryComparisonPlotter::MakeTables ( const vector< TString >  x,
const vector< TString >  y,
const vector< float >  dyMin,
const vector< float >  dyMax 
)

-1) check that only existing branches are called

0) min and max values

1) declare histograms

2) loop on the TTree data

Definition at line 1118 of file GeometryComparisonPlotter.cc.

1123 {
1125  // (we use a macro to avoid copy/paste)
1126 #define CHECK_BRANCHES(branchname_vector) \
1127  for (unsigned int i = 0; i < branchname_vector.size(); i++) { \
1128  if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \
1129  cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." \
1130  << endl; \
1131  return; \
1132  } \
1133  }
1134  CHECK_BRANCHES(x);
1135  CHECK_BRANCHES(y);
1136 
1137  const unsigned int nentries = data->GetEntries();
1138 
1139 #ifdef TALKATIVE
1140  cout << __FILE__ << ":" << __LINE__ << ":Info: ";
1141  INSIDE_VECTOR(x);
1142  cout << endl;
1143  cout << __FILE__ << ":" << __LINE__ << ":Info: ";
1144  INSIDE_VECTOR(y);
1145  cout << endl;
1146 #endif
1147 
1149  // the max and min of the graphs are computed from the tree if they have not been manually input yet
1150  // (we use a macro to avoid copy/paste)
1151 #define LIMITS(axes_vector) \
1152  for (unsigned int i = 0; i < axes_vector.size(); i++) { \
1153  if (_SF.find(axes_vector[i]) == _SF.end()) \
1154  _SF[axes_vector[i]] = 1.; \
1155  if (_min.find(axes_vector[i]) == _min.end()) \
1156  _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \
1157  if (_max.find(axes_vector[i]) == _max.end()) \
1158  _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \
1159  }
1160  LIMITS(x);
1161  LIMITS(y);
1162 
1163 #ifdef TALKATIVE
1164  CHECK_MAP_CONTENT(_min, float);
1165  CHECK_MAP_CONTENT(_max, float);
1166  CHECK_MAP_CONTENT(_SF, float);
1167 #endif
1168 
1170  // the idea is to produce tables of the differences and the absolute positions containing mean and RMS values
1171  // for the different subdetectors - 0..5=different sublevels.
1172  // Values for each endcap detector are to be split in +/-z, for the barrel detectors in +/- x (half barrels)
1173  // Since it is easier to handle in the loops, all subdetectors will be split in
1174  // 4 parts at first: (+/-x)X(+/-z)
1175  // This means that 2*2*6 histograms will be filled during the loop on the TTree
1176  // Pairs of histograms need to be combined afterwards again
1177  // Histograms 0-5 are at +x and +z, 6-11 at +x and -z, 12-17 at -x and +z, and 18-23 at -x and -z
1178  //
1179  // Two version of the table containing the differences are produced. Once using Gaussian fits (more stable
1180  // vs single outliers but perform poorly if the distributions are non-Gaussian) and once using
1181  // the mean and RMS of the histograms (more stable but outliers have a strong impact on the RMS).
1182  // For the absolute positions, only mean+RMS are used since the detector layout is not Gaussian
1183  // (structures due to layers/rings etc)
1184 #ifndef NB_SUBLEVELS
1185 #define NB_SUBLEVELS 6
1186 #endif
1187 #define NB_Z_SLICES 2
1188 #define NB_X_SLICES 2
1189 
1190  TH1F *histosx[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1191  float meanValuex[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1192  float RMSx[x.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1193 
1194  TH1F *histos[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1195  TF1 *gausFit[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1196  float meanValue[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1197  float meanValueGaussian[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1198  float RMS[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1199  float RMSGaussian[y.size()][NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES];
1200 
1201  for (unsigned int iy = 0; iy < y.size(); iy++) {
1202  for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) {
1203  // Create and correctly name a histogram for each subdetector*Z_Slice*X_Slice
1204  histos[iy][ihist] = new TH1F("hist" + y[iy] + _sublevel_names[ihist % NB_SUBLEVELS] +
1205  TString(ihist % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "zn" : "zp") +
1206  TString(ihist >= NB_SUBLEVELS * NB_Z_SLICES ? "xn" : "xp"),
1207  "",
1208  1000,
1209  _min[y[iy]],
1210  _max[y[iy]] + 1.);
1211  histos[iy][ihist]->StatOverflows(kTRUE);
1212  }
1213  }
1214 
1215  for (unsigned int ix = 0; ix < x.size(); ix++) {
1216  for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) {
1217  // Create and correctly name a histogram for each subdetector*Z_Slice*ModuleType
1218  histosx[ix][ihist] = new TH1F("histx" + x[ix] + _sublevel_names[ihist % NB_SUBLEVELS] +
1219  TString(ihist % (NB_SUBLEVELS * NB_Z_SLICES) >= NB_SUBLEVELS ? "zn" : "zp") +
1220  TString(ihist >= NB_SUBLEVELS * NB_Z_SLICES ? "xn" : "xp"),
1221  "",
1222  1000,
1223  _min[x[ix]],
1224  _max[x[ix]] + 1.);
1225  histosx[ix][ihist]->StatOverflows(kTRUE);
1226  }
1227  }
1228 
1229 #ifdef DEBUG
1230  cout << __FILE__ << ":" << __LINE__ << ":Info: Creation of the TH1F[" << y.size() << "]["
1231  << NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES << "] ended." << endl;
1232 #endif
1233 
1235 #ifdef DEBUG
1236  cout << __FILE__ << ":" << __LINE__ << ":Info: Looping on the TTree" << endl;
1237 #endif
1238 #ifdef TALKATIVE
1239  unsigned int progress = 0;
1240  cout << __FILE__ << ":" << __LINE__ << ":Info: 0%" << endl;
1241 #endif
1242  for (unsigned int ientry = 0; ientry < nentries; ientry++) {
1243 #ifdef TALKATIVE
1244  if (10 * ientry / nentries != progress) {
1245  progress = 10 * ientry / nentries;
1246  cout << __FILE__ << ":" << __LINE__ << ":Info: " << 10 * progress << "%" << endl;
1247  }
1248 #endif
1249  // load current tree entry
1250  data->GetEntry(ientry);
1251 
1252  // CUTS on entry
1253  if (branch_i["level"] != _levelCut)
1254  continue;
1255  if (!_1dModule && branch_i["detDim"] == 1)
1256  continue;
1257  if (!_2dModule && branch_i["detDim"] == 2)
1258  continue;
1259 
1260  for (unsigned int iy = 0; iy < y.size(); iy++) {
1261  if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS)
1262  continue;
1263  if (_SF[y[iy]] * branch_f[y[iy]] > _max[y[iy]] || _SF[y[iy]] * branch_f[y[iy]] < _min[y[iy]]) {
1264  //#ifdef DEBUG
1265  // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl;
1266  //#endif
1267  continue;
1268  }
1269 
1270  // FILLING HISTOGRAMS
1271 
1272  // histogram for all modules
1273  const short int ihisto = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) +
1274  (branch_f["x"] >= 0 ? 0 : NB_SUBLEVELS * NB_Z_SLICES);
1275 
1276  if (_module_plot_option == "all")
1277  histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]);
1278 
1279  // Only good modules
1280  else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0)
1281  histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]);
1282 
1283  // Only good modules and those in the list
1284  else if (_module_plot_option == "list" && (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0))
1285  histos[iy][ihisto]->Fill(_SF[y[iy]] * branch_f[y[iy]]);
1286  }
1287 
1288  for (unsigned int ix = 0; ix < x.size(); ix++) {
1289  if (branch_i["sublevel"] < 1 || branch_i["sublevel"] > NB_SUBLEVELS)
1290  continue;
1291  if (_SF[x[ix]] * branch_f[x[ix]] > _max[x[ix]] || _SF[x[ix]] * branch_f[x[ix]] < _min[x[ix]]) {
1292  //#ifdef DEBUG
1293  // cout << "branch_f[y[iy]]=" << branch_f[y[iy]] << endl;
1294  //#endif
1295  continue;
1296  }
1297 
1298  // FILLING HISTOGRAMS
1299 
1300  // histogram for all modules
1301  const short int ihistosx = (branch_i["sublevel"] - 1) + (branch_f["z"] >= 0 ? 0 : NB_SUBLEVELS) +
1302  (branch_f["x"] >= 0 ? 0 : NB_SUBLEVELS * NB_Z_SLICES);
1303 
1304  if (_module_plot_option == "all")
1305  histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]);
1306 
1307  // Only good modules
1308  else if (_module_plot_option == "good" && branch_i["badModuleQuality"] == 0)
1309  histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]);
1310 
1311  // Only good modules and those in the list
1312  else if (_module_plot_option == "list" && (branch_i["inModuleList"] == 1 || branch_i["badModuleQuality"] == 0))
1313  histosx[ix][ihistosx]->Fill(_SF[x[ix]] * branch_f[x[ix]]);
1314  }
1315  }
1316 #ifdef TALKATIVE
1317  cout << __FILE__ << ":" << __LINE__ << ":Info: 100%\tLoop ended" << endl;
1318 #endif
1319 
1320  //~ TString rangeLabel = "";
1321  // Calculate mean and standard deviation for each histogram
1322  for (unsigned int iy = 0; iy < y.size(); iy++) {
1323  for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) {
1324  // combine +/-z histograms for barrel detectors
1325  if (ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 0 || ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 2 ||
1326  ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 4) {
1327  histos[iy][ihist]->Add(histos[iy][ihist + NB_SUBLEVELS]);
1328  }
1329  // combine +/-x histograms for endcap detectors (only used for half shells in barrel)
1330  if (ihist < NB_SUBLEVELS * NB_Z_SLICES &&
1331  (ihist % NB_SUBLEVELS == 1 || ihist % NB_SUBLEVELS == 3 || ihist % NB_SUBLEVELS == 5)) {
1332  histos[iy][ihist]->Add(histos[iy][ihist + NB_SUBLEVELS * NB_Z_SLICES]);
1333  }
1334  meanValue[iy][ihist] = histos[iy][ihist]->GetMean();
1335  RMS[iy][ihist] = histos[iy][ihist]->GetRMS();
1336 
1337  histos[iy][ihist]->Fit("gaus");
1338  gausFit[iy][ihist] = histos[iy][ihist]->GetFunction("gaus");
1339  meanValueGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(1);
1340  RMSGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(2);
1341  }
1342  }
1343 
1344  for (unsigned int ix = 0; ix < x.size(); ix++) {
1345  for (unsigned int ihist = 0; ihist < NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES; ihist++) {
1346  // combine +/-z histograms for barrel detectors
1347  if (ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 0 || ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 2 ||
1348  ihist % (NB_SUBLEVELS * NB_Z_SLICES) == 4) {
1349  histosx[ix][ihist]->Add(histosx[ix][ihist + NB_SUBLEVELS]);
1350  }
1351  // combine +/-x histograms for endcap detectors (only used for half shells in barrel)
1352  if (ihist < NB_SUBLEVELS * NB_Z_SLICES &&
1353  (ihist % NB_SUBLEVELS == 1 || ihist % NB_SUBLEVELS == 3 || ihist % NB_SUBLEVELS == 5)) {
1354  histosx[ix][ihist]->Add(histosx[ix][ihist + NB_SUBLEVELS * NB_Z_SLICES]);
1355  }
1356  meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean();
1357  RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS();
1358  }
1359  }
1360 
1361  TString tableFileName, tableCaption, tableAlign, tableHeadline;
1362  TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine,
1363  TECmLine;
1364 
1365  // table using mean and RMS, round to integers in µm etc.
1366  tableFileName = "table_differences.tex";
1367  if (_module_plot_option == "all")
1368  tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name +
1369  " for each subdetector, all modules used.";
1370  else if (_module_plot_option == "good")
1371  tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name +
1372  " for each subdetector, only good modules used.";
1373  else if (_module_plot_option == "list")
1374  tableCaption = "Means and standard deviations of " + _alignment_name + " - " + _reference_name +
1375  " for each subdetector, good modules and those in given list used.";
1376 
1377  WriteTable(y, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValue, RMS, "0", tableCaption, tableFileName);
1378 
1379  //~ // table using Gaussian fit, round to integers in µm etc.
1380  tableFileName = "table_differences_Gaussian.tex";
1381  if (_module_plot_option == "all")
1382  tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name +
1383  " for each subdetector, all modules used.";
1384  else if (_module_plot_option == "good")
1385  tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name +
1386  " for each subdetector, only good modules used.";
1387  else if (_module_plot_option == "list")
1388  tableCaption = "Means and standard deviations for Gaussian fit of " + _alignment_name + " - " + _reference_name +
1389  " for each subdetector, good modules and those in given list used.";
1390 
1391  WriteTable(
1392  y, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValueGaussian, RMSGaussian, "0", tableCaption, tableFileName);
1393 
1394  // Table for the mean positions on the x-axis, round to 3 digits in cm etc.
1395  tableFileName = "table_meanPos.tex";
1396 
1397  if (_module_plot_option == "all")
1398  tableCaption = "Mean positions and standard deviations in " + _reference_name +
1399  " geometry for each subdetector, all modules used.";
1400  else if (_module_plot_option == "good")
1401  tableCaption = "Mean positions and standard deviations in " + _reference_name +
1402  " geometry for each subdetector, only good modules used.";
1403  else if (_module_plot_option == "list")
1404  tableCaption = "Mean positions and standard deviations in " + _reference_name +
1405  " geometry for each subdetector, good modules and those in given list used.";
1406 
1407  WriteTable(x, NB_SUBLEVELS * NB_Z_SLICES * NB_X_SLICES, meanValuex, RMSx, "3", tableCaption, tableFileName);
1408 
1409 #ifdef TALKATIVE
1410  cout << __FILE__ << ":" << __LINE__ << ":Info: End of MakeLegends method" << endl;
1411 #endif
1412 }

References _1dModule, _2dModule, _alignment_name, _levelCut, _max, _min, _module_plot_option, _reference_name, _SF, _sublevel_names, branch_f, branch_i, CHECK_BRANCHES, CHECK_MAP_CONTENT, gather_cfg::cout, data, combine::histos, INSIDE_VECTOR, LIMITS, NB_SUBLEVELS, NB_X_SLICES, NB_Z_SLICES, RMS, WriteTable(), x, and y.

◆ Set1dModule()

void GeometryComparisonPlotter::Set1dModule ( const bool  k1dModule)

Definition at line 1418 of file GeometryComparisonPlotter.cc.

1418 { _1dModule = k1dModule; }

References _1dModule.

◆ Set2dModule()

void GeometryComparisonPlotter::Set2dModule ( const bool  k2dModule)

Definition at line 1419 of file GeometryComparisonPlotter.cc.

1419 { _2dModule = k2dModule; }

References _2dModule.

◆ SetBatchMode()

void GeometryComparisonPlotter::SetBatchMode ( const bool  kBatchMode)

Definition at line 1421 of file GeometryComparisonPlotter.cc.

1421 { _batchMode = kBatchMode; }

References _batchMode.

◆ SetBranchMax()

void GeometryComparisonPlotter::SetBranchMax ( const TString  branchname,
const float  max 
)

Definition at line 1426 of file GeometryComparisonPlotter.cc.

1426 { _max[branchname] = max; }

References _max, and SiStripPI::max.

◆ SetBranchMin()

void GeometryComparisonPlotter::SetBranchMin ( const TString  branchname,
const float  min 
)

Definition at line 1427 of file GeometryComparisonPlotter.cc.

1427 { _min[branchname] = min; }

References _min, and min().

◆ SetBranchSF()

void GeometryComparisonPlotter::SetBranchSF ( const TString  branchname,
const float  SF 
)

Definition at line 1428 of file GeometryComparisonPlotter.cc.

1428 { _SF[branchname] = SF; }

References _SF.

◆ SetBranchUnits()

void GeometryComparisonPlotter::SetBranchUnits ( const TString  branchname,
const TString  units 
)

Definition at line 1429 of file GeometryComparisonPlotter.cc.

1429  {
1430  _units[branchname] = units;
1431 }

References _units, and units().

◆ SetCanvasSize()

void GeometryComparisonPlotter::SetCanvasSize ( const int  window_width = 3508,
const int  window_height = 2480 
)

Definition at line 1433 of file GeometryComparisonPlotter.cc.

1433  {
1434  _window_width = window_width;
1435  _window_height = window_height;
1436 }

References _window_height, and _window_width.

◆ SetGrid()

void GeometryComparisonPlotter::SetGrid ( const int  kGridX,
const int  kGridY 
)

Definition at line 1422 of file GeometryComparisonPlotter.cc.

1422  {
1423  _grid_x = kGridX;
1424  _grid_y = kGridY;
1425 }

References _grid_x, and _grid_y.

◆ SetLegend()

void GeometryComparisonPlotter::SetLegend ( const bool  kLegend)

Definition at line 1416 of file GeometryComparisonPlotter.cc.

1416 { _legend = kLegend; }

References _legend.

◆ SetLevelCut()

void GeometryComparisonPlotter::SetLevelCut ( const int  kLevelCut)

Definition at line 1420 of file GeometryComparisonPlotter.cc.

1420 { _levelCut = kLevelCut; }

References _levelCut.

◆ SetOutputDirectoryName()

void GeometryComparisonPlotter::SetOutputDirectoryName ( const TString  name)

Definition at line 1438 of file GeometryComparisonPlotter.cc.

1438  {
1439  _output_directory = name + TString(name.EndsWith("/") ? "" : "/");
1440 }

References _output_directory, and Skims_PA_cff::name.

◆ SetOutputFileName()

void GeometryComparisonPlotter::SetOutputFileName ( const TString  name)

Definition at line 1437 of file GeometryComparisonPlotter.cc.

1437 { _output_filename = name; }

References _output_filename, and Skims_PA_cff::name.

◆ SetPrint()

void GeometryComparisonPlotter::SetPrint ( const bool  kPrint)

Definition at line 1415 of file GeometryComparisonPlotter.cc.

1415 { _print = kPrint; }

References _print.

◆ SetPrintOption()

void GeometryComparisonPlotter::SetPrintOption ( const Option_t *  print_option)

Definition at line 1432 of file GeometryComparisonPlotter.cc.

1432 { _print_option = print_option; }

References _print_option.

◆ SetWrite()

void GeometryComparisonPlotter::SetWrite ( const bool  kWrite)

Definition at line 1417 of file GeometryComparisonPlotter.cc.

1417 { _write = kWrite; }

References _write.

◆ WriteTable()

void GeometryComparisonPlotter::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 at line 1534 of file GeometryComparisonPlotter.cc.

1540  {
1541  std::ofstream output(_output_directory + tableFileName);
1542 
1543  TString tableAlign, tableHeadline;
1544  TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine,
1545  TECmLine;
1546  char meanChar[x.size()][nLevelsTimesSlices][10];
1547  char RMSChar[x.size()][nLevelsTimesSlices][10];
1548 
1549  tableAlign = "l";
1550  tableHeadline = "";
1551  PXBpLine = "PXB x$+$";
1552  PXBmLine = "PXB x$-$";
1553  PXFpLine = "PXF z$+$";
1554  PXFmLine = "PXF z$-$";
1555  TIBpLine = "TIB x$+$";
1556  TIBmLine = "TIB x$-$";
1557  TIDpLine = "TID z$+$";
1558  TIDmLine = "TID z$-$";
1559  TOBpLine = "TOB x$+$";
1560  TOBmLine = "TOB x$-$";
1561  TECpLine = "TEC z$+$";
1562  TECmLine = "TEC z$-$";
1563 
1564  for (unsigned int ix = 0; ix < x.size(); ix++) {
1565  for (unsigned int isubDet = 0; isubDet < nLevelsTimesSlices; isubDet++) {
1566  sprintf(meanChar[ix][isubDet], "%." + nDigits + "f", meanValue[ix][isubDet]);
1567  sprintf(RMSChar[ix][isubDet], "%." + nDigits + "f", RMS[ix][isubDet]);
1568  }
1569  tableAlign += "|c";
1570  tableHeadline += " & " + LateXstyleTable(x[ix]) + " / " + _units[x[ix]].ReplaceAll("#mum", "$\\mu$m");
1571 
1572  PXBpLine += " & $";
1573  PXBpLine += meanChar[ix][0];
1574  PXBpLine += "\\pm";
1575  PXBpLine += RMSChar[ix][0];
1576  PXBpLine += " $";
1577  PXBmLine += " & $";
1578  PXBmLine += meanChar[ix][12];
1579  PXBmLine += "\\pm";
1580  PXBmLine += RMSChar[ix][12];
1581  PXBmLine += " $";
1582  PXFpLine += " & $";
1583  PXFpLine += meanChar[ix][1];
1584  PXFpLine += "\\pm";
1585  PXFpLine += RMSChar[ix][1];
1586  PXFpLine += " $";
1587  PXFmLine += " & $";
1588  PXFmLine += meanChar[ix][7];
1589  PXFmLine += "\\pm";
1590  PXFmLine += RMSChar[ix][7];
1591  PXFmLine += " $";
1592  TIBpLine += " & $";
1593  TIBpLine += meanChar[ix][2];
1594  TIBpLine += "\\pm";
1595  TIBpLine += RMSChar[ix][2];
1596  TIBpLine += " $";
1597  TIBmLine += " & $";
1598  TIBmLine += meanChar[ix][14];
1599  TIBmLine += "\\pm";
1600  TIBmLine += RMSChar[ix][14];
1601  TIBmLine += " $";
1602  TIDpLine += " & $";
1603  TIDpLine += meanChar[ix][3];
1604  TIDpLine += "\\pm";
1605  TIDpLine += RMSChar[ix][3];
1606  TIDpLine += " $";
1607  TIDmLine += " & $";
1608  TIDmLine += meanChar[ix][9];
1609  TIDmLine += "\\pm";
1610  TIDmLine += RMSChar[ix][9];
1611  TIDmLine += " $";
1612  TOBpLine += " & $";
1613  TOBpLine += meanChar[ix][4];
1614  TOBpLine += "\\pm";
1615  TOBpLine += RMSChar[ix][4];
1616  TOBpLine += " $";
1617  TOBmLine += " & $";
1618  TOBmLine += meanChar[ix][16];
1619  TOBmLine += "\\pm";
1620  TOBmLine += RMSChar[ix][16];
1621  TOBmLine += " $";
1622  TECpLine += " & $";
1623  TECpLine += meanChar[ix][5];
1624  TECpLine += "\\pm";
1625  TECpLine += RMSChar[ix][5];
1626  TECpLine += " $";
1627  TECmLine += " & $";
1628  TECmLine += meanChar[ix][11];
1629  TECmLine += "\\pm";
1630  TECmLine += RMSChar[ix][11];
1631  TECmLine += " $";
1632  }
1633 
1634  // Write the table to the tex file
1635  output << "\\begin{table}" << std::endl;
1636  output << "\\caption{" << tableCaption << "}" << std::endl;
1637  output << "\\begin{tabular}{" << tableAlign << "}" << std::endl;
1638  output << "\\hline" << std::endl;
1639  output << tableHeadline << " \\\\" << std::endl;
1640  output << "\\hline" << std::endl;
1641  output << PXBpLine << " \\\\" << std::endl;
1642  output << PXBmLine << " \\\\" << std::endl;
1643  output << PXFpLine << " \\\\" << std::endl;
1644  output << PXFmLine << " \\\\" << std::endl;
1645  output << TIBpLine << " \\\\" << std::endl;
1646  output << TIBmLine << " \\\\" << std::endl;
1647  output << TIDpLine << " \\\\" << std::endl;
1648  output << TIDmLine << " \\\\" << std::endl;
1649  output << TOBpLine << " \\\\" << std::endl;
1650  output << TOBmLine << " \\\\" << std::endl;
1651  output << TECpLine << " \\\\" << std::endl;
1652  output << TECmLine << " \\\\" << std::endl;
1653  output << "\\hline" << std::endl;
1654  output << "\\end{tabular}" << std::endl;
1655  output << "\\end{table}" << std::endl;
1656 }

References _output_directory, _units, LateXstyleTable(), output, RMS, and x.

Referenced by MakeTables().

Member Data Documentation

◆ _1dModule

bool GeometryComparisonPlotter::_1dModule
private

Definition at line 39 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), MakeTables(), and Set1dModule().

◆ _2dModule

bool GeometryComparisonPlotter::_2dModule
private

Definition at line 39 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), MakeTables(), and Set2dModule().

◆ _alignment_name

TString GeometryComparisonPlotter::_alignment_name
private

Definition at line 32 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and MakeTables().

◆ _batchMode

bool GeometryComparisonPlotter::_batchMode
private

Definition at line 39 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetBatchMode().

◆ _grid_x

int GeometryComparisonPlotter::_grid_x
private

Definition at line 47 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetGrid().

◆ _grid_y

int GeometryComparisonPlotter::_grid_y
private

Definition at line 47 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetGrid().

◆ _legend

bool GeometryComparisonPlotter::_legend
private

◆ _levelCut

int GeometryComparisonPlotter::_levelCut
private

Definition at line 47 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), MakeTables(), and SetLevelCut().

◆ _make_profile_plots

bool GeometryComparisonPlotter::_make_profile_plots
private

Definition at line 39 of file GeometryComparisonPlotter.h.

Referenced by MakePlots().

◆ _max

map<TString, float> GeometryComparisonPlotter::_max
private

◆ _min

map<TString, float> GeometryComparisonPlotter::_min
private

◆ _module_plot_option

TString GeometryComparisonPlotter::_module_plot_option
private

Definition at line 32 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and MakeTables().

◆ _output_directory

TString GeometryComparisonPlotter::_output_directory
private

Definition at line 32 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), SetOutputDirectoryName(), and WriteTable().

◆ _output_filename

TString GeometryComparisonPlotter::_output_filename
private

Definition at line 32 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetOutputFileName().

◆ _print

bool GeometryComparisonPlotter::_print
private

Definition at line 39 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetPrint().

◆ _print_only_global

bool GeometryComparisonPlotter::_print_only_global
private

Definition at line 39 of file GeometryComparisonPlotter.h.

Referenced by MakePlots().

◆ _print_option

TString GeometryComparisonPlotter::_print_option
private

Definition at line 32 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetPrintOption().

◆ _reference_name

TString GeometryComparisonPlotter::_reference_name
private

Definition at line 32 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and MakeTables().

◆ _SF

map<TString, float> GeometryComparisonPlotter::_SF
private

Definition at line 55 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), MakeTables(), and SetBranchSF().

◆ _sublevel_names

TString GeometryComparisonPlotter::_sublevel_names[6]
private

◆ _units

map<TString, TString> GeometryComparisonPlotter::_units
private

Definition at line 57 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), SetBranchUnits(), and WriteTable().

◆ _window_height

int GeometryComparisonPlotter::_window_height
private

Definition at line 47 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetCanvasSize().

◆ _window_width

int GeometryComparisonPlotter::_window_width
private

Definition at line 47 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetCanvasSize().

◆ _write

bool GeometryComparisonPlotter::_write
private

Definition at line 39 of file GeometryComparisonPlotter.h.

Referenced by MakePlots(), and SetWrite().

◆ branch_f

map<TString, float> GeometryComparisonPlotter::branch_f
private

Definition at line 55 of file GeometryComparisonPlotter.h.

Referenced by GeometryComparisonPlotter(), MakePlots(), and MakeTables().

◆ branch_i

map<TString, int> GeometryComparisonPlotter::branch_i
private

Definition at line 54 of file GeometryComparisonPlotter.h.

Referenced by GeometryComparisonPlotter(), MakePlots(), and MakeTables().

◆ canvas_index

int GeometryComparisonPlotter::canvas_index
static

Definition at line 77 of file GeometryComparisonPlotter.h.

Referenced by MakePlots().

◆ canvas_profile_index

int GeometryComparisonPlotter::canvas_profile_index
static

Definition at line 78 of file GeometryComparisonPlotter.h.

◆ data

TTree* GeometryComparisonPlotter::data
private

◆ output

TFile* GeometryComparisonPlotter::output
private

◆ tree_file

TFile* GeometryComparisonPlotter::tree_file
private
GeometryComparisonPlotter::_make_profile_plots
bool _make_profile_plots
Definition: GeometryComparisonPlotter.h:39
DDAxes::y
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
LIMITS
#define LIMITS(axes_vector)
NB_X_SLICES
#define NB_X_SLICES
COLOR_CODE
#define COLOR_CODE(icolor)
GeometryComparisonPlotter::_alignment_name
TString _alignment_name
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::LateXstyle
TString LateXstyle(TString)
Definition: GeometryComparisonPlotter.cc:1443
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
GeometryComparisonPlotter::_print_only_global
bool _print_only_global
Definition: GeometryComparisonPlotter.h:39
min
T min(T a, T b)
Definition: MathUtil.h:58
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
GeometryComparisonPlotter::_grid_x
int _grid_x
Definition: GeometryComparisonPlotter.h:47
gather_cfg.cout
cout
Definition: gather_cfg.py:144
NB_MODULE_QUALITY
#define NB_MODULE_QUALITY
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
DEFAULT_LEVEL
#define DEFAULT_LEVEL
Definition: GeometryComparisonPlotter.h:117
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
DDAxes::x
GeometryComparisonPlotter::LateXstyleTable
TString LateXstyleTable(TString)
Definition: GeometryComparisonPlotter.cc:1462
units
TString units(TString variable, Char_t axis)
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
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
plotBeamSpotDB.ipoint
ipoint
Definition: plotBeamSpotDB.py:340
GeometryComparisonPlotter::ExtensionFromPrintOption
TString ExtensionFromPrintOption(TString)
Definition: GeometryComparisonPlotter.cc:1481
DEFAULT_WINDOW_WIDTH
#define DEFAULT_WINDOW_WIDTH
Definition: GeometryComparisonPlotter.h:133
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:1534
NB_Z_SLICES
#define NB_Z_SLICES
GeometryComparisonPlotter::branch_i
map< TString, int > branch_i
Definition: GeometryComparisonPlotter.h:54
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
INDEX_IN_GLOBAL_CANVAS
#define INDEX_IN_GLOBAL_CANVAS(i1, i2)
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
GeometryComparisonPlotter::_1dModule
bool _1dModule
Definition: GeometryComparisonPlotter.h:39
listHistos.legend
legend
Definition: listHistos.py:41
GeometryComparisonPlotter::_levelCut
int _levelCut
Definition: GeometryComparisonPlotter.h:47
GeometryComparisonPlotter::_reference_name
TString _reference_name
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::_grid_y
int _grid_y
Definition: GeometryComparisonPlotter.h:47
GeometryComparisonPlotter::_batchMode
bool _batchMode
Definition: GeometryComparisonPlotter.h:39
combine.histos
histos
Definition: combine.py:4
CHECK_MAP_CONTENT
#define CHECK_MAP_CONTENT(m, type)
Definition: GeometryComparisonPlotter.cc:23
INSIDE_VECTOR
#define INSIDE_VECTOR(vector)
Definition: GeometryComparisonPlotter.cc:18
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:1514
GeometryComparisonPlotter::_write
bool _write
Definition: GeometryComparisonPlotter.h:39
NB_SUBLEVELS
#define NB_SUBLEVELS
Definition: GeometryComparisonPlotter.h:30
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DEBUG
#define DEBUG
Definition: DMRChecker.cc:119
GeometryComparisonPlotter::_legend
bool _legend
Definition: GeometryComparisonPlotter.h:39
GeometryComparisonPlotter::_min
map< TString, float > _min
Definition: GeometryComparisonPlotter.h:55
GeometryComparisonPlotter::_SF
map< TString, float > _SF
Definition: GeometryComparisonPlotter.h:55
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:52
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
GeometryComparisonPlotter::_print_option
TString _print_option
Definition: GeometryComparisonPlotter.h:32
GeometryComparisonPlotter::_window_height
int _window_height
Definition: GeometryComparisonPlotter.h:47
cuy.graphs
graphs
Definition: cuy.py:961
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
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
CHECK_BRANCHES
#define CHECK_BRANCHES(branchname_vector)