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++) {
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()) {
480 const short int igraph =
486 if (
branch_i[
"badModuleQuality"] > 0) {
487 const short int igraph =
501 const short int igraph =
507 if (
branch_i[
"badModuleQuality"] > 0) {
508 const short int igraph =
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;
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(
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]=" 665 << mgraphs[
ix][
iy][isublevel]->GetName() << std::endl;
668 std::cout << __FILE__ <<
":" << __LINE__ <<
":Error: color code incomplete for Z slices..." << std::endl;
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(),
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) +
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) +
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]
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++) {
1369 meanValue[
iy][ihist] =
histos[
iy][ihist]->GetMean();
1373 gausFit[
iy][ihist] =
histos[
iy][ihist]->GetFunction(
"gaus");
1374 meanValueGaussian[
iy][ihist] = gausFit[
iy][ihist]->GetParameter(1);
1375 RMSGaussian[
iy][ihist] = gausFit[
iy][ihist]->GetParameter(2);
1379 for (
unsigned int ix = 0;
ix <
x.size();
ix++) {
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)
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)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
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)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
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