@@ -234,6 +234,7 @@ inline float GPUQA::GetMCLabelWeight(const mcLabel_t& label) { return 1; }
234234inline bool GPUQA::mcPresent () { return !mConfig .noMC && mTracking && mClNative && mClNative ->clustersMCTruth && mMCInfos .size (); }
235235uint32_t GPUQA::GetMCLabelCol (const mcLabel_t& label) const { return !label.isValid () ? 0 : (mMCEventOffset [label.getSourceID ()] + label.getEventID ()); }
236236GPUQA::mcLabelI_t GPUQA::GetMCTrackLabel (uint32_t trackId) const { return trackId >= mTrackMCLabels .size () ? MCCompLabel () : mTrackMCLabels [trackId]; }
237+ bool GPUQA::CompareIgnoreFake (const mcLabelI_t& l1, const mcLabelI_t& l2) { return l1.compare (l2) >= 0 ; }
237238#define TRACK_EXPECTED_REFERENCE_X 78
238239#else
239240inline GPUQA::mcLabelI_t::mcLabelI_t (const GPUQA::mcLabel_t& l) : track(l.fMCID ) {}
@@ -263,6 +264,7 @@ inline int32_t GPUQA::AbsLabelID(int32_t id) { return id >= 0 ? id : (-id - 2);
263264inline bool GPUQA::mcPresent () { return !mConfig .noMC && mTracking && GetNMCLabels () && GetNMCTracks (0 ); }
264265uint32_t GPUQA::GetMCLabelCol (const mcLabel_t& label) const { return 0 ; }
265266GPUQA::mcLabelI_t GPUQA::GetMCTrackLabel (uint32_t trackId) const { return trackId >= mTrackMCLabels .size () ? mcLabelI_t () : mTrackMCLabels [trackId]; }
267+ bool GPUQA::CompareIgnoreFake (const mcLabelI_t& l1, const mcLabelI_t& l2) { return AbsLabelID (l1) == AbsLabelID (l2); }
266268#define TRACK_EXPECTED_REFERENCE_X TRACK_EXPECTED_REFERENCE_X_DEFAULT
267269#endif
268270template <class T >
@@ -1660,7 +1662,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16601662
16611663 if (mQATasks & taskTrackStatistics) {
16621664 // Fill track statistic histograms
1663- std::vector<std::array<float , 2 >> clusterAttachCounts;
1665+ std::vector<std::array<float , 3 >> clusterAttachCounts;
16641666 if (mcAvail) {
16651667 clusterAttachCounts.resize (GetNMCLabels (), {0 .f , 0 .f });
16661668 }
@@ -1691,17 +1693,23 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16911693 if (cl.state & GPUTPCGMMergedTrackHit::flagReject) {
16921694 continue ;
16931695 }
1694- bool labelOk = false ;
1695- if (mTrackMCLabels [i].isValid () && !mTrackMCLabels [i].isFake ()) {
1696+ bool labelOk = false , labelOkNonFake = false ;
1697+ const mcLabelI_t& trkLabel = mTrackMCLabels [i];
1698+ if (trkLabel.isValid () && !trkLabel.isNoise ()) {
16961699 for (int32_t l = 0 ; l < GetMCLabelNID (cl.num ); l++) {
1697- if (GetMCLabel (cl.num , l) == mTrackMCLabels [i]) {
1700+ const mcLabelI_t& clLabel = GetMCLabel (cl.num , l);
1701+ if (clLabel.isValid () && !clLabel.isNoise () && CompareIgnoreFake (trkLabel, clLabel)) {
16981702 labelOk = true ;
1703+ if (!trkLabel.isFake ()) {
1704+ labelOkNonFake = true ;
1705+ }
16991706 break ;
17001707 }
17011708 }
17021709 }
1703- clusterAttachCounts[cl.num ][0 ] += (float )labelOk / rowClCount;
1704- clusterAttachCounts[cl.num ][1 ] += 1 .0f ;
1710+ clusterAttachCounts[cl.num ][0 ] += 1 .0f ;
1711+ clusterAttachCounts[cl.num ][1 ] += (float )labelOk / rowClCount;
1712+ clusterAttachCounts[cl.num ][2 ] += (float )labelOkNonFake / rowClCount;
17051713 }
17061714 }
17071715 }
@@ -1721,13 +1729,15 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
17211729 }
17221730 }
17231731 if (mcAvail) {
1724- double clusterAttachNormalizedCount = 0 ;
1732+ double clusterAttachNormalizedCount = 0 , clusterAttachNormalizedCountNonFake = 0 ;
17251733 for (uint32_t i = 0 ; i < clusterAttachCounts.size (); i++) {
1726- if (clusterAttachCounts[i][1 ]) {
1727- clusterAttachNormalizedCount += clusterAttachCounts[i][0 ] / clusterAttachCounts[i][1 ];
1734+ if (clusterAttachCounts[i][0 ]) {
1735+ clusterAttachNormalizedCount += clusterAttachCounts[i][1 ] / clusterAttachCounts[i][0 ];
1736+ clusterAttachNormalizedCountNonFake += clusterAttachCounts[i][2 ] / clusterAttachCounts[i][0 ];
17281737 }
17291738 }
17301739 mClusterCounts .nCorrectlyAttachedNormalized = clusterAttachNormalizedCount;
1740+ mClusterCounts .nCorrectlyAttachedNormalizedNonFake = clusterAttachNormalizedCountNonFake;
17311741 clusterAttachCounts.clear ();
17321742 }
17331743
@@ -2901,7 +2911,8 @@ int32_t GPUQA::DoClusterCounts(uint64_t* attachClusterCounts, int32_t mode)
29012911 PrintClusterCount (mode, num, " Fake Protect (< 40 MeV)" , mClusterCounts .nFakeProtect40 , mClusterCounts .nBelow40 );
29022912 }
29032913 if (mcPresent () && (mQATasks & taskTrackStatistics)) {
2904- PrintClusterCount (mode, num, " Correctly Attached non-fake normalized" , mClusterCounts .nCorrectlyAttachedNormalized , mClusterCounts .nTotal );
2914+ PrintClusterCount (mode, num, " Correctly Attached all-trk normalized" , mClusterCounts .nCorrectlyAttachedNormalized , mClusterCounts .nTotal );
2915+ PrintClusterCount (mode, num, " Correctly Attached non-fake normalized" , mClusterCounts .nCorrectlyAttachedNormalizedNonFake , mClusterCounts .nTotal );
29052916 }
29062917 return num;
29072918}
0 commit comments