KaliVeda
Toolkit for HIC analysis
KV3DGeoTrack.cpp
1 #include "KV3DGeoTrack.h"
2 
3 #include "TPad.h"
4 #include "TView.h"
5 #include "KVNucleus.h"
6 #include "TPolyMarker3D.h"
7 
8 ClassImp(KV3DGeoTrack)
9 
10 
11 
14  TPolyLine3D(),
15  fIndex(0),
16  fTrack(nullptr),
17  fNuc()
18 {
19 }
20 
21 
22 
24 
25 KV3DGeoTrack::KV3DGeoTrack(TVirtualGeoTrack* tr):
26  TPolyLine3D(tr->GetNpoints()),
27  fIndex(0),
28  fTrack(tr),
29  fNuc(tr->GetName())
30 {
31  SetLineColor(Color());
32  for (int n = 0; n < tr->GetNpoints(); n++) {
33  const Double_t* point = tr->GetPoint(n);
34  SetPoint(n, point[0], point[1], point[2]);
35  }
36 }
37 
38 
39 
41 
43 {
44 }
45 
46 
47 
49 
50 Int_t KV3DGeoTrack::DistancetoPrimitive(Int_t px, Int_t py)
51 {
52  return TPolyLine3D::DistancetoPrimitive(px, py);
53 }
54 
55 
56 
58 
59 void KV3DGeoTrack::ExecuteEvent(Int_t event, Int_t px, Int_t py)
60 {
61 
62  gPad->SetCursor(kCross);
63  fTrack->ExecuteEvent(event, px, py);
64 }
65 
66 
67 
69 
70 const Text_t* KV3DGeoTrack::GetName() const
71 {
72  return fTrack->GetName();
73 }
74 
75 
76 
78 
79 Text_t* KV3DGeoTrack::GetObjectInfo(Int_t px, Int_t py) const
80 {
81  return fTrack->GetObjectInfo(px, py);
82 }
83 
84 
85 
88 
89 void KV3DGeoTrack::Draw(Option_t* option)
90 {
91  // Override Draw to add a TPolyMarker3D at the end of the track
92  TPolyMarker3D* pm = new TPolyMarker3D(1, 4);
93  Float_t* coords = &(GetP()[3 * GetLastPoint()]);
94  pm->SetPoint(0, coords[0], coords[1], coords[2]);
95  pm->SetMarkerColor(GetLineColor());
96  pm->SetMarkerSize(0.5);
97  pm->Draw(option);
98  pm->SetName(GetName());
99  TPolyLine3D::Draw(option);
100 }
101 
102 
103 
104 
106 
107 Int_t KV3DGeoTrack::Color()
108 {
109  SetLineWidth(2);
110  Int_t fZ = GetZ();
111  if (fZ == 0) return kBlue;
112  else if (fZ == 1) return kRed;
113  if (fZ == 2) return kGreen;
114  SetLineWidth(4);
115  if (fZ < 10) return kMagenta;
116  if (fZ < 20) return kCyan;
117  if (fZ < 30) return kOrange;
118  SetLineWidth(6);
119  return kGray;
120 }
121 
122 
123 
Visualise particle trajectories through array geometry.
Definition: KV3DGeoTrack.h:15
virtual ~KV3DGeoTrack()
Int_t GetZ() const
Definition: KV3DGeoTrack.h:33
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Text_t * GetObjectInfo(Int_t px, Int_t py) const override
void Draw(Option_t *option="") override
Override Draw to add a TPolyMarker3D at the end of the track.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
const Text_t * GetName() const override