File indexing completed on 2025-01-18 10:11:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef ROOT_TGeoPainter
0011 #define ROOT_TGeoPainter
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "TVirtualGeoPainter.h"
0023
0024 #include "TGeoManager.h"
0025
0026 class TString;
0027 class TGeoHMatrix;
0028 class TGeoNode;
0029 class TGeoVolume;
0030 class TGeoShape;
0031 class TVirtualGeoTrack;
0032 class TGeoPhysicalNode;
0033 class TGeoChecker;
0034 class TGeoOverlap;
0035 class TH2F;
0036 class TGeoBatemanSol;
0037 class TGeoPolygon;
0038
0039 class TGeoPainter : public TVirtualGeoPainter {
0040 private:
0041 Double_t fBombX;
0042 Double_t fBombY;
0043 Double_t fBombZ;
0044 Double_t fBombR;
0045 Double_t fCheckedBox[6];
0046 Double_t fMat[9];
0047 Int_t fNsegments;
0048 Int_t fNVisNodes;
0049 Int_t fVisLevel;
0050 Int_t fVisOption;
0051 Int_t fExplodedView;
0052 Bool_t fVisLock;
0053 Bool_t fTopVisible;
0054 Bool_t fPaintingOverlaps;
0055 Bool_t fIsRaytracing;
0056 Bool_t fIsPaintingShape;
0057 TString fVisBranch;
0058 TString fVolInfo;
0059 TGeoNode *fCheckedNode;
0060 TGeoOverlap *fOverlap;
0061 TGeoHMatrix *fGlobal;
0062 TBuffer3D *fBuffer;
0063 TGeoManager *fGeoManager;
0064 TGeoChecker *fChecker;
0065 TGeoShape *fClippingShape;
0066 TGeoVolume *fTopVolume;
0067 TGeoVolume *fLastVolume;
0068 TGeoIteratorPlugin *fPlugin;
0069 TObjArray *fVisVolumes;
0070 Bool_t fIsEditable;
0071
0072 void DefineColors() const;
0073 void LocalToMasterVect(const Double_t *local, Double_t *master) const;
0074
0075 protected:
0076 void ClearVisibleVolumes();
0077
0078 public:
0079 TGeoPainter(TGeoManager *manager);
0080 ~TGeoPainter() override;
0081
0082 void AddSize3D(Int_t numpoints, Int_t numsegs, Int_t numpolys) override;
0083 TVirtualGeoTrack *AddTrack(Int_t id, Int_t pdgcode, TObject *part) override;
0084 void AddTrackPoint(Double_t *point, Double_t *box, Bool_t reset = kFALSE) override;
0085 void BombTranslation(const Double_t *tr, Double_t *bombtr) override;
0086 void CheckBoundaryErrors(Int_t ntracks = 1000000, Double_t radius = -1.) override;
0087 void CheckBoundaryReference(Int_t icheck = -1) override;
0088 void CheckGeometryFull(Bool_t checkoverlaps = kTRUE, Bool_t checkcrossings = kTRUE, Int_t nrays = 10000,
0089 const Double_t *vertex = nullptr) override;
0090 void CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const override;
0091 void CheckEdit();
0092 void CheckPoint(Double_t x = 0, Double_t y = 0, Double_t z = 0, Option_t *option = "", Double_t safety = 0.) override;
0093 void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option) override;
0094 void CheckOverlaps(const TGeoVolume *vol, Double_t ovlp = 0.1, Option_t *option = "") const override;
0095 Int_t CountNodes(TGeoVolume *vol, Int_t level) const;
0096 Int_t CountVisibleNodes() override;
0097 void DefaultAngles() override;
0098 void DefaultColors() override;
0099 Int_t DistanceToPrimitiveVol(TGeoVolume *vol, Int_t px, Int_t py) override;
0100 void Draw(Option_t *option = "") override;
0101 void DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option = "") override;
0102 void DrawOverlap(void *ovlp, Option_t *option = "") override;
0103 void DrawCurrentPoint(Int_t color) override;
0104 void DrawOnly(Option_t *option = "") override;
0105 void DrawPanel() override;
0106 void DrawPath(const char *path, Option_t *option = "") override;
0107 void DrawPolygon(const TGeoPolygon *poly) override;
0108 void DrawShape(TGeoShape *shape, Option_t *option = "") override;
0109 void DrawVolume(TGeoVolume *vol, Option_t *option = "") override;
0110 void EditGeometry(Option_t *option = "") override;
0111 void EstimateCameraMove(Double_t tmin, Double_t tmax, Double_t *start, Double_t *end) override;
0112 void ExecuteManagerEvent(TGeoManager *geom, Int_t event, Int_t px, Int_t py) override;
0113 void ExecuteShapeEvent(TGeoShape *shape, Int_t event, Int_t px, Int_t py) override;
0114 void ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py) override;
0115 const char *GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const override;
0116 void GetBombFactors(Double_t &bombx, Double_t &bomby, Double_t &bombz, Double_t &bombr) const override
0117 {
0118 bombx = fBombX;
0119 bomby = fBombY;
0120 bombz = fBombZ;
0121 bombr = fBombR;
0122 }
0123 Int_t GetBombMode() const override { return fExplodedView; }
0124 TGeoNode *GetCheckedNode() { return fCheckedNode; }
0125 TGeoChecker *GetChecker();
0126 Int_t GetColor(Int_t base, Float_t light) const override;
0127 const char *GetDrawPath() const override { return fVisBranch.Data(); }
0128 TGeoVolume *GetDrawnVolume() const override;
0129 TGeoVolume *GetTopVolume() const override { return fTopVolume; }
0130 Int_t GetVisLevel() const override { return fVisLevel; }
0131 Int_t GetVisOption() const override { return fVisOption; }
0132 Int_t GetNsegments() const override { return fNsegments; }
0133 void GrabFocus(Int_t nfr = 0, Double_t dlong = 0, Double_t dlat = 0, Double_t dpsi = 0) override;
0134 Double_t *GetViewBox() override { return &fCheckedBox[0]; }
0135 void GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi) override;
0136 Bool_t IsExplodedView() const override { return (fExplodedView == kGeoVisDefault) ? kFALSE : kTRUE; }
0137 Bool_t IsRaytracing() const override { return fIsRaytracing; }
0138 Bool_t IsPaintingShape() const override { return fIsPaintingShape; }
0139 TH2F *LegoPlot(Int_t ntheta = 60, Double_t themin = 0., Double_t themax = 180., Int_t nphi = 90,
0140 Double_t phimin = 0., Double_t phimax = 360., Double_t rmin = 0., Double_t rmax = 9999999,
0141 Option_t *option = "") override;
0142 void Lock(Bool_t flag = kTRUE) { fVisLock = flag; }
0143 void ModifiedPad(Bool_t update = kFALSE) const override;
0144 void OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch = nullptr,
0145 Bool_t last = kFALSE, Bool_t refresh = kFALSE, const char *msg = "") override;
0146 void Paint(Option_t *option = "") override;
0147 void PaintNode(TGeoNode *node, Option_t *option = "", TGeoMatrix *global = nullptr) override;
0148 Bool_t PaintShape(const TGeoShape &shape, Option_t *option) const;
0149 void PaintShape(TGeoShape *shape, Option_t *option = "") override;
0150 void PaintOverlap(void *ovlp, Option_t *option = "") override;
0151 void PaintVolume(TGeoVolume *vol, Option_t *option = "", TGeoMatrix *global = nullptr) override;
0152 void PrintOverlaps() const override;
0153 void PaintPhysicalNode(TGeoPhysicalNode *node, Option_t *option = "");
0154 void RandomPoints(const TGeoVolume *vol, Int_t npoints, Option_t *option = "") override;
0155 void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol = nullptr,
0156 Bool_t check_norm = kFALSE) override;
0157 void Raytrace(Option_t *option = "") override;
0158 TGeoNode *SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char *g3path) override;
0159 void SetBombFactors(Double_t bombx = 1.3, Double_t bomby = 1.3, Double_t bombz = 1.3, Double_t bombr = 1.3) override;
0160 void SetClippingShape(TGeoShape *shape) override { fClippingShape = shape; }
0161 void SetExplodedView(Int_t iopt = 0) override;
0162 void SetNsegments(Int_t nseg = 20) override;
0163 void SetNmeshPoints(Int_t npoints) override;
0164 void SetGeoManager(TGeoManager *geom) override { fGeoManager = geom; }
0165 void SetIteratorPlugin(TGeoIteratorPlugin *plugin) override
0166 {
0167 fPlugin = plugin;
0168 ModifiedPad();
0169 }
0170 void SetCheckedNode(TGeoNode *node) override;
0171 void SetRaytracing(Bool_t flag = kTRUE) override { fIsRaytracing = flag; }
0172 void SetTopVisible(Bool_t vis = kTRUE) override;
0173 void SetTopVolume(TGeoVolume *vol) override { fTopVolume = vol; }
0174 void SetVisLevel(Int_t level = 3) override;
0175 void SetVisOption(Int_t option = 0) override;
0176 Int_t ShapeDistancetoPrimitive(const TGeoShape *shape, Int_t numpoints, Int_t px, Int_t py) const override;
0177 void Test(Int_t npoints, Option_t *option) override;
0178 void TestOverlaps(const char *path) override;
0179 Bool_t TestVoxels(TGeoVolume *vol) override;
0180 void UnbombTranslation(const Double_t *tr, Double_t *bombtr) override;
0181 Double_t Weight(Double_t precision, Option_t *option = "v") override;
0182
0183 ClassDefOverride(TGeoPainter, 0)
0184 };
0185
0186 #endif