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;
157 data->SetMarkerSize(0.5);
158 data->SetMarkerStyle(6);
160 gStyle->SetOptStat(
"emr");
161 gStyle->SetTitleAlign(22);
162 gStyle->SetTitleX(0.5);
163 gStyle->SetTitleY(0.97);
164 gStyle->SetTitleFont(62);
167 gStyle->SetTextFont(132);
168 gStyle->SetTextSize(0.08);
169 gStyle->SetLabelFont(132,
"x");
170 gStyle->SetLabelFont(132,
"y");
171 gStyle->SetLabelFont(132,
"z");
172 gStyle->SetTitleSize(0.08,
"x");
173 gStyle->SetTitleSize(0.08,
"y");
174 gStyle->SetTitleSize(0.08,
"z");
175 gStyle->SetLabelSize(0.08,
"x");
176 gStyle->SetLabelSize(0.08,
"y");
177 gStyle->SetLabelSize(0.08,
"z");
179 gStyle->SetMarkerStyle(8);
180 gStyle->SetHistLineWidth(2);
181 gStyle->SetLineStyleString(2,
"[12 12]");
183 gStyle->SetFrameBorderMode(0);
184 gStyle->SetCanvasBorderMode(0);
185 gStyle->SetPadBorderMode(0);
186 gStyle->SetPadColor(0);
187 gStyle->SetCanvasColor(0);
188 gStyle->SetTitleColor(1);
189 gStyle->SetStatColor(0);
190 gStyle->SetStatBorderSize(1);
191 gStyle->SetFrameFillColor(0);
193 gStyle->SetPadTickX(1);
194 gStyle->SetPadTickY(1);
196 gStyle->SetPadTopMargin(0.1);
197 gStyle->SetPadRightMargin(0.05);
198 gStyle->SetPadBottomMargin(0.16);
199 gStyle->SetPadLeftMargin(0.18);
202 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: end of constructor" << std::endl;
208 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: in destructor of the GeometryComparisonPlotter utility" 213 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: ending." << std::endl;
219 std::vector<TString>
x,
220 std::vector<TString>
y,
225 #define CHECK_BRANCHES(branchname_vector) \ 226 for (unsigned int i = 0; i < branchname_vector.size(); i++) { \ 227 if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \ 228 std::cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] \ 229 << " is not recognised." << std::endl; \ 236 const unsigned int nentries =
data->GetEntries();
239 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
241 std::cout << std::endl << __FILE__ <<
":" << __LINE__ <<
":Info: ";
249 #define LIMITS(axes_vector) \ 250 for (unsigned int i = 0; i < axes_vector.size(); i++) { \ 251 if (_SF.find(axes_vector[i]) == _SF.end()) \ 252 _SF[axes_vector[i]] = 1.; \ 253 if (_min.find(axes_vector[i]) == _min.end()) \ 254 _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \ 255 if (_max.find(axes_vector[i]) == _max.end()) \ 256 _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \ 286 #define NB_SUBLEVELS 6 288 #define NB_Z_SLICES 2 289 #define NB_MODULE_QUALITY 3 290 #define COLOR_CODE(icolor) int(icolor / 4) + icolor + 1 296 *mgraphs[
x.size()][
y.size()]
306 TH1F *histosYValues[
x.size()][
y.size()]
317 for (
unsigned int ic = 0; ic <=
NB_SUBLEVELS + 1; ic++) {
318 c_global[ic] =
new TCanvas(
321 TString::Format(
"Global overview of the %s variables",
322 ic == 0 ?
"tracker" : (ic == 7 ?
"pixel" :
_sublevel_names[ic - 1].Data())),
325 c_global[ic]->Divide(
x.size(),
y.size());
329 new TCanvas(TString::Format(
"global_profile_plots_%s_%d",
330 ic == 0 ?
"tracker" : (ic == 7 ?
"pixel" :
_sublevel_names[ic - 1].Data()),
332 TString::Format(
"Global overview profile plots of the %s variables",
333 ic == 0 ?
"tracker" : (ic == 7 ?
"pixel" :
_sublevel_names[ic - 1].Data())),
336 c_global_hist[ic]->Divide(
x.size(),
y.size());
340 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
341 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
347 graphs[ix][iy][igraph] =
new TGraph();
350 graphs[ix][iy][igraph]->SetMarkerStyle(6);
352 graphs[ix][iy][igraph]->SetName(
358 graphs[ix][iy][igraph]->SetTitle(
366 graphs[ix][iy][igraph]->SetMarkerStyle(
376 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
382 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
385 histos2D[ix][iy][igraph] =
402 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: Creation of the TGraph[" <<
x.size() <<
"][" <<
y.size() <<
"][" 408 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: Looping on the TTree" << std::endl;
411 unsigned int progress = 0;
412 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: 0%" << std::endl;
414 for (
unsigned int ientry = 0; ientry < nentries; ientry++) {
416 if (10 * ientry / nentries != progress) {
417 progress = 10 * ientry / nentries;
418 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: " << 10 * progress <<
"%" << std::endl;
422 data->GetEntry(ientry);
433 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
442 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
472 if (
y.size() >=
x.size()) {
475 graphs[ix][iy][igraph]->SetPoint(
480 const short int igraph =
482 graphs[ix][iy][igraph]->SetPoint(
486 if (
branch_i[
"badModuleQuality"] > 0) {
487 const short int igraph =
489 graphs[ix][iy][igraph]->SetPoint(
496 graphs[iy][ix][igraph]->SetPoint(
501 const short int igraph =
503 graphs[iy][ix][igraph]->SetPoint(
507 if (
branch_i[
"badModuleQuality"] > 0) {
508 const short int igraph =
510 graphs[iy][ix][igraph]->SetPoint(
519 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: 100%\tLoop ended" << std::endl;
529 <<
" failed" << std::endl;
533 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: output file is " 545 unsigned int n_module_types = 1;
554 #define INDEX_IN_GLOBAL_CANVAS(i1, i2) 1 + i1 + i2 *x.size() 556 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
558 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: x[" << ix <<
"]=" <<
x[ix] << std::endl;
562 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
563 TString min_branch = TString::Format(
"%s_min",
y[iy].Data());
564 TString max_branch = TString::Format(
"%s_max",
y[iy].Data());
567 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: x[" << ix <<
"]=" <<
x[ix] <<
" and y[" << iy <<
"]=" <<
y[iy]
568 <<
"\t-> creating TMultiGraph" << std::endl;
570 mgraphs[ix][iy][0] =
new TMultiGraph(
571 TString::Format(
"mgr_%s_vs_%s_tracker_%d",
579 mgraphs[ix][iy][7] =
new TMultiGraph(
580 TString::Format(
"mgr_%s_vs_%s_pixel_%d",
592 unsigned short int igraph =
597 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: writing TGraph to file" << std::endl;
601 graphs[ix][iy][igraph]->Write();
602 if (
graphs[ix][iy][igraph]->GetN() == 0) {
604 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: " <<
graphs[ix][iy][igraph]->GetName() <<
" is empty." 610 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: cloning, coloring and adding TGraph " 612 <<
" to global TMultiGraph" << std::endl;
615 TGraph *gr = (TGraph *)
graphs[ix][iy][igraph]->Clone();
618 mgraphs[ix][iy][0]->Add(gr,
"P");
621 mgraphs[ix][iy][7]->Add(gr,
"P");
625 for (
unsigned int isublevel = 1; isublevel <=
NB_SUBLEVELS; isublevel++) {
627 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: cloning, coloring and adding TGraph " 628 <<
_sublevel_names[isublevel - 1] <<
" to sublevel TMultiGraph" << std::endl;
630 mgraphs[ix][iy][isublevel] =
631 new TMultiGraph(TString::Format(
"%s_vs_%s_%s_%d",
641 graphs[ix][iy][isublevel - 1]->SetMarkerColor(kBlack);
647 if (
graphs[ix][iy][isublevel - 1]->GetN() > 0)
648 mgraphs[ix][iy][isublevel]->Add(
649 graphs[ix][iy][isublevel - 1],
654 <<
":Info: graphs[ix][iy][isublevel-1]=" <<
graphs[ix][iy][isublevel - 1]->GetName()
655 <<
" is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << std::endl;
658 mgraphs[ix][iy][isublevel]->Add(
663 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: graphs[ix][iy][NB_SUBLEVEL+isublevel-1]=" 664 <<
graphs[ix][iy][
NB_Z_SLICES + isublevel - 1]->GetName() <<
" is empty -> not added into " 665 << mgraphs[ix][iy][isublevel]->GetName() << std::endl;
668 std::cout << __FILE__ <<
":" << __LINE__ <<
":Error: color code incomplete for Z slices..." << std::endl;
672 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][2 *
NB_SUBLEVELS + isublevel - 1],
"P");
674 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][3 *
NB_SUBLEVELS + isublevel - 1],
"P");
676 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][4 *
NB_SUBLEVELS + isublevel - 1],
"P");
678 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][5 *
NB_SUBLEVELS + isublevel - 1],
"P");
682 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][2 *
NB_SUBLEVELS + isublevel - 1],
"P");
684 mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][3 *
NB_SUBLEVELS + isublevel - 1],
"P");
690 for (
unsigned short int imgr = 0; imgr <=
NB_SUBLEVELS + 1; imgr++) {
692 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: treating individual canvases." << std::endl;
695 c[ix][iy][imgr] =
new TCanvas(
696 TString::Format(
"c_%s_vs_%s_%s_%d",
699 imgr == 0 ?
"tracker" : (imgr == 7 ?
"pixel" :
_sublevel_names[imgr - 1].Data()),
701 TString::Format(
"%s vs. %s at %s level",
704 imgr == 0 ?
"tracker" : (imgr == 7 ?
"pixel" :
_sublevel_names[imgr - 1].Data())),
709 if (mgraphs[ix][iy][imgr]->GetListOfGraphs() !=
nullptr) {
710 if (CFG.count(min_branch.Data()) > 0) {
711 mgraphs[ix][iy][imgr]->SetMinimum(CFG.get<
float>(min_branch.Data()));
713 if (CFG.count(max_branch.Data()) > 0) {
714 mgraphs[ix][iy][imgr]->SetMaximum(CFG.get<
float>(max_branch.Data()));
716 mgraphs[ix][iy][imgr]->Draw(
"A");
721 c[ix][iy][imgr]->Print(
727 mgraphs[ix][iy][imgr]->Write();
733 if (mgraphs[ix][iy][imgr]->GetListOfGraphs() !=
nullptr) {
734 if (CFG.count(min_branch.Data()) > 0) {
735 mgraphs[ix][iy][imgr]->SetMinimum(CFG.get<
float>(min_branch.Data()));
737 if (CFG.count(max_branch.Data()) > 0) {
738 mgraphs[ix][iy][imgr]->SetMaximum(CFG.get<
float>(max_branch.Data()));
740 mgraphs[ix][iy][imgr]->Draw(
"A");
748 gStyle->SetOptTitle(0);
750 for (
unsigned int ic = 0; ic <=
NB_SUBLEVELS + 1; ic++) {
751 c_global[ic]->Draw();
756 TCanvas *c_temp = (TCanvas *)c_global[ic]->Clone(c_global[ic]->GetTitle() + TString(
"_sub"));
758 c_global[ic] =
new TCanvas(
759 c_temp->GetName() + TString(
"_final"), c_temp->GetTitle(), c_temp->GetWindowWidth(), c_temp->GetWindowHeight());
760 c_global[ic]->Draw();
761 TPad *p_up =
new TPad(TString(
"legend_") + c_temp->GetName(),
770 *p_down =
new TPad(TString(
"main_") + c_temp->GetName(),
"", 0., 0., 1., 0.9, -1, 0, 0);
774 c_temp->DrawClonePad();
782 global_legend->Draw();
783 TPaveText *pt_geom =
new TPaveText(.75, .1, .95, .8,
"NB");
784 pt_geom->SetFillColor(0);
785 pt_geom->SetTextSize(0.25);
791 TLegend *global_legend =
MakeLegend(.05, .1, .7, .8, 2);
792 global_legend->Draw();
793 TPaveText *pt_geom =
new TPaveText(.75, .1, .95, .8,
"NB");
794 pt_geom->SetFillColor(0);
795 pt_geom->SetTextSize(0.25);
801 TPaveText *
pt =
new TPaveText(.05, .1, .7, .8,
"NB");
805 TPaveText *pt_geom =
new TPaveText(.6, .1, .95, .8,
"NB");
806 pt_geom->SetFillColor(0);
807 pt_geom->SetTextSize(0.3);
817 c_global[ic]->Write();
829 bool entries =
false;
830 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
831 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
832 TString min_branch = TString::Format(
"%s_min",
y[iy].Data());
833 TString max_branch = TString::Format(
"%s_max",
y[iy].Data());
841 histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(),
846 histos[ix][iy][igraph]->StatOverflows(kTRUE);
849 for (
int binx = 0; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(); binx++) {
852 histosYValues[ix][iy][igraph] =
857 histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(),
860 histosYValues[ix][iy][igraph]->StatOverflows(kTRUE);
863 for (
int biny = 0; biny <= histos2D[ix][iy][igraph]->GetYaxis()->GetNbins() + 1; biny++) {
864 if (histos2D[ix][iy][igraph]->GetBinContent(binx, biny) > 1.) {
865 histosYValues[ix][iy][igraph]->SetBinContent(biny, histos2D[ix][iy][igraph]->GetBinContent(binx, biny));
870 histos[ix][iy][igraph]->SetBinContent(binx, histosYValues[ix][iy][igraph]->GetMean());
871 histos[ix][iy][igraph]->SetBinError(binx, histosYValues[ix][iy][igraph]->GetRMS());
873 histos[ix][iy][igraph]->SetBinContent(binx, -999999.);
883 new TCanvas(TString::Format(
"c_hist_%s_vs_%s_tracker_%d",
x[ix].Data(),
y[iy].Data(),
_canvas_index),
884 TString::Format(
"Profile plot %s vs. %s at tracker level",
x[ix].Data(),
y[iy].Data()),
890 c_hist[ix][iy][0]->GetPad(0)->DrawFrame(
892 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
894 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
901 unsigned short int igraph =
906 histosTracker[ix][iy][igraph] = (TH1F *)
histos[ix][iy][igraph]->Clone();
910 histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
911 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
915 c_hist[ix][iy][0]->Print(
917 TString::Format(
"Profile_plot_%s_vs_%s_tracker_%d",
x[ix].Data(),
y[iy].Data(),
_canvas_index) +
927 ->DrawFrame(
_min[
x[ix]],
928 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
930 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
935 unsigned short int igraph =
938 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
945 new TCanvas(TString::Format(
"c_hist_%s_vs_%s_pixel_%d",
x[ix].Data(),
y[iy].Data(),
_canvas_index),
946 TString::Format(
"Profile plot %s vs. %s at pixel level",
x[ix].Data(),
y[iy].Data()),
952 c_hist[ix][iy][7]->GetPad(0)->DrawFrame(
954 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
956 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
963 unsigned short int igraph =
970 histosTracker[ix][iy][igraph] = (TH1F *)
histos[ix][iy][igraph]->Clone();
974 histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
975 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
980 c_hist[ix][iy][7]->Print(
982 TString::Format(
"Profile_plot_%s_vs_%s_pixel_%d",
x[ix].Data(),
y[iy].Data(),
_canvas_index) +
992 ->DrawFrame(
_min[
x[ix]],
993 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
995 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
1000 unsigned short int igraph =
1003 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
1007 for (
unsigned int isublevel = 1; isublevel <=
NB_SUBLEVELS; isublevel++) {
1009 c_hist[ix][iy][isublevel] =
1010 new TCanvas(TString::Format(
"c_hist_%s_vs_%s_%s_%d",
1015 TString::Format(
"Profile plot %s vs. %s at %s level",
1022 c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(
1024 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
1026 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
1030 histos[ix][iy][isublevel - 1]->SetMarkerColor(kBlack);
1031 histos[ix][iy][isublevel - 1]->SetLineColor(kBlack);
1035 histos[ix][iy][isublevel - 1]->Draw(
"same pe0");
1040 TString::Format(
"Profile_plot_%s_vs_%s_%s_%d",
1051 c_global_hist[isublevel]
1053 ->SetFillStyle(4000);
1055 c_global_hist[isublevel]
1057 ->DrawFrame(
_min[
x[ix]],
1058 CFG.count(min_branch.Data()) > 0 ? CFG.get<
float>(min_branch.Data()) :
_min[
y[iy]],
1060 CFG.count(max_branch.Data()) > 0 ? CFG.get<
float>(max_branch.Data()) :
_max[
y[iy]],
1064 histos[ix][iy][isublevel - 1]->Draw(
"same pe0");
1072 gStyle->SetOptTitle(0);
1082 TCanvas *c_temp_hist = (TCanvas *)c_global_hist[ic]->Clone(c_global_hist[ic]->GetTitle() + TString(
"_sub"));
1083 c_temp_hist->Draw();
1084 c_global_hist[ic] =
new TCanvas(c_temp_hist->GetName() + TString(
"_final"),
1085 c_temp_hist->GetTitle(),
1086 c_temp_hist->GetWindowWidth(),
1087 c_temp_hist->GetWindowHeight());
1088 c_global_hist[ic]->Draw();
1089 TPad *p_up =
new TPad(TString(
"legend_") + c_temp_hist->GetName(),
1098 *p_down =
new TPad(TString(
"main_") + c_temp_hist->GetName(),
"", 0., 0., 1., 0.9, -1, 0, 0);
1102 c_temp_hist->DrawClonePad();
1103 c_global_hist[ic]->cd();
1110 global_legend->Draw();
1111 TPaveText *pt_geom =
new TPaveText(.75, .1, .95, .8,
"NB");
1112 pt_geom->SetFillColor(0);
1113 pt_geom->SetTextSize(0.25);
1119 TLegend *global_legend =
MakeLegend(.05, .1, .7, .8, 2);
1120 global_legend->Draw();
1121 TPaveText *pt_geom =
new TPaveText(.75, .1, .95, .8,
"NB");
1122 pt_geom->SetFillColor(0);
1123 pt_geom->SetTextSize(0.25);
1129 TPaveText *
pt =
new TPaveText(.05, .1, .7, .8,
"NB");
1130 pt->SetFillColor(0);
1133 TPaveText *pt_geom =
new TPaveText(.6, .1, .95, .8,
"NB");
1134 pt_geom->SetFillColor(0);
1135 pt_geom->SetTextSize(0.3);
1142 c_global_hist[ic]->Print(
1148 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: End of MakePlots method" << std::endl;
1154 std::vector<TString>
x,
1155 std::vector<TString>
y,
1160 #define CHECK_BRANCHES(branchname_vector) \ 1161 for (unsigned int i = 0; i < branchname_vector.size(); i++) { \ 1162 if (branch_f.find(branchname_vector[i]) == branch_f.end()) { \ 1163 std::cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] \ 1164 << " is not recognised." << std::endl; \ 1171 const unsigned int nentries =
data->GetEntries();
1174 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
1177 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: ";
1185 #define LIMITS(axes_vector) \ 1186 for (unsigned int i = 0; i < axes_vector.size(); i++) { \ 1187 if (_SF.find(axes_vector[i]) == _SF.end()) \ 1188 _SF[axes_vector[i]] = 1.; \ 1189 if (_min.find(axes_vector[i]) == _min.end()) \ 1190 _min[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMinimum(axes_vector[i]); \ 1191 if (_max.find(axes_vector[i]) == _max.end()) \ 1192 _max[axes_vector[i]] = _SF[axes_vector[i]] * data->GetMaximum(axes_vector[i]); \ 1218 #ifndef NB_SUBLEVELS 1219 #define NB_SUBLEVELS 6 1221 #define NB_Z_SLICES 2 1222 #define NB_X_SLICES 2 1235 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1245 histos[iy][ihist]->StatOverflows(kTRUE);
1249 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1259 histosx[ix][ihist]->StatOverflows(kTRUE);
1264 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: Creation of the TH1F[" <<
y.size() <<
"][" 1270 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: Looping on the TTree" << std::endl;
1273 unsigned int progress = 0;
1274 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: 0%" << std::endl;
1276 for (
unsigned int ientry = 0; ientry < nentries; ientry++) {
1278 if (10 * ientry / nentries != progress) {
1279 progress = 10 * ientry / nentries;
1280 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: " << 10 * progress <<
"%" << std::endl;
1284 data->GetEntry(ientry);
1294 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1322 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1351 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: 100%\tLoop ended" << std::endl;
1356 for (
unsigned int iy = 0; iy <
y.size(); iy++) {
1368 meanValue[iy][ihist] =
histos[iy][ihist]->GetMean();
1369 RMS[iy][ihist] =
histos[iy][ihist]->GetRMS();
1371 histos[iy][ihist]->Fit(
"gaus");
1372 gausFit[iy][ihist] =
histos[iy][ihist]->GetFunction(
"gaus");
1373 meanValueGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(1);
1374 RMSGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(2);
1378 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1383 histosx[ix][ihist]->Add(histosx[ix][ihist +
NB_SUBLEVELS]);
1390 meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean();
1391 RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS();
1395 TString tableFileName, tableCaption, tableAlign, tableHeadline;
1396 TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine,
1400 tableFileName =
"table_differences.tex";
1403 " for each subdetector, all modules used.";
1406 " for each subdetector, only good modules used.";
1409 " for each subdetector, good modules and those in given list used.";
1414 tableFileName =
"table_differences_Gaussian.tex";
1417 " for each subdetector, all modules used.";
1420 " for each subdetector, only good modules used.";
1423 " for each subdetector, good modules and those in given list used.";
1429 tableFileName =
"table_meanPos.tex";
1432 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1433 " geometry for each subdetector, all modules used.";
1435 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1436 " geometry for each subdetector, only good modules used.";
1438 tableCaption =
"Mean positions and standard deviations in " +
_reference_name +
1439 " geometry for each subdetector, good modules and those in given list used.";
1444 std::cout << __FILE__ <<
":" << __LINE__ <<
":Info: End of MakeLegends method" << std::endl;
1479 if (
word.BeginsWith(
"d"))
1480 word.ReplaceAll(
"d",
"#Delta");
1481 if (
word == TString(
"rdphi"))
1482 word =
"r#Delta#phi";
1483 else if (
word.EndsWith(
"phi"))
1484 word.ReplaceAll(
"phi",
"#phi");
1485 else if (
word.EndsWith(
"alpha"))
1486 word.ReplaceAll(
"alpha",
"#alpha");
1487 else if (
word.EndsWith(
"beta"))
1488 word.ReplaceAll(
"beta",
"#beta");
1489 else if (
word.EndsWith(
"gamma"))
1490 word.ReplaceAll(
"gamma",
"#gamma");
1491 else if (
word.EndsWith(
"eta"))
1492 word.ReplaceAll(
"eta",
"#eta");
1498 if (
word.BeginsWith(
"d"))
1499 word.ReplaceAll(
"d",
"$\\Delta$");
1500 if (
word == TString(
"rdphi"))
1501 word =
"r$\\Delta\\phi$";
1502 else if (
word.EndsWith(
"phi"))
1503 word.ReplaceAll(
"phi",
"$\\phi$");
1504 else if (
word.EndsWith(
"alpha"))
1505 word.ReplaceAll(
"alpha",
"$\\alpha$");
1506 else if (
word.EndsWith(
"beta"))
1507 word.ReplaceAll(
"beta",
"$\\beta$");
1508 else if (
word.EndsWith(
"gamma"))
1509 word.ReplaceAll(
"gamma",
"#$\\gamma$");
1510 else if (
word.EndsWith(
"eta"))
1511 word.ReplaceAll(
"eta",
"$\\eta$");
1516 if (print_option.Contains(
"pdf"))
1517 return TString(
".pdf");
1518 else if (print_option.Contains(
"eps"))
1519 return TString(
".eps");
1520 else if (print_option.Contains(
"ps"))
1521 return TString(
".ps");
1522 else if (print_option.Contains(
"svg"))
1523 return TString(
".svg");
1524 else if (print_option.Contains(
"tex"))
1525 return TString(
".tex");
1526 else if (print_option.Contains(
"gif"))
1527 return TString(
".gif");
1528 else if (print_option.Contains(
"xpm"))
1529 return TString(
".xpm");
1530 else if (print_option.Contains(
"png"))
1531 return TString(
".png");
1532 else if (print_option.Contains(
"jpg"))
1533 return TString(
".jpg");
1534 else if (print_option.Contains(
"tiff"))
1535 return TString(
".tiff");
1536 else if (print_option.Contains(
"cxx"))
1537 return TString(
".cxx");
1538 else if (print_option.Contains(
"xml"))
1539 return TString(
".xml");
1540 else if (print_option.Contains(
"root"))
1541 return TString(
".root");
1543 std::cout << __FILE__ <<
":" << __LINE__ <<
":Warning: unknown format. Returning .pdf, but possibly wrong..." 1545 return TString(
".pdf");
1550 double x1,
double y1,
double x2,
double y2,
int nPlottedSublevels,
const TString
title) {
1552 legend->SetNColumns(nPlottedSublevels);
1556 for (
int isublevel = 0; isublevel < nPlottedSublevels;
1559 TGraph *
g =
new TGraph(0);
1562 g->SetMarkerStyle(kFullSquare);
1563 g->SetMarkerSize(10);
1570 unsigned int nLevelsTimesSlices,
1571 float meanValue[10][24],
1573 const TString nDigits,
1574 const TString tableCaption,
1575 const TString tableFileName) {
1578 TString tableAlign, tableHeadline;
1579 TString PXBpLine, PXBmLine, PXFpLine, PXFmLine, TIBpLine, TIBmLine, TOBpLine, TOBmLine, TIDpLine, TIDmLine, TECpLine,
1581 char meanChar[
x.size()][nLevelsTimesSlices][10];
1582 char RMSChar[
x.size()][nLevelsTimesSlices][10];
1586 PXBpLine =
"PXB x$+$";
1587 PXBmLine =
"PXB x$-$";
1588 PXFpLine =
"PXF z$+$";
1589 PXFmLine =
"PXF z$-$";
1590 TIBpLine =
"TIB x$+$";
1591 TIBmLine =
"TIB x$-$";
1592 TIDpLine =
"TID z$+$";
1593 TIDmLine =
"TID z$-$";
1594 TOBpLine =
"TOB x$+$";
1595 TOBmLine =
"TOB x$-$";
1596 TECpLine =
"TEC z$+$";
1597 TECmLine =
"TEC z$-$";
1599 for (
unsigned int ix = 0; ix <
x.size(); ix++) {
1600 for (
unsigned int isubDet = 0; isubDet < nLevelsTimesSlices; isubDet++) {
1601 sprintf(meanChar[ix][isubDet],
"%." + nDigits +
"f", meanValue[ix][isubDet]);
1602 sprintf(RMSChar[ix][isubDet],
"%." + nDigits +
"f",
RMS[ix][isubDet]);
1608 PXBpLine += meanChar[ix][0];
1610 PXBpLine += RMSChar[ix][0];
1613 PXBmLine += meanChar[ix][12];
1615 PXBmLine += RMSChar[ix][12];
1618 PXFpLine += meanChar[ix][1];
1620 PXFpLine += RMSChar[ix][1];
1623 PXFmLine += meanChar[ix][7];
1625 PXFmLine += RMSChar[ix][7];
1628 TIBpLine += meanChar[ix][2];
1630 TIBpLine += RMSChar[ix][2];
1633 TIBmLine += meanChar[ix][14];
1635 TIBmLine += RMSChar[ix][14];
1638 TIDpLine += meanChar[ix][3];
1640 TIDpLine += RMSChar[ix][3];
1643 TIDmLine += meanChar[ix][9];
1645 TIDmLine += RMSChar[ix][9];
1648 TOBpLine += meanChar[ix][4];
1650 TOBpLine += RMSChar[ix][4];
1653 TOBmLine += meanChar[ix][16];
1655 TOBmLine += RMSChar[ix][16];
1658 TECpLine += meanChar[ix][5];
1660 TECpLine += RMSChar[ix][5];
1663 TECmLine += meanChar[ix][11];
1665 TECmLine += RMSChar[ix][11];
1670 output <<
"\\begin{table}" << std::endl;
1671 output <<
"\\caption{" << tableCaption <<
"}" << std::endl;
1672 output <<
"\\begin{tabular}{" << tableAlign <<
"}" << std::endl;
1673 output <<
"\\hline" << std::endl;
1674 output << tableHeadline <<
" \\\\" << std::endl;
1675 output <<
"\\hline" << std::endl;
1676 output << PXBpLine <<
" \\\\" << std::endl;
1677 output << PXBmLine <<
" \\\\" << std::endl;
1678 output << PXFpLine <<
" \\\\" << std::endl;
1679 output << PXFmLine <<
" \\\\" << std::endl;
1680 output << TIBpLine <<
" \\\\" << std::endl;
1681 output << TIBmLine <<
" \\\\" << std::endl;
1682 output << TIDpLine <<
" \\\\" << std::endl;
1683 output << TIDmLine <<
" \\\\" << std::endl;
1684 output << TOBpLine <<
" \\\\" << std::endl;
1685 output << TOBmLine <<
" \\\\" << std::endl;
1686 output << TECpLine <<
" \\\\" << std::endl;
1687 output << TECmLine <<
" \\\\" << std::endl;
1688 output <<
"\\hline" << std::endl;
1689 output <<
"\\end{tabular}" << std::endl;
1690 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)
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)
static std::string to_string(const XMLCh *ch)
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