Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoPainter.h
Go to the documentation of this file.
1// Author: Andrei Gheata 05/03/02
2
3/*************************************************************************
4 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10#ifndef ROOT_TGeoPainter
11#define ROOT_TGeoPainter
12
13//////////////////////////////////////////////////////////////////////////
14// //
15// TGeoPainter //
16// //
17// Painter class utility TGeo geometries. Interfaces visualization //
18// queries with the viewers. //
19// //
20//////////////////////////////////////////////////////////////////////////
21
22#include "TVirtualGeoPainter.h"
23
24#include "TGeoManager.h"
25
26class TString;
27class TGeoHMatrix;
28class TGeoNode;
29class TGeoVolume;
30class TGeoShape;
33class TGeoOverlap;
34class TGeoBatemanSol;
35class TGeoPolygon;
36
38private:
39 Double_t fBombX; // bomb factor on X
40 Double_t fBombY; // bomb factor on Y
41 Double_t fBombZ; // bomb factor on Z
42 Double_t fBombR; // bomb factor on radius (cyl or sph)
43 Double_t fCheckedBox[6]; // bounding box of checked node
44 Double_t fMat[9]; // view rotation matrix
45 Int_t fNsegments; // number of segments approximating circles
46 Int_t fNVisNodes; // number of visible nodes
47 Int_t fVisLevel; // depth for drawing
48 Int_t fVisOption; // global visualization option
49 Int_t fExplodedView; // type of exploding current view
50 Bool_t fVisLock; // lock for adding visible volumes
51 Bool_t fTopVisible; // set top volume visible
52 Bool_t fPaintingOverlaps; // lock overlaps painting
53 Bool_t fIsRaytracing; // raytracing flag
54 Bool_t fIsPaintingShape; // flag for shape painting
55 TString fVisBranch; // drawn branch
56 TString fVolInfo; // volume info
57 TGeoNode *fCheckedNode; // checked node
58 TGeoOverlap *fOverlap; // current overlap
59 TGeoHMatrix *fGlobal; // current global matrix
60 TBuffer3D *fBuffer; // buffer used for painting
61 TGeoManager *fGeoManager; // geometry to which applies
62 TGeoShape *fClippingShape; // clipping shape
63 TGeoVolume *fTopVolume; // top drawn volume
64 TGeoVolume *fLastVolume; // last drawn volume
65 TGeoIteratorPlugin *fPlugin; // User iterator plugin for changing pain volume properties
66 TObjArray *fVisVolumes; // list of visible volumes
67 Bool_t fIsEditable; // flag that geometry is editable
68
69 void DefineColors() const;
70 void LocalToMasterVect(const Double_t *local, Double_t *master) const;
71
72protected:
74
75public:
77 ~TGeoPainter() override;
78
81 void AddTrackPoint(Double_t *point, Double_t *box, Bool_t reset = kFALSE) override;
82 void BombTranslation(const Double_t *tr, Double_t *bombtr) override;
83 void CheckEdit();
84 Int_t CountNodes(TGeoVolume *vol, Int_t level) const;
85 Int_t CountVisibleNodes() override;
86 void DefaultAngles() override;
87 void DefaultColors() override;
88 Int_t DistanceToPrimitiveVol(TGeoVolume *vol, Int_t px, Int_t py) override;
89 void Draw(Option_t *option = "") override;
90 void DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option = "") override;
91 void DrawOverlap(void *ovlp, Option_t *option = "") override;
92 void DrawCurrentPoint(Int_t color) override;
93 void DrawOnly(Option_t *option = "") override;
94 void DrawPanel() override;
95 void DrawPath(const char *path, Option_t *option = "") override;
96 void DrawPolygon(const TGeoPolygon *poly) override;
97 void DrawShape(TGeoShape *shape, Option_t *option = "") override;
98 void DrawVolume(TGeoVolume *vol, Option_t *option = "") override;
99 void EditGeometry(Option_t *option = "") override;
100 void EstimateCameraMove(Double_t tmin, Double_t tmax, Double_t *start, Double_t *end) override;
101 void ExecuteManagerEvent(TGeoManager *geom, Int_t event, Int_t px, Int_t py) override;
102 void ExecuteShapeEvent(TGeoShape *shape, Int_t event, Int_t px, Int_t py) override;
103 void ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py) override;
104 const char *GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const override;
106 {
107 bombx = fBombX;
108 bomby = fBombY;
109 bombz = fBombZ;
110 bombr = fBombR;
111 }
112 Int_t GetBombMode() const override { return fExplodedView; }
114 Int_t GetColor(Int_t base, Float_t light) const override;
115 const char *GetDrawPath() const override { return fVisBranch.Data(); }
116 TGeoVolume *GetDrawnVolume() const override;
117 TGeoVolume *GetTopVolume() const override { return fTopVolume; }
118 Int_t GetVisLevel() const override { return fVisLevel; }
119 Int_t GetVisOption() const override { return fVisOption; }
120 Int_t GetNsegments() const override { return fNsegments; }
121 void GrabFocus(Int_t nfr = 0, Double_t dlong = 0, Double_t dlat = 0, Double_t dpsi = 0) override;
122 Double_t *GetViewBox() override { return &fCheckedBox[0]; }
124 Bool_t IsExplodedView() const override { return (fExplodedView == kGeoVisDefault) ? kFALSE : kTRUE; }
125 Bool_t IsRaytracing() const override { return fIsRaytracing; }
126 Bool_t IsPaintingShape() const override { return fIsPaintingShape; }
128 void ModifiedPad(Bool_t update = kFALSE) const override;
129 void Paint(Option_t *option = "") override;
130 void PaintNode(TGeoNode *node, Option_t *option = "", TGeoMatrix *global = nullptr) override;
131 Bool_t PaintShape(const TGeoShape &shape, Option_t *option) const;
132 void PaintShape(TGeoShape *shape, Option_t *option = "") override;
133 void PaintOverlap(void *ovlp, Option_t *option = "") override;
134 void PaintVolume(TGeoVolume *vol, Option_t *option = "", TGeoMatrix *global = nullptr) override;
136 void Raytrace(Option_t *option = "") override;
137 void SetBombFactors(Double_t bombx = 1.3, Double_t bomby = 1.3, Double_t bombz = 1.3, Double_t bombr = 1.3) override;
138 void SetClippingShape(TGeoShape *shape) override { fClippingShape = shape; }
139 void SetExplodedView(Int_t iopt = 0) override;
140 void SetNsegments(Int_t nseg = 20) override;
143 {
144 fPlugin = plugin;
145 ModifiedPad();
146 }
148 void SetTopVisible(Bool_t vis = kTRUE) override;
149 void SetTopVolume(TGeoVolume *vol) override { fTopVolume = vol; }
150 void SetVisLevel(Int_t level = 3) override;
151 void SetVisOption(Int_t option = 0) override;
152 Int_t ShapeDistancetoPrimitive(const TGeoShape *shape, Int_t numpoints, Int_t px, Int_t py) const override;
153 void UnbombTranslation(const Double_t *tr, Double_t *bombtr) override;
154
155 ClassDefOverride(TGeoPainter, 0) // geometry painter
156};
157
158#endif
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t option
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Class representing the Bateman solution for a decay branch.
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:458
The manager class for any TGeo geometry.
Definition TGeoManager.h:45
Geometrical transformation package.
Definition TGeoMatrix.h:38
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
Base class describing geometry overlaps.
Definition TGeoOverlap.h:37
Class implementing all draw interfaces for a generic 3D viewer using TBuffer3D mechanism.
Definition TGeoPainter.h:37
TVirtualGeoTrack * AddTrack(Int_t id, Int_t pdgcode, TObject *part) override
Create a primary TGeoTrack.
void PaintOverlap(void *ovlp, Option_t *option="") override
Paint an overlap.
Double_t fBombZ
Definition TGeoPainter.h:41
void EstimateCameraMove(Double_t tmin, Double_t tmax, Double_t *start, Double_t *end) override
Estimate camera movement between tmin and tmax for best track display.
TObjArray * fVisVolumes
Definition TGeoPainter.h:66
TGeoIteratorPlugin * fPlugin
Definition TGeoPainter.h:65
Double_t fMat[9]
Definition TGeoPainter.h:44
const char * GetDrawPath() const override
Int_t GetBombMode() const override
TBuffer3D * fBuffer
Definition TGeoPainter.h:60
void BombTranslation(const Double_t *tr, Double_t *bombtr) override
Get the new 'bombed' translation vector according current exploded view mode.
Int_t GetNsegments() const override
void Paint(Option_t *option="") override
Paint current geometry according to option.
void EditGeometry(Option_t *option="") override
Start the geometry editor.
void GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi) override
Get the current view angles.
void SetGeoManager(TGeoManager *geom) override
TGeoManager * fGeoManager
Definition TGeoPainter.h:61
void Raytrace(Option_t *option="") override
Raytrace current drawn geometry.
TGeoNode * GetCheckedNode()
Bool_t IsPaintingShape() const override
TString fVisBranch
Definition TGeoPainter.h:55
TGeoVolume * fTopVolume
Definition TGeoPainter.h:63
~TGeoPainter() override
Default destructor.
void SetVisOption(Int_t option=0) override
Set drawing mode :
Bool_t IsExplodedView() const override
Bool_t fIsPaintingShape
Definition TGeoPainter.h:54
Double_t fBombR
Definition TGeoPainter.h:42
Int_t ShapeDistancetoPrimitive(const TGeoShape *shape, Int_t numpoints, Int_t px, Int_t py) const override
Returns distance between point px,py on the pad an a shape.
Int_t CountVisibleNodes() override
Count total number of visible nodes.
void DefineColors() const
Define 100 colors with increasing light intensities for each basic color (1-7) Register these colors ...
void SetExplodedView(Int_t iopt=0) override
Set type of exploding view.
void ExecuteManagerEvent(TGeoManager *geom, Int_t event, Int_t px, Int_t py) override
Execute mouse actions on a given volume.
void SetTopVolume(TGeoVolume *vol) override
void SetRaytracing(Bool_t flag=kTRUE) override
TGeoVolume * fLastVolume
Definition TGeoPainter.h:64
Int_t DistanceToPrimitiveVol(TGeoVolume *vol, Int_t px, Int_t py) override
Compute the closest distance of approach from point px,py to a volume.
void UnbombTranslation(const Double_t *tr, Double_t *bombtr) override
Get the new 'unbombed' translation vector according current exploded view mode.
Bool_t fVisLock
Definition TGeoPainter.h:50
void PaintNode(TGeoNode *node, Option_t *option="", TGeoMatrix *global=nullptr) override
Paint recursively a node and its content according to visualization options.
void DefaultAngles() override
Set default angles for the current view.
TGeoShape * fClippingShape
Definition TGeoPainter.h:62
Bool_t PaintShape(const TGeoShape &shape, Option_t *option) const
Paint the supplied shape into the current 3D viewer.
Bool_t fIsEditable
Definition TGeoPainter.h:67
Int_t CountNodes(TGeoVolume *vol, Int_t level) const
Count number of visible nodes down to a given level.
Double_t fCheckedBox[6]
Definition TGeoPainter.h:43
void DrawShape(TGeoShape *shape, Option_t *option="") override
Draw a shape.
void DrawOnly(Option_t *option="") override
Draw only one volume.
TGeoOverlap * fOverlap
Definition TGeoPainter.h:58
Double_t fBombY
Definition TGeoPainter.h:40
Bool_t fPaintingOverlaps
Definition TGeoPainter.h:52
void SetBombFactors(Double_t bombx=1.3, Double_t bomby=1.3, Double_t bombz=1.3, Double_t bombr=1.3) override
Set cartesian and radial bomb factors for translations.
void DefaultColors() override
Set default volume colors according to tracking media.
void CheckEdit()
Check if Ged library is loaded and load geometry editor classe.
Int_t GetVisLevel() const override
void ClearVisibleVolumes()
Clear the list of visible volumes reset the kVisOnScreen bit for volumes previously in the list.
Int_t GetColor(Int_t base, Float_t light) const override
Get index of a base color with given light intensity (0,1)
void LocalToMasterVect(const Double_t *local, Double_t *master) const
Convert a local vector according view rotation matrix.
void DrawVolume(TGeoVolume *vol, Option_t *option="") override
Draw method.
TGeoVolume * GetDrawnVolume() const override
Get currently drawn volume.
void DrawPolygon(const TGeoPolygon *poly) override
Draw a polygon in 3D.
Int_t fNsegments
Definition TGeoPainter.h:45
void PaintVolume(TGeoVolume *vol, Option_t *option="", TGeoMatrix *global=nullptr) override
Paint recursively a node and its content according to visualization options.
TString fVolInfo
Definition TGeoPainter.h:56
void SetIteratorPlugin(TGeoIteratorPlugin *plugin) override
Bool_t fTopVisible
Definition TGeoPainter.h:51
TGeoVolume * GetTopVolume() const override
TGeoHMatrix * fGlobal
Definition TGeoPainter.h:59
void GetBombFactors(Double_t &bombx, Double_t &bomby, Double_t &bombz, Double_t &bombr) const override
Int_t fVisLevel
Definition TGeoPainter.h:47
void Lock(Bool_t flag=kTRUE)
void SetNsegments(Int_t nseg=20) override
Set number of segments to approximate circles.
void AddTrackPoint(Double_t *point, Double_t *box, Bool_t reset=kFALSE) override
Average center of view of all painted tracklets and compute view box.
void GrabFocus(Int_t nfr=0, Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0) override
Move focus to current volume.
void DrawOverlap(void *ovlp, Option_t *option="") override
Draw an overlap.
void SetVisLevel(Int_t level=3) override
Set default level down to which visualization is performed.
void AddSize3D(Int_t numpoints, Int_t numsegs, Int_t numpolys) override
Add numpoints, numsegs, numpolys to the global 3D size.
TGeoNode * fCheckedNode
Definition TGeoPainter.h:57
void PaintPhysicalNode(TGeoPhysicalNode *node, Option_t *option="")
Paints a physical node associated with a path.
Int_t fNVisNodes
Definition TGeoPainter.h:46
Int_t fExplodedView
Definition TGeoPainter.h:49
const char * GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const override
Get some info about the current selected volume.
void SetClippingShape(TGeoShape *shape) override
void DrawCurrentPoint(Int_t color) override
Draw current point in the same view.
void DrawPath(const char *path, Option_t *option="") override
Draw all volumes for a given path.
void DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option="") override
Draw the time evolution of a radionuclide.
Bool_t IsRaytracing() const override
Bool_t fIsRaytracing
Definition TGeoPainter.h:53
void ExecuteShapeEvent(TGeoShape *shape, Int_t event, Int_t px, Int_t py) override
Execute mouse actions on a given shape.
Double_t * GetViewBox() override
void ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py) override
Execute mouse actions on a given volume.
TGeoPainter(TGeoManager *manager)
Default constructor.
Double_t fBombX
Definition TGeoPainter.h:39
void ModifiedPad(Bool_t update=kFALSE) const override
Check if a pad and view are present and send signal "Modified" to pad.
void SetTopVisible(Bool_t vis=kTRUE) override
Set top geometry volume as visible.
void DrawPanel() override
Int_t GetVisOption() const override
Int_t fVisOption
Definition TGeoPainter.h:48
Physical nodes are the actual 'touchable' objects in the geometry, representing a path of positioned ...
An arbitrary polygon defined by vertices.
Definition TGeoPolygon.h:19
Base abstract class for all shapes.
Definition TGeoShape.h:25
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
An array of TObjects.
Definition TObjArray.h:31
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:138
const char * Data() const
Definition TString.h:384
Abstract class for geometry painters.
Base class for user-defined tracks attached to a geometry.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
th1 Draw()