Skip to content

Commit 96a6a75

Browse files
committed
GPU QA: Improvements for some plots
1 parent 9634a2e commit 96a6a75

File tree

3 files changed

+39
-36
lines changed

3 files changed

+39
-36
lines changed

GPU/GPUTracking/Definitions/GPUSettingsList.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,10 @@ AddOption(histMaxNClusters, uint32_t, 500000000, "", 0, "Maximum number of clust
527527
AddOption(minNClFindable, uint32_t, 70, "", 0, "Minimum number of (weighted) MC clusters for a track to count as findable")
528528
AddOption(minNClEff, uint32_t, 10, "", 0, "Minimum number of (weighted) MC clusters for a track to contribute to all-tracks efficiency histogramm")
529529
AddOption(minNClRes, uint32_t, 40, "", 0, "Minimum number of (weighted) MC clusters for a track to contribute to resolution histogram")
530-
AddOption(perfFigure, int32_t, 0, "", 0, "Show as performance figure, positive value for MC, negative value for data")
530+
AddOption(perfFigure, std::string, "", "", 0, "Show as performance figure, provide mc/MC or data as asgument, or a custom string", def("MC"))
531531
AddOption(plotsDir, std::string, "plots", "", 0, "Directory to write plots to")
532-
AddShortcut("compare", 0, "--QAinput", "Compare QA histograms", "--qa", "--QAinputHistogramsOnly")
532+
AddOption(plotsNoTitle, bool, false, "", 0, "Do not print titles on figures")
533+
AddShortcut("compare", 0, "--QAinput", "Compare QA histograms", "-c", "--qa", "--QAinputHistogramsOnly")
533534
AddHelp("help", 'h')
534535
EndConfig()
535536

GPU/GPUTracking/qa/GPUQA.cxx

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -413,20 +413,21 @@ void GPUQA::DrawHisto(TH1* histo, char* filename, char* options)
413413

414414
void GPUQA::doPerfFigure(float x, float y, float size)
415415
{
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) {
416+
if (mConfig.perfFigure == "") {
421417
return;
422418
}
419+
static constexpr const char* str_perf_figure_1 = "ALICE Performance";
420+
static constexpr const char* str_perf_figure_2_mc = "MC, Pb#minusPb, #sqrt{s_{NN}} = 5.36 TeV";
421+
static constexpr const char* str_perf_figure_2_data = "Pb#minusPb, #sqrt{s_{NN}} = 5.36 TeV";
422+
const char* str_perf_figure_2 = (mConfig.perfFigure == "mc" || mConfig.perfFigure == "MC") ? str_perf_figure_2_mc : (mConfig.perfFigure == "data" ? str_perf_figure_2_data : mConfig.perfFigure.c_str());
423+
423424
TLatex* t = createGarbageCollected<TLatex>(); // TODO: We could perhaps put everything in a legend, to get a white background if there is a grid
424425
t->SetNDC(kTRUE);
425426
t->SetTextColor(1);
426427
t->SetTextSize(size);
427428
t->DrawLatex(x, y, str_perf_figure_1);
428429
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);
430+
t->DrawLatex(x, y - 0.01 - size, str_perf_figure_2);
430431
}
431432

432433
void GPUQA::SetMCTrackRange(int32_t min, int32_t max)
@@ -539,7 +540,7 @@ int32_t GPUQA::InitQACreateHistograms()
539540
createHist(mNCl[i], name, name, 160, 0, 159);
540541
}
541542
std::unique_ptr<double[]> binsPt{CreateLogAxis(AXIS_BINS[4], PT_MIN_CLUST, PT_MAX)};
542-
createHist(mTracks, "tracks_pt", "tracks_pt", AXIS_BINS[4], binsPt.get());
543+
createHist(mTrackPt, "tracks_pt", "tracks_pt", AXIS_BINS[4], binsPt.get());
543544
const uint32_t maxTime = (mTracking && mTracking->GetParam().continuousMaxTimeBin > 0) ? mTracking->GetParam().continuousMaxTimeBin : TPC_MAX_TIME_BIN_TRIGGERED;
544545
createHist(mT0[0], "tracks_t0", "tracks_t0", (maxTime + 1) / 10, 0, maxTime);
545546
createHist(mT0[1], "tracks_t0_res", "tracks_t0_res", 1000, -100, 100);
@@ -1738,7 +1739,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
17381739
if (!track.OK()) {
17391740
continue;
17401741
}
1741-
mTracks->Fill(1.f / fabsf(track.GetParam().GetQPt()));
1742+
mTrackPt->Fill(1.f / fabsf(track.GetParam().GetQPt()));
17421743
mNCl[0]->Fill(track.NClustersFitted());
17431744
uint32_t nClCorrected = 0;
17441745
const auto& trackClusters = mTracking->mIOPtrs.mergedTrackHits;
@@ -2247,12 +2248,12 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
22472248

22482249
// Create Canvas for track statistic histos
22492250
if (mQATasks & taskTrackStatistics) {
2250-
mCTracks = createGarbageCollected<TCanvas>("ctrackspt", "ctrackspt", 0, 0, 700, 700. * 2. / 3.);
2251-
mCTracks->cd();
2252-
mPTracks = createGarbageCollected<TPad>("p0", "", 0.0, 0.0, 1.0, 1.0);
2253-
mPTracks->Draw();
2254-
mLTracks = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.5, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949);
2255-
SetLegend(mLTracks, true);
2251+
mCTrackPt = createGarbageCollected<TCanvas>("ctrackspt", "ctrackspt", 0, 0, 700, 700. * 2. / 3.);
2252+
mCTrackPt->cd();
2253+
mPTrackPt = createGarbageCollected<TPad>("p0", "", 0.0, 0.0, 1.0, 1.0);
2254+
mPTrackPt->Draw();
2255+
mLTrackPt = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.5, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949);
2256+
SetLegend(mLTrackPt, true);
22562257

22572258
for (int32_t i = 0; i < 2; i++) {
22582259
snprintf(name, 2048, "ctrackst0%d", i);
@@ -2800,7 +2801,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
28002801
continue;
28012802
}
28022803

2803-
e->SetTitle(CLUSTER_TITLES[i]);
2804+
e->SetTitle(mConfig.plotsNoTitle ? "" : CLUSTER_TITLES[i]);
28042805
e->GetYaxis()->SetTitle(i == 0 ? "Number of TPC clusters" : i == 1 ? "Fraction of TPC clusters" : CLUST_HIST_INT_SUM ? "Total TPC clusters (integrated)" : "Fraction of TPC clusters (integrated)");
28052806
e->GetXaxis()->SetTitle("#it{p}_{Tmc} (GeV/#it{c})");
28062807
e->GetXaxis()->SetTitleOffset(1.1);
@@ -2878,7 +2879,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
28782879
}
28792880
title += ")";
28802881

2881-
e->SetTitle(title.c_str());
2882+
e->SetTitle(mConfig.plotsNoTitle ? "" : title.c_str());
28822883
e->GetXaxis()->SetTitle(i == 3 ? "Local Occupancy" : (i ? "#Phi_{Cl} (sector)" : "First MC Pad Row"));
28832884
e->GetYaxis()->SetTitle("First Pad Row");
28842885
e->Draw();
@@ -2910,7 +2911,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
29102911
// Process track statistic histograms
29112912
float tmpMax = 0.;
29122913
for (int32_t k = 0; k < ConfigNumInputs; k++) { // TODO: Simplify this drawing, avoid copy&paste
2913-
TH1F* e = mTracks;
2914+
TH1F* e = mTrackPt;
29142915
if (GetHist(e, tin, k, nNewInput) == nullptr) {
29152916
continue;
29162917
}
@@ -2919,10 +2920,10 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
29192920
tmpMax = e->GetMaximum();
29202921
}
29212922
}
2922-
mPTracks->cd();
2923-
mPTracks->SetLogx();
2923+
mPTrackPt->cd();
2924+
mPTrackPt->SetLogx();
29242925
for (int32_t k = 0; k < ConfigNumInputs; k++) {
2925-
TH1F* e = mTracks;
2926+
TH1F* e = mTrackPt;
29262927
if (GetHist(e, tin, k, nNewInput) == nullptr) {
29272928
continue;
29282929
}
@@ -2933,24 +2934,25 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
29332934
e->SetMinimum(tmpMax * -0.02);
29342935
e->SetStats(kFALSE);
29352936
e->SetLineWidth(1);
2936-
e->SetTitle("Number of Tracks vs #it{p}_{T}");
2937+
e->SetTitle(mConfig.plotsNoTitle ? "" : "Number of Tracks vs #it{p}_{T}");
29372938
e->GetYaxis()->SetTitle("Number of Tracks");
29382939
e->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
2940+
e->GetXaxis()->SetTitleOffset(1.2);
29392941
if (qcout) {
29402942
qcout->Add(e);
29412943
}
29422944
e->SetMarkerColor(kBlack);
29432945
e->SetLineColor(colorNums[k % COLORCOUNT]);
29442946
e->Draw(k == 0 ? "" : "same");
29452947
GetName(fname, k, mConfig.inputHistogramsOnly);
2946-
mLTracks->AddEntry(e, Form(mConfig.inputHistogramsOnly ? "%s" : "%sTrack #it{p}_{T}", fname), "l");
2948+
mLTrackPt->AddEntry(e, Form(mConfig.inputHistogramsOnly ? "%s" : "%sTrack #it{p}_{T}", fname), "l");
29472949
}
2948-
mLTracks->Draw();
2950+
mLTrackPt->Draw();
29492951
doPerfFigure(0.63, 0.7, 0.030);
2950-
mCTracks->cd();
2951-
mCTracks->Print(Form("%s/tracks.pdf", mConfig.plotsDir.c_str()));
2952+
mCTrackPt->cd();
2953+
mCTrackPt->Print(Form("%s/tracks.pdf", mConfig.plotsDir.c_str()));
29522954
if (mConfig.writeFileExt != "") {
2953-
mCTracks->Print(Form("%s/tracks.%s", mConfig.plotsDir.c_str(), mConfig.writeFileExt.c_str()));
2955+
mCTrackPt->Print(Form("%s/tracks.%s", mConfig.plotsDir.c_str(), mConfig.writeFileExt.c_str()));
29542956
}
29552957

29562958
for (int32_t i = 0; i < 2; i++) {
@@ -2978,7 +2980,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
29782980
e->SetMinimum(tmpMax * -0.02);
29792981
e->SetStats(kFALSE);
29802982
e->SetLineWidth(1);
2981-
e->SetTitle(i ? "Track t_{0} resolution" : "Track t_{0} distribution");
2983+
e->SetTitle(mConfig.plotsNoTitle ? "" : (i ? "Track t_{0} resolution" : "Track t_{0} distribution"));
29822984
e->GetYaxis()->SetTitle("a.u.");
29832985
e->GetXaxis()->SetTitle(i ? "t_{0} - t_{0, mc}" : "t_{0}");
29842986
if (qcout) {
@@ -3022,7 +3024,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
30223024
e->SetMinimum(tmpMax * -0.02);
30233025
e->SetStats(kFALSE);
30243026
e->SetLineWidth(1);
3025-
e->SetTitle(i ? "Number of Rows with attached Cluster" : "Number of Clusters");
3027+
e->SetTitle(mConfig.plotsNoTitle ? "" : (i ? "Number of Rows with attached Cluster" : "Number of Clusters"));
30263028
e->GetYaxis()->SetTitle("a.u.");
30273029
e->GetXaxis()->SetTitle(i ? "N_{Rows with Clusters}" : "N_{Clusters}");
30283030
if (qcout) {
@@ -3061,7 +3063,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
30613063
mClRej[i]->Write();
30623064
}
30633065
mPClRej[i]->cd();
3064-
mClRej[i]->SetTitle(REJECTED_NAMES[i]);
3066+
mClRej[i]->SetTitle(mConfig.plotsNoTitle ? "" : REJECTED_NAMES[i]);
30653067
mClRej[i]->SetOption("colz");
30663068
mClRej[i]->Draw();
30673069
mCClRej[i]->cd();
@@ -3098,7 +3100,7 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
30983100
delete proj2;
30993101
e->SetMinimum(-0.02);
31003102
e->SetMaximum(0.22);
3101-
e->SetTitle("Rejected Clusters");
3103+
e->SetTitle(mConfig.plotsNoTitle ? "" : "Rejected Clusters");
31023104
e->GetXaxis()->SetTitle("Pad Row");
31033105
e->GetYaxis()->SetTitle("Rejected Clusters (fraction)");
31043106
e->Draw(k == 0 ? "" : "same");

GPU/GPUTracking/qa/GPUQA.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ class GPUQA
290290
double nUnaccessible = 0;
291291
} mClusterCounts;
292292

293-
TH1F* mTracks;
294-
TCanvas* mCTracks;
295-
TPad* mPTracks;
296-
TLegend* mLTracks;
293+
TH1F* mTrackPt;
294+
TCanvas* mCTrackPt;
295+
TPad* mPTrackPt;
296+
TLegend* mLTrackPt;
297297

298298
TH1F* mNCl[2];
299299
TCanvas* mCNCl[2];

0 commit comments

Comments
 (0)