Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
23class TVirtualGeoTrack : public TObject, public TGeoAtt, public TAttLine, public TAttMarker {
24protected:
25 Int_t fPDG{0}; // track pdg code
26 Int_t fId{-1}; // track id
27 TVirtualGeoTrack *fParent{nullptr}; // id of parent
28 TObject *fParticle{nullptr}; // particle for this track
29 TObjArray *fTracks{nullptr}; // daughter tracks
30
33
34public:
36 TVirtualGeoTrack(Int_t id, Int_t pdgcode, TVirtualGeoTrack *parent = nullptr, TObject *particle = nullptr);
37 ~TVirtualGeoTrack() override;
38
39 virtual TVirtualGeoTrack *AddDaughter(Int_t id, Int_t pdgcode, TObject *particle = nullptr) = 0;
40 virtual Int_t AddDaughter(TVirtualGeoTrack *other) = 0;
41 virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t) = 0;
42 virtual TVirtualGeoTrack *FindTrackWithId(Int_t id) const;
43 Int_t GetId() const { return fId; }
44 virtual Int_t GetDaughterId(Int_t index) const;
46 TVirtualGeoTrack *GetMother() const { return fParent; }
47 TObject *GetMotherParticle() const { return fParent ? fParent->GetParticle() : nullptr; }
48 const char *GetName() const override;
49 Int_t GetNdaughters() const { return fTracks ? fTracks->GetEntriesFast() : 0; }
50 virtual Int_t GetNpoints() const = 0;
51 Int_t GetParentId() const { return fParent ? fParent->GetId() : -1; }
52 TObject *GetParticle() const { return fParticle; }
53 Int_t GetPDG() const { return fPDG; }
55 {
56 return GetPoint(GetNpoints() - 1, x, y, z, t);
57 }
58 const Double_t *GetFirstPoint() const { return GetPoint(0); }
59 const Double_t *GetLastPoint() const { return GetPoint(GetNpoints() - 1); }
60 virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const = 0;
61 virtual const Double_t *GetPoint(Int_t i) const = 0;
62 Bool_t HasPoints() const { return (GetNpoints() == 0) ? kFALSE : kTRUE; }
63 Bool_t IsInTimeRange() const;
64 void Paint(Option_t *option = "") override = 0;
65 virtual void PaintCollect(Double_t /*time*/, Double_t * /*box*/) {}
66 virtual void PaintCollectTrack(Double_t /*time*/, Double_t * /*box*/) {}
67 virtual void PaintTrack(Option_t *option = "") = 0;
68 virtual void ResetTrack() = 0;
69 void SetName(const char *name);
70 virtual void SetParticle(TObject *particle) { fParticle = particle; }
71 void SetParent(TVirtualGeoTrack *parent) { fParent = parent; }
72 void SetId(Int_t id) { fId = id; }
73 virtual void SetPDG(Int_t pdgcode) { fPDG = pdgcode; }
74
75 ClassDefOverride(TVirtualGeoTrack, 1) // virtual geometry tracks
76};
77
78#endif
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
char name[80]
Definition TGX11.cxx:110
Line Attributes class.
Definition TAttLine.h:18
Marker Attributes class.
Definition TAttMarker.h:19
Visualization and tracking attributes for volumes and nodes.
Definition TGeoAtt.h:17
An array of TObjects.
Definition TObjArray.h:31
Int_t GetEntriesFast() const
Definition TObjArray.h:58
TObject * At(Int_t idx) const override
Definition TObjArray.h:164
Mother of all ROOT objects.
Definition TObject.h:41
Base class for user-defined tracks attached to a geometry.
const Double_t * GetFirstPoint() const
virtual TVirtualGeoTrack * AddDaughter(Int_t id, Int_t pdgcode, TObject *particle=nullptr)=0
Int_t GetParentId() const
virtual Int_t GetDaughterId(Int_t index) const
Returns daughter id.
Bool_t HasPoints() const
TObject * GetParticle() const
virtual Int_t GetNpoints() const =0
Int_t GetId() const
TVirtualGeoTrack * fParent
~TVirtualGeoTrack() override
Destructor.
virtual Int_t AddDaughter(TVirtualGeoTrack *other)=0
virtual void AddPoint(Double_t x, Double_t y, Double_t z, Double_t t)=0
void SetParent(TVirtualGeoTrack *parent)
void Paint(Option_t *option="") override=0
This method must be overridden if a class wants to paint itself.
void SetName(const char *name)
Set a default name for this track.
TVirtualGeoTrack * GetMother() const
virtual void ResetTrack()=0
const Double_t * GetLastPoint() const
TVirtualGeoTrack(const TVirtualGeoTrack &)=delete
virtual void SetParticle(TObject *particle)
TVirtualGeoTrack * GetDaughter(Int_t index) const
TVirtualGeoTrack()
Virtual tracks default constructor.
virtual void PaintCollect(Double_t, Double_t *)
virtual const Double_t * GetPoint(Int_t i) const =0
Int_t GetPDG() const
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)
Int_t GetLastPoint(Double_t &x, Double_t &y, Double_t &z, Double_t &t) const
virtual Int_t GetPoint(Int_t i, Double_t &x, Double_t &y, Double_t &z, Double_t &t) const =0
Bool_t IsInTimeRange() const
True if track TOF range overlaps with time interval of TGeoManager.
TObject * GetMotherParticle() const
virtual void PaintTrack(Option_t *option="")=0
void SetId(Int_t id)
const char * GetName() const override
Get the PDG name.
virtual void PaintCollectTrack(Double_t, Double_t *)
TVirtualGeoTrack & operator=(const TVirtualGeoTrack &)=delete
Int_t GetNdaughters() const
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17