File indexing completed on 2025-11-03 10:04:47
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 #ifndef ROOT_TVirtualGeoTrack
0013 #define ROOT_TVirtualGeoTrack
0014 
0015 #include "TObjArray.h"
0016 
0017 #include "TGeoAtt.h"
0018 
0019 #include "TAttLine.h"
0020 
0021 #include "TAttMarker.h"
0022 
0023 class TVirtualGeoTrack : public TObject, public TGeoAtt, public TAttLine, public TAttMarker {
0024 protected:
0025    Int_t fPDG{0};                      
0026    Int_t fId{-1};                      
0027    TVirtualGeoTrack *fParent{nullptr}; 
0028    TObject *fParticle{nullptr};        
0029    TObjArray *fTracks{nullptr};        
0030 
0031    TVirtualGeoTrack(const TVirtualGeoTrack &) = delete;
0032    TVirtualGeoTrack &operator=(const TVirtualGeoTrack &) = delete;
0033 
0034 public:
0035    TVirtualGeoTrack();
0036    TVirtualGeoTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent = nullptr, TObject *particle = nullptr);
0037    ~TVirtualGeoTrack() override;
0038 
0039    virtual TVirtualGeoTrack *AddDaughter(Int_t id, Int_t pdgcode, TObject *particle = nullptr) = 0;
0040    virtual Int_t AddDaughter(TVirtualGeoTrack *other) = 0;
0041    virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t) = 0;
0042    virtual TVirtualGeoTrack *FindTrackWithId(Int_t id) const;
0043    Int_t GetId() const { return fId; }
0044    virtual Int_t GetDaughterId(Int_t index) const;
0045    TVirtualGeoTrack *GetDaughter(Int_t index) const { return (TVirtualGeoTrack *)fTracks->At(index); }
0046    TVirtualGeoTrack *GetMother() const { return fParent; }
0047    TObject *GetMotherParticle() const { return fParent ? fParent->GetParticle() : nullptr; }
0048    const char *GetName() const override;
0049    Int_t GetNdaughters() const { return fTracks ? fTracks->GetEntriesFast() : 0; }
0050    virtual Int_t GetNpoints() const = 0;
0051    Int_t GetParentId() const { return fParent ? fParent->GetId() : -1; }
0052    TObject *GetParticle() const { return fParticle; }
0053    Int_t GetPDG() const { return fPDG; }
0054    Int_t GetLastPoint(Double_t &x, Double_t &y, Double_t &z, Double_t &t) const
0055    {
0056       return GetPoint(GetNpoints() - 1, x, y, z, t);
0057    }
0058    const Double_t *GetFirstPoint() const { return GetPoint(0); }
0059    const Double_t *GetLastPoint() const { return GetPoint(GetNpoints() - 1); }
0060    virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const = 0;
0061    virtual const Double_t *GetPoint(Int_t i) const = 0;
0062    Bool_t HasPoints() const { return (GetNpoints() == 0) ? kFALSE : kTRUE; }
0063    Bool_t IsInTimeRange() const;
0064    void Paint(Option_t *option = "") override = 0;
0065    virtual void PaintCollect(Double_t , Double_t * ) {}
0066    virtual void PaintCollectTrack(Double_t , Double_t * ) {}
0067    virtual void PaintTrack(Option_t *option = "") = 0;
0068    virtual void ResetTrack() = 0;
0069    void SetName(const char *name);
0070    virtual void SetParticle(TObject *particle) { fParticle = particle; }
0071    void SetParent(TVirtualGeoTrack *parent) { fParent = parent; }
0072    void SetId(Int_t id) { fId = id; }
0073    virtual void SetPDG(Int_t pdgcode) { fPDG = pdgcode; }
0074 
0075    ClassDefOverride(TVirtualGeoTrack, 1) 
0076 };
0077 
0078 #endif