|
19 | 19 | #include <cstring> |
20 | 20 | #include <map> |
21 | 21 | #include <queue> |
| 22 | +#include <fstream> |
22 | 23 |
|
23 | 24 | using namespace o2::gpu; |
24 | 25 |
|
@@ -106,7 +107,7 @@ void GenerateCodes(const INode* node, const HuffCode& prefix, HuffCodeMap& outCo |
106 | 107 | } // anonymous namespace |
107 | 108 | } // namespace o2::gpu |
108 | 109 |
|
109 | | -void GPUTPCClusterStatistics::RunStatistics(const o2::tpc::ClusterNativeAccess* clustersNative, const o2::tpc::CompressedClusters* clustersCompressed, const GPUParam& param) |
| 110 | +void GPUTPCClusterStatistics::RunStatistics(const o2::tpc::ClusterNativeAccess* clustersNative, const o2::tpc::CompressedClusters* clustersCompressed, const GPUParam& param, bool dumpCSV) |
110 | 111 | { |
111 | 112 | uint32_t decodingErrors = 0; |
112 | 113 | o2::tpc::ClusterNativeAccess clustersNativeDecoded; |
@@ -185,6 +186,49 @@ void GPUTPCClusterStatistics::RunStatistics(const o2::tpc::ClusterNativeAccess* |
185 | 186 | FillStatisticCombined(mPQU, clustersCompressed->qMaxU, clustersCompressed->qTotU, clustersCompressed->nUnattachedClusters, P_MAX_QMAX); |
186 | 187 | FillStatisticCombined(mProwSectorA, clustersCompressed->rowDiffA, clustersCompressed->sliceLegDiffA, clustersCompressed->nAttachedClustersReduced, GPUTPCGeometry::NROWS); |
187 | 188 | mNTotalClusters += clustersCompressed->nAttachedClusters + clustersCompressed->nUnattachedClusters; |
| 189 | + |
| 190 | + if (dumpCSV) { |
| 191 | + std::ofstream csv("clusters_raw.csv"); |
| 192 | + csv << "sector,row,time,pad,flags,qtot,qmax,sigmatime,sigmapad\n"; |
| 193 | + for (uint32_t i = 0; i < NSECTORS; i++) { |
| 194 | + for (uint32_t j = 0; j < GPUTPCGeometry::NROWS; j++) { |
| 195 | + for (uint32_t k = 0; k < clustersNativeDecoded.nClusters[i][j]; k++) { |
| 196 | + const auto& cl = clustersNativeDecoded.clusters[i][j][k]; |
| 197 | + csv << i << ',' << j << ',' << cl.getTimePacked() << ',' << cl.padPacked << ',' << (uint32_t)cl.getFlags() << ',' << cl.qTot << ',' << cl.qMax << ',' << (uint32_t)cl.sigmaTimePacked << ',' << (uint32_t)cl.sigmaPadPacked << '\n'; |
| 198 | + } |
| 199 | + } |
| 200 | + } |
| 201 | + |
| 202 | + csv = std::ofstream("attachedCl.csv"); |
| 203 | + csv << "qTotA,qMaxA,flagsA,sigmaPadA,sigmaTimeA\n"; |
| 204 | + for (uint32_t i = 0; i < clustersCompressed->nAttachedClusters; i++) { |
| 205 | + csv << clustersCompressed->qTotA[i] << ',' << clustersCompressed->qMaxA[i] << ',' << (uint32_t)clustersCompressed->flagsA[i] << ',' << (uint32_t)clustersCompressed->sigmaPadA[i] << ',' << (uint32_t)clustersCompressed->sigmaTimeA[i] << "\n"; |
| 206 | + } |
| 207 | + |
| 208 | + csv = std::ofstream("attachedClred.csv"); |
| 209 | + csv << "rodDiffA,legDiffA,padResA,timeResA\n"; |
| 210 | + for (uint32_t i = 0; i < clustersCompressed->nAttachedClustersReduced; i++) { |
| 211 | + csv << (uint32_t)clustersCompressed->rowDiffA[i] << ',' << (uint32_t)clustersCompressed->sliceLegDiffA[i] << ',' << clustersCompressed->padResA[i] << ',' << clustersCompressed->timeResA[i] << "\n"; |
| 212 | + } |
| 213 | + |
| 214 | + csv = std::ofstream("nClU.csv"); |
| 215 | + csv << "sliceRowCl\n"; |
| 216 | + for (uint32_t i = 0; i < clustersCompressed->nSliceRows; i++) { |
| 217 | + csv << clustersCompressed->nSliceRowClusters[i] << "\n"; |
| 218 | + } |
| 219 | + |
| 220 | + csv = std::ofstream("trk.csv"); |
| 221 | + csv << "qPtA,rowA,sliceA,timeA,padA,nCl\n"; |
| 222 | + for (uint32_t i = 0; i < clustersCompressed->nTracks; i++) { |
| 223 | + csv << (uint32_t)clustersCompressed->qPtA[i] << ',' << (uint32_t)clustersCompressed->rowA[i] << ',' << (uint32_t)clustersCompressed->sliceA[i] << ',' << clustersCompressed->timeA[i] << ',' << clustersCompressed->padA[i] << ',' << clustersCompressed->nTrackClusters[i] << "\n"; |
| 224 | + } |
| 225 | + |
| 226 | + csv = std::ofstream("unattachedCl.csv"); |
| 227 | + csv << "qTotU,qMaxU,flagsU,padDiffU,timeDiffU,sigmaPadU,sigmaTimeU\n"; |
| 228 | + for (uint32_t i = 0; i < clustersCompressed->nUnattachedClusters; i++) { |
| 229 | + csv << clustersCompressed->qTotU[i] << ',' << clustersCompressed->qMaxU[i] << ',' << (uint32_t)clustersCompressed->flagsU[i] << ',' << clustersCompressed->padDiffU[i] << ',' << clustersCompressed->timeDiffU[i] << ',' << (uint32_t)clustersCompressed->sigmaPadU[i] << ',' << (uint32_t)clustersCompressed->sigmaTimeU[i] << "\n"; |
| 230 | + } |
| 231 | + } |
188 | 232 | } |
189 | 233 |
|
190 | 234 | void GPUTPCClusterStatistics::Finish() |
|
0 commit comments