using namespace Reve;
-//______________________________________________________________________
+//______________________________________________________________________________
// NLTTrack
//
ClassImp(NLTTrack)
+//______________________________________________________________________________
NLTTrack::NLTTrack() :
Track (),
fOrigPnts(0),
fProjection(0)
-{}
+{
+ // Default constructor.
+}
+
+//______________________________________________________________________________
+NLTTrack::~NLTTrack()
+{
+ // Destructor. Noop.
+}
-/**************************************************************************/
+/******************************************************************************/
+
+//______________________________________________________________________________
void NLTTrack::SetProjection(NLTProjector* proj, NLTProjectable* model)
{
NLTProjected::SetProjection(proj, model);
Track* origTrack = dynamic_cast<Track*>(fProjectable);
SetTrackParams(*origTrack);
-
- // unfortunately fPathMarks is a vector of PathMark pointers
- PathMark* pm;
- std::vector<PathMark*>& refs = origTrack->GetPathMarksRef();
- for(std::vector<PathMark*>::iterator i=refs.begin(); i!=refs.end(); ++i)
- {
- pm = new PathMark();
- pm->V = (*i)->V;
- pm->P = (*i)->P;
- pm->type = (*i)->type;
- pm->time = (*i)->time;
- fPathMarks.push_back(pm);
- }
+ SetPathMarks (*origTrack);
}
-/**************************************************************************/
+/******************************************************************************/
+
+//______________________________________________________________________________
void NLTTrack::UpdateProjection()
{
fProjection = fProjector->GetProjection();
- MakeTrack(kFALSE); //NLTProjector makes recursive calls
+ MakeTrack(kFALSE); // NLTProjector makes recursive calls
}
//______________________________________________________________________________
-void NLTTrack::GetBreakPoint(Int_t idx, Bool_t back, Float_t& x, Float_t& y, Float_t& z)
+void NLTTrack::GetBreakPoint(Int_t idx, Bool_t back,
+ Float_t& x, Float_t& y, Float_t& z)
{
Vector vL = fOrigPnts[idx];
Vector vR = fOrigPnts[idx+1];
//______________________________________________________________________________
Int_t NLTTrack::GetBreakPointIdx(Int_t start)
{
+ // Findex index of the last point that lies within the same
+ // segment of projected space.
+ // For example, rho-z projection separates upper and lower hemisphere
+ // and tracks break into two lines when crossing the y=0 plane.
+
Int_t val = fLastPoint;
- Vector v1; Vector v2;
- if( Size() > 1 )
+ Vector v1, v2;
+ if (Size() > 1)
{
- Bool_t broken = kFALSE;
Int_t i = start;
while(i < fLastPoint)
{
GetPoint(i+1, v2.x, v2.y, v2.z);
if(fProjection->AcceptSegment(v1, v2, fRnrStyle->fDelta) == kFALSE)
{
- broken = kTRUE;
+ val = i;
break;
}
i++;
}
- if(broken) val = i;
}
// printf("BreakPoint IDX start:%d, BREAK %d, total:%d \n", start, val, Size());
return val;
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void NLTTrack::MakeTrack(Bool_t recurse)
{
+ // Calculate the points of the track for drawing.
+ // Call base-class, project, find break-points and insert points
+ // required for full representation.
+
Track::MakeTrack(recurse);
fBreakPoints.clear();
- if(Size() == 0) return; // it is possible to be outside the limits of MaxR, MaxZ ...
+ if(Size() == 0) return; // All points can be outside of MaxR / MaxZ limits.
- // poject line points
+ // Project points, store originals (needed for break-points).
Float_t *p = GetP();
- fOrigPnts = new Vector[Size()];
+ fOrigPnts = new Vector[Size()];
for(Int_t i = 0; i < Size(); ++i, p+=3)
{
fOrigPnts[i].Set(p);
fProjection->ProjectPoint(p[0], p[1], p[2]);
p[2] = fDepth;
- }
+ }
+
Float_t x, y, z;
std::vector<Vector> vvec;
Int_t bL = 0, bR = GetBreakPointIdx(0);
{
for(Int_t i=bL; i<=bR; i++)
{
- GetPoint(i, x, y,z);
+ GetPoint(i, x, y, z);
vvec.push_back(Vector(x, y, z));
}
if (bR == fLastPoint)
bL = bR + 1;
bR = GetBreakPointIdx(bL);
}
- fBreakPoints.push_back(fLastPoint+1); // enforce drawing to end of line
+ fBreakPoints.push_back(vvec.size()); // Mark the track-end for drawing.
+
Reset(vvec.size());
for (std::vector<Reve::Vector>::iterator i=vvec.begin(); i!=vvec.end(); ++i)
SetNextPoint((*i).x, (*i).y, (*i).z);
delete [] fOrigPnts;
}
-/**************************************************************************/
+/******************************************************************************/
+
+//______________________________________________________________________________
void NLTTrack::PrintLineSegments()
{
printf("%s LineSegments:\n", GetName());
}
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void NLTTrack::CtrlClicked(Reve::Track* /*track*/)
{
Track* t = dynamic_cast<Track*>(fProjectable);
t->CtrlClicked(t);
}
-//______________________________________________________________________
+
+/******************************************************************************/
+/******************************************************************************/
+
+
+//______________________________________________________________________________
// NLTTrackList
//
ClassImp(NLTTrackList)
+//______________________________________________________________________________
NLTTrackList::NLTTrackList() :
TrackList (),
NLTProjected ()
{
+ // Default constructor.
}
-/**************************************************************************/
+/******************************************************************************/
+
+//______________________________________________________________________________
void NLTTrackList::SetProjection(NLTProjector* proj, NLTProjectable* model)
{
NLTProjected::SetProjection(proj, model);
using namespace Reve;
-//______________________________________________________________________
+//______________________________________________________________________________
// Track
//
ClassImp(Reve::Track)
+//______________________________________________________________________________
Track::Track() :
Line(),
fRnrStyle(0)
{}
+//______________________________________________________________________________
Track::Track(TParticle* t, Int_t label, TrackRnrStyle* rs):
Line(),
SetName(t->GetName());
}
+//______________________________________________________________________________
Track::Track(Reve::MCTrack* t, TrackRnrStyle* rs):
Line(),
SetName(t->GetName());
}
+//______________________________________________________________________________
Track::Track(Reve::RecTrack* t, TrackRnrStyle* rs) :
Line(),
SetName(t->GetName());
}
+//______________________________________________________________________________
Track::~Track()
{
SetRnrStyle(0);
delete *i;
}
+//______________________________________________________________________________
Track::Track(const Track& t) :
Line(),
TQObject(),
fPathMarks(),
fRnrStyle(0)
{
- SetRnrStyle(t.fRnrStyle);
+ // Copy constructor.
+
SetMainColor(t.GetMainColor());
// Line
- fRnrLine = t.fRnrLine;
+ fRnrLine = t.fRnrLine;
fRnrPoints = t.fRnrPoints;
// TLineAttrib
fLineColor = t.fLineColor;
fLineStyle = t.fLineStyle;
fLineWidth = t.fLineWidth;
+ SetPathMarks(t);
+ SetRnrStyle (t.fRnrStyle);
}
+//______________________________________________________________________________
void Track::SetTrackParams(const Track& t)
{
- fV = t.fV;
- fP = t.fP;
- fBeta = t.fBeta;
- fCharge = t.fCharge;
- fLabel = t.fLabel;
- fIndex = t.fIndex;
- fPathMarks= t.fPathMarks;
+ // Copy track parameters from t.
+ // PathMarks are cleared.
+
+ fV = t.fV;
+ fP = t.fP;
+ fBeta = t.fBeta;
+ fCharge = t.fCharge;
+ fLabel = t.fLabel;
+ fIndex = t.fIndex;
SetMainColor(t.GetMainColor());
// Line
fLineColor = t.fLineColor;
fLineStyle = t.fLineStyle;
fLineWidth = t.fLineWidth;
-
+ fPathMarks.clear();
SetRnrStyle(t.fRnrStyle);
}
-/*
-void Track::Reset(Int_t n_points)
+//______________________________________________________________________________
+void Track::SetPathMarks(const Track& t)
{
- delete [] TPolyLine3D::fP; TPolyLine3D::fP = 0;
- fN = n_points;
- if(fN) TPolyLine3D::fP = new Float_t [3*fN];
- memset(TPolyLine3D::fP, 0, 3*fN*sizeof(Float_t));
- fLastPoint = -1;
+ // Copy path-marks from t.
+
+ const std::vector<PathMark*>& refs = t.GetPathMarksRef();
+ for(std::vector<PathMark*>::const_iterator i=refs.begin(); i!=refs.end(); ++i)
+ {
+ fPathMarks.push_back(new PathMark(**i));
+ }
}
-*/
-/**************************************************************************/
+/******************************************************************************/
+
+//______________________________________________________________________________
void Track::SetRnrStyle(TrackRnrStyle* rs)
{
if (fRnrStyle == rs) return;
if (fRnrStyle) rs->IncRefCount(this);
}
-/**************************************************************************/
+/******************************************************************************/
+
+//______________________________________________________________________________
void Track::SetAttLineAttMarker(TrackList* tl)
{
SetLineColor(tl->GetLineColor());
SetMarkerSize(tl->GetMarkerSize());
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void Track::MakeTrack(Bool_t recurse)
{
TrackRnrStyle& RS((fRnrStyle != 0) ? *fRnrStyle : TrackRnrStyle::fgDefStyle);
Reset(size);
for(Int_t i=0; i<size; ++i)
{
- MCVertex& v = track_points[i];
+ const MCVertex& v = track_points[i];
SetNextPoint(v.x, v.y, v.z);
}
}
if(t) t->MakeTrack(recurse);
}
}
- Emit("MakeTrack(Bool_t)", (Long_t)recurse);
}
-/**************************************************************************/
+/******************************************************************************/
+
+//______________________________________________________________________________
TClass* Track::ProjectedClass() const
{
return NLTTrack::Class();
}
-/**************************************************************************/
+/******************************************************************************/
namespace {
}
+//______________________________________________________________________________
void Track::SortPathMarksByTime()
{
std::sort(fPathMarks.begin(), fPathMarks.end(), cmp_pathmark());
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void Track::ImportHits()
{
Reve::LoadMacro("hits_from_label.C");
fLabel, this));
}
+//______________________________________________________________________________
void Track::ImportClusters()
{
Reve::LoadMacro("clusters_from_label.C");
fLabel, this));
}
+//______________________________________________________________________________
void Track::ImportClustersFromIndex()
{
static const Exc_t eH("Track::ImportClustersFromIndex ");
fIndex, this));
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void Track::ImportKine()
{
static const Exc_t eH("Track::ImportKine ");
}
+//______________________________________________________________________________
void Track::ImportKineWithArgs(Bool_t importMother, Bool_t importDaugters)
{
static const Exc_t eH("Track::ImportKineWithArgs ");
fLabel, importMother, importDaugters, this));
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void Track::PrintKineStack()
{
Reve::LoadMacro("print_kine_from_label.C");
gROOT->ProcessLine(Form("print_kine_from_label(%d);", fLabel));
}
-
+//______________________________________________________________________________
void Track::PrintPathMarks()
{
static const Exc_t eH("Track::PrintPathMarks ");
}
}
-/**************************************************************************/
+/******************************************************************************/
+//______________________________________________________________________________
void Track::CtrlClicked(Reve::Track* track)
{
Emit("CtrlClicked(Reve::Track*)", (Long_t)track);
}
+//______________________________________________________________________________
void Track::SetLineStyle(Style_t lstyle)
{
TAttLine::SetLineStyle(lstyle);
}
}
-/**************************************************************************/
-/**************************************************************************/
-//______________________________________________________________________
+/******************************************************************************/
+/******************************************************************************/
+
+
+//______________________________________________________________________________
// TrackRnrStyle
//
TrackList* tlist;
while ((tlist = dynamic_cast<TrackList*>(next())))
tlist->DecDenyDestroy();
- fTrackLists.Clear();
+ fTrackLists.Clear("nodelete");
}
void TrackCounter::RegisterTracks(TrackList* tlist, Bool_t goodTracks)