00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveTrackGL.h"
00013 #include "TEveTrack.h"
00014 #include "TEveTrackPropagator.h"
00015
00016 #include "TGLIncludes.h"
00017 #include "TGLRnrCtx.h"
00018 #include "TGLSelectRecord.h"
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 ClassImp(TEveTrackGL);
00029
00030
00031 TEveTrackGL::TEveTrackGL() : TEveLineGL()
00032 {
00033
00034
00035
00036 }
00037
00038
00039
00040
00041 Bool_t TEveTrackGL::SetModel(TObject* obj, const Option_t* )
00042 {
00043
00044
00045 TEveLineGL::SetModel(obj);
00046 fTrack = DynCast<TEveTrack>(obj);
00047 return kTRUE;
00048 }
00049
00050
00051 void TEveTrackGL::ProcessSelection(TGLRnrCtx & , TGLSelectRecord & rec)
00052 {
00053
00054
00055
00056
00057 if (gDebug > 0)
00058 {
00059 printf("TEveTrackGL::ProcessSelection %d names on the stack (z1=%g, z2=%g).\n",
00060 rec.GetN(), rec.GetMinZ(), rec.GetMaxZ());
00061 printf(" Names: ");
00062 for (Int_t j=0; j<rec.GetN(); ++j) printf ("%d ", rec.GetItem(j));
00063 printf("\n");
00064 }
00065
00066 fTrack->SecSelected(fTrack);
00067 }
00068
00069
00070 void TEveTrackGL::DirectDraw(TGLRnrCtx & rnrCtx) const
00071 {
00072
00073
00074
00075 TEveLineGL::DirectDraw(rnrCtx);
00076
00077 RenderPathMarksAndFirstVertex(rnrCtx);
00078 }
00079
00080
00081 void TEveTrackGL::RenderPathMarksAndFirstVertex(TGLRnrCtx& rnrCtx) const
00082 {
00083
00084
00085 TEveTrackPropagator &rTP = *fTrack->GetPropagator();
00086 const TEveTrack::vPathMark_t &pms = fTrack->RefPathMarks();
00087 if ( ! pms.empty())
00088 {
00089 Float_t *pnts = new Float_t[3*pms.size()];
00090 Int_t cnt = 0;
00091 Int_t n = 0;
00092 for (Int_t i = 0; i < fTrack->fLastPMIdx; ++i)
00093 {
00094 const TEvePathMark &pm = pms[i];
00095 if ((pm.fType == TEvePathMark::kDaughter && rTP.GetRnrDaughters()) ||
00096 (pm.fType == TEvePathMark::kReference && rTP.GetRnrReferences()) ||
00097 (pm.fType == TEvePathMark::kDecay && rTP.GetRnrDecay()) ||
00098 (pm.fType == TEvePathMark::kCluster2D && rTP.GetRnrCluster2Ds()))
00099 {
00100 pnts[n ] = pm.fV.fX;
00101 pnts[n+1] = pm.fV.fY;
00102 pnts[n+2] = pm.fV.fZ;
00103 n += 3;
00104 ++cnt;
00105 }
00106 }
00107 TGLUtil::RenderPolyMarkers(rTP.RefPMAtt(), 0, pnts, cnt,
00108 rnrCtx.GetPickRadius(),
00109 rnrCtx.Selection());
00110 delete [] pnts;
00111 }
00112
00113
00114 if (rTP.GetRnrFV() && fTrack->GetLastPoint())
00115 TGLUtil::RenderPolyMarkers(rTP.RefFVAtt(), 0, fTrack->GetP(), 1,
00116 rnrCtx.GetPickRadius(),
00117 rnrCtx.Selection());
00118 }