1#ifndef CHETVISUALIZER_HH
2#define CHETVISUALIZER_HH
20#include <TMultiGraph.h>
22#include <TPolyLine3D.h>
23#include <TPolyMarker3D.h>
57 VisPoint2D(
double _x,
double _y,
int _col = kBlue,
int _mst = 1,
double _sz = 1.0)
80 VisPoint3D(
double _x,
double _y,
double _z,
int _col = kRed,
int _mst = 20,
double _sz = 1.0,
81 bool _isLocal =
false)
107 std::vector<VisPoint3D> _pts,
int _c = 1,
int _w = 2,
int _s = 1,
bool _loc =
false)
135 VisLineTrack(
double _x,
double _y,
double _z,
double _dx,
double _dy,
double _dz,
int _col = 54,
136 int _w = 2,
int _s = 1,
bool _isLocal =
false)
145 double norm = std::sqrt(_dx * _dx + _dy * _dy + _dz * _dz);
179 VisHelixTrack(
double _cx,
double _cy,
double _r,
double _z0,
double _dz,
double _tmin,
180 double _tmax,
int _c = 1,
int _w = 2,
int _s = 1,
bool _loc =
false)
198void Draw2DCore(
const std::vector<int> &bundle_ids,
const std::vector<VisPoint2D> &extraPoints,
199 const std::function<
void(TMultiGraph *, TMultiGraph *, TMultiGraph *, TMultiGraph *)>
201 bool wrap_phi =
true);
203void Draw3DCore(
const std::vector<int> &hit_ids,
const std::vector<VisPoint3D> &points,
204 bool drawSkeleton,
const std::function<
void(
double[6])> &trackDrawer);
207void RenderTrack2D(
const VisLineTrack &tr, TMultiGraph *mg_xy);
208void RenderTrack2D(
const VisHelixTrack &tr, TMultiGraph *mg_xy);
209void RenderTrack2D(
const VisGenericTrack &tr, TMultiGraph *mg_xy);
211void RenderTrackZX(
const VisLineTrack &tr, TMultiGraph *mg_zx);
212void RenderTrackZX(
const VisHelixTrack &tr, TMultiGraph *mg_zx);
213void RenderTrackZX(
const VisGenericTrack &tr, TMultiGraph *mg_zx);
215void RenderTrackZY(
const VisLineTrack &tr, TMultiGraph *mg_zy);
216void RenderTrackZY(
const VisHelixTrack &tr, TMultiGraph *mg_zy);
217void RenderTrackZY(
const VisGenericTrack &tr, TMultiGraph *mg_zy);
219void RenderTrackPhiZ(
const VisLineTrack &tr, TMultiGraph *mg_phiz,
bool wrap_phi =
true);
220void RenderTrackPhiZ(
const VisHelixTrack &tr, TMultiGraph *mg_phiz,
bool wrap_phi =
true);
221void RenderTrackPhiZ(
const VisGenericTrack &tr, TMultiGraph *mg_phiz,
bool wrap_phi =
true);
224void RenderTrack3D(
const VisHelixTrack &tr,
double bounds[6]);
225void RenderTrack3D(
const VisGenericTrack &tr,
double bounds[6]);
239template <
typename TrackContainer = std::vector<VisGenericTrack>>
240void Draw2D(
const std::vector<int> &bundle_ids,
const TrackContainer &tracks = {},
241 const std::vector<VisPoint2D> &extraPoints = {},
bool wrap_phi =
true)
245 bundle_ids, extraPoints,
246 [&](TMultiGraph *mg_xy, TMultiGraph *mg_zx, TMultiGraph *mg_zy, TMultiGraph *mg_phiz)
248 for(
const auto &tr : tracks)
268template <
typename TrackContainer = std::vector<VisGenericTrack>>
269void Draw3D(
const std::vector<int> &hit_ids,
const TrackContainer &tracks = {},
270 const std::vector<VisPoint3D> &points = {},
bool drawSkeleton =
true)
273 [&](
double bounds[6])
275 for(
const auto &tr : tracks)
void RenderTrack3D(const VisLineTrack &tr, double bounds[6])
void RenderTrack2D(const VisLineTrack &tr, TMultiGraph *mg_xy)
void RenderTrackZX(const VisLineTrack &tr, TMultiGraph *mg_zx)
void Draw3DCore(const std::vector< int > &hit_ids, const std::vector< VisPoint3D > &points, bool drawSkeleton, const std::function< void(double[6])> &trackDrawer)
void RenderTrackPhiZ(const VisLineTrack &tr, TMultiGraph *mg_phiz, bool wrap_phi=true)
void Draw3D(const std::vector< int > &hit_ids, const TrackContainer &tracks={}, const std::vector< VisPoint3D > &points={}, bool drawSkeleton=true)
Draws the full 3D detector view.
void Draw2D(const std::vector< int > &bundle_ids, const TrackContainer &tracks={}, const std::vector< VisPoint2D > &extraPoints={}, bool wrap_phi=true)
Draws 2D projections: Phi-Z Unrolled Map, ZX/ZY Side views, and XY Transverse view.
void RenderTrackZY(const VisLineTrack &tr, TMultiGraph *mg_zy)
void Draw2DCore(const std::vector< int > &bundle_ids, const std::vector< VisPoint2D > &extraPoints, const std::function< void(TMultiGraph *, TMultiGraph *, TMultiGraph *, TMultiGraph *)> &trackDrawer, bool wrap_phi=true)
Root namespace for the Cylindrical Helix Tracker (CHeT) project.
Structure representing a reconstructed 3D generic track for visualization.
VisGenericTrack()=default
int color
ROOT Color index.
bool isLocalFrame
If true, coordinates are in Detector Local Frame.
VisGenericTrack(std::vector< VisPoint3D > _pts, int _c=1, int _w=2, int _s=1, bool _loc=false)
std::vector< VisPoint3D > points
Sequence of 3D points.
Structure representing a reconstructed 3D helix track for visualization.
double z0
Initial Z position (at t=0)
double t_min
Minimum angular parameter range.
double dz_dt
Pitch: Z advancement per radian.
bool isLocalFrame
If true, coordinates are in Detector Local Frame.
VisHelixTrack(double _cx, double _cy, double _r, double _z0, double _dz, double _tmin, double _tmax, int _c=1, int _w=2, int _s=1, bool _loc=false)
double t_max
Maximum angular parameter range (default: 2*PI)
double cy
Helix center in XY plane.
int color
ROOT Color index.
Structure representing a reconstructed 3D line track for visualization.
VisLineTrack(double _x, double _y, double _z, double _dx, double _dy, double _dz, int _col=54, int _w=2, int _s=1, bool _isLocal=false)
double uz
Direction unit vector.
VisLineTrack()=default
Construct a new VisLineTrack. Automatically normalizes the direction vector (dx, dy,...
bool isLocalFrame
If true, coordinates are in Detector Local Frame.
int color
ROOT Color index.
Structure representing a 2D point (e.g., for Hough space or transverse projection).
int color
ROOT Color index.
VisPoint2D(double _x, double _y, int _col=kBlue, int _mst=1, double _sz=1.0)
int markerStyle
ROOT Marker style (e.g., 20 = Full Circle)
Structure representing a 3D point (e.g., space points, clusters).
VisPoint3D(double _x, double _y, double _z, int _col=kRed, int _mst=20, double _sz=1.0, bool _isLocal=false)
int markerStyle
ROOT Marker style.
int color
ROOT Color index.
bool isLocalFrame
If true, coordinates are in Detector Local Frame.