15 #define TALKATIVE // get some comments while processing
19 #define INSIDE_VECTOR(vector) \
20 cout << #vector << "={"; for (unsigned int i = 0 ; i < vector.size()-1 ; i++) cout << vector[i] << ","; cout << vector.back() << "}";
21 #define CHECK_MAP_CONTENT(m,type) \
22 for (map<TString,type>::iterator it = m.begin() ; it != m.end() ; it++) \
23 cout << __FILE__ << ":" << __LINE__ << ":Info: " << #m << "[" << it->first << "]=" << it->second << endl;
27 TString output_directory,
28 TString modulesToPlot,
29 TString alignmentName,
30 TString referenceName,
34 _output_directory(output_directory + TString(output_directory.EndsWith(
"/") ?
"" :
"/")),
35 _output_filename(
"comparison.root"),
37 _module_plot_option(modulesToPlot),
38 _alignment_name(alignmentName),
39 _reference_name(referenceName),
40 _print_only_global(printOnlyGlobal),
41 _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") == 0x0)
111 cout << __FILE__ <<
":" << __LINE__ <<
":Info: computing the rdphi branch from r and dphi branches (assuming they exist...)" << endl;
113 TBranch * br_rdphi =
data->Branch(
"rdphi", &
branch_f[
"rdphi"],
"rdphi/F");
114 for (
unsigned int ientry = 0 ; ientry <
data->GetEntries() ; ientry++)
116 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;
183 cout << __FILE__ <<
":" << __LINE__ <<
":Info: in destructor of the GeometryComparisonPlotter utility" << endl;
187 cout << __FILE__ <<
":" << __LINE__ <<
":Info: ending." << endl;
199 #define CHECK_BRANCHES(branchname_vector) \
200 for (unsigned int i = 0 ; i < branchname_vector.size() ; i++) \
202 if (branch_f.find(branchname_vector[i]) == branch_f.end()) \
204 cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." << endl; \
211 const unsigned int nentries =
data->GetEntries();
221 #define LIMITS(axes_vector) \
222 for (unsigned int i = 0 ; i < axes_vector.size() ; i++) \
224 if ( _SF.find(axes_vector[i]) == _SF.end()) _SF[axes_vector[i]] = 1.; \
225 if (_min.find(axes_vector[i]) == _min.end()) _min[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMinimum(axes_vector[i]); \
226 if (_max.find(axes_vector[i]) == _max.end()) _max[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMaximum(axes_vector[i]); \
256 #define NB_SUBLEVELS 6
258 #define NB_Z_SLICES 2
259 #define NB_MODULE_QUALITY 3
260 #define COLOR_CODE(icolor) int(icolor/4)+icolor+1
287 c_global[ic] =
new TCanvas (TString::Format(
"global_%s_%d", ic==0 ?
"tracker" : ( ic==7 ?
"pixel" :
_sublevel_names[ic-1].Data() ),
289 TString::Format(
"Global overview of the %s variables", ic==0 ?
"tracker" : ( ic==7 ?
"pixel" :
_sublevel_names[ic-1].Data() ) ),
292 c_global[ic]->Divide(
x.size(),
y.size());
295 c_global_hist[ic] =
new TCanvas (TString::Format(
"global_profile_plots_%s_%d", ic==0 ?
"tracker" : ( ic==7 ?
"pixel" :
_sublevel_names[ic-1].Data() ),
297 TString::Format(
"Global overview profile plots of the %s variables", ic==0 ?
"tracker" : ( ic==7 ?
"pixel" :
_sublevel_names[ic-1].Data() ) ),
300 c_global_hist[ic]->Divide(
x.size(),
y.size());
306 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
308 for (
unsigned int iy = 0 ; iy <
y.size() ; iy++)
314 ipoint[ix][iy][igraph] = 0;
315 graphs[ix][iy][igraph] =
new TGraph ();
318 graphs[ix][iy][igraph]->SetMarkerStyle(6);
338 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
340 if (
x[ix] ==
"phi") nXBins = 10;
343 for (
unsigned int iy = 0 ; iy <
y.size() ; iy++)
364 cout << __FILE__ <<
":" << __LINE__ <<
":Info: Looping on the TTree" << endl;
367 unsigned int progress = 0;
368 cout << __FILE__ <<
":" << __LINE__ <<
":Info: 0%" << endl;
370 for (
unsigned int ientry = 0 ; ientry < nentries ; ientry++)
373 if (10*ientry/nentries != progress)
375 progress = 10*ientry/nentries;
376 cout << __FILE__ <<
":" << __LINE__ <<
":Info: " << 10*progress <<
"%" << endl;
380 data->GetEntry(ientry);
388 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
399 for (
unsigned int iy = 0 ; iy <
y.size() ; iy++)
408 const short int igraph = (
branch_i[
"sublevel"]-1)
414 const short int igraph = (
branch_i[
"sublevel"]-1)
420 const short int igraph = (
branch_i[
"sublevel"]-1)
437 if (
y.size() >=
x.size()){
439 const short int igraph = (
branch_i[
"sublevel"]-1)
441 graphs[ix][iy][igraph]->SetPoint(
ipoint[ix][iy][igraph],
447 const short int igraph = (
branch_i[
"sublevel"]-1)
450 graphs[ix][iy][igraph]->SetPoint(
ipoint[ix][iy][igraph],
455 if (
branch_i[
"badModuleQuality"]>0){
456 const short int igraph = (
branch_i[
"sublevel"]-1)
459 graphs[ix][iy][igraph]->SetPoint(
ipoint[ix][iy][igraph],
467 const short int igraph = (
branch_i[
"sublevel"]-1)
469 graphs[iy][ix][igraph]->SetPoint(
ipoint[iy][ix][igraph],
475 const short int igraph = (
branch_i[
"sublevel"]-1)
478 graphs[iy][ix][igraph]->SetPoint(
ipoint[iy][ix][igraph],
483 if (
branch_i[
"badModuleQuality"]>0){
484 const short int igraph = (
branch_i[
"sublevel"]-1)
487 graphs[iy][ix][igraph]->SetPoint(
ipoint[ix][iy][igraph],
497 cout << __FILE__ <<
":" << __LINE__ <<
":Info: 100%\tLoop ended" << endl;
521 unsigned int n_module_types = 1;
533 #define INDEX_IN_GLOBAL_CANVAS(i1,i2) 1 + i1 + i2*x.size()
535 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
538 cout << __FILE__ <<
":" << __LINE__ <<
":Info: x[" << ix <<
"]="<<
x[ix] << endl;
542 for (
unsigned int iy = 0 ; iy <
y.size() ; iy++)
547 cout << __FILE__ <<
":" << __LINE__ <<
":Info: x[" << ix <<
"]=" <<
x[ix]
548 <<
" and y[" << iy <<
"]=" <<
y[iy]
549 <<
"\t-> creating TMultiGraph" << endl;
551 mgraphs[ix][iy][0] =
new TMultiGraph (TString::Format(
"mgr_%s_vs_%s_tracker_%d",
x[ix].Data(),
558 mgraphs[ix][iy][7] =
new TMultiGraph (TString::Format(
"mgr_%s_vs_%s_pixel_%d",
x[ix].Data(),
573 cout << __FILE__ <<
":" << __LINE__ <<
":Info: writing TGraph to file" << endl;
577 if (
graphs[ix][iy][igraph]->GetN() == 0)
580 cout << __FILE__ <<
":" << __LINE__ <<
":Info: " <<
graphs[ix][iy][igraph]->GetName() <<
" is empty." << endl;
585 cout << __FILE__ <<
":" << __LINE__ <<
":Info: cloning, coloring and adding TGraph "
588 <<
" to global TMultiGraph" << endl;
591 TGraph * gr = (TGraph *)
graphs[ix][iy][igraph]->Clone();
594 mgraphs[ix][iy][0]->Add(gr,
"P");
601 for (
unsigned int isublevel = 1 ; isublevel <=
NB_SUBLEVELS ; isublevel++)
604 cout << __FILE__ <<
":" << __LINE__ <<
":Info: cloning, coloring and adding TGraph "
607 mgraphs[ix][iy][isublevel] =
new TMultiGraph (TString::Format(
"%s_vs_%s_%s_%d",
x[ix].Data(),
616 graphs[ix][iy][ isublevel-1]->SetMarkerColor(kBlack);
622 if (
graphs[ix][iy][ isublevel-1]->GetN() > 0) mgraphs[ix][iy][isublevel]->Add(
graphs[ix][iy][ isublevel-1],
"P");
624 else cout << __FILE__ <<
":" << __LINE__ <<
":Info: graphs[ix][iy][isublevel-1]=" <<
graphs[ix][iy][isublevel-1]->GetName() <<
" is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl;
628 else cout << __FILE__ <<
":" << __LINE__ <<
":Info: graphs[ix][iy][NB_SUBLEVEL+isublevel-1]=" <<
graphs[ix][iy][
NB_Z_SLICES+isublevel-1]->GetName() <<
" is empty -> not added into " << mgraphs[ix][iy][isublevel]->GetName() << endl;
631 cout << __FILE__ <<
":" << __LINE__ <<
":Error: color code incomplete for Z slices..." << endl;
648 for (
unsigned short int imgr = 0 ; imgr <=
NB_SUBLEVELS+1 ; imgr++)
651 cout << __FILE__ <<
":" << __LINE__ <<
":Info: treating individual canvases." << endl;
654 c[ix][iy][imgr] =
new TCanvas (TString::Format(
"c_%s_vs_%s_%s_%d",
x[ix].Data(),
656 imgr==0 ?
"tracker" : ( imgr==7 ?
"pixel" :
_sublevel_names[imgr-1].Data() ),
658 TString::Format(
"%s vs. %s at %s level",
x[ix].Data(),
660 imgr==0 ?
"tracker" : ( imgr==7 ?
"pixel" :
_sublevel_names[imgr-1].Data() ) ),
665 if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) {
666 if (dyMin[iy] != -99999) {
667 mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]);
669 if (dyMax[iy] != -99999) {
670 mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]);
672 mgraphs[ix][iy][imgr]->Draw(
"A");
678 if (
_write) mgraphs[ix][iy][imgr]->Write();
684 if (mgraphs[ix][iy][imgr]->GetListOfGraphs() != 0) {
685 if (dyMin[iy] != -99999) {
686 mgraphs[ix][iy][imgr]->SetMinimum(dyMin[iy]);
688 if (dyMax[iy] != -99999) {
689 mgraphs[ix][iy][imgr]->SetMaximum(dyMax[iy]);
691 mgraphs[ix][iy][imgr]->Draw(
"A");
701 gStyle->SetOptTitle(0);
705 c_global[ic]->Draw();
709 TCanvas * c_temp = (TCanvas *) c_global[ic]->Clone(c_global[ic]->GetTitle() + TString(
"_sub"));
711 c_global[ic] =
new TCanvas (c_temp->GetName() + TString(
"_final"), c_temp->GetTitle(), c_temp->GetWindowWidth(), c_temp->GetWindowHeight());
712 c_global[ic]->Draw();
713 TPad * p_up =
new TPad (TString(
"legend_") + c_temp->GetName(),
"",
716 * p_down =
new TPad (TString(
"main_") + c_temp->GetName(),
"",
722 c_temp->DrawClonePad();
730 global_legend->Draw();
731 TPaveText * pt_geom =
new TPaveText(.75,.1,.95,.8,
"NB");
732 pt_geom->SetFillColor(0);
733 pt_geom->SetTextSize(0.25);
740 TLegend * global_legend =
MakeLegend(.05,.1,.7,.8,2);
741 global_legend->Draw();
742 TPaveText * pt_geom =
new TPaveText(.75,.1,.95,.8,
"NB");
743 pt_geom->SetFillColor(0);
744 pt_geom->SetTextSize(0.25);
751 TPaveText *
pt =
new TPaveText(.05,.1,.7,.8,
"NB");
755 TPaveText * pt_geom =
new TPaveText(.6,.1,.95,.8,
"NB");
756 pt_geom->SetFillColor(0);
757 pt_geom->SetTextSize(0.3);
764 if (
_write) c_global[ic]->Write();
777 bool entries =
false;
778 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
780 for (
unsigned int iy = 0 ; iy <
y.size() ; iy++)
789 "",histos2D[ix][iy][igraph]->GetXaxis()->GetNbins(),
_min[
x[ix]],
_max[
x[ix]]);
792 histos[ix][iy][igraph]->StatOverflows(kTRUE);
796 for (
int binx = 0 ; binx <= histos2D[ix][iy][igraph]->GetXaxis()->GetNbins() ; binx++)
803 +std::to_string(binx),
804 "",histos2D[ix][iy][igraph]->GetYaxis()->GetNbins(),
807 histosYValues[ix][iy][igraph]->StatOverflows(kTRUE);
810 for (
int biny = 0 ; biny <= histos2D[ix][iy][igraph]->GetYaxis()->GetNbins()+1 ; biny++)
812 if (histos2D[ix][iy][igraph]->GetBinContent(binx,biny) > 1.)
814 histosYValues[ix][iy][igraph]->SetBinContent(biny,histos2D[ix][iy][igraph]->GetBinContent(binx,biny));
820 histos[ix][iy][igraph]->SetBinContent(binx,histosYValues[ix][iy][igraph]->GetMean());
821 histos[ix][iy][igraph]->SetBinError(binx,histosYValues[ix][iy][igraph]->GetRMS());
823 else histos[ix][iy][igraph]->SetBinContent(binx,-999999.);
834 c_hist[ix][iy][0] =
new TCanvas (TString::Format(
"c_hist_%s_vs_%s_tracker_%d",
x[ix].Data(),
837 TString::Format(
"Profile plot %s vs. %s at tracker level",
x[ix].Data(),
844 c_hist[ix][iy][0]->GetPad(0)->DrawFrame(
_min[
x[ix]],
845 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
847 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
857 histosTracker[ix][iy][igraph] = (TH1F *)
histos[ix][iy][igraph]->Clone();
861 histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
862 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
867 + TString::Format(
"Profile_plot_%s_vs_%s_tracker_%d",
x[ix].Data(),
y[iy].Data(),
canvas_index)
876 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
878 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
885 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
891 c_hist[ix][iy][7] =
new TCanvas (TString::Format(
"c_hist_%s_vs_%s_pixel_%d",
x[ix].Data(),
894 TString::Format(
"Profile plot %s vs. %s at pixel level",
x[ix].Data(),
901 c_hist[ix][iy][7]->GetPad(0)->DrawFrame(
_min[
x[ix]],
902 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
904 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
916 histosTracker[ix][iy][igraph] = (TH1F *)
histos[ix][iy][igraph]->Clone();
920 histosTracker[ix][iy][igraph]->SetMarkerStyle(6);
921 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
927 + TString::Format(
"Profile_plot_%s_vs_%s_pixel_%d",
x[ix].Data(),
y[iy].Data(),
canvas_index)
936 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
938 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
945 histosTracker[ix][iy][igraph]->Draw(
"same pe0");
949 for (
unsigned int isublevel = 1 ; isublevel <=
NB_SUBLEVELS ; isublevel++)
953 c_hist[ix][iy][isublevel] =
new TCanvas (TString::Format(
"c_hist_%s_vs_%s_%s_%d",
x[ix].Data(),
957 TString::Format(
"Profile plot %s vs. %s at %s level",
x[ix].Data(),
963 c_hist[ix][iy][isublevel]->GetPad(0)->DrawFrame(
_min[
x[ix]],
964 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
966 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
970 histos[ix][iy][ isublevel-1]->SetMarkerColor(kBlack);
971 histos[ix][iy][ isublevel-1]->SetLineColor(kBlack);
976 histos[ix][iy][ isublevel-1]->Draw(
"same pe0");
990 dyMin[iy] != -99999 ? dyMin[iy] :
_min[
y[iy]],
992 dyMax[iy] != -99999 ? dyMax[iy] :
_max[
y[iy]],
997 histos[ix][iy][ isublevel-1]->Draw(
"same pe0");
1007 gStyle->SetOptTitle(0);
1016 TCanvas * c_temp_hist = (TCanvas *) c_global_hist[ic]->Clone(c_global_hist[ic]->GetTitle() + TString(
"_sub"));
1017 c_temp_hist->Draw();
1018 c_global_hist[ic] =
new TCanvas (c_temp_hist->GetName() + TString(
"_final"), c_temp_hist->GetTitle(), c_temp_hist->GetWindowWidth(), c_temp_hist->GetWindowHeight());
1019 c_global_hist[ic]->Draw();
1020 TPad * p_up =
new TPad (TString(
"legend_") + c_temp_hist->GetName(),
"",
1023 * p_down =
new TPad (TString(
"main_") + c_temp_hist->GetName(),
"",
1029 c_temp_hist->DrawClonePad();
1030 c_global_hist[ic]->cd();
1037 global_legend->Draw();
1038 TPaveText * pt_geom =
new TPaveText(.75,.1,.95,.8,
"NB");
1039 pt_geom->SetFillColor(0);
1040 pt_geom->SetTextSize(0.25);
1047 TLegend * global_legend =
MakeLegend(.05,.1,.7,.8,2);
1048 global_legend->Draw();
1049 TPaveText * pt_geom =
new TPaveText(.75,.1,.95,.8,
"NB");
1050 pt_geom->SetFillColor(0);
1051 pt_geom->SetTextSize(0.25);
1058 TPaveText *
pt =
new TPaveText(.05,.1,.7,.8,
"NB");
1059 pt->SetFillColor(0);
1062 TPaveText * pt_geom =
new TPaveText(.6,.1,.95,.8,
"NB");
1063 pt_geom->SetFillColor(0);
1064 pt_geom->SetTextSize(0.3);
1076 cout << __FILE__ <<
":" << __LINE__ <<
":Info: End of MakePlots method" << endl;
1085 vector<float> dyMin,
1086 vector<float> dyMax)
1091 #define CHECK_BRANCHES(branchname_vector) \
1092 for (unsigned int i = 0 ; i < branchname_vector.size() ; i++) \
1094 if (branch_f.find(branchname_vector[i]) == branch_f.end()) \
1096 cout << __FILE__ << ":" << __LINE__ << ":Error: The branch " << branchname_vector[i] << " is not recognised." << endl; \
1103 const unsigned int nentries =
data->GetEntries();
1114 #define LIMITS(axes_vector) \
1115 for (unsigned int i = 0 ; i < axes_vector.size() ; i++) \
1117 if ( _SF.find(axes_vector[i]) == _SF.end()) _SF[axes_vector[i]] = 1.; \
1118 if (_min.find(axes_vector[i]) == _min.end()) _min[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMinimum(axes_vector[i]); \
1119 if (_max.find(axes_vector[i]) == _max.end()) _max[axes_vector[i]] = _SF[axes_vector[i]]*data->GetMaximum(axes_vector[i]); \
1145 #ifndef NB_SUBLEVELS
1146 #define NB_SUBLEVELS 6
1148 #define NB_Z_SLICES 2
1149 #define NB_X_SLICES 2
1162 for (
unsigned int iy = 0 ; iy <
y.size() ; iy++)
1174 histos[iy][ihist]->StatOverflows(kTRUE);
1179 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
1191 histosx[ix][ihist]->StatOverflows(kTRUE);
1202 cout << __FILE__ <<
":" << __LINE__ <<
":Info: Looping on the TTree" << endl;
1205 unsigned int progress = 0;
1206 cout << __FILE__ <<
":" << __LINE__ <<
":Info: 0%" << endl;
1208 for (
unsigned int ientry = 0 ; ientry < nentries ; ientry++)
1211 if (10*ientry/nentries != progress)
1213 progress = 10*ientry/nentries;
1214 cout << __FILE__ <<
":" << __LINE__ <<
":Info: " << 10*progress <<
"%" << endl;
1218 data->GetEntry(ientry);
1226 for (
unsigned int iy = 0 ; iy <
y.size() ; iy++)
1252 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
1279 cout << __FILE__ <<
":" << __LINE__ <<
":Info: 100%\tLoop ended" << endl;
1284 for (
unsigned int iy = 0 ; iy <
y.size() ; iy++)
1297 meanValue[iy][ihist] =
histos[iy][ihist]->GetMean();
1298 RMS[iy][ihist] =
histos[iy][ihist]->GetRMS();
1300 histos[iy][ihist]->Fit(
"gaus");
1301 gausFit[iy][ihist] =
histos[iy][ihist]->GetFunction(
"gaus");
1302 meanValueGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(1);
1303 RMSGaussian[iy][ihist] = gausFit[iy][ihist]->GetParameter(2);
1310 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
1317 histosx[ix][ihist]->Add(histosx[ix][ihist+
NB_SUBLEVELS]);
1323 meanValuex[ix][ihist] = histosx[ix][ihist]->GetMean();
1324 RMSx[ix][ihist] = histosx[ix][ihist]->GetRMS();
1329 TString tableFileName,tableCaption,tableAlign,tableHeadline;
1330 TString PXBpLine,PXBmLine,PXFpLine,PXFmLine,TIBpLine,TIBmLine,TOBpLine,TOBmLine,TIDpLine,TIDmLine,TECpLine,TECmLine;
1334 tableFileName =
"table_differences.tex";
1343 tableFileName =
"table_differences_Gaussian.tex";
1354 tableFileName =
"table_meanPos.tex";
1357 else if (
_module_plot_option ==
"good") tableCaption =
"Mean positions and standard deviations in "+
_reference_name+
" geometry for each subdetector, only good modules used.";
1358 else if (
_module_plot_option ==
"list") tableCaption =
"Mean positions and standard deviations in "+
_reference_name+
" geometry for each subdetector, good modules and those in given list used.";
1364 cout << __FILE__ <<
":" << __LINE__ <<
":Info: End of MakeLegends method" << endl;
1378 const int kGridY) {
_grid_x = kGridX ;
1381 const float max) {
_max[branchname] =
max ; }
1383 const float min) {
_min[branchname] =
min ; }
1385 const float SF) {
_SF[branchname] = SF ; }
1394 + TString(
name.EndsWith(
"/") ?
"" :
"/") ; }
1400 if (
word.BeginsWith(
"d"))
word.ReplaceAll(
"d",
"#Delta");
1401 if (
word == TString(
"rdphi"))
word =
"r#Delta#phi";
1402 else if (
word.EndsWith(
"phi"))
word.ReplaceAll(
"phi",
"#phi");
1403 else if (
word.EndsWith(
"alpha"))
word.ReplaceAll(
"alpha",
"#alpha");
1404 else if (
word.EndsWith(
"beta"))
word.ReplaceAll(
"beta" ,
"#beta");
1405 else if (
word.EndsWith(
"gamma"))
word.ReplaceAll(
"gamma",
"#gamma");
1406 else if (
word.EndsWith(
"eta"))
word.ReplaceAll(
"eta",
"#eta");
1413 if (
word.BeginsWith(
"d"))
word.ReplaceAll(
"d",
"$\\Delta$");
1414 if (
word == TString(
"rdphi"))
word =
"r$\\Delta\\phi$";
1415 else if (
word.EndsWith(
"phi"))
word.ReplaceAll(
"phi",
"$\\phi$");
1416 else if (
word.EndsWith(
"alpha"))
word.ReplaceAll(
"alpha",
"$\\alpha$");
1417 else if (
word.EndsWith(
"beta"))
word.ReplaceAll(
"beta" ,
"$\\beta$");
1418 else if (
word.EndsWith(
"gamma"))
word.ReplaceAll(
"gamma",
"#$\\gamma$");
1419 else if (
word.EndsWith(
"eta"))
word.ReplaceAll(
"eta",
"$\\eta$");
1425 if (print_option.Contains(
"pdf" ))
return TString(
".pdf" );
1426 else if (print_option.Contains(
"eps" ))
return TString(
".eps" );
1427 else if (print_option.Contains(
"ps" ))
return TString(
".ps" );
1428 else if (print_option.Contains(
"svg" ))
return TString(
".svg" );
1429 else if (print_option.Contains(
"tex" ))
return TString(
".tex" );
1430 else if (print_option.Contains(
"gif" ))
return TString(
".gif" );
1431 else if (print_option.Contains(
"xpm" ))
return TString(
".xpm" );
1432 else if (print_option.Contains(
"png" ))
return TString(
".png" );
1433 else if (print_option.Contains(
"jpg" ))
return TString(
".jpg" );
1434 else if (print_option.Contains(
"tiff"))
return TString(
".tiff");
1435 else if (print_option.Contains(
"cxx" ))
return TString(
".cxx" );
1436 else if (print_option.Contains(
"xml" ))
return TString(
".xml" );
1437 else if (print_option.Contains(
"root"))
return TString(
".root");
1440 cout << __FILE__ <<
":" << __LINE__ <<
":Warning: unknown format. Returning .pdf, but possibly wrong..." << endl;
1441 return TString(
".pdf");
1449 int nPlottedSublevels,
1450 const TString
title)
1453 legend->SetNColumns(nPlottedSublevels);
1457 for (
int isublevel = 0 ; isublevel < nPlottedSublevels ; isublevel++)
1459 TGraph *
g =
new TGraph (0);
1462 g->SetMarkerStyle(kFullSquare);
1463 g->SetMarkerSize(10);
1471 unsigned int nLevelsTimesSlices,
1472 float meanValue[10][24],
1474 const TString nDigits,
1475 const TString tableCaption,
1476 const TString tableFileName)
1480 TString tableAlign,tableHeadline;
1481 TString PXBpLine,PXBmLine,PXFpLine,PXFmLine,TIBpLine,TIBmLine,TOBpLine,TOBmLine,TIDpLine,TIDmLine,TECpLine,TECmLine;
1482 char meanChar[
x.size()][nLevelsTimesSlices][10];
1483 char RMSChar[
x.size()][nLevelsTimesSlices][10];
1487 PXBpLine =
"PXB x$+$";
1488 PXBmLine =
"PXB x$-$";
1489 PXFpLine =
"PXF z$+$";
1490 PXFmLine =
"PXF z$-$";
1491 TIBpLine =
"TIB x$+$";
1492 TIBmLine =
"TIB x$-$";
1493 TIDpLine =
"TID z$+$";
1494 TIDmLine =
"TID z$-$";
1495 TOBpLine =
"TOB x$+$";
1496 TOBmLine =
"TOB x$-$";
1497 TECpLine =
"TEC z$+$";
1498 TECmLine =
"TEC z$-$";
1502 for (
unsigned int ix = 0 ; ix <
x.size() ; ix++)
1504 for (
unsigned int isubDet = 0 ; isubDet < nLevelsTimesSlices; isubDet++)
1507 sprintf(meanChar[ix][isubDet],
"%."+nDigits+
"f",meanValue[ix][isubDet]);
1508 sprintf(RMSChar[ix][isubDet],
"%."+nDigits+
"f",
RMS[ix][isubDet]);
1513 PXBpLine +=
" & $"; PXBpLine += meanChar[ix][0]; PXBpLine +=
"\\pm"; PXBpLine += RMSChar[ix][0]; PXBpLine +=
" $";
1514 PXBmLine +=
" & $"; PXBmLine += meanChar[ix][12]; PXBmLine +=
"\\pm"; PXBmLine += RMSChar[ix][12]; PXBmLine +=
" $";
1515 PXFpLine +=
" & $"; PXFpLine += meanChar[ix][1]; PXFpLine +=
"\\pm"; PXFpLine += RMSChar[ix][1]; PXFpLine +=
" $";
1516 PXFmLine +=
" & $"; PXFmLine += meanChar[ix][7]; PXFmLine +=
"\\pm"; PXFmLine += RMSChar[ix][7]; PXFmLine +=
" $";
1517 TIBpLine +=
" & $"; TIBpLine += meanChar[ix][2]; TIBpLine +=
"\\pm"; TIBpLine += RMSChar[ix][2]; TIBpLine +=
" $";
1518 TIBmLine +=
" & $"; TIBmLine += meanChar[ix][14]; TIBmLine +=
"\\pm"; TIBmLine += RMSChar[ix][14]; TIBmLine +=
" $";
1519 TIDpLine +=
" & $"; TIDpLine += meanChar[ix][3]; TIDpLine +=
"\\pm"; TIDpLine += RMSChar[ix][3]; TIDpLine +=
" $";
1520 TIDmLine +=
" & $"; TIDmLine += meanChar[ix][9]; TIDmLine +=
"\\pm"; TIDmLine += RMSChar[ix][9]; TIDmLine +=
" $";
1521 TOBpLine +=
" & $"; TOBpLine += meanChar[ix][4]; TOBpLine +=
"\\pm"; TOBpLine += RMSChar[ix][4]; TOBpLine +=
" $";
1522 TOBmLine +=
" & $"; TOBmLine += meanChar[ix][16]; TOBmLine +=
"\\pm"; TOBmLine += RMSChar[ix][16]; TOBmLine +=
" $";
1523 TECpLine +=
" & $"; TECpLine += meanChar[ix][5]; TECpLine +=
"\\pm"; TECpLine += RMSChar[ix][5]; TECpLine +=
" $";
1524 TECmLine +=
" & $"; TECmLine += meanChar[ix][11]; TECmLine +=
"\\pm"; TECmLine += RMSChar[ix][11]; TECmLine +=
" $";
1528 output <<
"\\begin{table}" << std::endl;
1529 output <<
"\\caption{" << tableCaption <<
"}" << std::endl;
1530 output <<
"\\begin{tabular}{"<< tableAlign <<
"}" << std::endl;
1531 output <<
"\\hline" << std::endl;
1532 output << tableHeadline <<
" \\\\" << std::endl;
1533 output <<
"\\hline" << std::endl;
1534 output << PXBpLine <<
" \\\\"<< std::endl;
1535 output << PXBmLine <<
" \\\\"<< std::endl;
1536 output << PXFpLine <<
" \\\\"<< std::endl;
1537 output << PXFmLine <<
" \\\\"<< std::endl;
1538 output << TIBpLine <<
" \\\\"<< std::endl;
1539 output << TIBmLine <<
" \\\\"<< std::endl;
1540 output << TIDpLine <<
" \\\\"<< std::endl;
1541 output << TIDmLine <<
" \\\\"<< std::endl;
1542 output << TOBpLine <<
" \\\\"<< std::endl;
1543 output << TOBmLine <<
" \\\\"<< std::endl;
1544 output << TECpLine <<
" \\\\"<< std::endl;
1545 output << TECmLine <<
" \\\\"<< std::endl;
1546 output <<
"\\hline" << std::endl;
1547 output <<
"\\end{tabular}" << std::endl;
1548 output <<
"\\end{table}" << std::endl;