Skip to content

Commit 468f40d

Browse files
committed
GPU QA: Add histogram with number of rows in which primary TPC track has clusters
1 parent dd16607 commit 468f40d

File tree

2 files changed

+80
-53
lines changed

2 files changed

+80
-53
lines changed

GPU/GPUTracking/qa/GPUQA.cxx

Lines changed: 76 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,10 @@ int32_t GPUQA::InitQACreateHistograms()
525525

526526
if (mQATasks & taskTrackStatistics) {
527527
// Create Tracks Histograms
528-
snprintf(name, 2048, "nclusters");
529-
createHist(mNCl, name, name, 160, 0, 159);
528+
for (int32_t i = 0; i < 2; i++) {
529+
snprintf(name, 2048, i ? "nrows_with_cluster" : "nclusters");
530+
createHist(mNCl[i], name, name, 160, 0, 159);
531+
}
530532
snprintf(name, 2048, "tracks");
531533
std::unique_ptr<double[]> binsPt{CreateLogAxis(AXIS_BINS[4], PT_MIN_CLUST, PT_MAX)};
532534
createHist(mTracks, name, name, AXIS_BINS[4], binsPt.get());
@@ -895,7 +897,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
895897
mTrackMCLabelsReverse[iCol][i] = -1;
896898
}
897899
}
898-
if (mQATasks & taskClusterAttach) {
900+
if (mQATasks & taskClusterAttach && GetNMCLabels()) {
899901
mClusterParam.resize(GetNMCLabels());
900902
memset(mClusterParam.data(), 0, mClusterParam.size() * sizeof(mClusterParam[0]));
901903
}
@@ -1661,7 +1663,25 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16611663
continue;
16621664
}
16631665
mTracks->Fill(1.f / fabsf(track.GetParam().GetQPt()));
1664-
mNCl->Fill(track.NClustersFitted());
1666+
mNCl[0]->Fill(track.NClustersFitted());
1667+
uint32_t nClCorrected = 0;
1668+
int32_t lastSector = -1, lastRow = -1;
1669+
const auto& trackClusters = mTracking->mIOPtrs.mergedTrackHits;
1670+
for (uint32_t j = 0; j < track.NClusters(); j++) {
1671+
if (trackClusters[track.FirstClusterRef() + j].state & GPUTPCGMMergedTrackHit::flagReject) {
1672+
continue;
1673+
}
1674+
if (trackClusters[track.FirstClusterRef() + j].sector == lastSector && trackClusters[track.FirstClusterRef() + j].row == lastRow) {
1675+
continue;
1676+
}
1677+
if (trackClusters[track.FirstClusterRef() + j].leg != trackClusters[track.FirstClusterRef() + track.NClusters() - 1].leg) {
1678+
continue;
1679+
}
1680+
nClCorrected++;
1681+
lastSector = trackClusters[track.FirstClusterRef() + j].sector;
1682+
lastRow = trackClusters[track.FirstClusterRef() + j].sector;
1683+
}
1684+
mNCl[1]->Fill(nClCorrected);
16651685
}
16661686
if (mClNative && mTracking && mTracking->GetTPCTransformHelper()) {
16671687
for (uint32_t i = 0; i < GPUChainTracking::NSECTORS; i++) {
@@ -2055,12 +2075,15 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
20552075
mLTracks = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.45, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949);
20562076
SetLegend(mLTracks);
20572077

2058-
mCNCl = createGarbageCollected<TCanvas>("cncl", "Number of clusters per track", 0, 0, 700, 700. * 2. / 3.);
2059-
mCNCl->cd();
2060-
mPNCl = createGarbageCollected<TPad>("p0", "", 0.0, 0.0, 1.0, 1.0);
2061-
mPNCl->Draw();
2062-
mLNCl = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.45, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949);
2063-
SetLegend(mLNCl);
2078+
for (int32_t i = 0; i < 2; i++) {
2079+
snprintf(name, 2048, "cncl%d Pull", i);
2080+
mCNCl[i] = createGarbageCollected<TCanvas>(name, i ? "Number of clusters (corrected for multiple per row)" : "Number of clusters per track", 0, 0, 700, 700. * 2. / 3.);
2081+
mCNCl[i]->cd();
2082+
mPNCl[i] = createGarbageCollected<TPad>("p0", "", 0.0, 0.0, 1.0, 1.0);
2083+
mPNCl[i]->Draw();
2084+
mLNCl[i] = createGarbageCollected<TLegend>(0.9 - legendSpacingString * 1.45, 0.93 - (0.93 - 0.86) / 2. * (float)ConfigNumInputs, 0.98, 0.949);
2085+
SetLegend(mLNCl[i]);
2086+
}
20642087

20652088
mCClXY = createGarbageCollected<TCanvas>("clxy", "Number of clusters per X / Y", 0, 0, 700, 700. * 2. / 3.);
20662089
mCClXY->cd();
@@ -2696,47 +2719,51 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
26962719
mCTracks->Print("plots/tracks.root");
26972720
}
26982721

2699-
tmpMax = 0.;
2700-
for (int32_t k = 0; k < ConfigNumInputs; k++) {
2701-
TH1F* e = mNCl;
2702-
if (GetHist(e, tin, k, nNewInput) == nullptr) {
2703-
continue;
2704-
}
2705-
e->SetMaximum(-1111);
2706-
if (e->GetMaximum() > tmpMax) {
2707-
tmpMax = e->GetMaximum();
2708-
}
2709-
}
2710-
mPNCl->cd();
2711-
for (int32_t k = 0; k < ConfigNumInputs; k++) {
2712-
TH1F* e = mNCl;
2713-
if (GetHist(e, tin, k, nNewInput) == nullptr) {
2714-
continue;
2715-
}
2716-
if (tout && !mConfig.inputHistogramsOnly && k == 0) {
2717-
e->Write();
2722+
for (int32_t i = 0; i < 2; i++) {
2723+
tmpMax = 0.;
2724+
for (int32_t k = 0; k < ConfigNumInputs; k++) {
2725+
TH1F* e = mNCl[i];
2726+
if (GetHist(e, tin, k, nNewInput) == nullptr) {
2727+
continue;
2728+
}
2729+
e->SetMaximum(-1111);
2730+
if (e->GetMaximum() > tmpMax) {
2731+
tmpMax = e->GetMaximum();
2732+
}
27182733
}
2719-
e->SetMaximum(tmpMax * 1.02);
2720-
e->SetMinimum(tmpMax * -0.02);
2721-
e->SetStats(kFALSE);
2722-
e->SetLineWidth(1);
2723-
e->GetYaxis()->SetTitle("a.u.");
2724-
e->GetXaxis()->SetTitle("NClusters");
2725-
if (qcout) {
2726-
qcout->Add(e);
2734+
mPNCl[i]->cd();
2735+
for (int32_t k = 0; k < ConfigNumInputs; k++) {
2736+
TH1F* e = mNCl[i];
2737+
if (GetHist(e, tin, k, nNewInput) == nullptr) {
2738+
continue;
2739+
}
2740+
if (tout && !mConfig.inputHistogramsOnly && k == 0) {
2741+
e->Write();
2742+
}
2743+
e->SetMaximum(tmpMax * 1.02);
2744+
e->SetMinimum(tmpMax * -0.02);
2745+
e->SetStats(kFALSE);
2746+
e->SetLineWidth(1);
2747+
e->GetYaxis()->SetTitle("a.u.");
2748+
e->GetXaxis()->SetTitle("NClusters");
2749+
if (qcout) {
2750+
qcout->Add(e);
2751+
}
2752+
e->SetMarkerColor(kBlack);
2753+
e->SetLineColor(colorNums[k % COLORCOUNT]);
2754+
e->Draw(k == 0 ? "" : "same");
2755+
GetName(fname, k);
2756+
snprintf(name, 2048, "%sNClusters%d", fname, i);
2757+
mLNCl[i]->AddEntry(e, name, "l");
2758+
}
2759+
mLNCl[i]->Draw();
2760+
mCNCl[i]->cd();
2761+
snprintf(name, 2048, "plots/nClusters%s.pdf", i ? "_corrected" : "");
2762+
mCNCl[i]->Print(name);
2763+
if (mConfig.writeRootFiles) {
2764+
snprintf(name, 2048, "plots/nClusters%s.root", i ? "_corrected" : "");
2765+
mCNCl[i]->Print(name);
27272766
}
2728-
e->SetMarkerColor(kBlack);
2729-
e->SetLineColor(colorNums[k % COLORCOUNT]);
2730-
e->Draw(k == 0 ? "" : "same");
2731-
GetName(fname, k);
2732-
snprintf(name, 2048, "%sNClusters", fname);
2733-
mLNCl->AddEntry(e, name, "l");
2734-
}
2735-
mLNCl->Draw();
2736-
mCNCl->cd();
2737-
mCNCl->Print("plots/nClusters.pdf");
2738-
if (mConfig.writeRootFiles) {
2739-
mCNCl->Print("plots/nClusters.root");
27402767
}
27412768

27422769
mPClXY->cd();

GPU/GPUTracking/qa/GPUQA.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ class GPUQA
299299
TPad* mPTracks;
300300
TLegend* mLTracks;
301301

302-
TH1F* mNCl;
303-
TCanvas* mCNCl;
304-
TPad* mPNCl;
305-
TLegend* mLNCl;
302+
TH1F* mNCl[2];
303+
TCanvas* mCNCl[2];
304+
TPad* mPNCl[2];
305+
TLegend* mLNCl[2];
306306

307307
TH2F* mClXY;
308308
TCanvas* mCClXY;

0 commit comments

Comments
 (0)