13 m_driftLines.reserve(1000);
14 m_driftLinePlots.reserve(1000);
15 m_tracks.reserve(100);
16 m_trackPlots.reserve(100);
17 m_excMarkers.reserve(1000);
18 m_ionMarkers.reserve(1000);
19 m_attMarkers.reserve(1000);
27 const double xmax,
const double ymax,
30 if (xmin == xmax || ymin == ymax || zmin == zmax) {
31 std::cerr <<
m_className <<
"::SetArea: Null area range not permitted.\n";
34 m_xMin = std::min(xmin, xmax);
35 m_yMin = std::min(ymin, ymax);
36 m_zMin = std::min(zmin, zmax);
37 m_xMax = std::max(xmin, xmax);
38 m_yMax = std::max(ymin, ymax);
39 m_zMax = std::max(zmin, zmax);
55 m_trackLinePlots.clear();
60 m_markerSizeCluster = size;
62 std::cerr <<
m_className <<
"::SetClusterMarkerSize: Size must be > 0.\n";
68 m_markerSizeCollision = size;
70 std::cerr <<
m_className <<
"::SetCollisionMarkerSize: Size must be > 0.\n";
75 const double x0,
const double y0,
82 d.points.front().x = x0;
83 d.points.front().y = y0;
84 d.points.front().z = z0;
87 for (
unsigned int i = 0; i < np; ++i) {
94 m_driftLines.push_back(std::move(d));
96 id = m_driftLines.size() - 1;
100 const double x0,
const double y0,
109 d.points.push_back(m0);
111 d.points.assign(np, m0);
114 m_driftLines.push_back(std::move(d));
116 id = m_driftLines.size() - 1;
120 const double y0,
const double z0) {
128 d.points.push_back(m0);
130 d.points.assign(np, m0);
133 m_driftLines.push_back(std::move(d));
135 id = m_driftLines.size() - 1;
139 const double z0,
const double x1,
140 const double y1,
const double z1) {
145 p.SetNextPoint(x0, y0, z0);
146 p.SetNextPoint(x1, y1, z1);
150 const double x0,
const double y0,
153 std::vector<Marker> track(std::max(1U, np));
157 m_tracks.push_back(std::move(track));
159 id = m_tracks.size() - 1;
163 const double x,
const double y,
165 if (iL >= m_driftLines.size()) {
166 std::cerr <<
m_className <<
"::SetDriftLinePoint: Index out of range.\n";
169 m_driftLines[iL].points[iP].x = x;
170 m_driftLines[iL].points[iP].y = y;
171 m_driftLines[iL].points[iP].z = z;
175 const double y,
const double z) {
176 if (iL >= m_driftLines.size()) {
177 std::cerr <<
m_className <<
"::AddDriftLinePoint: Index out of range.\n";
184 m_driftLines[iL].points.push_back(std::move(m));
188 const double x,
const double y,
const double z) {
189 if (iL >= m_tracks.size()) {
190 std::cerr <<
m_className <<
"::SetTrackPoint: Index out of range.\n";
193 m_tracks[iL][iP].x = x;
194 m_tracks[iL][iP].y = y;
195 m_tracks[iL][iP].z = z;
199 const double y,
const double z) {
200 if (iL >= m_tracks.size()) {
201 std::cerr <<
m_className <<
"::AddTrackPoint: Index out of range.\n";
208 m_tracks[iL].push_back(std::move(newPoint));
217 m_excMarkers.push_back(std::move(newMarker));
226 m_ionMarkers.push_back(std::move(newMarker));
235 m_attMarkers.push_back(std::move(newMarker));
246void ViewDrift::Plot2d(
const bool axis) {
248 std::cout <<
m_className <<
"::Plot: Plotting in 2D.\n";
257 for (
const auto& driftLine : m_driftLines) {
258 const auto nPoints = driftLine.points.size();
260 for (
unsigned int j = 0; j < nPoints; ++j) {
261 t.SetPoint(j, driftLine.points[j].x, driftLine.points[j].y);
263 t.SetLineColor(driftLine.n);
265 if (&driftLine == &m_driftLines.front()) {
266 t.GetXaxis()->SetLimits(m_xMin, m_xMax);
267 t.GetXaxis()->SetTitle(
"x [cm]");
268 t.GetYaxis()->SetTitle(
"y [cm]");
269 t.GetHistogram()->SetMaximum(m_yMax);
270 t.GetHistogram()->SetMinimum(m_yMin);
272 t.DrawClone(
"ALsame");
274 t.DrawClone(
"Lsame");
277 t.DrawClone(
"Lsame");
283 for (
const auto& track : m_tracks) {
284 const auto nPoints = track.size();
286 for (
unsigned int j = 0; j < nPoints; ++j) {
287 t.SetPoint(j, track[j].x, track[j].y);
289 t.SetLineColor(trackCol);
291 if (&track == &m_tracks.front()) {
292 t.GetXaxis()->SetLimits(m_xMin, m_xMax);
293 t.GetHistogram()->SetMaximum(m_yMax);
294 t.GetHistogram()->SetMinimum(m_yMin);
295 if (axis && m_driftLines.empty()) {
296 t.DrawClone(
"ALsame");
298 t.DrawClone(
"Lsame");
301 t.DrawClone(
"Lsame");
307void ViewDrift::Plot3d(
const bool axis) {
309 std::cout <<
m_className <<
"::Plot: Plotting in 3D.\n";
318 m_view.reset(TView::CreateView(1, 0, 0));
319 m_view->SetRange(m_xMin, m_yMin, m_zMin, m_xMax, m_yMax, m_zMax);
326 for (
const auto& driftLine : m_driftLines) {
327 TPolyLine3D t(driftLine.points.size());
328 for (
const auto& point : driftLine.points) {
329 t.SetNextPoint(point.x, point.y, point.z);
331 t.SetLineColor(driftLine.n);
332 m_driftLinePlots.push_back(std::move(t));
333 m_driftLinePlots.back().Draw(
"same");
337 for (
const auto& track : m_tracks) {
338 const unsigned int nPoints = track.size();
339 TPolyMarker3D t(nPoints);
340 TPolyLine3D l(nPoints);
341 for (
const auto& point : track) {
342 t.SetNextPoint(point.x, point.y, point.z);
343 l.SetNextPoint(point.x, point.y, point.z);
345 t.SetMarkerStyle(20);
346 t.SetMarkerColor(trackCol);
347 t.SetMarkerSize(m_markerSizeCluster);
349 m_trackPlots.push_back(std::move(t));
350 l.SetLineColor(trackCol);
353 m_trackLinePlots.push_back(std::move(l));
356 if (!m_excMarkers.empty()) {
357 m_excPlot.reset(
new TPolyMarker3D(m_excMarkers.size()));
359 m_excPlot->SetMarkerStyle(20);
360 m_excPlot->SetMarkerSize(m_markerSizeCollision);
361 for (
const auto& point : m_excMarkers) {
362 m_excPlot->SetNextPoint(point.x, point.y, point.z);
364 m_excPlot->Draw(
"same");
366 m_excPlot.reset(
nullptr);
369 if (!m_ionMarkers.empty()) {
370 m_ionPlot.reset(
new TPolyMarker3D(m_ionMarkers.size()));
372 m_ionPlot->SetMarkerStyle(20);
373 m_ionPlot->SetMarkerSize(m_markerSizeCollision);
374 for (
const auto& point : m_ionMarkers) {
375 m_ionPlot->SetNextPoint(point.x, point.y, point.z);
377 m_ionPlot->Draw(
"same");
379 m_ionPlot.reset(
nullptr);
382 if (!m_attMarkers.empty()) {
383 m_attPlot.reset(
new TPolyMarker3D(m_attMarkers.size()));
385 m_attPlot->SetMarkerStyle(20);
386 m_attPlot->SetMarkerSize(m_markerSizeCollision);
387 for (
const auto& point : m_attMarkers) {
388 m_attPlot->SetNextPoint(point.x, point.y, point.z);
390 m_attPlot->Draw(
"same");
392 m_attPlot.reset(
nullptr);
396 TAxis3D* ax3d = TAxis3D::GetPadAxis();
397 ax3d->SetLabelColor(kBlack);
398 ax3d->SetAxisColor(kBlack);
399 ax3d->SetXTitle(
"x");
400 ax3d->SetYTitle(
"y");
401 ax3d->SetZTitle(
"z");
int GetRootColorChargedParticle()
int GetRootColorElectron()
Base class for visualization classes.
void NewElectronDriftLine(const unsigned int np, int &id, const double x0, const double y0, const double z0)
void AddExcitationMarker(const double x, const double y, const double z)
void AddIonisationMarker(const double x, const double y, const double z)
void Plot(const bool twod=false, const bool axis=true)
Draw the drift lines.
void SetDriftLinePoint(const unsigned int iL, const unsigned int iP, const double x, const double y, const double z)
void SetArea(const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax)
Set the region to be plotted.
void AddAttachmentMarker(const double x, const double y, const double z)
void AddTrackPoint(const unsigned int iL, const double x, const double y, const double z)
void SetClusterMarkerSize(const double size)
Set the size of the cluster markers (see TAttMarker).
void NewChargedParticleTrack(const unsigned int np, int &id, const double x0, const double y0, const double z0)
void AddDriftLinePoint(const unsigned int iL, const double x, const double y, const double z)
void SetTrackPoint(const unsigned int iL, const unsigned int iP, const double x, const double y, const double z)
void Clear()
Delete existing drift lines, tracks and markers.
void NewPhotonTrack(const double x0, const double y0, const double z0, const double x1, const double y1, const double z1)
void NewHoleDriftLine(const unsigned int np, int &id, const double x0, const double y0, const double z0)
void NewIonDriftLine(const unsigned int np, int &id, const double x0, const double y0, const double z0)
void SetCollisionMarkerSize(const double size)
Set the size of the collision markers (see TAttMarker).
PlottingEngineRoot plottingEngine