4 #include <Reve/NLTProjector.h>
9 //______________________________________________________________________________
15 //______________________________________________________________________________
16 NLTTrack::NLTTrack() :
21 // Default constructor.
24 //______________________________________________________________________________
30 /******************************************************************************/
32 //______________________________________________________________________________
33 void NLTTrack::SetProjection(NLTProjector* proj, NLTProjectable* model)
35 NLTProjected::SetProjection(proj, model);
36 Track* origTrack = dynamic_cast<Track*>(fProjectable);
38 SetTrackParams(*origTrack);
39 SetPathMarks (*origTrack);
42 /******************************************************************************/
44 //______________________________________________________________________________
45 void NLTTrack::UpdateProjection()
47 fProjection = fProjector->GetProjection();
48 MakeTrack(kFALSE); // NLTProjector makes recursive calls
51 //______________________________________________________________________________
52 void NLTTrack::GetBreakPoint(Int_t idx, Bool_t back,
53 Float_t& x, Float_t& y, Float_t& z)
55 Vector vL = fOrigPnts[idx];
56 Vector vR = fOrigPnts[idx+1];
58 while((vL-vR).Mag() > 0.01)
61 vLP.Set(vL); fProjection->ProjectPoint(vLP.x, vLP.y, vLP.z);
62 vMP.Set(vM); fProjection->ProjectPoint(vMP.x, vMP.y, vMP.z);
63 if(fProjection->AcceptSegment(vLP, vMP, 0.0f))
71 //printf("new interval Mag %f (%f, %f, %f)(%f, %f, %f) \n",(vL-vR).Mag(), vL.x, vL.y, vL.z, vR.x, vR.y, vR.z);
76 x = vL.x; y = vL.y; z = vL.z;
80 x = vR.x; y = vR.y; z = vR.z;
82 fProjection->ProjectPoint(x, y, z);
83 // printf("NLTTrack::GetBreakPoint %d (%f, %f, %f) \n", idx, x, y, z);
86 //______________________________________________________________________________
87 Int_t NLTTrack::GetBreakPointIdx(Int_t start)
89 // Findex index of the last point that lies within the same
90 // segment of projected space.
91 // For example, rho-z projection separates upper and lower hemisphere
92 // and tracks break into two lines when crossing the y=0 plane.
94 Int_t val = fLastPoint;
100 while(i < fLastPoint)
102 GetPoint(i, v1.x, v1.y, v1.z);
103 GetPoint(i+1, v2.x, v2.y, v2.z);
104 if(fProjection->AcceptSegment(v1, v2, fRnrStyle->fDelta) == kFALSE)
112 // printf("BreakPoint IDX start:%d, BREAK %d, total:%d \n", start, val, Size());
116 /******************************************************************************/
118 //______________________________________________________________________________
119 void NLTTrack::MakeTrack(Bool_t recurse)
121 // Calculate the points of the track for drawing.
122 // Call base-class, project, find break-points and insert points
123 // required for full representation.
125 Track::MakeTrack(recurse);
127 fBreakPoints.clear();
128 if(Size() == 0) return; // All points can be outside of MaxR / MaxZ limits.
130 // Project points, store originals (needed for break-points).
132 fOrigPnts = new Vector[Size()];
133 for(Int_t i = 0; i < Size(); ++i, p+=3)
136 fProjection->ProjectPoint(p[0], p[1], p[2]);
141 std::vector<Vector> vvec;
142 Int_t bL = 0, bR = GetBreakPointIdx(0);
145 for(Int_t i=bL; i<=bR; i++)
147 GetPoint(i, x, y, z);
148 vvec.push_back(Vector(x, y, z));
150 if (bR == fLastPoint)
153 GetBreakPoint(bR, kTRUE, x, y, z); vvec.push_back(Vector(x, y, z));
154 fBreakPoints.push_back(vvec.size());
155 GetBreakPoint(bR, kFALSE, x, y, z); vvec.push_back(Vector(x, y, z));
158 bR = GetBreakPointIdx(bL);
160 fBreakPoints.push_back(vvec.size()); // Mark the track-end for drawing.
163 for (std::vector<Reve::Vector>::iterator i=vvec.begin(); i!=vvec.end(); ++i)
164 SetNextPoint((*i).x, (*i).y, (*i).z);
168 /******************************************************************************/
170 //______________________________________________________________________________
171 void NLTTrack::PrintLineSegments()
173 printf("%s LineSegments:\n", GetName());
178 for (std::vector<Int_t>::iterator bpi = fBreakPoints.begin();
179 bpi != fBreakPoints.end(); ++bpi)
181 Int_t size = *bpi - start;
183 GetPoint(start, S.x, S.y, S.z);
184 GetPoint((*bpi)-1, E.x, E.y, E.z);
185 printf("seg %d size %d start %d ::(%f, %f, %f) (%f, %f, %f)\n",
186 segment, size, start, S.x, S.y, S.z, E.x, E.y, E.z);
192 /******************************************************************************/
194 //______________________________________________________________________________
195 void NLTTrack::CtrlClicked(Reve::Track* /*track*/)
197 Track* t = dynamic_cast<Track*>(fProjectable);
203 /******************************************************************************/
204 /******************************************************************************/
207 //______________________________________________________________________________
211 ClassImp(NLTTrackList)
213 //______________________________________________________________________________
214 NLTTrackList::NLTTrackList() :
218 // Default constructor.
221 /******************************************************************************/
223 //______________________________________________________________________________
224 void NLTTrackList::SetProjection(NLTProjector* proj, NLTProjectable* model)
226 NLTProjected::SetProjection(proj, model);
228 TrackList& tl = * dynamic_cast<TrackList*>(model);
229 SetLineColor(tl.GetLineColor());
230 SetLineStyle(tl.GetLineStyle());
231 SetLineWidth(tl.GetLineWidth());
232 SetMarkerColor(tl.GetMarkerColor());
233 SetMarkerStyle(tl.GetMarkerStyle());
234 SetMarkerSize(tl.GetMarkerSize());
235 SetRnrLine(tl.GetRnrLine());
236 SetRnrPoints(tl.GetRnrPoints());
238 SetRnrStyle(tl.GetRnrStyle());