@@ -100,11 +100,11 @@ inline checkClusterStateResult GPUQA::checkClusterState(uint32_t attach, T* coun
100100{
101101 checkClusterStateResult r;
102102 r.unattached = attach == 0 ;
103- r.id = attach & gputpcgmmergertypes::attachTrackMask ;
103+ r.id = gputpcgmmergertypes::getAttachedTrackId (attach) ;
104104 if (!r.unattached && !(attach & gputpcgmmergertypes::attachProtect)) {
105105 r.qpt = fabsf (mTracking ->mIOPtrs .mergedTracks [r.id ].GetParam ().GetQPt ());
106106 r.lowPt = r.qpt * mTracking ->GetParam ().qptB5Scaler > mTracking ->GetParam ().rec .tpc .rejectQPtB5 ;
107- r.mev200 = r.qpt > 5 ;
107+ r.mev200 = r.qpt * mTracking -> GetParam (). qptB5Scaler > 5 ;
108108 r.mergedLooperUnconnected = mTracking ->mIOPtrs .mergedTracks [r.id ].MergedLooperUnconnected ();
109109 r.mergedLooperConnected = mTracking ->mIOPtrs .mergedTracks [r.id ].MergedLooperConnected ();
110110 }
@@ -172,9 +172,9 @@ static const constexpr char* AXIS_TITLES[5] = {"#it{y}-#it{y}_{mc} (mm) (Resolut
172172static const constexpr char * AXIS_TITLES_NATIVE [5 ] = {" #it{y}-#it{y}_{mc} (mm) (Resolution)" , " #it{z}-#it{z}_{mc} (mm) (Resolution)" , " sin(#phi)-sin(#phi_{mc}) (Resolution)" , " tan(#lambda)-tan(#lambda_{mc}) (Resolution)" , " q*(q/#it{p}_{T} - q/#it{p}_{Tmc}) (Resolution)" };
173173static const constexpr char * AXIS_TITLES_PULL [5 ] = {" #it{y}-#it{y}_{mc}/#sigma_{y} (Pull)" , " #it{z}-#it{z}_{mc}/#sigma_{z} (Pull)" , " sin(#phi)-sin(#phi_{mc})/#sigma_{sin(#phi)} (Pull)" , " tan(#lambda)-tan(#lambda_{mc})/#sigma_{tan(#lambda)} (Pull)" ,
174174 " q*(q/#it{p}_{T} - q/#it{p}_{Tmc})/#sigma_{q/#it{p}_{T}} (Pull)" };
175- static const constexpr char * CLUSTER_NAMES [GPUQA ::N_CLS_HIST ] = {" Correctly attached clusters" , " Fake attached clusters" , " Attached + adjacent clusters" , " Fake adjacent clusters" , " Clusters of reconstructed tracks" , " Used in Physics" , " Protected" , " All clusters" };
175+ static const constexpr char * CLUSTER_NAMES [GPUQA ::N_CLS_HIST ] = {" Correctly attached clusters" , " Fake attached clusters" , " Attached + adjacent clusters" , " Fake adjacent clusters" , " Adjacent clusters (not rejected) " , " Fake adjacent clusters (not rejected) " , " All MC clusters of reconstructed tracks" , " Clusters used in Physics" , " Protected clusters " , " All clusters" };
176176static const constexpr char * CLUSTER_TITLES [GPUQA ::N_CLS_TYPE ] = {" Clusters Pt Distribution / Attachment" , " Clusters Pt Distribution / Attachment (relative to all clusters)" , " Clusters Pt Distribution / Attachment (integrated)" };
177- static const constexpr char * CLUSTER_NAMES_SHORT [GPUQA ::N_CLS_HIST ] = {" Attached" , " Fake" , " AttachAdjacent" , " FakeAdjacent" , " FoundTracks" , " Physics" , " Protected" , " All" };
177+ static const constexpr char * CLUSTER_NAMES_SHORT [GPUQA ::N_CLS_HIST ] = {" Attached" , " Fake" , " AttachAdjacent" , " FakeAdjacent" , " AdjacentNoRej " , " FakeAdjacentNoRej " , " FoundTracks" , " Physics" , " Protected" , " All" };
178178static const constexpr char * CLUSTER_TYPES [GPUQA ::N_CLS_TYPE ] = {" " , " Ratio" , " Integral" };
179179static const constexpr char * REJECTED_NAMES [3 ] = {" All" , " Rejected" , " Fraction" };
180180static const constexpr int32_t COLORS_HEX [COLORCOUNT ] = {0xB03030 , 0x00A000 , 0x0000C0 , 0x9400D3 , 0x19BBBF , 0xF25900 , 0x7F7F7F , 0xFFD700 , 0x07F707 , 0x07F7F7 , 0xF08080 , 0x000000 };
@@ -1021,19 +1021,26 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
10211021 }
10221022 if (!mTrackMCLabels [i].isValid ()) {
10231023 for (uint32_t k = 0 ; k < track->NClusters (); k++) {
1024+ int32_t hitId = mTracking ->mIOPtrs .mergedTrackHits [track->FirstClusterRef () + k].num ;
10241025 if (mTracking ->mIOPtrs .mergedTrackHits [track->FirstClusterRef () + k].state & GPUTPCGMMergedTrackHit::flagReject) {
1026+ if (mTracking ->mIOPtrs .mergedTrackHitAttachment && gputpcgmmergertypes::getAttachedTrackId (mTracking ->mIOPtrs .mergedTrackHitAttachment [hitId]) == i) {
1027+ mClusterParam [hitId].rejected = 1 ; // Not attached, but will count as adjacent to this track
1028+ }
10251029 continue ;
10261030 }
1027- mClusterParam [mTracking -> mIOPtrs . mergedTrackHits [track-> FirstClusterRef () + k]. num ].fakeAttached ++;
1031+ mClusterParam [hitId ].fakeAttached ++;
10281032 }
10291033 continue ;
10301034 }
10311035 if (mMCTrackMin == -1 || (label.getTrackID () >= mMCTrackMin && label.getTrackID () < mMCTrackMax )) {
10321036 for (uint32_t k = 0 ; k < track->NClusters (); k++) {
1037+ int32_t hitId = mTracking ->mIOPtrs .mergedTrackHits [track->FirstClusterRef () + k].num ;
10331038 if (mTracking ->mIOPtrs .mergedTrackHits [track->FirstClusterRef () + k].state & GPUTPCGMMergedTrackHit::flagReject) {
1039+ if (mTracking ->mIOPtrs .mergedTrackHitAttachment && gputpcgmmergertypes::getAttachedTrackId (mTracking ->mIOPtrs .mergedTrackHitAttachment [hitId]) == i) {
1040+ mClusterParam [hitId].rejected = 1 ; // Not attached, but will count as adjacent to this track
1041+ }
10341042 continue ;
10351043 }
1036- int32_t hitId = mTracking ->mIOPtrs .mergedTrackHits [track->FirstClusterRef () + k].num ;
10371044 bool correct = false ;
10381045 for (int32_t j = 0 ; j < GetMCLabelNID (hitId); j++) {
10391046 if (label == GetMCLabel (hitId, j)) {
@@ -1087,7 +1094,10 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
10871094 if (mClusterParam [i].attached == 0 && mClusterParam [i].fakeAttached == 0 ) {
10881095 int32_t attach = mTracking ->mIOPtrs .mergedTrackHitAttachment [i];
10891096 if (attach & gputpcgmmergertypes::attachFlagMask) {
1090- int32_t track = attach & gputpcgmmergertypes::attachTrackMask;
1097+ if ((attach & gputpcgmmergertypes::attachProtect) && !(attach & gputpcgmmergertypes::attachGoodLeg)) {
1098+ mClusterParam [i].rejected = 1 ; // Protection entry for a cluster of an initial track that no final track took over: it has no track id, so the track below is arbitrary
1099+ }
1100+ int32_t track = gputpcgmmergertypes::getAttachedTrackId (attach);
10911101 mcLabelI_t trackL = mTrackMCLabels [track];
10921102 bool fake = true ;
10931103 for (int32_t j = 0 ; j < GetMCLabelNID (i); j++) {
@@ -1544,7 +1554,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
15441554 if (!track.OK ()) {
15451555 continue ;
15461556 }
1547- if (!mTrackMCLabels [iTrk].isValid ()) {
1557+ if (!mTrackMCLabels [iTrk].isValid ()) { // Track is pure noise / bogus MC label
15481558 for (uint32_t k = 0 ; k < track.NClusters (); k++) {
15491559 if (mTracking ->mIOPtrs .mergedTrackHits [track.FirstClusterRef () + k].state & GPUTPCGMMergedTrackHit::flagReject) {
15501560 continue ;
@@ -1601,7 +1611,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16011611 if (mMCTrackMin != -1 && (label.getTrackID () < mMCTrackMin || label.getTrackID () >= mMCTrackMax )) {
16021612 continue ;
16031613 }
1604- for (uint32_t k = 0 ; k < track.NClusters (); k++) {
1614+ for (uint32_t k = 0 ; k < track.NClusters (); k++) { // Clusters of reconstructed tracks
16051615 if (mTracking ->mIOPtrs .mergedTrackHits [track.FirstClusterRef () + k].state & GPUTPCGMMergedTrackHit::flagReject) {
16061616 continue ;
16071617 }
@@ -1623,6 +1633,18 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16231633 mClusters [CL_tracks]->Fill (pt, weight);
16241634 } else {
16251635 mClusters [CL_fake]->Fill (pt, weight);
1636+ float totalWeight = 0 .f ; // The cluster belongs to other particles, count it for those that were reconstructed
1637+ for (int32_t j = 0 ; j < GetMCLabelNID (hitId); j++) {
1638+ if (!GetMCLabel (hitId, j).isFake () && GetMCTrackObj (mMCParam , GetMCLabel (hitId, j)).pt > 1 .f / mTracking ->GetParam ().rec .maxTrackQPtB5 ) {
1639+ totalWeight += GetMCLabelWeight (hitId, j);
1640+ }
1641+ }
1642+ for (int32_t j = 0 ; j < GetMCLabelNID (hitId) && totalWeight > 0 .f ; j++) {
1643+ const mcLabelI_t labelCl = GetMCLabel (hitId, j);
1644+ if (!labelCl.isFake () && GetMCTrackObj (mMCParam , labelCl).pt > 1 .f / mTracking ->GetParam ().rec .maxTrackQPtB5 && GetMCTrackObj (mRecTracks , labelCl)) {
1645+ mClusters [CL_tracks]->Fill (CAMath::Max (GetMCTrackObj (mMCParam , labelCl).pt , PT_MIN_CLUST ), GetMCLabelWeight (hitId, j) * weight / totalWeight);
1646+ }
1647+ }
16261648 }
16271649 mClusters [CL_att_adj]->Fill (pt, weight);
16281650 mClusters [CL_all]->Fill (pt, weight);
@@ -1636,7 +1658,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16361658 }
16371659 }
16381660 }
1639- for (uint32_t i = 0 ; i < GetNMCLabels (); i++) {
1661+ for (uint32_t i = 0 ; i < GetNMCLabels (); i++) { // Loop over all clusters
16401662 if ((mMCTrackMin != -1 && GetMCLabelID (i, 0 ) < mMCTrackMin ) || (mMCTrackMax != -1 && GetMCLabelID (i, 0 ) >= mMCTrackMax )) {
16411663 continue ;
16421664 }
@@ -1645,9 +1667,9 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16451667 }
16461668 int32_t attach = mTracking ->mIOPtrs .mergedTrackHitAttachment [i];
16471669 const auto & r = checkClusterState<false >(attach);
1648- if (mClusterParam [i].adjacent ) {
1649- int32_t label = mTracking ->mIOPtrs .mergedTrackHitAttachment [i] & gputpcgmmergertypes::attachTrackMask ;
1650- if (!mTrackMCLabels [label].isValid ()) {
1670+ if (mClusterParam [i].adjacent ) { // Cluster is adjacent
1671+ int32_t label = gputpcgmmergertypes::getAttachedTrackId ( mTracking ->mIOPtrs .mergedTrackHitAttachment [i]) ;
1672+ if (!mTrackMCLabels [label].isValid ()) { // Track is pure noise / has bogus MC label
16511673 float totalWeight = 0 .;
16521674 for (int32_t j = 0 ; j < GetMCLabelNID (i); j++) {
16531675 mcLabelI_t labelT = GetMCLabel (i, j);
@@ -1669,6 +1691,10 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16691691 }
16701692 mClusters [CL_att_adj]->Fill (pt, GetMCLabelWeight (i, j) * weight);
16711693 mClusters [CL_fakeAdj]->Fill (pt, GetMCLabelWeight (i, j) * weight);
1694+ if (!mClusterParam [i].rejected ) {
1695+ mClusters [CL_adjNoRej]->Fill (pt, GetMCLabelWeight (i, j) * weight);
1696+ mClusters [CL_fakeAdjNoReject]->Fill (pt, GetMCLabelWeight (i, j) * weight);
1697+ }
16721698 mClusters [CL_all]->Fill (pt, GetMCLabelWeight (i, j) * weight);
16731699 if (r.protect || r.physics ) {
16741700 mClusters [CL_prot]->Fill (pt, GetMCLabelWeight (i, j) * weight);
@@ -1681,6 +1707,10 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16811707 } else {
16821708 mClusters [CL_att_adj]->Fill (0 .f , 1 .f );
16831709 mClusters [CL_fakeAdj]->Fill (0 .f , 1 .f );
1710+ if (!mClusterParam [i].rejected ) {
1711+ mClusters [CL_adjNoRej]->Fill (0 .f , 1 .f );
1712+ mClusters [CL_fakeAdjNoReject]->Fill (0 .f , 1 .f );
1713+ }
16841714 mClusters [CL_all]->Fill (0 .f , 1 .f );
16851715 mClusterCounts .nUnaccessible ++;
16861716 if (r.protect || r.physics ) {
@@ -1697,6 +1727,9 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
16971727 }
16981728 mClusters [CL_att_adj]->Fill (pt, 1 .f );
16991729 mClusters [CL_tracks]->Fill (pt, 1 .f );
1730+ if (!mClusterParam [i].rejected ) {
1731+ mClusters [CL_adjNoRej]->Fill (pt, 1 .f );
1732+ }
17001733 mClusters [CL_all]->Fill (pt, 1 .f );
17011734 if (r.protect || r.physics ) {
17021735 mClusters [CL_prot]->Fill (pt, 1 .f );
@@ -1705,7 +1738,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
17051738 mClusters [CL_physics]->Fill (pt, 1 .f );
17061739 }
17071740 }
1708- } else {
1741+ } else { // Cluster is not adjacent
17091742 float totalWeight = 0 .;
17101743 for (int32_t j = 0 ; j < GetMCLabelNID (i); j++) {
17111744 mcLabelI_t labelT = GetMCLabel (i, j);
@@ -1724,6 +1757,10 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
17241757 float weight = GetMCLabelWeight (i, j) / totalWeight;
17251758 if (mClusterParam [i].fakeAdjacent ) {
17261759 mClusters [CL_fakeAdj]->Fill (pt, weight);
1760+ if (!mClusterParam [i].rejected ) {
1761+ mClusters [CL_adjNoRej]->Fill (pt, weight);
1762+ mClusters [CL_fakeAdjNoReject]->Fill (pt, weight);
1763+ }
17271764 }
17281765 if (mClusterParam [i].fakeAdjacent ) {
17291766 mClusters [CL_att_adj]->Fill (pt, weight);
@@ -1743,6 +1780,10 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
17431780 } else {
17441781 if (mClusterParam [i].fakeAdjacent ) {
17451782 mClusters [CL_fakeAdj]->Fill (0 .f , 1 .f );
1783+ if (!mClusterParam [i].rejected ) {
1784+ mClusters [CL_adjNoRej]->Fill (0 .f , 1 .f );
1785+ mClusters [CL_fakeAdjNoReject]->Fill (0 .f , 1 .f );
1786+ }
17461787 }
17471788 if (mClusterParam [i].fakeAdjacent ) {
17481789 mClusters [CL_att_adj]->Fill (0 .f , 1 .f );
@@ -1791,7 +1832,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
17911832 uint32_t jNext = 0 ;
17921833 for (uint32_t j = 0 ; j < track.NClusters (); j = jNext) {
17931834 uint32_t rowClCount = !(trackClusters[track.FirstClusterRef () + j].state & GPUTPCGMMergedTrackHit::flagReject);
1794- for (jNext = j + 1 ; j < track.NClusters (); jNext++) {
1835+ for (jNext = j + 1 ; jNext < track.NClusters (); jNext++) {
17951836 if (trackClusters[track.FirstClusterRef () + j].sector != trackClusters[track.FirstClusterRef () + jNext].sector || trackClusters[track.FirstClusterRef () + j].row != trackClusters[track.FirstClusterRef () + jNext].row ) {
17961837 break ;
17971838 }
@@ -1898,7 +1939,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
18981939 if (totalWeight > 0 && 10 .f * weight400 >= totalWeight) {
18991940 if (!r.unattached && !r.protect && !r.physics ) {
19001941 mClusterCounts .nFakeRemove400 ++;
1901- int32_t totalFake = weight400 < 0 .9f * totalWeight;
1942+ int32_t totalFake = weight400 >= 0 .9f * totalWeight;
19021943 if (totalFake) {
19031944 mClusterCounts .nFullFakeRemove400 ++;
19041945 }
@@ -1971,7 +2012,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
19712012 uint32_t attach = mTracking ->mIOPtrs .mergedTrackHitAttachment [clid];
19722013 float x = 0 , y = 0 , z = 0 ;
19732014 if (attach & gputpcgmmergertypes::attachFlagMask) {
1974- uint32_t track = attach & gputpcgmmergertypes::attachTrackMask ;
2015+ uint32_t track = gputpcgmmergertypes::getAttachedTrackId (attach) ;
19752016 const auto & trk = mTracking ->mIOPtrs .mergedTracks [track];
19762017 mTracking ->GetTPCTransform ()->Transform (i, j, cl.getPad (), cl.getTime (), x, y, z, trk.GetParam ().GetTOffset ());
19772018 mTracking ->GetParam ().Sector2Global (i, x, y, z, &x, &y, &z);
@@ -1984,7 +2025,7 @@ void GPUQA::RunQA(bool matchOnly, const std::vector<o2::tpc::TrackTPC>* tracksEx
19842025 memset ((void *)&trk, 0 , sizeof (trk));
19852026 memset ((void *)&trkHit, 0 , sizeof (trkHit));
19862027 if (attach & gputpcgmmergertypes::attachFlagMask) {
1987- uint32_t track = attach & gputpcgmmergertypes::attachTrackMask ;
2028+ uint32_t track = gputpcgmmergertypes::getAttachedTrackId (attach) ;
19882029 trk = mTracking ->mIOPtrs .mergedTracks [track];
19892030 for (uint32_t l = 0 ; l < trk.NClusters (); l++) {
19902031 const auto & tmp = mTracking ->mIOPtrs .mergedTrackHits [trk.FirstClusterRef () + l];
@@ -3310,8 +3351,8 @@ int32_t GPUQA::DoClusterCounts(uint64_t* attachClusterCounts, int32_t mode)
33103351 PrintClusterCount (mode, num, " Fake Protect (< 40 MeV)" , mClusterCounts .nFakeProtect40 , mClusterCounts .nBelow40 );
33113352 }
33123353 if (mcPresent () && (mQATasks & taskTrackStatistics)) {
3313- PrintClusterCount (mode, num, " Correctly Attached all-trk normalized" , mClusterCounts .nCorrectlyAttachedNormalized , mClusterCounts .nTotal );
3314- PrintClusterCount (mode, num, " Correctly Attached non-fake normalized" , mClusterCounts .nCorrectlyAttachedNormalizedNonFake , mClusterCounts .nTotal );
3354+ PrintClusterCount (mode, num, " Correctly Attached all-trk row- normalized" , mClusterCounts .nCorrectlyAttachedNormalized , mClusterCounts .nTotal );
3355+ PrintClusterCount (mode, num, " Correctly Attached non-fake row- normalized" , mClusterCounts .nCorrectlyAttachedNormalizedNonFake , mClusterCounts .nTotal );
33153356 }
33163357 if (mTextDump ) {
33173358 fclose (mTextDump );
0 commit comments