Skip to content

Commit 4801674

Browse files
committed
GPU: Improve existing debug dumps
1 parent 354b12e commit 4801674

File tree

2 files changed

+40
-36
lines changed

2 files changed

+40
-36
lines changed

GPU/GPUTracking/Merger/GPUTPCGMMerger.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ class GPUTPCGMMerger : public GPUProcessor
199199
void DumpRefit(std::ostream& out) const;
200200
void DumpFinal(std::ostream& out) const;
201201
void DumpLoopers(std::ostream& out) const;
202+
void DumpTrackParam(std::ostream& out) const;
203+
void DumpTrackClusters(std::ostream& out, bool non0StateOnly = false, bool noNDF0 = false) const;
202204

203205
template <int32_t mergeType>
204206
void MergedTrackStreamerInternal(const GPUTPCGMBorderTrack& b1, const GPUTPCGMBorderTrack& b2, const char* name, int32_t sector1, int32_t sector2, int32_t mergeMode, float weight, float frac) const;

GPU/GPUTracking/Merger/GPUTPCGMMergerDump.cxx

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ using namespace gputpcgmmergertypes;
4343
void GPUTPCGMMerger::DumpSectorTracks(std::ostream& out) const
4444
{
4545
std::streamsize ss = out.precision();
46-
out << std::setprecision(2);
46+
out << std::setprecision(10);
4747
out << "\nTPC Merger Sector Tracks\n";
4848
for (int32_t iSector = 0; iSector < NSECTORS; iSector++) {
49-
out << "Sector Track Info Index " << (mSectorTrackInfoIndex[iSector + 1] - mSectorTrackInfoIndex[iSector]) << " / " << (mSectorTrackInfoIndex[NSECTORS + iSector + 1] - mSectorTrackInfoIndex[NSECTORS + iSector]) << "\n";
49+
out << "Sector Track Info Sector " << iSector << " Index " << (mSectorTrackInfoIndex[iSector + 1] - mSectorTrackInfoIndex[iSector]) << " / " << (mSectorTrackInfoIndex[NSECTORS + iSector + 1] - mSectorTrackInfoIndex[NSECTORS + iSector]) << "\n";
5050
for (int32_t iGlobal = 0; iGlobal < 2; iGlobal++) {
5151
out << " Track type " << iGlobal << "\n";
5252
for (int32_t j = mSectorTrackInfoIndex[iSector + NSECTORS * iGlobal]; j < mSectorTrackInfoIndex[iSector + NSECTORS * iGlobal + 1]; j++) {
@@ -134,9 +134,14 @@ void GPUTPCGMMerger::DumpMergedBetweenSectors(std::ostream& out) const
134134

135135
void GPUTPCGMMerger::DumpCollected(std::ostream& out) const
136136
{
137-
std::streamsize ss = out.precision();
138-
out << std::setprecision(6);
139137
out << "\nTPC Merger Collected Tracks\n";
138+
DumpTrackParam(out);
139+
}
140+
141+
void GPUTPCGMMerger::DumpTrackParam(std::ostream& out) const
142+
{
143+
std::streamsize ss = out.precision();
144+
out << std::setprecision(10);
140145
for (uint32_t i = 0; i < mMemory->nMergedTracks; i++) {
141146
const auto& trk = mMergedTracks[i];
142147
const auto& p = trk.GetParam();
@@ -157,33 +162,42 @@ void GPUTPCGMMerger::DumpMergeCE(std::ostream& out) const
157162
}
158163
}
159164

160-
void GPUTPCGMMerger::DumpFitPrepare(std::ostream& out) const
165+
void GPUTPCGMMerger::DumpTrackClusters(std::ostream& out, bool non0StateOnly, bool noNDF0) const
161166
{
162-
out << "\nTPC Merger Refit Prepare\n";
163-
out << " Sort\n";
164-
for (uint32_t i = 0; i < mMemory->nMergedTracks; i++) {
165-
out << " " << i << ": " << mTrackOrderAttach[i] << "\n";
166-
}
167-
out << " Clusters\n";
168167
for (uint32_t j = 0; j < mMemory->nMergedTracks; j++) {
169168
const auto& trk = mMergedTracks[j];
170-
out << " Track " << j << ": ";
169+
if (trk.NClusters() == 0) {
170+
continue;
171+
}
172+
if (noNDF0 && (!trk.OK() || trk.GetParam().GetNDF() < 0)) {
173+
continue;
174+
}
175+
out << " Track " << j << ": (" << trk.NClusters() << "): ";
171176
for (uint32_t i = trk.FirstClusterRef(); i < trk.FirstClusterRef() + trk.NClusters(); i++) {
172-
out << j << "/" << (i - trk.FirstClusterRef()) << ": " << mClusters[i].num << "/" << (int32_t)mClusters[i].state << ", ";
177+
if (!non0StateOnly || mClusters[i].state != 0) {
178+
out << j << "/" << (i - trk.FirstClusterRef()) << ": " << (int32_t)mClusters[i].row << "/" << mClusters[i].num << "/" << (int32_t)mClusters[i].state << ", ";
179+
}
173180
}
174181
out << "\n";
175182
}
176-
uint32_t maxId = mNMaxClusters;
183+
}
184+
185+
void GPUTPCGMMerger::DumpFitPrepare(std::ostream& out) const
186+
{
187+
out << "\nTPC Merger Refit Prepare\n";
188+
out << " Sort\n";
189+
for (uint32_t i = 0; i < mMemory->nMergedTracks; i++) {
190+
out << " " << i << ": " << mTrackOrderAttach[i] << "\n";
191+
}
192+
out << " Track Clusters";
193+
DumpTrackClusters(out);
177194
uint32_t j = 0;
178-
for (uint32_t i = 0; i < maxId; i++) {
195+
for (uint32_t i = 0; i < mNMaxClusters; i++) {
179196
if ((mClusterAttachment[i] & attachFlagMask) != 0) {
180-
if (++j % 10 == 0) {
181-
out << " Cluster attachment ";
197+
if (j++ % 10 == 0) {
198+
out << "\n Cluster attachment ";
182199
}
183200
out << i << ": " << (mClusterAttachment[i] & attachTrackMask) << " / " << (mClusterAttachment[i] & attachFlagMask) << " - ";
184-
if (j % 10 == 0) {
185-
out << "\n";
186-
}
187201
}
188202
}
189203
out << "\n";
@@ -192,7 +206,7 @@ void GPUTPCGMMerger::DumpFitPrepare(std::ostream& out) const
192206
void GPUTPCGMMerger::DumpRefit(std::ostream& out) const
193207
{
194208
std::streamsize ss = out.precision();
195-
out << std::setprecision(2);
209+
out << std::setprecision(10);
196210
out << "\nTPC Merger Refit\n";
197211
for (uint32_t i = 0; i < mMemory->nMergedTracks; i++) {
198212
const auto& trk = mMergedTracks[i];
@@ -224,22 +238,10 @@ void GPUTPCGMMerger::DumpLoopers(std::ostream& out) const
224238
void GPUTPCGMMerger::DumpFinal(std::ostream& out) const
225239
{
226240
out << "\nTPC Merger Finalized\n";
227-
for (uint32_t j = 0; j < mMemory->nMergedTracks; j++) {
228-
const auto& trk = mMergedTracks[j];
229-
if (trk.NClusters() == 0) {
230-
continue;
231-
}
232-
out << " Track " << j << ": ";
233-
for (uint32_t i = trk.FirstClusterRef(); i < trk.FirstClusterRef() + trk.NClusters(); i++) {
234-
if (mClusters[i].state != 0) {
235-
out << j << "/" << (i - trk.FirstClusterRef()) << ": " << mClusters[i].num << "/" << (int32_t)mClusters[i].state << ", ";
236-
}
237-
}
238-
out << "\n";
239-
}
240-
uint32_t maxId = mNMaxClusters;
241+
out << "Track Clusters\n";
242+
DumpTrackClusters(out, true);
241243
uint32_t j = 0;
242-
for (uint32_t i = 0; i < maxId; i++) {
244+
for (uint32_t i = 0; i < mNMaxClusters; i++) {
243245
if ((mClusterAttachment[i] & attachFlagMask) != 0) {
244246
if (++j % 10 == 0) {
245247
out << " Cluster attachment ";

0 commit comments

Comments
 (0)