Skip to content

Commit 0f4be00

Browse files
committed
GPU QA: Add firstPadRow QA
1 parent c546419 commit 0f4be00

File tree

2 files changed

+80
-18
lines changed

2 files changed

+80
-18
lines changed

GPU/GPUTracking/qa/GPUQA.cxx

Lines changed: 76 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@ int32_t GPUQA::InitQACreateHistograms()
523523
std::unique_ptr<double[]> binsPt{CreateLogAxis(AXIS_BINS[4], PT_MIN_CLUST, PT_MAX)};
524524
createHist(mClusters[i], name, name, AXIS_BINS[4], binsPt.get());
525525
}
526+
527+
createHist(mPadRow[0], "padrow0", "padrow0", GPUCA_ROW_COUNT, 0, GPUCA_ROW_COUNT - 1, GPUCA_ROW_COUNT, 0, GPUCA_ROW_COUNT - 1);
528+
createHist(mPadRow[1], "padrow0", "padrow0", 100.f, -0.2f, 0.2f, GPUCA_ROW_COUNT, 0, GPUCA_ROW_COUNT - 1);
526529
}
527530

528531
if (mQATasks & taskTrackStatistics) {
@@ -537,6 +540,7 @@ int32_t GPUQA::InitQACreateHistograms()
537540
createHist(mT0[0], "tracks_t0", "tracks_t0", (maxTime + 1) / 10, 0, maxTime);
538541
createHist(mT0[1], "tracks_t0_res", "tracks_t0_res", 1000, -100, 100);
539542
createHist(mClXY, "clXY", "clXY", 1000, -250, 250, 1000, -250, 250); // TODO: Pass name only once
543+
540544
const int padCount = GPUTPCGeometry::NPads(GPUCA_ROW_COUNT - 1);
541545
for (int32_t i = 0; i < 3; i++) {
542546
snprintf(name, 2048, "clrej_%d", i);
@@ -1063,29 +1067,56 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
10631067
}
10641068
}
10651069
}
1066-
if ((mQATasks & taskClusterAttach) && mTracking->mIOPtrs.mergedTrackHitAttachment) {
1070+
if ((mQATasks & taskClusterAttach)) {
1071+
std::vector<uint8_t> lowestPadRow(mTracking->mIOPtrs.nMergedTracks);
10671072
// fill cluster adjacent status
1068-
for (uint32_t i = 0; i < GetNMCLabels(); i++) {
1069-
if (mClusterParam[i].attached == 0 && mClusterParam[i].fakeAttached == 0) {
1070-
int32_t attach = mTracking->mIOPtrs.mergedTrackHitAttachment[i];
1071-
if (attach & gputpcgmmergertypes::attachFlagMask) {
1072-
int32_t track = attach & gputpcgmmergertypes::attachTrackMask;
1073-
mcLabelI_t trackL = mTrackMCLabels[track];
1074-
bool fake = true;
1075-
for (int32_t j = 0; j < GetMCLabelNID(i); j++) {
1076-
// GPUInfo("Attach %x Track %d / %d:%d", attach, track, j, GetMCLabelID(i, j));
1077-
if (trackL == GetMCLabel(i, j)) {
1078-
fake = false;
1079-
break;
1073+
if (mTracking->mIOPtrs.mergedTrackHitAttachment) {
1074+
for (uint32_t i = 0; i < GetNMCLabels(); i++) {
1075+
if (mClusterParam[i].attached == 0 && mClusterParam[i].fakeAttached == 0) {
1076+
int32_t attach = mTracking->mIOPtrs.mergedTrackHitAttachment[i];
1077+
if (attach & gputpcgmmergertypes::attachFlagMask) {
1078+
int32_t track = attach & gputpcgmmergertypes::attachTrackMask;
1079+
mcLabelI_t trackL = mTrackMCLabels[track];
1080+
bool fake = true;
1081+
for (int32_t j = 0; j < GetMCLabelNID(i); j++) {
1082+
// GPUInfo("Attach %x Track %d / %d:%d", attach, track, j, GetMCLabelID(i, j));
1083+
if (trackL == GetMCLabel(i, j)) {
1084+
fake = false;
1085+
break;
1086+
}
1087+
}
1088+
if (fake) {
1089+
mClusterParam[i].fakeAdjacent++;
1090+
} else {
1091+
mClusterParam[i].adjacent++;
10801092
}
10811093
}
1082-
if (fake) {
1083-
mClusterParam[i].fakeAdjacent++;
1084-
} else {
1085-
mClusterParam[i].adjacent++;
1094+
}
1095+
}
1096+
}
1097+
if (mTracking->mIOPtrs.nMergedTracks && mTracking->mIOPtrs.clustersNative) {
1098+
std::fill(lowestPadRow.begin(), lowestPadRow.end(), 255);
1099+
for (uint32_t iSector = 0; iSector < GPUCA_NSECTORS; iSector++) {
1100+
for (uint32_t iRow = 0; iRow < GPUCA_ROW_COUNT; iRow++) {
1101+
for (uint32_t iCl = 0; iCl < mTracking->mIOPtrs.clustersNative->nClusters[iSector][iRow]; iCl++) {
1102+
int32_t i = mTracking->mIOPtrs.clustersNative->clusterOffset[iSector][iRow] + iCl;
1103+
for (int32_t j = 0; j < GetMCLabelNID(i); j++) {
1104+
uint32_t trackId = GetMCTrackObj(mTrackMCLabelsReverse, GetMCLabel(i, j));
1105+
if (trackId < lowestPadRow.size() && lowestPadRow[trackId] > iRow) {
1106+
lowestPadRow[trackId] = iRow;
1107+
}
1108+
}
10861109
}
10871110
}
10881111
}
1112+
for (uint32_t i = 0; i < mTracking->mIOPtrs.nMergedTracks; i++) {
1113+
const auto& trk = mTracking->mIOPtrs.mergedTracks[i];
1114+
if (trk.OK() && lowestPadRow[i] != 255 && trk.NClustersFitted() > 70 && CAMath::Abs(trk.GetParam().GetQPt()) < 0.5) {
1115+
int32_t lowestRow = CAMath::Min(mTracking->mIOPtrs.mergedTrackHits[trk.FirstClusterRef()].row, mTracking->mIOPtrs.mergedTrackHits[trk.FirstClusterRef() + trk.NClusters() - 1].row);
1116+
mPadRow[0]->Fill((float)lowestPadRow[i], (float)lowestRow, 1.f);
1117+
mPadRow[1]->Fill(CAMath::ATan2(trk.GetParam().GetY(), trk.GetParam().GetX()), lowestRow, 1.f);
1118+
}
1119+
}
10891120
}
10901121
}
10911122

@@ -1677,7 +1708,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16771708
}
16781709
} else if (!mConfig.inputHistogramsOnly && !mConfig.noMC && (mQATasks & (taskTrackingEff | taskTrackingRes | taskTrackingResPull | taskClusterAttach))) {
16791710
GPUWarning("No MC information available, only running partial TPC QA!");
1680-
}
1711+
} // mcAvail
16811712

16821713
if (mQATasks & taskTrackStatistics) {
16831714
// Fill track statistic histograms
@@ -2245,6 +2276,14 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
22452276
mCClRejP->cd();
22462277
mPClRejP = createGarbageCollected<TPad>("p0", "", 0.0, 0.0, 1.0, 1.0);
22472278
mPClRejP->Draw();
2279+
2280+
for (int32_t i = 0; i < 2; i++) {
2281+
snprintf(name, 2048, "cpadrow%d", i);
2282+
mCPadRow[i] = createGarbageCollected<TCanvas>(name, "First Track Pad Row", 0, 0, 700, 700. * 2. / 3.);
2283+
mCPadRow[i]->cd();
2284+
mPPadRow[i] = createGarbageCollected<TPad>("p0", "", 0.0, 0.0, 1.0, 1.0);
2285+
mPPadRow[i]->Draw();
2286+
}
22482287
}
22492288
}
22502289

@@ -2816,6 +2855,25 @@ int32_t GPUQA::DrawQAHistograms(TObjArray* qcout)
28162855
mCClust[i]->Print(i == 2 ? "plots/clusters_integral.root" : i == 1 ? "plots/clusters_relative.root" : "plots/clusters.root");
28172856
}
28182857
}
2858+
2859+
for (int32_t i = 0; i < 2; i++) {
2860+
auto* e = mPadRow[i];
2861+
if (tout && !mConfig.inputHistogramsOnly) {
2862+
e->Write();
2863+
}
2864+
mPPadRow[i]->cd();
2865+
e->SetOption("colz");
2866+
e->GetXaxis()->SetTitle("First MC Pad Row");
2867+
e->GetYaxis()->SetTitle("First Pad Row");
2868+
e->Draw();
2869+
mCPadRow[i]->cd();
2870+
snprintf(name, 2048, "plots/padrow%d.pdf", i);
2871+
mCPadRow[i]->Print(name);
2872+
if (mConfig.writeRootFiles) {
2873+
snprintf(name, 2048, "plots/padrow%d.root", i);
2874+
mCPadRow[i]->Print(name);
2875+
}
2876+
}
28192877
}
28202878

28212879
// Process cluster count statistics

GPU/GPUTracking/qa/GPUQA.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ class GPUQA
323323
TPad* mPClRej[3];
324324
TPad* mPClRejP;
325325

326+
TH2F* mPadRow[2];
327+
TCanvas* mCPadRow[2];
328+
TPad* mPPadRow[2];
329+
326330
std::vector<TH2F*> mHistClusterCount;
327331

328332
std::vector<TH1F>* mHist1D = nullptr;

0 commit comments

Comments
 (0)