TGeoPainter.h

Go to the documentation of this file.
00001 // Author: Andrei Gheata   05/03/02
00002 
00003 /*************************************************************************
00004  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00009  *************************************************************************/
00010 #ifndef ROOT_TGeoPainter
00011 #define ROOT_TGeoPainter
00012 
00013 //////////////////////////////////////////////////////////////////////////
00014 //                                                                      //
00015 // TGeoPainter                                                          //
00016 //                                                                      //
00017 // Painter class utility TGeo geometries. Interfaces visualization      //
00018 // queries with the viewers.                                            //
00019 //                                                                      //
00020 //////////////////////////////////////////////////////////////////////////
00021 
00022 
00023 #ifndef ROOT_TVirtualGeoPainter
00024 #include "TVirtualGeoPainter.h"
00025 #endif
00026 
00027 #ifndef ROOT_TGeoManager
00028 #include "TGeoManager.h"
00029 #endif
00030 
00031 class TString;
00032 class TGeoHMatrix;
00033 class TGeoNode;
00034 class TGeoVolume;
00035 class TGeoShape;
00036 class TVirtualGeoTrack;
00037 class TGeoPhysicalNode;
00038 class TGeoChecker;
00039 class TGeoOverlap;
00040 class TH2F;
00041 class TGeoBatemanSol;
00042 
00043 class TGeoPainter : public TVirtualGeoPainter {
00044 private:
00045    Double_t           fBombX;            // bomb factor on X
00046    Double_t           fBombY;            // bomb factor on Y
00047    Double_t           fBombZ;            // bomb factor on Z
00048    Double_t           fBombR;            // bomb factor on radius (cyl or sph)
00049    Double_t           fCheckedBox[6];    // bounding box of checked node
00050    Double_t           fMat[9];           // view rotation matrix
00051    Int_t              fNsegments;        // number of segments approximating circles
00052    Int_t              fNVisNodes;        // number of visible nodes
00053    Int_t              fVisLevel;         // depth for drawing
00054    Int_t              fVisOption;        // global visualization option
00055    Int_t              fExplodedView;     // type of exploding current view
00056    Bool_t             fVisLock;          // lock for adding visible volumes
00057    Bool_t             fTopVisible;       // set top volume visible
00058    Bool_t             fPaintingOverlaps; // lock overlaps painting
00059    Bool_t             fIsRaytracing;     // raytracing flag
00060    Bool_t             fIsPaintingShape;  // flag for shape painting
00061    TString            fVisBranch;        // drawn branch
00062    TString            fVolInfo;          // volume info
00063    TGeoNode          *fCheckedNode;      // checked node
00064    TGeoOverlap       *fOverlap;          // current overlap
00065    TGeoHMatrix       *fGlobal;           // current global matrix
00066    TBuffer3D         *fBuffer;           // buffer used for painting
00067    TGeoManager       *fGeoManager;       // geometry to which applies
00068    TGeoChecker       *fChecker;          // geometry checker
00069    TGeoShape         *fClippingShape;    // clipping shape
00070    TGeoVolume        *fTopVolume;        // top drawn volume
00071    TGeoVolume        *fLastVolume;       // last drawn volume
00072    TGeoIteratorPlugin
00073                      *fPlugin;           // User iterator plugin for changing pain volume properties
00074    TObjArray         *fVisVolumes;       // list of visible volumes
00075    Bool_t             fIsEditable;       // flag that geometry is editable
00076    
00077    void               DefineColors() const;
00078    void               LocalToMasterVect(const Double_t *local, Double_t *master) const;
00079 
00080 protected:
00081    virtual void       ClearVisibleVolumes();
00082 
00083 public:
00084    TGeoPainter(TGeoManager *manager);
00085    virtual ~TGeoPainter();
00086    virtual void       AddSize3D(Int_t numpoints, Int_t numsegs, Int_t numpolys);
00087    virtual TVirtualGeoTrack *AddTrack(Int_t id, Int_t pdgcode, TObject *part);
00088    virtual void       AddTrackPoint(Double_t *point, Double_t *box, Bool_t reset=kFALSE);
00089    virtual void       BombTranslation(const Double_t *tr, Double_t *bombtr);
00090    virtual void       CheckBoundaryErrors(Int_t ntracks=1000000, Double_t radius=-1.); 
00091    virtual void       CheckBoundaryReference(Int_t icheck=-1);
00092    virtual void       CheckGeometryFull(Bool_t checkoverlaps=kTRUE, Bool_t checkcrossings=kTRUE, Int_t nrays=10000, const Double_t *vertex=NULL);
00093    virtual void       CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const;
00094    void               CheckEdit();
00095    virtual void       CheckPoint(Double_t x=0, Double_t y=0, Double_t z=0, Option_t *option="");
00096    virtual void       CheckOverlaps(const TGeoVolume *vol, Double_t ovlp=0.1, Option_t *option="") const;
00097    Int_t              CountNodes(TGeoVolume *vol, Int_t level) const;
00098    virtual Int_t      CountVisibleNodes();
00099    virtual void       DefaultAngles();
00100    virtual void       DefaultColors();
00101    virtual Int_t      DistanceToPrimitiveVol(TGeoVolume *vol, Int_t px, Int_t py);
00102    virtual void       Draw(Option_t *option="");
00103    virtual void       DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option="");
00104    virtual void       DrawOverlap(void *ovlp, Option_t *option="");
00105    virtual void       DrawCurrentPoint(Int_t color);
00106    virtual void       DrawOnly(Option_t *option="");
00107    virtual void       DrawPanel();
00108    virtual void       DrawPath(const char *path);
00109    virtual void       DrawShape(TGeoShape *shape, Option_t *option="");
00110    virtual void       DrawVolume(TGeoVolume *vol, Option_t *option="");
00111    virtual void       EditGeometry(Option_t *option="");
00112    virtual void       EstimateCameraMove(Double_t tmin, Double_t tmax, Double_t *start, Double_t *end);
00113    virtual void       ExecuteManagerEvent(TGeoManager *geom, Int_t event, Int_t px, Int_t py);
00114    virtual void       ExecuteShapeEvent(TGeoShape *shape, Int_t event, Int_t px, Int_t py);
00115    virtual void       ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py);
00116    virtual const char*GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const;
00117    virtual void       GetBombFactors(Double_t &bombx, Double_t &bomby, Double_t &bombz, Double_t &bombr) const 
00118                                     {bombx=fBombX; bomby=fBombY; bombz=fBombZ; bombr=fBombR;}
00119    virtual Int_t      GetBombMode() const      {return fExplodedView;}
00120    virtual TGeoNode  *GetCheckedNode() {return fCheckedNode;}
00121    TGeoChecker       *GetChecker();
00122    virtual Int_t      GetColor(Int_t base, Float_t light) const;
00123    virtual const char *GetDrawPath() const     {return fVisBranch.Data();}
00124    virtual TGeoVolume *GetDrawnVolume() const;
00125    virtual TGeoVolume *GetTopVolume() const {return fTopVolume;} 
00126    virtual Int_t      GetVisLevel() const      {return fVisLevel;}
00127    virtual Int_t      GetVisOption() const     {return fVisOption;}
00128    Int_t              GetNsegments() const     {return fNsegments;}
00129    virtual void       GrabFocus(Int_t nfr=0, Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0);
00130    virtual Double_t  *GetViewBox() {return &fCheckedBox[0];}
00131    virtual void       GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi);
00132    virtual Bool_t     IsExplodedView() const {return ((fExplodedView==kGeoVisDefault)?kFALSE:kTRUE);}
00133    virtual Bool_t     IsRaytracing() const {return fIsRaytracing;}
00134    virtual Bool_t     IsPaintingShape() const  {return fIsPaintingShape;}
00135    TH2F              *LegoPlot(Int_t ntheta=60, Double_t themin=0., Double_t themax=180.,
00136                             Int_t nphi=90, Double_t phimin=0., Double_t phimax=360.,
00137                             Double_t rmin=0., Double_t rmax=9999999, Option_t *option="");
00138    void               Lock(Bool_t flag = kTRUE) {fVisLock = flag;}
00139    virtual void       ModifiedPad(Bool_t update=kFALSE) const;
00140    virtual void       OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch=0, Bool_t last=kFALSE, Bool_t refresh=kFALSE);
00141    virtual void       Paint(Option_t *option="");
00142    virtual void       PaintNode(TGeoNode *node, Option_t *option="", TGeoMatrix* global=0);
00143    Bool_t             PaintShape(const TGeoShape & shape, Option_t * option) const;
00144    virtual void       PaintShape(TGeoShape *shape, Option_t *option="");
00145    virtual void       PaintOverlap(void *ovlp, Option_t *option="");
00146    virtual void       PaintVolume(TGeoVolume *vol, Option_t *option="", TGeoMatrix* global=0);
00147    virtual void       PrintOverlaps() const;
00148    void               PaintPhysicalNode(TGeoPhysicalNode *node, Option_t *option="");
00149    virtual void       RandomPoints(const TGeoVolume *vol, Int_t npoints, Option_t *option="");
00150    virtual void       RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz);
00151    virtual void       Raytrace(Option_t *option="");
00152    virtual TGeoNode  *SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char* g3path);
00153    virtual void       SetBombFactors(Double_t bombx=1.3, Double_t bomby=1.3, Double_t bombz=1.3, Double_t bombr=1.3);
00154    virtual void       SetClippingShape(TGeoShape *shape) {fClippingShape = shape;}
00155    virtual void       SetExplodedView(Int_t iopt=0);
00156    virtual void       SetNsegments(Int_t nseg=20);
00157    virtual void       SetNmeshPoints(Int_t npoints);
00158    virtual void       SetGeoManager(TGeoManager *geom) {fGeoManager=geom;}
00159    virtual void       SetIteratorPlugin(TGeoIteratorPlugin *plugin) {fPlugin = plugin; ModifiedPad();}
00160    virtual void       SetCheckedNode(TGeoNode *node);
00161    virtual void       SetRaytracing(Bool_t flag=kTRUE) {fIsRaytracing = flag;}
00162    virtual void       SetTopVisible(Bool_t vis=kTRUE);
00163    virtual void       SetTopVolume(TGeoVolume *vol) {fTopVolume = vol;}
00164    virtual void       SetVisLevel(Int_t level=3);
00165    virtual void       SetVisOption(Int_t option=0);
00166    virtual Int_t      ShapeDistancetoPrimitive(const TGeoShape *shape, Int_t numpoints, Int_t px, Int_t py) const;   
00167    virtual void       Test(Int_t npoints, Option_t *option);
00168    virtual void       TestOverlaps(const char *path);
00169    virtual Bool_t     TestVoxels(TGeoVolume *vol);
00170    virtual void       UnbombTranslation(const Double_t *tr, Double_t *bombtr);
00171    virtual Double_t   Weight(Double_t precision, Option_t *option="v");
00172 
00173    ClassDef(TGeoPainter,0)  //geometry painter
00174 };
00175 
00176 #endif

Generated on Tue Jul 5 14:13:19 2011 for ROOT_528-00b_version by  doxygen 1.5.1