14 #define TALKATIVE // get some comments while processing 18 #define INSIDE_VECTOR(vector) \ 19 cout << #vector << "={"; \ 20 for (unsigned int i = 0; i < vector.size() - 1; i++) \ 21 cout << vector[i] << ","; \ 22 cout << vector.back() << "}"; 23 #define CHECK_MAP_CONTENT(m, type) \ 24 for (map<TString, type>::iterator it = m.begin(); it != m.end(); it++) \ 25 cout << __FILE__ << ":" << __LINE__ << ":Info: " << #m << "[" << it->first << "]=" << it->second << endl; 29 TString output_directory,
30 TString modulesToPlot,
31 TString alignmentName,
32 TString referenceName,
34 bool makeProfilePlots)
35 : _output_directory(output_directory + TString(output_directory.EndsWith(
"/") ?
"" :
"/")),
36 _output_filename(
"comparison.root"),
38 _module_plot_option(modulesToPlot),
39 _alignment_name(alignmentName),
40 _reference_name(referenceName),
41 _print_only_global(printOnlyGlobal),
42 _make_profile_plots(makeProfilePlots),
61 cout <<
">>> TALKATIVE MODE ACTIVATED <<<" << endl;
64 cout <<
">>> DEBUG MODE ACTIVATED <<<" << endl;
65 cout << __FILE__ <<
":" << __LINE__ <<
":Info: inside constructor of GeometryComparisonPlotter utility" << endl;
78 tree_file =
new TFile(tree_file_name,
"UPDATE");
82 data->SetBranchAddress(
"inModuleList", &
branch_i[
"inModuleList"]);
83 data->SetBranchAddress(
"badModuleQuality", &
branch_i[
"badModuleQuality"]);
87 data->SetBranchAddress(
"sublevel", &
branch_i[
"sublevel"]);
88 data->SetBranchAddress(
"useDetId", &
branch_i[
"useDetId"]);
108 if (
data->GetBranch(
"rdphi") ==
112 cout << __FILE__ <<
":" << __LINE__
113 <<
":Info: computing the rdphi branch from r and dphi branches (assuming they exist...)" << endl;
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);
125 cout << __FILE__ <<
":" << __LINE__ <<
":Info: branch addresses set" << endl;
131 data->SetMarkerSize(0.5);
132 data->SetMarkerStyle(6);
134 gStyle->SetOptStat(
"emr");
135 gStyle->SetTitleAlign(22);
136 gStyle->SetTitleX(0.5);
137 gStyle->SetTitleY(0.97);
138 gStyle->SetTitleFont(62);
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");
153 gStyle->SetMarkerStyle(8);
154 gStyle->SetHistLineWidth(2);
155 gStyle->SetLineStyleString(2,
"[12 12]");
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);
167 gStyle->SetPadTickX(1);
168 gStyle->SetPadTickY(1);
170 gStyle->SetPadTopMargin(0.1);
171 gStyle->SetPadRightMargin(0.05);
172 gStyle->SetPadBottomMargin(0.16);
173 gStyle->SetPadLeftMargin(0.18);
176 cout << __FILE__ <<
":" << __LINE__ <<
":Info: end of constructor" << endl;
182 cout << __FILE__ <<
":" << __LINE__ <<
":Info: in destructor of the GeometryComparisonPlotter utility" << endl;
186 cout << __FILE__ <<
":" << __LINE__ <<
":Info: ending." << endl;
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." \ 210 const unsigned int nentries =
data->GetEntries();
213 cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
215 cout << endl << __FILE__ <<
":" << __LINE__ <<
":Info: ";
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]); \ 260 #define NB_SUBLEVELS 6 262 #define NB_Z_SLICES 2 263 #define NB_MODULE_QUALITY 3 264 #define COLOR_CODE(icolor) int(icolor / 4) + icolor + 1 270 *mgraphs[
x.size()][
y.size()]
280 TH1F *histosYValues[
x.size()][
y.size()]
291 for (
unsigned int ic = 0; ic <=
NB_SUBLEVELS + 1; ic++) {
292 c_global[ic] =
new TCanvas(
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());
303 new TCanvas(TString::Format(
"global_profile_plots_%s_%d",
304 ic == 0 ?
"tracker" : (ic == 7 ?
"pixel" :
_sublevel_names[ic - 1].Data()),
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());
314 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
315 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
321 graphs[ix][iy][igraph] =
new TGraph();
324 graphs[ix][iy][igraph]->SetMarkerStyle(6);
326 graphs[ix][iy][igraph]->SetName(
332 graphs[ix][iy][igraph]->SetTitle(
340 graphs[ix][iy][igraph]->SetMarkerStyle(
350 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
356 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
359 histos2D[ix][iy][igraph] =
376 cout << __FILE__ <<
":" << __LINE__ <<
":Info: Creation of the TGraph[" <<
x.size() <<
"][" <<
y.size() <<
"][" 382 cout << __FILE__ <<
":" << __LINE__ <<
":Info: Looping on the TTree" << endl;
385 unsigned int progress = 0;
386 cout << __FILE__ <<
":" << __LINE__ <<
":Info: 0%" << endl;
388 for (
unsigned int ientry = 0; ientry < nentries; ientry++) {
390 if (10 * ientry / nentries != progress) {
391 progress = 10 * ientry / nentries;
392 cout << __FILE__ <<
":" << __LINE__ <<
":Info: " << 10 * progress <<
"%" << endl;
396 data->GetEntry(ientry);
407 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
416 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
446 if (
y.size() >=
x.size()) {
449 graphs[ix][iy][igraph]->SetPoint(
454 const short int igraph =
456 graphs[ix][iy][igraph]->SetPoint(
460 if (
branch_i[
"badModuleQuality"] > 0) {
461 const short int igraph =
463 graphs[ix][iy][igraph]->SetPoint(
470 graphs[iy][ix][igraph]->SetPoint(
475 const short int igraph =
477 graphs[iy][ix][igraph]->SetPoint(
481 if (
branch_i[
"badModuleQuality"] > 0) {
482 const short int igraph =
484 graphs[iy][ix][igraph]->SetPoint(
493 cout << __FILE__ <<
":" << __LINE__ <<
":Info: 100%\tLoop ended" << endl;
503 <<
" failed" << endl;
519 unsigned int n_module_types = 1;
528 #define INDEX_IN_GLOBAL_CANVAS(i1, i2) 1 + i1 + i2 *x.size() 530 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
532 cout << __FILE__ <<
":" << __LINE__ <<
":Info: x[" << ix <<
"]=" <<
x[ix] << endl;
536 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
538 cout << __FILE__ <<
":" << __LINE__ <<
":Info: x[" << ix <<
"]=" <<
x[ix] <<
" and y[" << iy <<
"]=" <<
y[iy]
539 <<
"\t-> creating TMultiGraph" << endl;
541 mgraphs[ix][iy][0] =
new TMultiGraph(
542 TString::Format(
"mgr_%s_vs_%s_tracker_%d",
550 mgraphs[ix][iy][7] =
new TMultiGraph(
551 TString::Format(
"mgr_%s_vs_%s_pixel_%d",
563 unsigned short int igraph =
568 cout << __FILE__ <<
":" << __LINE__ <<
":Info: writing TGraph to file" << endl;
572 graphs[ix][iy][igraph]->Write();
573 if (
graphs[ix][iy][igraph]->GetN() == 0) {
575 cout << __FILE__ <<
":" << __LINE__ <<
":Info: " <<
graphs[ix][iy][igraph]->GetName() <<
" is empty." << endl;
580 cout << __FILE__ <<
":" << __LINE__ <<
":Info: cloning, coloring and adding TGraph " 582 <<
" to global TMultiGraph" << endl;
585 TGraph *gr = (TGraph *)
graphs[ix][iy][igraph]->Clone();
588 mgraphs[ix][iy][0]->Add(gr,
"P");
591 mgraphs[ix][iy][7]->Add(gr,
"P");
595 for (
unsigned int isublevel = 1; isublevel <=
NB_SUBLEVELS; isublevel++) {
597 cout << __FILE__ <<
":" << __LINE__ <<
":Info: cloning, coloring and adding TGraph " 598 <<
_sublevel_names[isublevel - 1] <<
" to sublevel TMultiGraph" << endl;
600 mgraphs[ix][iy][isublevel] =
601 new TMultiGraph(TString::Format(
"%s_vs_%s_%s_%d",
611 graphs[ix][iy][isublevel - 1]->SetMarkerColor(kBlack);
617 if (
graphs[ix][iy][isublevel - 1]->GetN() > 0)
618 mgraphs[ix][iy][isublevel]->Add(
619 graphs[ix][iy][isublevel - 1],
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;
628 mgraphs[ix][iy][isublevel]->Add(
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;
638 cout << __FILE__ <<
":" << __LINE__ <<
":Error: color code incomplete for Z slices..." << endl;
642 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][2 *
NB_SUBLEVELS + isublevel - 1],
"P");
644 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][3 *
NB_SUBLEVELS + isublevel - 1],
"P");
646 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][4 *
NB_SUBLEVELS + isublevel - 1],
"P");
648 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][5 *
NB_SUBLEVELS + isublevel - 1],
"P");
652 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][2 *
NB_SUBLEVELS + isublevel - 1],
"P");
654 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][3 *
NB_SUBLEVELS + isublevel - 1],
"P");
660 for (
unsigned short int imgr = 0; imgr <=
NB_SUBLEVELS + 1; imgr++) {
662 cout << __FILE__ <<
":" << __LINE__ <<
":Info: treating individual canvases." << endl;
665 c[ix][iy][imgr] =
new TCanvas(
666 TString::Format(
"c_%s_vs_%s_%s_%d",
669 imgr == 0 ?
"tracker" : (imgr == 7 ?
"pixel" :
_sublevel_names[imgr - 1].Data()),
671 TString::Format(
"%s vs. %s at %s level",
674 imgr == 0 ?
"tracker" : (imgr == 7 ?
"pixel" :
_sublevel_names[imgr - 1].Data())),
679 if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) {
680 if (dyMin[iy] != -99999) {
681 mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]);
683 if (dyMax[iy] != -99999) {
684 mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]);
686 mgraphs[ix][iy][imgr]->Draw(
"A");
691 c[ix][iy][imgr]->Print(
697 mgraphs[ix][iy][imgr]->Write();
703 if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) {
704 if (dyMin[iy] != -99999) {
705 mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]);
707 if (dyMax[iy] != -99999) {
708 mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]);
710 mgraphs[ix][iy][imgr]->Draw(
"A");
718 gStyle->SetOptTitle(0);
720 for (
unsigned int ic = 0; ic <=
NB_SUBLEVELS + 1; ic++) {
721 c_global[ic]->Draw();
726 TCanvas *c_temp = (TCanvas *)c_global[ic]->Clone(c_global[ic]->GetTitle() + TString(
"_sub"));
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(),
740 *p_down =
new TPad(TString(
"main_") + c_temp->GetName(),
"", 0., 0., 1., 0.9, -1, 0, 0);
744 c_temp->DrawClonePad();
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);
761 TLegend *global_legend =
MakeLegend(.05, .1, .7, .8, 2);
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);
771 TPaveText *
pt =
new TPaveText(.05, .1, .7, .8,
"NB");
775 TPaveText *pt_geom =
new TPaveText(.6, .1, .95, .8,
"NB");
776 pt_geom->SetFillColor(0);
777 pt_geom->SetTextSize(0.3);
787 c_global[ic]->Write();
799 bool entries =
false;
800 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
801 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
809 histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(),
814 histos[ix][iy][igraph]->StatOverflows(kTRUE);
817 for (
int binx = 0; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(); binx++) {
820 histosYValues[ix][iy][igraph] =
825 histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(),
828 histosYValues[ix][iy][igraph]->StatOverflows(kTRUE);
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));
838 histos[ix][iy][igraph]->SetBinContent(binx, histosYValues[ix][iy][igraph]->GetMean());
839 histos[ix][iy][igraph]->SetBinError(binx, histosYValues[ix][iy][igraph]->GetRMS());
841 histos[ix][iy][igraph]->SetBinContent(binx, -999999.);
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()),
858 c_hist[ix][iy][0]->GetPad(0)->DrawFrame(
_min[
x[ix]],
859 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
861 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
868 unsigned short int igraph =
873 histosTracker[ix][iy][igraph] = (TH1F *)
histos[ix][iy][igraph]->Clone();
877 histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
878 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
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) +
894 ->DrawFrame(
_min[
x[ix]],
895 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
897 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
902 unsigned short int igraph =
905 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
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()),
919 c_hist[ix][iy][7]->GetPad(0)->DrawFrame(
_min[
x[ix]],
920 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
922 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
929 unsigned short int igraph =
936 histosTracker[ix][iy][igraph] = (TH1F *)
histos[ix][iy][igraph]->Clone();
940 histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
941 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
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) +
958 ->DrawFrame(
_min[
x[ix]],
959 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
961 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
966 unsigned short int igraph =
969 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
973 for (
unsigned int isublevel = 1; isublevel <=
NB_SUBLEVELS; isublevel++) {
975 c_hist[ix][iy][isublevel] =
976 new TCanvas(TString::Format(
"c_hist_%s_vs_%s_%s_%d",
981 TString::Format(
"Profile plot %s vs. %s at %s level",
988 c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(
_min[
x[ix]],
989 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
991 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
995 histos[ix][iy][isublevel - 1]->SetMarkerColor(kBlack);
996 histos[ix][iy][isublevel - 1]->SetLineColor(kBlack);
1000 histos[ix][iy][isublevel - 1]->Draw(
"same pe0");
1005 TString::Format(
"Profile_plot_%s_vs_%s_%s_%d",
1016 c_global_hist[isublevel]
1018 ->SetFillStyle(4000);
1020 c_global_hist[isublevel]
1022 ->DrawFrame(
_min[
x[ix]],
1023 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
1025 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
1029 histos[ix][iy][isublevel - 1]->Draw(
"same pe0");
1037 gStyle->SetOptTitle(0);
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(),
1063 *p_down =
new TPad(TString(
"main_") + c_temp_hist->GetName(),
"", 0., 0., 1., 0.9, -1, 0, 0);
1067 c_temp_hist->DrawClonePad();
1068 c_global_hist[ic]->cd();
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);
1084 TLegend *global_legend =
MakeLegend(.05, .1, .7, .8, 2);
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);
1094 TPaveText *
pt =
new TPaveText(.05, .1, .7, .8,
"NB");
1095 pt->SetFillColor(0);
1098 TPaveText *pt_geom =
new TPaveText(.6, .1, .95, .8,
"NB");
1099 pt_geom->SetFillColor(0);
1100 pt_geom->SetTextSize(0.3);
1107 c_global_hist[ic]->Print(
1113 cout << __FILE__ <<
":" << __LINE__ <<
":Info: End of MakePlots method" << endl;
1121 vector<float> dyMin,
1122 vector<float> dyMax)
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." \ 1137 const unsigned int nentries =
data->GetEntries();
1140 cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
1143 cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
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]); \ 1184 #ifndef NB_SUBLEVELS 1185 #define NB_SUBLEVELS 6 1187 #define NB_Z_SLICES 2 1188 #define NB_X_SLICES 2 1201 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1211 histos[iy][ihist]->StatOverflows(kTRUE);
1215 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1225 histosx[ix][ihist]->StatOverflows(kTRUE);
1230 cout << __FILE__ <<
":" << __LINE__ <<
":Info: Creation of the TH1F[" <<
y.size() <<
"][" 1236 cout << __FILE__ <<
":" << __LINE__ <<
":Info: Looping on the TTree" << endl;
1239 unsigned int progress = 0;
1240 cout << __FILE__ <<
":" << __LINE__ <<
":Info: 0%" << endl;
1242 for (
unsigned int ientry = 0; ientry < nentries; ientry++) {
1244 if (10 * ientry / nentries != progress) {
1245 progress = 10 * ientry / nentries;
1246 cout << __FILE__ <<
":" << __LINE__ <<
":Info: " << 10 * progress <<
"%" << endl;
1250 data->GetEntry(ientry);
1260 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1288 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1317 cout << __FILE__ <<
":" << __LINE__ <<
":Info: 100%\tLoop ended" << endl;
1322 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1334 meanValue[iy][ihist] =
histos[iy][ihist]->GetMean();
1335 RMS[iy][ihist] =
histos[iy][ihist]->GetRMS();
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);
1344 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1349 histosx[ix][ihist]->Add(histosx[ix][ihist +
NB_SUBLEVELS]);
1356 meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean();
1357 RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS();
1361 TString tableFileName, tableCaption, tableAlign, tableHeadline;
1362 TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine,
1366 tableFileName =
"table_differences.tex";
1369 " for each subdetector, all modules used.";
1372 " for each subdetector, only good modules used.";
1375 " for each subdetector, good modules and those in given list used.";
1380 tableFileName =
"table_differences_Gaussian.tex";
1383 " for each subdetector, all modules used.";
1386 " for each subdetector, only good modules used.";
1389 " for each subdetector, good modules and those in given list used.";
1395 tableFileName =
"table_meanPos.tex";
1398 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1399 " geometry for each subdetector, all modules used.";
1401 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1402 " geometry for each subdetector, only good modules used.";
1404 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1405 " geometry for each subdetector, good modules and those in given list used.";
1410 cout << __FILE__ <<
":" << __LINE__ <<
":Info: End of MakeLegends method" << endl;
1445 if (
word.BeginsWith(
"d"))
1446 word.ReplaceAll(
"d",
"#Delta");
1447 if (
word == TString(
"rdphi"))
1448 word =
"r#Delta#phi";
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");
1464 if (
word.BeginsWith(
"d"))
1465 word.ReplaceAll(
"d",
"$\\Delta$");
1466 if (
word == TString(
"rdphi"))
1467 word =
"r$\\Delta\\phi$";
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$");
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");
1509 cout << __FILE__ <<
":" << __LINE__ <<
":Warning: unknown format. Returning .pdf, but possibly wrong..." << endl;
1510 return TString(
".pdf");
1515 double x1,
double y1,
double x2,
double y2,
int nPlottedSublevels,
const TString
title) {
1517 legend->SetNColumns(nPlottedSublevels);
1521 for (
int isublevel = 0; isublevel < nPlottedSublevels;
1524 TGraph *
g =
new TGraph(0);
1527 g->SetMarkerStyle(kFullSquare);
1528 g->SetMarkerSize(10);
1535 unsigned int nLevelsTimesSlices,
1536 float meanValue[10][24],
1538 const TString nDigits,
1539 const TString tableCaption,
1540 const TString tableFileName) {
1543 TString tableAlign, tableHeadline;
1544 TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine,
1546 char meanChar[
x.size()][nLevelsTimesSlices][10];
1547 char RMSChar[
x.size()][nLevelsTimesSlices][10];
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$-$";
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]);
1573 PXBpLine += meanChar[ix][0];
1575 PXBpLine += RMSChar[ix][0];
1578 PXBmLine += meanChar[ix][12];
1580 PXBmLine += RMSChar[ix][12];
1583 PXFpLine += meanChar[ix][1];
1585 PXFpLine += RMSChar[ix][1];
1588 PXFmLine += meanChar[ix][7];
1590 PXFmLine += RMSChar[ix][7];
1593 TIBpLine += meanChar[ix][2];
1595 TIBpLine += RMSChar[ix][2];
1598 TIBmLine += meanChar[ix][14];
1600 TIBmLine += RMSChar[ix][14];
1603 TIDpLine += meanChar[ix][3];
1605 TIDpLine += RMSChar[ix][3];
1608 TIDmLine += meanChar[ix][9];
1610 TIDmLine += RMSChar[ix][9];
1613 TOBpLine += meanChar[ix][4];
1615 TOBpLine += RMSChar[ix][4];
1618 TOBmLine += meanChar[ix][16];
1620 TOBmLine += RMSChar[ix][16];
1623 TECpLine += meanChar[ix][5];
1625 TECpLine += RMSChar[ix][5];
1628 TECmLine += meanChar[ix][11];
1630 TECmLine += RMSChar[ix][11];
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;
void WriteTable(const vector< TString > x, unsigned int nLevelsTimesSlices, float meanValue[10][24], float RMS[10][24], const TString nDigits, const TString tableCaption, const TString tableFileName)
void SetCanvasSize(const int window_width=3508, const int window_height=2480)
void MakePlots(const vector< TString >, const vector< TString >, const vector< float >, const vector< float >)
void Set1dModule(const bool)
map< TString, float > branch_f
TString LateXstyleTable(TString)
TString LateXstyle(TString)
void SetGrid(const int, const int)
void SetBatchMode(const bool)
std::string to_string(const V &value)
#define LIMITS(axes_vector)
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
~GeometryComparisonPlotter()
#define INDEX_IN_GLOBAL_CANVAS(i1, i2)
void SetBranchMax(const TString, const float)
void SetBranchUnits(const TString, const TString)
#define DEFAULT_WINDOW_WIDTH
void SetOutputDirectoryName(const TString)
map< TString, float > _max
void SetPrintOption(const Option_t *)
void Set2dModule(const bool)
void SetLegend(const bool)
map< TString, float > _min
#define CHECK_MAP_CONTENT(m, type)
TString _module_plot_option
void SetWrite(const bool)
TString _output_directory
map< TString, TString > _units
TString _sublevel_names[6]
TString ExtensionFromPrintOption(TString)
void SetOutputFileName(const TString)
void SetPrint(const bool)
void SetBranchSF(const TString, const float)
TString units(TString variable, Char_t axis)
#define CHECK_BRANCHES(branchname_vector)
map< TString, int > branch_i
void MakeTables(const vector< TString >, const vector< TString >, const vector< float >, const vector< float >)
TLegend * MakeLegend(double x1, double y1, double x2, double y2, int nPlottedSublevels, const TString title="")
#define DEFAULT_WINDOW_HEIGHT
#define COLOR_CODE(icolor)
void SetBranchMin(const TString, const float)
#define INSIDE_VECTOR(vector)
void SetLevelCut(const int)
#define NB_MODULE_QUALITY
map< TString, float > _SF
GeometryComparisonPlotter(TString tree_file_name, TString outputDirname="output/", TString modulesToPlot="all", TString referenceName="Ideal", TString alignmentName="Alignment", bool plotOnlyGlobal=false, bool makeProfilePlots=false)