15 #define TALKATIVE // get some comments while processing 19 #define INSIDE_VECTOR(vector) \ 20 std::cout << #vector << "={"; \ 21 for (unsigned int i = 0; i < vector.size() - 1; i++) \ 22 std::cout << vector[i] << ","; \ 23 std::cout << vector.back() << "}"; 24 #define CHECK_MAP_CONTENT(m, type) \ 25 for (std::map<TString, type>::iterator it = m.begin(); it != m.end(); it++) \ 26 std::cout << __FILE__ << ":" << __LINE__ << ":Info: " << #m << "[" << it->first << "]=" << it->second << std::endl; 52 TString output_directory,
53 TString modulesToPlot,
54 TString alignmentName,
55 TString referenceName,
57 bool makeProfilePlots,
59 : _output_directory(output_directory + TString(output_directory.EndsWith(
"/") ?
"" :
"/")),
60 _output_filename(
"comparison.root"),
62 _module_plot_option(modulesToPlot),
63 _alignment_name(alignmentName),
64 _reference_name(referenceName),
68 _print_only_global(printOnlyGlobal),
69 _make_profile_plots(makeProfilePlots),
84 _canvas_index(canvas_idx) {
86 std::cout <<
">>> TALKATIVE MODE ACTIVATED <<<" << std::endl;
89 std::cout <<
">>> DEBUG MODE ACTIVATED <<<" << std::endl;
90 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: inside constructor of GeometryComparisonPlotter utility" 106 tree_file =
new TFile(tree_file_name,
"UPDATE");
110 data->SetBranchAddress(
"inModuleList", &
branch_i[
"inModuleList"]);
111 data->SetBranchAddress(
"badModuleQuality", &
branch_i[
"badModuleQuality"]);
115 data->SetBranchAddress(
"sublevel", &
branch_i[
"sublevel"]);
116 data->SetBranchAddress(
"useDetId", &
branch_i[
"useDetId"]);
136 if (
data->GetBranch(
"rdphi") ==
141 <<
":Info: computing the rdphi branch from r and dphi branches (assuming they exist...)" << std::endl;
143 TBranch *br_rdphi =
data->Branch(
"rdphi", &
branch_f[
"rdphi"],
"rdphi/F");
144 for (
unsigned int ientry = 0; ientry <
data->GetEntries(); ientry++) {
145 data->GetEntry(ientry);
153 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: branch addresses set" << std::endl;
159 data->SetMarkerSize(0.5);
160 data->SetMarkerStyle(6);
162 gStyle->SetOptStat(
"emr");
163 gStyle->SetTitleAlign(22);
164 gStyle->SetTitleX(0.5);
165 gStyle->SetTitleY(0.97);
166 gStyle->SetTitleFont(62);
169 gStyle->SetTextFont(132);
170 gStyle->SetTextSize(0.08);
171 gStyle->SetLabelFont(132,
"x");
172 gStyle->SetLabelFont(132,
"y");
173 gStyle->SetLabelFont(132,
"z");
174 gStyle->SetTitleSize(0.08,
"x");
175 gStyle->SetTitleSize(0.08,
"y");
176 gStyle->SetTitleSize(0.08,
"z");
177 gStyle->SetLabelSize(0.08,
"x");
178 gStyle->SetLabelSize(0.08,
"y");
179 gStyle->SetLabelSize(0.08,
"z");
181 gStyle->SetMarkerStyle(8);
182 gStyle->SetHistLineWidth(2);
183 gStyle->SetLineStyleString(2,
"[12 12]");
185 gStyle->SetFrameBorderMode(0);
186 gStyle->SetCanvasBorderMode(0);
187 gStyle->SetPadBorderMode(0);
188 gStyle->SetPadColor(0);
189 gStyle->SetCanvasColor(0);
190 gStyle->SetTitleColor(1);
191 gStyle->SetStatColor(0);
192 gStyle->SetStatBorderSize(1);
193 gStyle->SetFrameFillColor(0);
195 gStyle->SetPadTickX(1);
196 gStyle->SetPadTickY(1);
198 gStyle->SetPadTopMargin(0.1);
199 gStyle->SetPadRightMargin(0.05);
200 gStyle->SetPadBottomMargin(0.16);
201 gStyle->SetPadLeftMargin(0.18);
204 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: end of constructor" << std::endl;
210 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: in destructor of the GeometryComparisonPlotter utility" 215 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: ending." << std::endl;
221 std::vector<TString>
x,
222 std::vector<TString>
y,
227 #define CHECK_BRANCHES(branchname_vector) \ 228 for (unsigned int i = 0; i < branchname_vector.size(); i++) { \ 229 if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \ 230 std::cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] \ 231 << " is not recognised." << std::endl; \ 238 const unsigned int nentries =
data->GetEntries();
241 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
243 std::cout << std::endl << __FILE__ <<
":" << __LINE__ <<
":Info: ";
251 #define LIMITS(axes_vector) \ 252 for (unsigned int i = 0; i < axes_vector.size(); i++) { \ 253 if (_SF.find(axes_vector[i]) == _SF.end()) \ 254 _SF[axes_vector[i]] = 1.; \ 255 if (_min.find(axes_vector[i]) == _min.end()) \ 256 _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \ 257 if (_max.find(axes_vector[i]) == _max.end()) \ 258 _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \ 288 #define NB_SUBLEVELS 6 290 #define NB_Z_SLICES 2 291 #define NB_MODULE_QUALITY 3 292 #define COLOR_CODE(icolor) int(icolor / 4) + icolor + 1 298 *mgraphs[
x.size()][
y.size()]
308 TH1F *histosYValues[
x.size()][
y.size()]
319 for (
unsigned int ic = 0; ic <=
NB_SUBLEVELS + 1; ic++) {
320 c_global[ic] =
new TCanvas(
323 TString::Format(
"Global overview of the %s variables",
324 ic == 0 ?
"tracker" : (ic == 7 ?
"pixel" :
_sublevel_names[ic - 1].Data())),
327 c_global[ic]->Divide(
x.size(),
y.size());
331 new TCanvas(TString::Format(
"global_profile_plots_%s_%d",
332 ic == 0 ?
"tracker" : (ic == 7 ?
"pixel" :
_sublevel_names[ic - 1].Data()),
334 TString::Format(
"Global overview profile plots of the %s variables",
335 ic == 0 ?
"tracker" : (ic == 7 ?
"pixel" :
_sublevel_names[ic - 1].Data())),
338 c_global_hist[ic]->Divide(
x.size(),
y.size());
342 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
343 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
349 graphs[ix][iy][igraph] =
new TGraph();
352 graphs[ix][iy][igraph]->SetMarkerStyle(6);
354 graphs[ix][iy][igraph]->SetName(
360 graphs[ix][iy][igraph]->SetTitle(
368 graphs[ix][iy][igraph]->SetMarkerStyle(
378 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
384 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
387 histos2D[ix][iy][igraph] =
404 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: Creation of the TGraph[" <<
x.size() <<
"][" <<
y.size() <<
"][" 410 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: Looping on the TTree" << std::endl;
413 unsigned int progress = 0;
414 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: 0%" << std::endl;
416 for (
unsigned int ientry = 0; ientry < nentries; ientry++) {
418 if (10 * ientry / nentries != progress) {
419 progress = 10 * ientry / nentries;
420 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: " << 10 * progress <<
"%" << std::endl;
424 data->GetEntry(ientry);
435 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
444 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
474 if (
y.size() >=
x.size()) {
477 graphs[ix][iy][igraph]->SetPoint(
482 const short int igraph =
484 graphs[ix][iy][igraph]->SetPoint(
488 if (
branch_i[
"badModuleQuality"] > 0) {
489 const short int igraph =
491 graphs[ix][iy][igraph]->SetPoint(
498 graphs[iy][ix][igraph]->SetPoint(
503 const short int igraph =
505 graphs[iy][ix][igraph]->SetPoint(
509 if (
branch_i[
"badModuleQuality"] > 0) {
510 const short int igraph =
512 graphs[iy][ix][igraph]->SetPoint(
521 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: 100%\tLoop ended" << std::endl;
531 <<
" failed" << std::endl;
535 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: output file is " 547 unsigned int n_module_types = 1;
556 #define INDEX_IN_GLOBAL_CANVAS(i1, i2) 1 + i1 + i2 *x.size() 558 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
560 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: x[" << ix <<
"]=" <<
x[ix] << std::endl;
564 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
565 TString min_branch = TString::Format(
"%s_min",
y[iy].Data());
566 TString max_branch = TString::Format(
"%s_max",
y[iy].Data());
569 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: x[" << ix <<
"]=" <<
x[ix] <<
" and y[" << iy <<
"]=" <<
y[iy]
570 <<
"\t-> creating TMultiGraph" << std::endl;
572 mgraphs[ix][iy][0] =
new TMultiGraph(
573 TString::Format(
"mgr_%s_vs_%s_tracker_%d",
581 mgraphs[ix][iy][7] =
new TMultiGraph(
582 TString::Format(
"mgr_%s_vs_%s_pixel_%d",
594 unsigned short int igraph =
599 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: writing TGraph to file" << std::endl;
603 graphs[ix][iy][igraph]->Write();
604 if (
graphs[ix][iy][igraph]->GetN() == 0) {
606 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: " <<
graphs[ix][iy][igraph]->GetName() <<
" is empty." 612 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: cloning, coloring and adding TGraph " 614 <<
" to global TMultiGraph" << std::endl;
617 TGraph *gr = (TGraph *)
graphs[ix][iy][igraph]->Clone();
620 mgraphs[ix][iy][0]->Add(gr,
"P");
623 mgraphs[ix][iy][7]->Add(gr,
"P");
627 for (
unsigned int isublevel = 1; isublevel <=
NB_SUBLEVELS; isublevel++) {
629 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: cloning, coloring and adding TGraph " 630 <<
_sublevel_names[isublevel - 1] <<
" to sublevel TMultiGraph" << std::endl;
632 mgraphs[ix][iy][isublevel] =
633 new TMultiGraph(TString::Format(
"%s_vs_%s_%s_%d",
643 graphs[ix][iy][isublevel - 1]->SetMarkerColor(kBlack);
649 if (
graphs[ix][iy][isublevel - 1]->GetN() > 0)
650 mgraphs[ix][iy][isublevel]->Add(
651 graphs[ix][iy][isublevel - 1],
656 <<
":Info: graphs[ix][iy][isublevel-1]=" <<
graphs[ix][iy][isublevel - 1]->GetName()
657 <<
" is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << std::endl;
660 mgraphs[ix][iy][isublevel]->Add(
665 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: graphs[ix][iy][NB_SUBLEVEL+isublevel-1]=" 666 <<
graphs[ix][iy][
NB_Z_SLICES + isublevel - 1]->GetName() <<
" is empty -> not added into " 667 << mgraphs[ix][iy][isublevel]->GetName() << std::endl;
670 std::cout << __FILE__ <<
":" << __LINE__ <<
":Error: color code incomplete for Z slices..." << std::endl;
674 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][2 *
NB_SUBLEVELS + isublevel - 1],
"P");
676 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][3 *
NB_SUBLEVELS + isublevel - 1],
"P");
678 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][4 *
NB_SUBLEVELS + isublevel - 1],
"P");
680 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][5 *
NB_SUBLEVELS + isublevel - 1],
"P");
684 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][2 *
NB_SUBLEVELS + isublevel - 1],
"P");
686 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][3 *
NB_SUBLEVELS + isublevel - 1],
"P");
692 for (
unsigned short int imgr = 0; imgr <=
NB_SUBLEVELS + 1; imgr++) {
694 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: treating individual canvases." << std::endl;
697 c[ix][iy][imgr] =
new TCanvas(
698 TString::Format(
"c_%s_vs_%s_%s_%d",
701 imgr == 0 ?
"tracker" : (imgr == 7 ?
"pixel" :
_sublevel_names[imgr - 1].Data()),
703 TString::Format(
"%s vs. %s at %s level",
706 imgr == 0 ?
"tracker" : (imgr == 7 ?
"pixel" :
_sublevel_names[imgr - 1].Data())),
711 if (mgraphs[ix][iy][imgr]->GetListOfGraphs() !=
nullptr) {
712 if (CFG.count(min_branch.Data()) > 0) {
713 mgraphs[ix][iy][imgr]->SetMinimum(CFG.get<
float>(min_branch.Data()));
715 if (CFG.count(max_branch.Data()) > 0) {
716 mgraphs[ix][iy][imgr]->SetMaximum(CFG.get<
float>(max_branch.Data()));
718 mgraphs[ix][iy][imgr]->Draw(
"A");
723 c[ix][iy][imgr]->Print(
729 mgraphs[ix][iy][imgr]->Write();
735 if (mgraphs[ix][iy][imgr]->GetListOfGraphs() !=
nullptr) {
736 if (CFG.count(min_branch.Data()) > 0) {
737 mgraphs[ix][iy][imgr]->SetMinimum(CFG.get<
float>(min_branch.Data()));
739 if (CFG.count(max_branch.Data()) > 0) {
740 mgraphs[ix][iy][imgr]->SetMaximum(CFG.get<
float>(max_branch.Data()));
742 mgraphs[ix][iy][imgr]->Draw(
"A");
750 gStyle->SetOptTitle(0);
752 for (
unsigned int ic = 0; ic <=
NB_SUBLEVELS + 1; ic++) {
753 c_global[ic]->Draw();
758 TCanvas *c_temp = (TCanvas *)c_global[ic]->Clone(c_global[ic]->GetTitle() + TString(
"_sub"));
760 c_global[ic] =
new TCanvas(
761 c_temp->GetName() + TString(
"_final"), c_temp->GetTitle(), c_temp->GetWindowWidth(), c_temp->GetWindowHeight());
762 c_global[ic]->Draw();
763 TPad *p_up =
new TPad(TString(
"legend_") + c_temp->GetName(),
772 *p_down =
new TPad(TString(
"main_") + c_temp->GetName(),
"", 0., 0., 1., 0.9, -1, 0, 0);
776 c_temp->DrawClonePad();
784 global_legend->Draw();
785 TPaveText *pt_geom =
new TPaveText(.75, .1, .95, .8,
"NB");
786 pt_geom->SetFillColor(0);
787 pt_geom->SetTextSize(0.25);
793 TLegend *global_legend =
MakeLegend(.05, .1, .7, .8, 2);
794 global_legend->Draw();
795 TPaveText *pt_geom =
new TPaveText(.75, .1, .95, .8,
"NB");
796 pt_geom->SetFillColor(0);
797 pt_geom->SetTextSize(0.25);
803 TPaveText *
pt =
new TPaveText(.05, .1, .7, .8,
"NB");
807 TPaveText *pt_geom =
new TPaveText(.6, .1, .95, .8,
"NB");
808 pt_geom->SetFillColor(0);
809 pt_geom->SetTextSize(0.3);
819 c_global[ic]->Write();
831 bool entries =
false;
832 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
833 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
834 TString min_branch = TString::Format(
"%s_min",
y[iy].Data());
835 TString max_branch = TString::Format(
"%s_max",
y[iy].Data());
843 histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(),
848 histos[ix][iy][igraph]->StatOverflows(kTRUE);
851 for (
int binx = 0; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(); binx++) {
854 histosYValues[ix][iy][igraph] =
859 histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(),
862 histosYValues[ix][iy][igraph]->StatOverflows(kTRUE);
865 for (
int biny = 0; biny <= histos2D[ix][iy][igraph]->GetYaxis()->GetNbins() + 1; biny++) {
866 if (histos2D[ix][iy][igraph]->GetBinContent(binx, biny) > 1.) {
867 histosYValues[ix][iy][igraph]->SetBinContent(biny, histos2D[ix][iy][igraph]->GetBinContent(binx, biny));
872 histos[ix][iy][igraph]->SetBinContent(binx, histosYValues[ix][iy][igraph]->GetMean());
873 histos[ix][iy][igraph]->SetBinError(binx, histosYValues[ix][iy][igraph]->GetRMS());
875 histos[ix][iy][igraph]->SetBinContent(binx, -999999.);
885 new TCanvas(TString::Format(
"c_hist_%s_vs_%s_tracker_%d",
x[ix].Data(),
y[iy].Data(),
_canvas_index),
886 TString::Format(
"Profile plot %s vs. %s at tracker level",
x[ix].Data(),
y[iy].Data()),
892 c_hist[ix][iy][0]->GetPad(0)->DrawFrame(
894 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
896 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
903 unsigned short int igraph =
908 histosTracker[ix][iy][igraph] = (TH1F *)
histos[ix][iy][igraph]->Clone();
912 histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
913 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
917 c_hist[ix][iy][0]->Print(
919 TString::Format(
"Profile_plot_%s_vs_%s_tracker_%d",
x[ix].Data(),
y[iy].Data(),
_canvas_index) +
929 ->DrawFrame(
_min[
x[ix]],
930 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
932 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
937 unsigned short int igraph =
940 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
947 new TCanvas(TString::Format(
"c_hist_%s_vs_%s_pixel_%d",
x[ix].Data(),
y[iy].Data(),
_canvas_index),
948 TString::Format(
"Profile plot %s vs. %s at pixel level",
x[ix].Data(),
y[iy].Data()),
954 c_hist[ix][iy][7]->GetPad(0)->DrawFrame(
956 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
958 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
965 unsigned short int igraph =
972 histosTracker[ix][iy][igraph] = (TH1F *)
histos[ix][iy][igraph]->Clone();
976 histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
977 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
982 c_hist[ix][iy][7]->Print(
984 TString::Format(
"Profile_plot_%s_vs_%s_pixel_%d",
x[ix].Data(),
y[iy].Data(),
_canvas_index) +
994 ->DrawFrame(
_min[
x[ix]],
995 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
997 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
1002 unsigned short int igraph =
1005 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
1009 for (
unsigned int isublevel = 1; isublevel <=
NB_SUBLEVELS; isublevel++) {
1011 c_hist[ix][iy][isublevel] =
1012 new TCanvas(TString::Format(
"c_hist_%s_vs_%s_%s_%d",
1017 TString::Format(
"Profile plot %s vs. %s at %s level",
1024 c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(
1026 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
1028 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
1032 histos[ix][iy][isublevel - 1]->SetMarkerColor(kBlack);
1033 histos[ix][iy][isublevel - 1]->SetLineColor(kBlack);
1037 histos[ix][iy][isublevel - 1]->Draw(
"same pe0");
1042 TString::Format(
"Profile_plot_%s_vs_%s_%s_%d",
1053 c_global_hist[isublevel]
1055 ->SetFillStyle(4000);
1057 c_global_hist[isublevel]
1059 ->DrawFrame(
_min[
x[ix]],
1060 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
1062 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
1066 histos[ix][iy][isublevel - 1]->Draw(
"same pe0");
1074 gStyle->SetOptTitle(0);
1084 TCanvas *c_temp_hist = (TCanvas *)c_global_hist[ic]->Clone(c_global_hist[ic]->GetTitle() + TString(
"_sub"));
1085 c_temp_hist->Draw();
1086 c_global_hist[ic] =
new TCanvas(c_temp_hist->GetName() + TString(
"_final"),
1087 c_temp_hist->GetTitle(),
1088 c_temp_hist->GetWindowWidth(),
1089 c_temp_hist->GetWindowHeight());
1090 c_global_hist[ic]->Draw();
1091 TPad *p_up =
new TPad(TString(
"legend_") + c_temp_hist->GetName(),
1100 *p_down =
new TPad(TString(
"main_") + c_temp_hist->GetName(),
"", 0., 0., 1., 0.9, -1, 0, 0);
1104 c_temp_hist->DrawClonePad();
1105 c_global_hist[ic]->cd();
1112 global_legend->Draw();
1113 TPaveText *pt_geom =
new TPaveText(.75, .1, .95, .8,
"NB");
1114 pt_geom->SetFillColor(0);
1115 pt_geom->SetTextSize(0.25);
1121 TLegend *global_legend =
MakeLegend(.05, .1, .7, .8, 2);
1122 global_legend->Draw();
1123 TPaveText *pt_geom =
new TPaveText(.75, .1, .95, .8,
"NB");
1124 pt_geom->SetFillColor(0);
1125 pt_geom->SetTextSize(0.25);
1131 TPaveText *
pt =
new TPaveText(.05, .1, .7, .8,
"NB");
1132 pt->SetFillColor(0);
1135 TPaveText *pt_geom =
new TPaveText(.6, .1, .95, .8,
"NB");
1136 pt_geom->SetFillColor(0);
1137 pt_geom->SetTextSize(0.3);
1144 c_global_hist[ic]->Print(
1150 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: End of MakePlots method" << std::endl;
1156 std::vector<TString>
x,
1157 std::vector<TString>
y,
1162 #define CHECK_BRANCHES(branchname_vector) \ 1163 for (unsigned int i = 0; i < branchname_vector.size(); i++) { \ 1164 if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \ 1165 std::cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] \ 1166 << " is not recognised." << std::endl; \ 1173 const unsigned int nentries =
data->GetEntries();
1176 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
1179 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
1187 #define LIMITS(axes_vector) \ 1188 for (unsigned int i = 0; i < axes_vector.size(); i++) { \ 1189 if (_SF.find(axes_vector[i]) == _SF.end()) \ 1190 _SF[axes_vector[i]] = 1.; \ 1191 if (_min.find(axes_vector[i]) == _min.end()) \ 1192 _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \ 1193 if (_max.find(axes_vector[i]) == _max.end()) \ 1194 _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \ 1220 #ifndef NB_SUBLEVELS 1221 #define NB_SUBLEVELS 6 1223 #define NB_Z_SLICES 2 1224 #define NB_X_SLICES 2 1237 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1247 histos[iy][ihist]->StatOverflows(kTRUE);
1251 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1261 histosx[ix][ihist]->StatOverflows(kTRUE);
1266 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: Creation of the TH1F[" <<
y.size() <<
"][" 1272 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: Looping on the TTree" << std::endl;
1275 unsigned int progress = 0;
1276 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: 0%" << std::endl;
1278 for (
unsigned int ientry = 0; ientry < nentries; ientry++) {
1280 if (10 * ientry / nentries != progress) {
1281 progress = 10 * ientry / nentries;
1282 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: " << 10 * progress <<
"%" << std::endl;
1286 data->GetEntry(ientry);
1296 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1324 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1353 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: 100%\tLoop ended" << std::endl;
1358 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1370 meanValue[iy][ihist] =
histos[iy][ihist]->GetMean();
1371 RMS[iy][ihist] =
histos[iy][ihist]->GetRMS();
1373 histos[iy][ihist]->Fit(
"gaus");
1374 gausFit[iy][ihist] =
histos[iy][ihist]->GetFunction(
"gaus");
1375 meanValueGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(1);
1376 RMSGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(2);
1380 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1385 histosx[ix][ihist]->Add(histosx[ix][ihist +
NB_SUBLEVELS]);
1392 meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean();
1393 RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS();
1397 TString tableFileName, tableCaption, tableAlign, tableHeadline;
1398 TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine,
1402 tableFileName =
"table_differences.tex";
1405 " for each subdetector, all modules used.";
1408 " for each subdetector, only good modules used.";
1411 " for each subdetector, good modules and those in given list used.";
1416 tableFileName =
"table_differences_Gaussian.tex";
1419 " for each subdetector, all modules used.";
1422 " for each subdetector, only good modules used.";
1425 " for each subdetector, good modules and those in given list used.";
1431 tableFileName =
"table_meanPos.tex";
1434 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1435 " geometry for each subdetector, all modules used.";
1437 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1438 " geometry for each subdetector, only good modules used.";
1440 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1441 " geometry for each subdetector, good modules and those in given list used.";
1446 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: End of MakeLegends method" << std::endl;
1481 if (
word.BeginsWith(
"d"))
1482 word.ReplaceAll(
"d",
"#Delta");
1483 if (
word == TString(
"rdphi"))
1484 word =
"r#Delta#phi";
1485 else if (
word.EndsWith(
"phi"))
1486 word.ReplaceAll(
"phi",
"#phi");
1487 else if (
word.EndsWith(
"alpha"))
1488 word.ReplaceAll(
"alpha",
"#alpha");
1489 else if (
word.EndsWith(
"beta"))
1490 word.ReplaceAll(
"beta",
"#beta");
1491 else if (
word.EndsWith(
"gamma"))
1492 word.ReplaceAll(
"gamma",
"#gamma");
1493 else if (
word.EndsWith(
"eta"))
1494 word.ReplaceAll(
"eta",
"#eta");
1500 if (
word.BeginsWith(
"d"))
1501 word.ReplaceAll(
"d",
"$\\Delta$");
1502 if (
word == TString(
"rdphi"))
1503 word =
"r$\\Delta\\phi$";
1504 else if (
word.EndsWith(
"phi"))
1505 word.ReplaceAll(
"phi",
"$\\phi$");
1506 else if (
word.EndsWith(
"alpha"))
1507 word.ReplaceAll(
"alpha",
"$\\alpha$");
1508 else if (
word.EndsWith(
"beta"))
1509 word.ReplaceAll(
"beta",
"$\\beta$");
1510 else if (
word.EndsWith(
"gamma"))
1511 word.ReplaceAll(
"gamma",
"#$\\gamma$");
1512 else if (
word.EndsWith(
"eta"))
1513 word.ReplaceAll(
"eta",
"$\\eta$");
1518 if (print_option.Contains(
"pdf"))
1519 return TString(
".pdf");
1520 else if (print_option.Contains(
"eps"))
1521 return TString(
".eps");
1522 else if (print_option.Contains(
"ps"))
1523 return TString(
".ps");
1524 else if (print_option.Contains(
"svg"))
1525 return TString(
".svg");
1526 else if (print_option.Contains(
"tex"))
1527 return TString(
".tex");
1528 else if (print_option.Contains(
"gif"))
1529 return TString(
".gif");
1530 else if (print_option.Contains(
"xpm"))
1531 return TString(
".xpm");
1532 else if (print_option.Contains(
"png"))
1533 return TString(
".png");
1534 else if (print_option.Contains(
"jpg"))
1535 return TString(
".jpg");
1536 else if (print_option.Contains(
"tiff"))
1537 return TString(
".tiff");
1538 else if (print_option.Contains(
"cxx"))
1539 return TString(
".cxx");
1540 else if (print_option.Contains(
"xml"))
1541 return TString(
".xml");
1542 else if (print_option.Contains(
"root"))
1543 return TString(
".root");
1545 std::cout << __FILE__ <<
":" << __LINE__ <<
":Warning: unknown format. Returning .pdf, but possibly wrong..." 1547 return TString(
".pdf");
1552 double x1,
double y1,
double x2,
double y2,
int nPlottedSublevels,
const TString
title) {
1554 legend->SetNColumns(nPlottedSublevels);
1558 for (
int isublevel = 0; isublevel < nPlottedSublevels;
1561 TGraph *
g =
new TGraph(0);
1564 g->SetMarkerStyle(kFullSquare);
1565 g->SetMarkerSize(10);
1572 unsigned int nLevelsTimesSlices,
1573 float meanValue[10][24],
1575 const TString nDigits,
1576 const TString tableCaption,
1577 const TString tableFileName) {
1580 TString tableAlign, tableHeadline;
1581 TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine,
1583 char meanChar[
x.size()][nLevelsTimesSlices][10];
1584 char RMSChar[
x.size()][nLevelsTimesSlices][10];
1588 PXBpLine =
"PXB x$+$";
1589 PXBmLine =
"PXB x$-$";
1590 PXFpLine =
"PXF z$+$";
1591 PXFmLine =
"PXF z$-$";
1592 TIBpLine =
"TIB x$+$";
1593 TIBmLine =
"TIB x$-$";
1594 TIDpLine =
"TID z$+$";
1595 TIDmLine =
"TID z$-$";
1596 TOBpLine =
"TOB x$+$";
1597 TOBmLine =
"TOB x$-$";
1598 TECpLine =
"TEC z$+$";
1599 TECmLine =
"TEC z$-$";
1601 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1602 for (
unsigned int isubDet = 0; isubDet < nLevelsTimesSlices; isubDet++) {
1603 sprintf(meanChar[ix][isubDet],
"%." + nDigits +
"f", meanValue[ix][isubDet]);
1604 sprintf(RMSChar[ix][isubDet],
"%." + nDigits +
"f",
RMS[ix][isubDet]);
1610 PXBpLine += meanChar[ix][0];
1612 PXBpLine += RMSChar[ix][0];
1615 PXBmLine += meanChar[ix][12];
1617 PXBmLine += RMSChar[ix][12];
1620 PXFpLine += meanChar[ix][1];
1622 PXFpLine += RMSChar[ix][1];
1625 PXFmLine += meanChar[ix][7];
1627 PXFmLine += RMSChar[ix][7];
1630 TIBpLine += meanChar[ix][2];
1632 TIBpLine += RMSChar[ix][2];
1635 TIBmLine += meanChar[ix][14];
1637 TIBmLine += RMSChar[ix][14];
1640 TIDpLine += meanChar[ix][3];
1642 TIDpLine += RMSChar[ix][3];
1645 TIDmLine += meanChar[ix][9];
1647 TIDmLine += RMSChar[ix][9];
1650 TOBpLine += meanChar[ix][4];
1652 TOBpLine += RMSChar[ix][4];
1655 TOBmLine += meanChar[ix][16];
1657 TOBmLine += RMSChar[ix][16];
1660 TECpLine += meanChar[ix][5];
1662 TECpLine += RMSChar[ix][5];
1665 TECmLine += meanChar[ix][11];
1667 TECmLine += RMSChar[ix][11];
1672 output <<
"\\begin{table}" << std::endl;
1673 output <<
"\\caption{" << tableCaption <<
"}" << std::endl;
1674 output <<
"\\begin{tabular}{" << tableAlign <<
"}" << std::endl;
1675 output <<
"\\hline" << std::endl;
1676 output << tableHeadline <<
" \\\\" << std::endl;
1677 output <<
"\\hline" << std::endl;
1678 output << PXBpLine <<
" \\\\" << std::endl;
1679 output << PXBmLine <<
" \\\\" << std::endl;
1680 output << PXFpLine <<
" \\\\" << std::endl;
1681 output << PXFmLine <<
" \\\\" << std::endl;
1682 output << TIBpLine <<
" \\\\" << std::endl;
1683 output << TIBmLine <<
" \\\\" << std::endl;
1684 output << TIDpLine <<
" \\\\" << std::endl;
1685 output << TIDmLine <<
" \\\\" << std::endl;
1686 output << TOBpLine <<
" \\\\" << std::endl;
1687 output << TOBmLine <<
" \\\\" << std::endl;
1688 output << TECpLine <<
" \\\\" << std::endl;
1689 output << TECmLine <<
" \\\\" << std::endl;
1690 output <<
"\\hline" << std::endl;
1691 output <<
"\\end{tabular}" << std::endl;
1692 output <<
"\\end{table}" << std::endl;
void SetCanvasSize(const int window_width=3508, const int window_height=2480)
void Set1dModule(const bool)
TString LateXstyleTable(TString)
std::map< TString, float > branch_f
TString LateXstyle(TString)
void SetGrid(const int, const int)
void SetBatchMode(const bool)
std::string to_string(const V &value)
void MakePlots(const std::vector< TString >, const std::vector< TString >, pt::ptree CFG)
#define LIMITS(axes_vector)
GeometryComparisonPlotter(TString tree_file_name, TString outputDirname="output/", TString modulesToPlot="all", TString referenceName="Ideal", TString alignmentName="Alignment", bool plotOnlyGlobal=false, bool makeProfilePlots=false, int canvas_idx=0)
std::map< TString, float > _SF
void WriteTable(const std::vector< TString > x, unsigned int nLevelsTimesSlices, float meanValue[10][24], float RMS[10][24], const TString nDigits, const TString tableCaption, const TString tableFileName)
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)
std::map< TString, int > branch_i
void SetBranchMax(const TString, const float)
std::map< TString, float > _max
void SetBranchUnits(const TString, const TString)
std::map< TString, TString > _units
#define DEFAULT_WINDOW_WIDTH
std::map< TString, float > _min
void SetOutputDirectoryName(const TString)
void MakeTables(const std::vector< TString >, const std::vector< TString >, pt::ptree CFG)
void SetPrintOption(const Option_t *)
void Set2dModule(const bool)
void SetLegend(const bool)
#define CHECK_MAP_CONTENT(m, type)
TString _module_plot_option
void SetWrite(const bool)
TString _output_directory
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)
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