ROOT logo
// @(#)root/geom:$Id: TVirtualGeoTrack.h 21425 2007-12-17 15:59:27Z brun $
// Author: Andrei Gheata   2003/04/10

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TVirtualGeoTrack
#define ROOT_TVirtualGeoTrack

#ifndef ROOT_TObjArray
#include "TObjArray.h"
#endif

#ifndef ROOT_TGeoAtt
#include "TGeoAtt.h"
#endif

#ifndef ROOT_TAttLine
#include "TAttLine.h"
#endif

#ifndef ROOT_TAttMarker
#include "TAttMarker.h"
#endif

////////////////////////////////////////////////////////////////////////////
//                                                                        //
// TVirtualGeoTrack - Base class for user-defined tracks attached to a    //
//             geometry. Tracks are 3D objects made of points and they    //
//             store a pointer to a TParticle. The geometry manager holds //
//             a list of all tracks that will be deleted on destruction   // 
//             of TGeoManager object.                                     //
//                                                                        //
////////////////////////////////////////////////////////////////////////////

class TVirtualGeoTrack : public TObject,
                         public TGeoAtt,
                         public TAttLine,
                         public TAttMarker
{
protected:
   Int_t             fPDG;        // track pdg code
   Int_t             fId;         // track id
   TVirtualGeoTrack *fParent;     // id of parent
   TObject          *fParticle;   // particle for this track
   TObjArray        *fTracks;     // daughter tracks

   TVirtualGeoTrack(const TVirtualGeoTrack&);
   TVirtualGeoTrack& operator=(const TVirtualGeoTrack&);

public:
   TVirtualGeoTrack();
   TVirtualGeoTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0);
   virtual ~TVirtualGeoTrack();
   
   virtual TVirtualGeoTrack *AddDaughter(Int_t id, Int_t pdgcode, TObject *particle=0) = 0;
   virtual Int_t       AddDaughter(TVirtualGeoTrack *other) = 0;
   virtual void        AddPoint(Double_t x, Double_t y, Double_t z, Double_t t) = 0;
   Int_t               GetId() const         {return fId;}
   virtual Int_t       GetDaughterId(Int_t index) const {return GetDaughter(index)->GetId();}
   TVirtualGeoTrack   *GetDaughter(Int_t index) const {return (TVirtualGeoTrack*)fTracks->At(index);}
   TVirtualGeoTrack   *GetMother() const {return fParent;}
   TObject            *GetMotherParticle() const {return (fParent)?fParent->GetParticle():0;}
   virtual const char *GetName() const;
   Int_t               GetNdaughters() const {return (fTracks)?fTracks->GetEntriesFast():0;}
   virtual Int_t       GetNpoints() const = 0;
   Int_t               GetParentId() const   {return (fParent)?fParent->GetId():-1;}
   TObject            *GetParticle() const   {return fParticle;}
   Int_t               GetPDG() const        {return fPDG;}
   Int_t               GetLastPoint(Double_t &x, Double_t &y, Double_t &z, Double_t &t) const {return GetPoint(GetNpoints()-1,x,y,z,t);}
   const Double_t     *GetFirstPoint() const {return GetPoint(0);}
   const Double_t     *GetLastPoint() const {return GetPoint(GetNpoints()-1);}
   virtual Int_t       GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const = 0;
   virtual const Double_t *GetPoint(Int_t i) const = 0;
   Bool_t              HasPoints() const {return (GetNpoints()==0)?kFALSE:kTRUE;}
   Bool_t              IsInTimeRange() const;
   virtual void        Paint(Option_t *option="") = 0;
   virtual void        PaintCollect(Double_t /*time*/, Double_t * /*box*/) {;}
   virtual void        PaintCollectTrack(Double_t /*time*/, Double_t * /*box*/) {;}
   virtual void        PaintTrack(Option_t *option="") = 0;
   virtual void        ResetTrack() = 0;
   void                SetName(const char *name);
   virtual void        SetParticle(TObject *particle) {fParticle=particle;}
   void                SetParent(TVirtualGeoTrack *parent) {fParent = parent;}
   void                SetId(Int_t id)       {fId = id;}
   virtual void        SetPDG(Int_t pdgcode) {fPDG = pdgcode;}
   
   ClassDef(TVirtualGeoTrack, 1)              // virtual geometry tracks
};

#endif

   
   
   
 TVirtualGeoTrack.h:1
 TVirtualGeoTrack.h:2
 TVirtualGeoTrack.h:3
 TVirtualGeoTrack.h:4
 TVirtualGeoTrack.h:5
 TVirtualGeoTrack.h:6
 TVirtualGeoTrack.h:7
 TVirtualGeoTrack.h:8
 TVirtualGeoTrack.h:9
 TVirtualGeoTrack.h:10
 TVirtualGeoTrack.h:11
 TVirtualGeoTrack.h:12
 TVirtualGeoTrack.h:13
 TVirtualGeoTrack.h:14
 TVirtualGeoTrack.h:15
 TVirtualGeoTrack.h:16
 TVirtualGeoTrack.h:17
 TVirtualGeoTrack.h:18
 TVirtualGeoTrack.h:19
 TVirtualGeoTrack.h:20
 TVirtualGeoTrack.h:21
 TVirtualGeoTrack.h:22
 TVirtualGeoTrack.h:23
 TVirtualGeoTrack.h:24
 TVirtualGeoTrack.h:25
 TVirtualGeoTrack.h:26
 TVirtualGeoTrack.h:27
 TVirtualGeoTrack.h:28
 TVirtualGeoTrack.h:29
 TVirtualGeoTrack.h:30
 TVirtualGeoTrack.h:31
 TVirtualGeoTrack.h:32
 TVirtualGeoTrack.h:33
 TVirtualGeoTrack.h:34
 TVirtualGeoTrack.h:35
 TVirtualGeoTrack.h:36
 TVirtualGeoTrack.h:37
 TVirtualGeoTrack.h:38
 TVirtualGeoTrack.h:39
 TVirtualGeoTrack.h:40
 TVirtualGeoTrack.h:41
 TVirtualGeoTrack.h:42
 TVirtualGeoTrack.h:43
 TVirtualGeoTrack.h:44
 TVirtualGeoTrack.h:45
 TVirtualGeoTrack.h:46
 TVirtualGeoTrack.h:47
 TVirtualGeoTrack.h:48
 TVirtualGeoTrack.h:49
 TVirtualGeoTrack.h:50
 TVirtualGeoTrack.h:51
 TVirtualGeoTrack.h:52
 TVirtualGeoTrack.h:53
 TVirtualGeoTrack.h:54
 TVirtualGeoTrack.h:55
 TVirtualGeoTrack.h:56
 TVirtualGeoTrack.h:57
 TVirtualGeoTrack.h:58
 TVirtualGeoTrack.h:59
 TVirtualGeoTrack.h:60
 TVirtualGeoTrack.h:61
 TVirtualGeoTrack.h:62
 TVirtualGeoTrack.h:63
 TVirtualGeoTrack.h:64
 TVirtualGeoTrack.h:65
 TVirtualGeoTrack.h:66
 TVirtualGeoTrack.h:67
 TVirtualGeoTrack.h:68
 TVirtualGeoTrack.h:69
 TVirtualGeoTrack.h:70
 TVirtualGeoTrack.h:71
 TVirtualGeoTrack.h:72
 TVirtualGeoTrack.h:73
 TVirtualGeoTrack.h:74
 TVirtualGeoTrack.h:75
 TVirtualGeoTrack.h:76
 TVirtualGeoTrack.h:77
 TVirtualGeoTrack.h:78
 TVirtualGeoTrack.h:79
 TVirtualGeoTrack.h:80
 TVirtualGeoTrack.h:81
 TVirtualGeoTrack.h:82
 TVirtualGeoTrack.h:83
 TVirtualGeoTrack.h:84
 TVirtualGeoTrack.h:85
 TVirtualGeoTrack.h:86
 TVirtualGeoTrack.h:87
 TVirtualGeoTrack.h:88
 TVirtualGeoTrack.h:89
 TVirtualGeoTrack.h:90
 TVirtualGeoTrack.h:91
 TVirtualGeoTrack.h:92
 TVirtualGeoTrack.h:93
 TVirtualGeoTrack.h:94
 TVirtualGeoTrack.h:95
 TVirtualGeoTrack.h:96
 TVirtualGeoTrack.h:97
 TVirtualGeoTrack.h:98
 TVirtualGeoTrack.h:99
 TVirtualGeoTrack.h:100