ROOT  6.06/09
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 #ifndef ROOT_TObjArray
16 #include "TObjArray.h"
17 #endif
18 
19 #ifndef ROOT_TGeoAtt
20 #include "TGeoAtt.h"
21 #endif
22 
23 #ifndef ROOT_TAttLine
24 #include "TAttLine.h"
25 #endif
26 
27 #ifndef ROOT_TAttMarker
28 #include "TAttMarker.h"
29 #endif
30 
31 ////////////////////////////////////////////////////////////////////////////
32 // //
33 // TVirtualGeoTrack - Base class for user-defined tracks attached to a //
34 // geometry. Tracks are 3D objects made of points and they //
35 // store a pointer to a TParticle. The geometry manager holds //
36 // a list of all tracks that will be deleted on destruction //
37 // of TGeoManager object. //
38 // //
39 ////////////////////////////////////////////////////////////////////////////
40 
41 class TVirtualGeoTrack : public TObject,
42  public TGeoAtt,
43  public TAttLine,
44  public TAttMarker
45 {
46 protected:
47  Int_t fPDG; // track pdg code
48  Int_t fId; // track id
49  TVirtualGeoTrack *fParent; // id of parent
50  TObject *fParticle; // particle for this track
51  TObjArray *fTracks; // daughter tracks
52 
55 
56 public:
58  TVirtualGeoTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent=0, TObject *particle=0);
59  virtual ~TVirtualGeoTrack();
60 
61  virtual TVirtualGeoTrack *AddDaughter(Int_t id, Int_t pdgcode, TObject *particle=0) = 0;
62  virtual Int_t AddDaughter(TVirtualGeoTrack *other) = 0;
63  virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t) = 0;
64  virtual TVirtualGeoTrack *FindTrackWithId(Int_t id) const;
65  Int_t GetId() const {return fId;}
66  virtual Int_t GetDaughterId(Int_t index) const;
67  TVirtualGeoTrack *GetDaughter(Int_t index) const {return (TVirtualGeoTrack*)fTracks->At(index);}
68  TVirtualGeoTrack *GetMother() const {return fParent;}
69  TObject *GetMotherParticle() const {return (fParent)?fParent->GetParticle():0;}
70  virtual const char *GetName() const;
71  Int_t GetNdaughters() const {return (fTracks)?fTracks->GetEntriesFast():0;}
72  virtual Int_t GetNpoints() const = 0;
73  Int_t GetParentId() const {return (fParent)?fParent->GetId():-1;}
74  TObject *GetParticle() const {return fParticle;}
75  Int_t GetPDG() const {return fPDG;}
76  Int_t GetLastPoint(Double_t &x, Double_t &y, Double_t &z, Double_t &t) const {return GetPoint(GetNpoints()-1,x,y,z,t);}
77  const Double_t *GetFirstPoint() const {return GetPoint(0);}
78  const Double_t *GetLastPoint() const {return GetPoint(GetNpoints()-1);}
79  virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const = 0;
80  virtual const Double_t *GetPoint(Int_t i) const = 0;
81  Bool_t HasPoints() const {return (GetNpoints()==0)?kFALSE:kTRUE;}
82  Bool_t IsInTimeRange() const;
83  virtual void Paint(Option_t *option="") = 0;
84  virtual void PaintCollect(Double_t /*time*/, Double_t * /*box*/) {;}
85  virtual void PaintCollectTrack(Double_t /*time*/, Double_t * /*box*/) {;}
86  virtual void PaintTrack(Option_t *option="") = 0;
87  virtual void ResetTrack() = 0;
88  void SetName(const char *name);
89  virtual void SetParticle(TObject *particle) {fParticle=particle;}
90  void SetParent(TVirtualGeoTrack *parent) {fParent = parent;}
91  void SetId(Int_t id) {fId = id;}
92  virtual void SetPDG(Int_t pdgcode) {fPDG = pdgcode;}
93 
94  ClassDef(TVirtualGeoTrack, 1) // virtual geometry tracks
95 };
96 
97 #endif
98 
99 
100 
101 
Int_t GetNdaughters() const
Bool_t IsInTimeRange() const
True if track TOF range overlaps with time interval of TGeoManager.
An array of TObjects.
Definition: TObjArray.h:39
virtual TVirtualGeoTrack * FindTrackWithId(Int_t id) const
Recursively search through this track for a daughter particle (at any depth) with the specified id...
virtual void SetPDG(Int_t pdgcode)
const char Option_t
Definition: RtypesCore.h:62
const Double_t * GetLastPoint() const
const Double_t * GetFirstPoint() const
void SetId(Int_t id)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Int_t GetEntriesFast() const
Definition: TObjArray.h:66
Int_t GetId() const
virtual Int_t GetDaughterId(Int_t index) const
Returns daughter id.
Marker Attributes class.
Definition: TAttMarker.h:32
Double_t x[n]
Definition: legend1.C:17
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const =0
virtual void ResetTrack()=0
TObject * GetMotherParticle() const
Bool_t HasPoints() const
ClassDef(TAttLine, 2)
XFontStruct * id
Definition: TGX11.cxx:108
TVirtualGeoTrack * GetMother() const
void SetName(const char *name)
Set a default name for this track.
TObject * GetParticle() const
virtual void PaintCollect(Double_t, Double_t *)
Int_t GetPDG() const
double Double_t
Definition: RtypesCore.h:55
Double_t y[n]
Definition: legend1.C:17
TVirtualGeoTrack & operator=(const TVirtualGeoTrack &)
Assignment operator. NOT TO BE CALLED.
virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t)=0
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual void Paint(Option_t *option="")=0
This method must be overridden if a class wants to paint itself.
Mother of all ROOT objects.
Definition: TObject.h:58
virtual void PaintTrack(Option_t *option="")=0
TVirtualGeoTrack * GetDaughter(Int_t index) const
TObjArray * fTracks
virtual Int_t GetNpoints() const =0
virtual TVirtualGeoTrack * AddDaughter(Int_t id, Int_t pdgcode, TObject *particle=0)=0
virtual const char * GetName() const
Get the PDG name.
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
Int_t GetParentId() const
virtual void SetParticle(TObject *particle)
Int_t GetLastPoint(Double_t &x, Double_t &y, Double_t &z, Double_t &t) const
const Bool_t kTRUE
Definition: Rtypes.h:91
TVirtualGeoTrack * fParent
Line Attributes class.
Definition: TAttLine.h:32
void SetParent(TVirtualGeoTrack *parent)
virtual ~TVirtualGeoTrack()
Destructor.
virtual void PaintCollectTrack(Double_t, Double_t *)