Skip to content

Commit ee4bb3b

Browse files
committed
GPU QA: Make some of the plots nices
1 parent bc87760 commit ee4bb3b

File tree

3 files changed

+41
-36
lines changed

3 files changed

+41
-36
lines changed

GPU/GPUTracking/Definitions/GPUSettingsList.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ AddOption(histMaxNClusters, uint32_t, 500000000, "", 0, "Maximum number of clust
525525
AddOption(minNClFindable, uint32_t, 70, "", 0, "Minimum number of (weighted) MC clusters for a track to count as findable")
526526
AddOption(minNClEff, uint32_t, 10, "", 0, "Minimum number of (weighted) MC clusters for a track to contribute to all-tracks efficiency histogramm")
527527
AddOption(minNClRes, uint32_t, 40, "", 0, "Minimum number of (weighted) MC clusters for a track to contribute to resolution histogram")
528+
AddOption(perfFigure, int32_t, 0, "", 0, "Show as performance figure, positive value for MC, negative value for data")
528529
AddShortcut("compare", 0, "--QAinput", "Compare QA histograms", "--qa", "--QAinputHistogramsOnly")
529530
AddHelp("help", 'h')
530531
EndConfig()

GPU/GPUTracking/qa/GPUQA.cxx

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,11 @@ static const GPUSettingsQA& GPUQA_GetConfig(GPUChainTracking* chain)
144144
}
145145
}
146146

147-
// static const constexpr bool PLOT_ROOT = 0;
148-
// static const constexpr bool FIX_SCALES = 0;
149-
static const constexpr bool PERF_FIGURE = 0;
150-
// static const constexpr float FIXED_SCALES_MIN[5] = {-0.05, -0.05, -0.2, -0.2, -0.5};
151-
// static const constexpr float FIXED_SCALES_MAX[5] = {0.4, 0.7, 5, 3, 6.5};
152147
static const constexpr float LOG_PT_MIN = -1.;
153148

154149
static constexpr float Y_MAX = 40;
155150
static constexpr float Z_MAX = 100;
156151
static constexpr float PT_MIN = GPUCA_MIN_TRACK_PTB5_DEFAULT;
157-
// static constexpr float PT_MIN2 = 0.1;
158152
static constexpr float PT_MIN_PRIM = 0.1;
159153
static constexpr float PT_MIN_CLUST = GPUCA_MIN_TRACK_PTB5_DEFAULT;
160154
static constexpr float PT_MAX = 20;
@@ -375,10 +369,10 @@ void GPUQA::SetAxisSize(T* e)
375369
e->GetXaxis()->SetLabelSize(0.045);
376370
}
377371

378-
void GPUQA::SetLegend(TLegend* l)
372+
void GPUQA::SetLegend(TLegend* l, bool bigText)
379373
{
380374
l->SetTextFont(72);
381-
l->SetTextSize(0.016);
375+
l->SetTextSize(bigText ? 0.03 : 0.016);
382376
l->SetFillColor(0);
383377
}
384378

@@ -419,15 +413,20 @@ void GPUQA::DrawHisto(TH1* histo, char* filename, char* options)
419413

420414
void GPUQA::doPerfFigure(float x, float y, float size)
421415
{
422-
if (!PERF_FIGURE) {
416+
const char* str_perf_figure_1 = "ALICE Performance";
417+
const char* str_perf_figure_2_mc = "MC, Pb#minusPb, #sqrt{s_{NN}} = 5.36 TeV";
418+
const char* str_perf_figure_2_data = "Pb#minusPb, #sqrt{s_{NN}} = 5.36 TeV";
419+
420+
if (mConfig.perfFigure == 0) {
423421
return;
424422
}
425-
TLatex* t = createGarbageCollected<TLatex>();
423+
TLatex* t = createGarbageCollected<TLatex>(); // TODO: We could perhaps put everything in a legend, to get a white background if there is a grid
426424
t->SetNDC(kTRUE);
427425
t->SetTextColor(1);
428426
t->SetTextSize(size);
429427
t->DrawLatex(x, y, str_perf_figure_1);
430-
t->DrawLatex(x, y - 0.01 - size, str_perf_figure_2);
428+
t->SetTextSize(size * 0.8);
429+
t->DrawLatex(x, y - 0.01 - size, mConfig.perfFigure > 0 ? str_perf_figure_2_mc : str_perf_figure_2_data);
431430
}
432431

433432
void GPUQA::SetMCTrackRange(int32_t min, int32_t max)
@@ -1954,20 +1953,22 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
19541953
mTrackingScratchBuffer.shrink_to_fit();
19551954
}
19561955

1957-
void GPUQA::GetName(char* fname, int32_t k)
1956+
void GPUQA::GetName(char* fname, int32_t k, bool noDash)
19581957
{
19591958
const int32_t nNewInput = mConfig.inputHistogramsOnly ? 0 : 1;
19601959
if (k || mConfig.inputHistogramsOnly || mConfig.name.size()) {
19611960
if (!(mConfig.inputHistogramsOnly || k)) {
1962-
snprintf(fname, 1024, "%s - ", mConfig.name.c_str());
1961+
snprintf(fname, 1024, "%s%s", mConfig.name.c_str(), noDash ? "" : " - ");
19631962
} else if (mConfig.compareInputNames.size() > (unsigned)(k - nNewInput)) {
1964-
snprintf(fname, 1024, "%s - ", mConfig.compareInputNames[k - nNewInput].c_str());
1963+
snprintf(fname, 1024, "%s%s", mConfig.compareInputNames[k - nNewInput].c_str(), noDash ? "" : " - ");
19651964
} else {
19661965
strcpy(fname, mConfig.compareInputs[k - nNewInput].c_str());
19671966
if (strlen(fname) > 5 && strcmp(fname + strlen(fname) - 5, ".root") == 0) {
19681967
fname[strlen(fname) - 5] = 0;
19691968
}
1970-
strcat(fname, " - ");
1969+
if (!noDash) {
1970+
strcat(fname, " - ");
1971+
}
19711972
}
19721973
} else {
19731974
fname[0] = 0;
@@ -2187,8 +2188,8 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
21872188
mCTracks->cd();
21882189
mPTracks = createGarbageCollected<TPad>("p0", "", 0.0, 0.0, 1.0, 1.0);
21892190
mPTracks->Draw();
2190-
mLTracks = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.45, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949);
2191-
SetLegend(mLTracks);
2191+
mLTracks = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.5, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949);
2192+
SetLegend(mLTracks, true);
21922193

21932194
for (int32_t i = 0; i < 2; i++) {
21942195
snprintf(name, 2048, "ctrackst0%d", i);
@@ -2204,8 +2205,8 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
22042205
mCNCl[i]->cd();
22052206
mPNCl[i] = createGarbageCollected<TPad>("p0", "", 0.0, 0.0, 1.0, 1.0);
22062207
mPNCl[i]->Draw();
2207-
mLNCl[i] = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.45, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949);
2208-
SetLegend(mLNCl[i]);
2208+
mLNCl[i] = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.45, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949); // TODO: Fix sizing of legend, and also fix font size
2209+
SetLegend(mLNCl[i], true);
22092210
}
22102211

22112212
mCClXY = createGarbageCollected<TCanvas>("clxy", "Number of clusters per X / Y", 0, 0, 700, 700. * 2. / 3.);
@@ -2288,7 +2289,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
22882289
continue;
22892290
}
22902291
e->SetMarkerColor(kBlack);
2291-
e->SetLineColor(colorNums[(k * 3 + l) % COLORCOUNT]);
2292+
e->SetLineColor(colorNums[(k < 3 ? (l * 3 + k) : (k * 3 + l)) % COLORCOUNT]);
22922293
e->GetHistogram()->GetYaxis()->SetRangeUser(-0.02, 1.02);
22932294
e->Draw(k || l ? "same P" : "AP");
22942295
if (j == 0) {
@@ -2776,7 +2777,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
27762777
if (!mConfig.enableLocalOutput) {
27772778
continue;
27782779
}
2779-
doPerfFigure(i != 2 ? 0.37 : 0.6, 0.295, 0.030);
2780+
doPerfFigure(i == 0 ? 0.37 : (i == 1 ? 0.34 : 0.6), 0.295, 0.030);
27802781
mCClust[i]->cd();
27812782
mCClust[i]->Print(i == 2 ? "plots/clusters_integral.pdf" : i == 1 ? "plots/clusters_relative.pdf" : "plots/clusters.pdf");
27822783
if (mConfig.writeRootFiles) {
@@ -2827,19 +2828,21 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
28272828
e->SetMinimum(tmpMax * -0.02);
28282829
e->SetStats(kFALSE);
28292830
e->SetLineWidth(1);
2830-
e->GetYaxis()->SetTitle("a.u.");
2831-
e->GetXaxis()->SetTitle("#it{p}_{Tmc} (GeV/#it{c})");
2831+
e->SetTitle("Number of Tracks vs #it{p}_{T}");
2832+
e->GetYaxis()->SetTitle("Number of Tracks");
2833+
e->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
28322834
if (qcout) {
28332835
qcout->Add(e);
28342836
}
28352837
e->SetMarkerColor(kBlack);
28362838
e->SetLineColor(colorNums[k % COLORCOUNT]);
28372839
e->Draw(k == 0 ? "" : "same");
2838-
GetName(fname, k);
2839-
snprintf(name, 2048, "%sTrack Pt", fname);
2840+
GetName(fname, k, mConfig.inputHistogramsOnly);
2841+
snprintf(name, 2048, mConfig.inputHistogramsOnly ? "%s" : "%sTrack #it{p}_{T}", fname);
28402842
mLTracks->AddEntry(e, name, "l");
28412843
}
28422844
mLTracks->Draw();
2845+
doPerfFigure(0.63, 0.7, 0.030);
28432846
mCTracks->cd();
28442847
mCTracks->Print("plots/tracks.pdf");
28452848
if (mConfig.writeRootFiles) {
@@ -2871,19 +2874,21 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
28712874
e->SetMinimum(tmpMax * -0.02);
28722875
e->SetStats(kFALSE);
28732876
e->SetLineWidth(1);
2877+
e->SetTitle(i ? "Track t_{0} resolution" : "Track t_{0} distribution");
28742878
e->GetYaxis()->SetTitle("a.u.");
2875-
e->GetXaxis()->SetTitle(i ? "to vs t0_{mc}" : "t0");
2879+
e->GetXaxis()->SetTitle(i ? "t_{0} - t_{0, mc}" : "t_{0}");
28762880
if (qcout) {
28772881
qcout->Add(e);
28782882
}
28792883
e->SetMarkerColor(kBlack);
28802884
e->SetLineColor(colorNums[k % COLORCOUNT]);
28812885
e->Draw(k == 0 ? "" : "same");
2882-
GetName(fname, k);
2883-
snprintf(name, 2048, "%sTrack T0 %s", fname, i ? "" : "resolution");
2886+
GetName(fname, k, mConfig.inputHistogramsOnly);
2887+
snprintf(name, 2048, mConfig.inputHistogramsOnly ? "%s (%s)" : "%sTrack t_{0} %s", fname, i ? "" : "resolution");
28842888
mLT0[i]->AddEntry(e, name, "l");
28852889
}
28862890
mLT0[i]->Draw();
2891+
doPerfFigure(0.63, 0.7, 0.030);
28872892
mCT0[i]->cd();
28882893
snprintf(name, 2048, "plots/t0%s.pdf", i ? "_res" : "");
28892894
mCT0[i]->Print(name);
@@ -2916,19 +2921,21 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
29162921
e->SetMinimum(tmpMax * -0.02);
29172922
e->SetStats(kFALSE);
29182923
e->SetLineWidth(1);
2924+
e->SetTitle(i ? "Number of Rows with attached Cluster" : "Number of Clusters");
29192925
e->GetYaxis()->SetTitle("a.u.");
2920-
e->GetXaxis()->SetTitle("NClusters");
2926+
e->GetXaxis()->SetTitle(i ? "N_{Rows with Clusters}" : "N_{Clusters}");
29212927
if (qcout) {
29222928
qcout->Add(e);
29232929
}
29242930
e->SetMarkerColor(kBlack);
29252931
e->SetLineColor(colorNums[k % COLORCOUNT]);
29262932
e->Draw(k == 0 ? "" : "same");
2927-
GetName(fname, k);
2928-
snprintf(name, 2048, "%sNClusters%d", fname, i);
2933+
GetName(fname, k, mConfig.inputHistogramsOnly);
2934+
snprintf(name, 2048, mConfig.inputHistogramsOnly ? "%s" : (i ? "%sN_{Clusters}" : "%sN_{Rows with Clusters}"), fname);
29292935
mLNCl[i]->AddEntry(e, name, "l");
29302936
}
29312937
mLNCl[i]->Draw();
2938+
doPerfFigure(0.6, 0.7, 0.030);
29322939
mCNCl[i]->cd();
29332940
snprintf(name, 2048, "plots/nClusters%s.pdf", i ? "_corrected" : "");
29342941
mCNCl[i]->Print(name);

GPU/GPUTracking/qa/GPUQA.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ class GPUQA
172172
void CopyO2MCtoIOPtr(GPUTrackingInOutPointers* ptr);
173173
template <class T>
174174
void SetAxisSize(T* e);
175-
void SetLegend(TLegend* l);
175+
void SetLegend(TLegend* l, bool bigText = false);
176176
double* CreateLogAxis(int32_t nbins, float xmin, float xmax);
177177
void ChangePadTitleSize(TPad* p, float size);
178178
void DrawHisto(TH1* histo, char* filename, char* options);
179179
void doPerfFigure(float x, float y, float size);
180-
void GetName(char* fname, int32_t k);
180+
void GetName(char* fname, int32_t k, bool noDash = false);
181181
template <class T>
182182
T* GetHist(T*& ee, std::vector<std::unique_ptr<TFile>>& tin, int32_t k, int32_t nNewInput);
183183

@@ -234,9 +234,6 @@ class GPUQA
234234
const GPUSettingsQA& mConfig;
235235
const GPUParam* mParam;
236236

237-
const char* str_perf_figure_1 = "ALICE Performance 2018/03/20";
238-
// const char* str_perf_figure_2 = "2015, MC pp, #sqrt{s} = 5.02 TeV";
239-
const char* str_perf_figure_2 = "2015, MC Pb-Pb, #sqrt{s_{NN}} = 5.02 TeV";
240237
//-------------------------
241238

242239
std::vector<mcLabelI_t> mTrackMCLabels;

0 commit comments

Comments
 (0)