Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions GPU/GPUTracking/qa/GPUQA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ inline float GPUQA::GetMCLabelWeight(const mcLabel_t& label) { return 1; }
inline bool GPUQA::mcPresent() { return !mConfig.noMC && mTracking && mClNative && mClNative->clustersMCTruth && mMCInfos.size(); }
uint32_t GPUQA::GetMCLabelCol(const mcLabel_t& label) const { return !label.isValid() ? 0 : (mMCEventOffset[label.getSourceID()] + label.getEventID()); }
GPUQA::mcLabelI_t GPUQA::GetMCTrackLabel(uint32_t trackId) const { return trackId >= mTrackMCLabels.size() ? MCCompLabel() : mTrackMCLabels[trackId]; }
bool GPUQA::CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2) { return l1.compare(l2) >= 0; }
#define TRACK_EXPECTED_REFERENCE_X 78
#else
inline GPUQA::mcLabelI_t::mcLabelI_t(const GPUQA::mcLabel_t& l) : track(l.fMCID) {}
Expand Down Expand Up @@ -263,6 +264,7 @@ inline int32_t GPUQA::AbsLabelID(int32_t id) { return id >= 0 ? id : (-id - 2);
inline bool GPUQA::mcPresent() { return !mConfig.noMC && mTracking && GetNMCLabels() && GetNMCTracks(0); }
uint32_t GPUQA::GetMCLabelCol(const mcLabel_t& label) const { return 0; }
GPUQA::mcLabelI_t GPUQA::GetMCTrackLabel(uint32_t trackId) const { return trackId >= mTrackMCLabels.size() ? mcLabelI_t() : mTrackMCLabels[trackId]; }
bool GPUQA::CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2) { return AbsLabelID(l1) == AbsLabelID(l2); }
#define TRACK_EXPECTED_REFERENCE_X TRACK_EXPECTED_REFERENCE_X_DEFAULT
#endif
template <class T>
Expand Down Expand Up @@ -1660,7 +1662,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx

if (mQATasks & taskTrackStatistics) {
// Fill track statistic histograms
std::vector<std::array<float, 2>> clusterAttachCounts;
std::vector<std::array<float, 3>> clusterAttachCounts;
if (mcAvail) {
clusterAttachCounts.resize(GetNMCLabels(), {0.f, 0.f});
}
Expand Down Expand Up @@ -1691,17 +1693,23 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
if (cl.state & GPUTPCGMMergedTrackHit::flagReject) {
continue;
}
bool labelOk = false;
if (mTrackMCLabels[i].isValid() && !mTrackMCLabels[i].isFake()) {
bool labelOk = false, labelOkNonFake = false;
const mcLabelI_t& trkLabel = mTrackMCLabels[i];
if (trkLabel.isValid() && !trkLabel.isNoise()) {
for (int32_t l = 0; l < GetMCLabelNID(cl.num); l++) {
if (GetMCLabel(cl.num, l) == mTrackMCLabels[i]) {
const mcLabelI_t& clLabel = GetMCLabel(cl.num, l);
if (clLabel.isValid() && !clLabel.isNoise() && CompareIgnoreFake(trkLabel, clLabel)) {
labelOk = true;
if (!trkLabel.isFake()) {
labelOkNonFake = true;
}
break;
}
}
}
clusterAttachCounts[cl.num][0] += (float)labelOk / rowClCount;
clusterAttachCounts[cl.num][1] += 1.0f;
clusterAttachCounts[cl.num][0] += 1.0f;
clusterAttachCounts[cl.num][1] += (float)labelOk / rowClCount;
clusterAttachCounts[cl.num][2] += (float)labelOkNonFake / rowClCount;
}
}
}
Expand All @@ -1721,13 +1729,15 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
}
}
if (mcAvail) {
double clusterAttachNormalizedCount = 0;
double clusterAttachNormalizedCount = 0, clusterAttachNormalizedCountNonFake = 0;
for (uint32_t i = 0; i < clusterAttachCounts.size(); i++) {
if (clusterAttachCounts[i][1]) {
clusterAttachNormalizedCount += clusterAttachCounts[i][0] / clusterAttachCounts[i][1];
if (clusterAttachCounts[i][0]) {
clusterAttachNormalizedCount += clusterAttachCounts[i][1] / clusterAttachCounts[i][0];
clusterAttachNormalizedCountNonFake += clusterAttachCounts[i][2] / clusterAttachCounts[i][0];
}
}
mClusterCounts.nCorrectlyAttachedNormalized = clusterAttachNormalizedCount;
mClusterCounts.nCorrectlyAttachedNormalizedNonFake = clusterAttachNormalizedCountNonFake;
clusterAttachCounts.clear();
}

Expand Down Expand Up @@ -2901,7 +2911,8 @@ int32_t GPUQA::DoClusterCounts(uint64_t* attachClusterCounts, int32_t mode)
PrintClusterCount(mode, num, "Fake Protect (< 40 MeV)", mClusterCounts.nFakeProtect40, mClusterCounts.nBelow40);
}
if (mcPresent() && (mQATasks & taskTrackStatistics)) {
PrintClusterCount(mode, num, "Correctly Attached non-fake normalized", mClusterCounts.nCorrectlyAttachedNormalized, mClusterCounts.nTotal);
PrintClusterCount(mode, num, "Correctly Attached all-trk normalized", mClusterCounts.nCorrectlyAttachedNormalized, mClusterCounts.nTotal);
PrintClusterCount(mode, num, "Correctly Attached non-fake normalized", mClusterCounts.nCorrectlyAttachedNormalizedNonFake, mClusterCounts.nTotal);
}
return num;
}
Expand Down
3 changes: 2 additions & 1 deletion GPU/GPUTracking/qa/GPUQA.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class GPUQA
float GetMCLabelWeight(uint32_t i, uint32_t j);
float GetMCLabelWeight(const mcLabels_t& label, uint32_t j);
float GetMCLabelWeight(const mcLabel_t& label);
static bool CompareIgnoreFake(const mcLabelI_t& l1, const mcLabelI_t& l2);
const auto& GetClusterLabels();
bool mcPresent();

Expand Down Expand Up @@ -290,7 +291,7 @@ class GPUQA
TLegend* mLClust[N_CLS_TYPE];

struct counts_t {
int64_t nRejected = 0, nTube = 0, nTube200 = 0, nLoopers = 0, nLowPt = 0, n200MeV = 0, nPhysics = 0, nProt = 0, nUnattached = 0, nTotal = 0, nHighIncl = 0, nAbove400 = 0, nFakeRemove400 = 0, nFullFakeRemove400 = 0, nBelow40 = 0, nFakeProtect40 = 0, nMergedLooper = 0, nCorrectlyAttachedNormalized = 0;
int64_t nRejected = 0, nTube = 0, nTube200 = 0, nLoopers = 0, nLowPt = 0, n200MeV = 0, nPhysics = 0, nProt = 0, nUnattached = 0, nTotal = 0, nHighIncl = 0, nAbove400 = 0, nFakeRemove400 = 0, nFullFakeRemove400 = 0, nBelow40 = 0, nFakeProtect40 = 0, nMergedLooper = 0, nCorrectlyAttachedNormalized = 0, nCorrectlyAttachedNormalizedNonFake = 0;
double nUnaccessible = 0;
} mClusterCounts;

Expand Down