Skip to content

Commit 3afa6e9

Browse files
committed
Add output
1 parent 19b171d commit 3afa6e9

2 files changed

Lines changed: 290 additions & 14 deletions

File tree

‎Detectors/Upgrades/ALICE3/GlobalReconstruction/reconstruction/include/ALICE3GlobalReconstruction/TrackerACTS.h‎

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <chrono>
2424
#include <cmath>
2525
#include <iomanip>
26+
#include <memory>
27+
#include <string>
2628
#include <string_view>
2729
#include <Framework/Logger.h>
2830
#include <array>
@@ -32,6 +34,8 @@
3234
#include <ITStracking/TimeFrame.h>
3335
#include <TH2F.h>
3436

37+
class TFile;
38+
class TTree;
3539
namespace Acts
3640
{
3741
class Surface;
@@ -64,6 +68,12 @@ struct TrackerACTSConfig {
6468
// Quality cuts
6569
float maxSeedsPerMiddleSP = 2;
6670
float deltaPhiMax = 0.1f; ///< Maximum phi difference for doublets
71+
// Optional debug output. No ROOT file or histogram is created by default.
72+
bool writeDebugTrees = false; ///< Cluster, seed and ROF summary trees
73+
bool dumpTrackingGeometry = false; ///< Write a JSON volume/surface snapshot on first use
74+
int debugMaxTimeFrames = 1; ///< 1 by default, -1 for all TFs
75+
std::string debugFileName = "TrackerACTS_debug.root";
76+
std::string geometryDumpFileName = "TrackerACTS_geometry.json";
6777
};
6878

6979
/// Space point representation for tracking
@@ -101,14 +111,7 @@ class TrackerACTS
101111
{
102112
public:
103113
TrackerACTS();
104-
~TrackerACTS()
105-
{
106-
if (mHistSpacePoints) {
107-
mHistSpacePoints->SaveAs("/tmp/mHistSpacePoints.C");
108-
delete mHistSpacePoints;
109-
mHistSpacePoints = nullptr;
110-
}
111-
}
114+
~TrackerACTS();
112115

113116
/// Adopt a TimeFrame for processing
114117
void adoptTimeFrame(o2::its::TimeFrame<nLayers>& tf);
@@ -135,7 +138,40 @@ class TrackerACTS
135138
void printSummary() const;
136139

137140
private:
138-
TH2F* mHistSpacePoints = nullptr;
141+
// Debug resources are allocated only if requested and closed at destruction.
142+
std::unique_ptr<TFile> mDebugFile;
143+
TTree* mClusterTree = nullptr; // Owned by mDebugFile
144+
TTree* mSeedTree = nullptr; // Owned by mDebugFile
145+
TTree* mROFTree = nullptr; // Owned by mDebugFile
146+
std::unique_ptr<TH2F> mHistSpacePoints;
147+
bool mGeometryDumped = false;
148+
149+
struct DebugClusterRecord {
150+
int tf = 0, rof = 0, layer = 0, clusterId = -1;
151+
int externalId = -1, sensorId = -1, mappingStatus = 0;
152+
unsigned long long geometryId = 0;
153+
float x = 0.f, y = 0.f, z = 0.f;
154+
float r = 0.f, phi = 0.f;
155+
float varianceR = 0.f, varianceZ = 0.f;
156+
} mDebugCluster;
157+
158+
struct DebugSeedRecord {
159+
int tf = 0, rof = 0, seedId = 0;
160+
float quality = 0.f;
161+
int layer[3] = {}, clusterId[3] = {}, sensorId[3] = {};
162+
unsigned long long geometryId[3] = {};
163+
float x[3] = {}, y[3] = {}, z[3] = {}, r[3] = {}, phi[3] = {};
164+
} mDebugSeed;
165+
166+
struct DebugROFRecord {
167+
int tf = 0, rof = 0, nSpacePoints = 0, nSeeds = 0;
168+
int nAcceptedTracks = 0;
169+
} mDebugROF;
170+
171+
void initDebugOutput();
172+
void dumpGeometryOnce();
173+
bool isDebugTimeFrame() const;
174+
void fillDebugSeeds(int rof);
139175

140176
/// Build space points from clusters in the TimeFrame
141177
void buildSpacePoints(int rof);

0 commit comments

Comments
 (0)