Logo ROOT  
Reference Guide
TVirtualGeoTrack.h
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 2003/04/10
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TVirtualGeoTrack
13 #define ROOT_TVirtualGeoTrack
14 
15 #include "TObjArray.h"
16 
17 #include "TGeoAtt.h"
18 
19 #include "TAttLine.h"
20 
21 #include "TAttMarker.h"
22 
23 class TVirtualGeoTrack : public TObject,
24  public TGeoAtt,
25  public TAttLine,
26  public TAttMarker
27 {
28 protected:
29  Int_t fPDG{0}; // track pdg code
30  Int_t fId{-1}; // track id
31  TVirtualGeoTrack *fParent{nullptr}; // id of parent
32  TObject *fParticle{nullptr}; // particle for this track
33  TObjArray *fTracks{nullptr}; // daughter tracks
34 
37 
38 public:
40  TVirtualGeoTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0);
41  virtual ~TVirtualGeoTrack();
42 
43  virtual TVirtualGeoTrack *AddDaughter(Int_t id, Int_t pdgcode, TObject *particle=0) = 0;
44  virtual Int_t AddDaughter(TVirtualGeoTrack *other) = 0;
45  virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t) = 0;
46  virtual TVirtualGeoTrack *FindTrackWithId(Int_t id) const;
47  Int_t GetId() const {return fId;}
48  virtual Int_t GetDaughterId(Int_t index) const;
49  TVirtualGeoTrack *GetDaughter(Int_t index) const {return (TVirtualGeoTrack*)fTracks->At(index);}
50  TVirtualGeoTrack *GetMother() const {return fParent;}
52  virtual const char *GetName() const;
54  virtual Int_t GetNpoints() const = 0;
55  Int_t GetParentId() const {return (fParent)?fParent->GetId():-1;}
56  TObject *GetParticle() const {return fParticle;}
57  Int_t GetPDG() const {return fPDG;}
58  Int_t GetLastPoint(Double_t &x, Double_t &y, Double_t &z, Double_t &t) const {return GetPoint(GetNpoints()-1,x,y,z,t);}
59  const Double_t *GetFirstPoint() const {return GetPoint(0);}
60  const Double_t *GetLastPoint() const {return GetPoint(GetNpoints()-1);}
61  virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const = 0;
62  virtual const Double_t *GetPoint(Int_t i) const = 0;
63  Bool_t HasPoints() const {return (GetNpoints()==0)?kFALSE:kTRUE;}
64  Bool_t IsInTimeRange() const;
65  virtual void Paint(Option_t *option="") = 0;
66  virtual void PaintCollect(Double_t /*time*/, Double_t * /*box*/) {;}
67  virtual void PaintCollectTrack(Double_t /*time*/, Double_t * /*box*/) {;}
68  virtual void PaintTrack(Option_t *option="") = 0;
69  virtual void ResetTrack() = 0;
70  void SetName(const char *name);
71  virtual void SetParticle(TObject *particle) {fParticle=particle;}
72  void SetParent(TVirtualGeoTrack *parent) {fParent = parent;}
73  void SetId(Int_t id) {fId = id;}
74  virtual void SetPDG(Int_t pdgcode) {fPDG = pdgcode;}
75 
76  ClassDef(TVirtualGeoTrack, 1) // virtual geometry tracks
77 };
78 
79 #endif
80 
81 
82 
83 
TVirtualGeoTrack::GetDaughter
TVirtualGeoTrack * GetDaughter(Int_t index) const
Definition: TVirtualGeoTrack.h:49
TVirtualGeoTrack::PaintCollect
virtual void PaintCollect(Double_t, Double_t *)
Definition: TVirtualGeoTrack.h:66
TVirtualGeoTrack::ResetTrack
virtual void ResetTrack()=0
TVirtualGeoTrack::FindTrackWithId
virtual TVirtualGeoTrack * FindTrackWithId(Int_t id) const
Recursively search through this track for a daughter particle (at any depth) with the specified id.
Definition: TVirtualGeoTrack.cxx:83
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TVirtualGeoTrack::Paint
virtual void Paint(Option_t *option="")=0
This method must be overridden if a class wants to paint itself.
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
TVirtualGeoTrack::TVirtualGeoTrack
TVirtualGeoTrack()
Virtual tracks default constructor.
Definition: TVirtualGeoTrack.cxx:33
Option_t
const char Option_t
Definition: RtypesCore.h:66
TVirtualGeoTrack::PaintTrack
virtual void PaintTrack(Option_t *option="")=0
TVirtualGeoTrack::GetNdaughters
Int_t GetNdaughters() const
Definition: TVirtualGeoTrack.h:53
TVirtualGeoTrack::GetParentId
Int_t GetParentId() const
Definition: TVirtualGeoTrack.h:55
TAttMarker.h
Int_t
int Int_t
Definition: RtypesCore.h:45
TVirtualGeoTrack::~TVirtualGeoTrack
virtual ~TVirtualGeoTrack()
Destructor.
Definition: TVirtualGeoTrack.cxx:58
TVirtualGeoTrack::AddDaughter
virtual TVirtualGeoTrack * AddDaughter(Int_t id, Int_t pdgcode, TObject *particle=0)=0
TVirtualGeoTrack::fId
Int_t fId
Definition: TVirtualGeoTrack.h:30
TVirtualGeoTrack::PaintCollectTrack
virtual void PaintCollectTrack(Double_t, Double_t *)
Definition: TVirtualGeoTrack.h:67
TVirtualGeoTrack::operator=
TVirtualGeoTrack & operator=(const TVirtualGeoTrack &)=delete
x
Double_t x[n]
Definition: legend1.C:17
TVirtualGeoTrack::HasPoints
Bool_t HasPoints() const
Definition: TVirtualGeoTrack.h:63
TVirtualGeoTrack::GetMother
TVirtualGeoTrack * GetMother() const
Definition: TVirtualGeoTrack.h:50
TObjArray::At
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
TVirtualGeoTrack::TVirtualGeoTrack
TVirtualGeoTrack(const TVirtualGeoTrack &)=delete
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TVirtualGeoTrack::fParticle
TObject * fParticle
Definition: TVirtualGeoTrack.h:32
bool
id
XFontStruct * id
Definition: TGX11.cxx:109
TAttLine.h
TVirtualGeoTrack::AddPoint
virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t)=0
TGeoAtt
Visualization and tracking attributes for volumes and nodes.
Definition: TGeoAtt.h:18
TVirtualGeoTrack::GetFirstPoint
const Double_t * GetFirstPoint() const
Definition: TVirtualGeoTrack.h:59
TVirtualGeoTrack::SetId
void SetId(Int_t id)
Definition: TVirtualGeoTrack.h:73
TAttLine
Line Attributes class.
Definition: TAttLine.h:18
TVirtualGeoTrack::GetPoint
virtual const Double_t * GetPoint(Int_t i) const =0
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
TVirtualGeoTrack::GetId
Int_t GetId() const
Definition: TVirtualGeoTrack.h:47
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TVirtualGeoTrack::SetParticle
virtual void SetParticle(TObject *particle)
Definition: TVirtualGeoTrack.h:71
TAttMarker
Marker Attributes class.
Definition: TAttMarker.h:19
TVirtualGeoTrack::fTracks
TObjArray * fTracks
Definition: TVirtualGeoTrack.h:33
y
Double_t y[n]
Definition: legend1.C:17
TVirtualGeoTrack::GetNpoints
virtual Int_t GetNpoints() const =0
TVirtualGeoTrack::fParent
TVirtualGeoTrack * fParent
Definition: TVirtualGeoTrack.h:31
TVirtualGeoTrack::GetName
virtual const char * GetName() const
Get the PDG name.
Definition: TVirtualGeoTrack.cxx:106
TVirtualGeoTrack::SetParent
void SetParent(TVirtualGeoTrack *parent)
Definition: TVirtualGeoTrack.h:72
Double_t
double Double_t
Definition: RtypesCore.h:59
TVirtualGeoTrack::IsInTimeRange
Bool_t IsInTimeRange() const
True if track TOF range overlaps with time interval of TGeoManager.
Definition: TVirtualGeoTrack.cxx:114
TObjArray.h
TVirtualGeoTrack::fPDG
Int_t fPDG
Definition: TVirtualGeoTrack.h:29
TVirtualGeoTrack::GetLastPoint
const Double_t * GetLastPoint() const
Definition: TVirtualGeoTrack.h:60
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TVirtualGeoTrack::SetPDG
virtual void SetPDG(Int_t pdgcode)
Definition: TVirtualGeoTrack.h:74
TVirtualGeoTrack::GetDaughterId
virtual Int_t GetDaughterId(Int_t index) const
Returns daughter id.
Definition: TVirtualGeoTrack.cxx:69
name
char name[80]
Definition: TGX11.cxx:110
TVirtualGeoTrack::GetParticle
TObject * GetParticle() const
Definition: TVirtualGeoTrack.h:56
TVirtualGeoTrack::SetName
void SetName(const char *name)
Set a default name for this track.
Definition: TVirtualGeoTrack.cxx:130
TVirtualGeoTrack::GetMotherParticle
TObject * GetMotherParticle() const
Definition: TVirtualGeoTrack.h:51
TVirtualGeoTrack::GetLastPoint
Int_t GetLastPoint(Double_t &x, Double_t &y, Double_t &z, Double_t &t) const
Definition: TVirtualGeoTrack.h:58
TVirtualGeoTrack
Base class for user-defined tracks attached to a geometry.
Definition: TVirtualGeoTrack.h:27
TVirtualGeoTrack::AddDaughter
virtual Int_t AddDaughter(TVirtualGeoTrack *other)=0
TGeoAtt.h
int
TVirtualGeoTrack::GetPDG
Int_t GetPDG() const
Definition: TVirtualGeoTrack.h:57
TVirtualGeoTrack::GetPoint
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const =0