Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
23 #include "TVirtualGeoPainter.h"
24 
25 #include "TGeoManager.h"
26 
27 class TString;
28 class TGeoHMatrix;
29 class TGeoNode;
30 class TGeoVolume;
31 class TGeoShape;
32 class TVirtualGeoTrack;
33 class TGeoPhysicalNode;
34 class TGeoChecker;
35 class TGeoOverlap;
36 class TH2F;
37 class TGeoBatemanSol;
38 class TGeoPolygon;
39 
40 class TGeoPainter : public TVirtualGeoPainter {
41 private:
42  Double_t fBombX; // bomb factor on X
43  Double_t fBombY; // bomb factor on Y
44  Double_t fBombZ; // bomb factor on Z
45  Double_t fBombR; // bomb factor on radius (cyl or sph)
46  Double_t fCheckedBox[6]; // bounding box of checked node
47  Double_t fMat[9]; // view rotation matrix
48  Int_t fNsegments; // number of segments approximating circles
49  Int_t fNVisNodes; // number of visible nodes
50  Int_t fVisLevel; // depth for drawing
51  Int_t fVisOption; // global visualization option
52  Int_t fExplodedView; // type of exploding current view
53  Bool_t fVisLock; // lock for adding visible volumes
54  Bool_t fTopVisible; // set top volume visible
55  Bool_t fPaintingOverlaps; // lock overlaps painting
56  Bool_t fIsRaytracing; // raytracing flag
57  Bool_t fIsPaintingShape; // flag for shape painting
58  TString fVisBranch; // drawn branch
59  TString fVolInfo; // volume info
60  TGeoNode *fCheckedNode; // checked node
61  TGeoOverlap *fOverlap; // current overlap
62  TGeoHMatrix *fGlobal; // current global matrix
63  TBuffer3D *fBuffer; // buffer used for painting
64  TGeoManager *fGeoManager; // geometry to which applies
65  TGeoChecker *fChecker; // geometry checker
66  TGeoShape *fClippingShape; // clipping shape
67  TGeoVolume *fTopVolume; // top drawn volume
68  TGeoVolume *fLastVolume; // last drawn volume
69  TGeoIteratorPlugin
70  *fPlugin; // User iterator plugin for changing pain volume properties
71  TObjArray *fVisVolumes; // list of visible volumes
72  Bool_t fIsEditable; // flag that geometry is editable
73 
74  void DefineColors() const;
75  void LocalToMasterVect(const Double_t *local, Double_t *master) const;
76 
77 protected:
78  virtual void ClearVisibleVolumes();
79 
80 public:
81  TGeoPainter(TGeoManager *manager);
82  virtual ~TGeoPainter();
83  virtual void AddSize3D(Int_t numpoints, Int_t numsegs, Int_t numpolys);
84  virtual TVirtualGeoTrack *AddTrack(Int_t id, Int_t pdgcode, TObject *part);
85  virtual void AddTrackPoint(Double_t *point, Double_t *box, Bool_t reset=kFALSE);
86  virtual void BombTranslation(const Double_t *tr, Double_t *bombtr);
87  virtual void CheckBoundaryErrors(Int_t ntracks=1000000, Double_t radius=-1.);
88  virtual void CheckBoundaryReference(Int_t icheck=-1);
89  virtual void CheckGeometryFull(Bool_t checkoverlaps=kTRUE, Bool_t checkcrossings=kTRUE, Int_t nrays=10000, const Double_t *vertex=NULL);
90  virtual void CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const;
91  void CheckEdit();
92  virtual void CheckPoint(Double_t x=0, Double_t y=0, Double_t z=0, Option_t *option="");
93  virtual void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option);
94  virtual void CheckOverlaps(const TGeoVolume *vol, Double_t ovlp=0.1, Option_t *option="") const;
95  Int_t CountNodes(TGeoVolume *vol, Int_t level) const;
96  virtual Int_t CountVisibleNodes();
97  virtual void DefaultAngles();
98  virtual void DefaultColors();
99  virtual Int_t DistanceToPrimitiveVol(TGeoVolume *vol, Int_t px, Int_t py);
100  virtual void Draw(Option_t *option="");
101  virtual void DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option="");
102  virtual void DrawOverlap(void *ovlp, Option_t *option="");
103  virtual void DrawCurrentPoint(Int_t color);
104  virtual void DrawOnly(Option_t *option="");
105  virtual void DrawPanel();
106  virtual void DrawPath(const char *path, Option_t *option="");
107  virtual void DrawPolygon(const TGeoPolygon *poly);
108  virtual void DrawShape(TGeoShape *shape, Option_t *option="");
109  virtual void DrawVolume(TGeoVolume *vol, Option_t *option="");
110  virtual void EditGeometry(Option_t *option="");
111  virtual void EstimateCameraMove(Double_t tmin, Double_t tmax, Double_t *start, Double_t *end);
112  virtual void ExecuteManagerEvent(TGeoManager *geom, Int_t event, Int_t px, Int_t py);
113  virtual void ExecuteShapeEvent(TGeoShape *shape, Int_t event, Int_t px, Int_t py);
114  virtual void ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py);
115  virtual const char*GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const;
116  virtual void GetBombFactors(Double_t &bombx, Double_t &bomby, Double_t &bombz, Double_t &bombr) const
117  {bombx=fBombX; bomby=fBombY; bombz=fBombZ; bombr=fBombR;}
118  virtual Int_t GetBombMode() const {return fExplodedView;}
119  virtual TGeoNode *GetCheckedNode() {return fCheckedNode;}
120  TGeoChecker *GetChecker();
121  virtual Int_t GetColor(Int_t base, Float_t light) const;
122  virtual const char *GetDrawPath() const {return fVisBranch.Data();}
123  virtual TGeoVolume *GetDrawnVolume() const;
124  virtual TGeoVolume *GetTopVolume() const {return fTopVolume;}
125  virtual Int_t GetVisLevel() const {return fVisLevel;}
126  virtual Int_t GetVisOption() const {return fVisOption;}
127  Int_t GetNsegments() const {return fNsegments;}
128  virtual void GrabFocus(Int_t nfr=0, Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0);
129  virtual Double_t *GetViewBox() {return &fCheckedBox[0];}
130  virtual void GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi);
131  virtual Bool_t IsExplodedView() const {return ((fExplodedView==kGeoVisDefault)?kFALSE:kTRUE);}
132  virtual Bool_t IsRaytracing() const {return fIsRaytracing;}
133  virtual Bool_t IsPaintingShape() const {return fIsPaintingShape;}
134  TH2F *LegoPlot(Int_t ntheta=60, Double_t themin=0., Double_t themax=180.,
135  Int_t nphi=90, Double_t phimin=0., Double_t phimax=360.,
136  Double_t rmin=0., Double_t rmax=9999999, Option_t *option="");
137  void Lock(Bool_t flag = kTRUE) {fVisLock = flag;}
138  virtual void ModifiedPad(Bool_t update=kFALSE) const;
139  virtual void OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch=0, Bool_t last=kFALSE, Bool_t refresh=kFALSE, const char *msg="");
140  virtual void Paint(Option_t *option="");
141  virtual void PaintNode(TGeoNode *node, Option_t *option="", TGeoMatrix* global=0);
142  Bool_t PaintShape(const TGeoShape & shape, Option_t * option) const;
143  virtual void PaintShape(TGeoShape *shape, Option_t *option="");
144  virtual void PaintOverlap(void *ovlp, Option_t *option="");
145  virtual void PaintVolume(TGeoVolume *vol, Option_t *option="", TGeoMatrix* global=0);
146  virtual void PrintOverlaps() const;
147  void PaintPhysicalNode(TGeoPhysicalNode *node, Option_t *option="");
148  virtual void RandomPoints(const TGeoVolume *vol, Int_t npoints, Option_t *option="");
149  virtual void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol=0, Bool_t check_norm=kFALSE);
150  virtual void Raytrace(Option_t *option="");
151  virtual TGeoNode *SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char* g3path);
152  virtual void SetBombFactors(Double_t bombx=1.3, Double_t bomby=1.3, Double_t bombz=1.3, Double_t bombr=1.3);
153  virtual void SetClippingShape(TGeoShape *shape) {fClippingShape = shape;}
154  virtual void SetExplodedView(Int_t iopt=0);
155  virtual void SetNsegments(Int_t nseg=20);
156  virtual void SetNmeshPoints(Int_t npoints);
157  virtual void SetGeoManager(TGeoManager *geom) {fGeoManager=geom;}
158  virtual void SetIteratorPlugin(TGeoIteratorPlugin *plugin) {fPlugin = plugin; ModifiedPad();}
159  virtual void SetCheckedNode(TGeoNode *node);
160  virtual void SetRaytracing(Bool_t flag=kTRUE) {fIsRaytracing = flag;}
161  virtual void SetTopVisible(Bool_t vis=kTRUE);
162  virtual void SetTopVolume(TGeoVolume *vol) {fTopVolume = vol;}
163  virtual void SetVisLevel(Int_t level=3);
164  virtual void SetVisOption(Int_t option=0);
165  virtual Int_t ShapeDistancetoPrimitive(const TGeoShape *shape, Int_t numpoints, Int_t px, Int_t py) const;
166  virtual void Test(Int_t npoints, Option_t *option);
167  virtual void TestOverlaps(const char *path);
168  virtual Bool_t TestVoxels(TGeoVolume *vol);
169  virtual void UnbombTranslation(const Double_t *tr, Double_t *bombtr);
170  virtual Double_t Weight(Double_t precision, Option_t *option="v");
171 
172  ClassDef(TGeoPainter,0) //geometry painter
173 };
174 
175 #endif