TVirtualGeoTrack.h

Go to the documentation of this file.
00001 // @(#)root/geom:$Id: TVirtualGeoTrack.h 33212 2010-04-26 12:19:20Z agheata $
00002 // Author: Andrei Gheata   2003/04/10
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TVirtualGeoTrack
00013 #define ROOT_TVirtualGeoTrack
00014 
00015 #ifndef ROOT_TObjArray
00016 #include "TObjArray.h"
00017 #endif
00018 
00019 #ifndef ROOT_TGeoAtt
00020 #include "TGeoAtt.h"
00021 #endif
00022 
00023 #ifndef ROOT_TAttLine
00024 #include "TAttLine.h"
00025 #endif
00026 
00027 #ifndef ROOT_TAttMarker
00028 #include "TAttMarker.h"
00029 #endif
00030 
00031 ////////////////////////////////////////////////////////////////////////////
00032 //                                                                        //
00033 // TVirtualGeoTrack - Base class for user-defined tracks attached to a    //
00034 //             geometry. Tracks are 3D objects made of points and they    //
00035 //             store a pointer to a TParticle. The geometry manager holds //
00036 //             a list of all tracks that will be deleted on destruction   // 
00037 //             of TGeoManager object.                                     //
00038 //                                                                        //
00039 ////////////////////////////////////////////////////////////////////////////
00040 
00041 class TVirtualGeoTrack : public TObject,
00042                          public TGeoAtt,
00043                          public TAttLine,
00044                          public TAttMarker
00045 {
00046 protected:
00047    Int_t             fPDG;        // track pdg code
00048    Int_t             fId;         // track id
00049    TVirtualGeoTrack *fParent;     // id of parent
00050    TObject          *fParticle;   // particle for this track
00051    TObjArray        *fTracks;     // daughter tracks
00052 
00053    TVirtualGeoTrack(const TVirtualGeoTrack&);
00054    TVirtualGeoTrack& operator=(const TVirtualGeoTrack&);
00055 
00056 public:
00057    TVirtualGeoTrack();
00058    TVirtualGeoTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0);
00059    virtual ~TVirtualGeoTrack();
00060    
00061    virtual TVirtualGeoTrack *AddDaughter(Int_t id, Int_t pdgcode, TObject *particle=0) = 0;
00062    virtual Int_t       AddDaughter(TVirtualGeoTrack *other) = 0;
00063    virtual void        AddPoint(Double_t x, Double_t y, Double_t z, Double_t t) = 0;
00064    virtual TVirtualGeoTrack *FindTrackWithId(Int_t id) const;
00065    Int_t               GetId() const         {return fId;}
00066    virtual Int_t       GetDaughterId(Int_t index) const {return GetDaughter(index)->GetId();}
00067    TVirtualGeoTrack   *GetDaughter(Int_t index) const {return (TVirtualGeoTrack*)fTracks->At(index);}
00068    TVirtualGeoTrack   *GetMother() const {return fParent;}
00069    TObject            *GetMotherParticle() const {return (fParent)?fParent->GetParticle():0;}
00070    virtual const char *GetName() const;
00071    Int_t               GetNdaughters() const {return (fTracks)?fTracks->GetEntriesFast():0;}
00072    virtual Int_t       GetNpoints() const = 0;
00073    Int_t               GetParentId() const   {return (fParent)?fParent->GetId():-1;}
00074    TObject            *GetParticle() const   {return fParticle;}
00075    Int_t               GetPDG() const        {return fPDG;}
00076    Int_t               GetLastPoint(Double_t &x, Double_t &y, Double_t &z, Double_t &t) const {return GetPoint(GetNpoints()-1,x,y,z,t);}
00077    const Double_t     *GetFirstPoint() const {return GetPoint(0);}
00078    const Double_t     *GetLastPoint() const {return GetPoint(GetNpoints()-1);}
00079    virtual Int_t       GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const = 0;
00080    virtual const Double_t *GetPoint(Int_t i) const = 0;
00081    Bool_t              HasPoints() const {return (GetNpoints()==0)?kFALSE:kTRUE;}
00082    Bool_t              IsInTimeRange() const;
00083    virtual void        Paint(Option_t *option="") = 0;
00084    virtual void        PaintCollect(Double_t /*time*/, Double_t * /*box*/) {;}
00085    virtual void        PaintCollectTrack(Double_t /*time*/, Double_t * /*box*/) {;}
00086    virtual void        PaintTrack(Option_t *option="") = 0;
00087    virtual void        ResetTrack() = 0;
00088    void                SetName(const char *name);
00089    virtual void        SetParticle(TObject *particle) {fParticle=particle;}
00090    void                SetParent(TVirtualGeoTrack *parent) {fParent = parent;}
00091    void                SetId(Int_t id)       {fId = id;}
00092    virtual void        SetPDG(Int_t pdgcode) {fPDG = pdgcode;}
00093    
00094    ClassDef(TVirtualGeoTrack, 1)              // virtual geometry tracks
00095 };
00096 
00097 #endif
00098 
00099    
00100    
00101    

Generated on Tue Jul 5 14:12:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1