Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 09:10:13

0001 // @(#)root/eve7:$Id$
0002 // Author: Matevz Tadel 2007, 1018
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT7_REveGeoShape
0013 #define ROOT7_REveGeoShape
0014 
0015 #include <ROOT/REveShape.hxx>
0016 
0017 class TGeoManager;
0018 class TGeoShape;
0019 class TGeoHMatrix;
0020 class TGeoCompositeShape;
0021 class TBuffer3D;
0022 
0023 namespace ROOT {
0024 namespace Experimental {
0025 
0026 class REveGeoShapeExtract;
0027 
0028 // ==========================================================================================
0029 // REveGeoShape
0030 // Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted
0031 // TGeoShape's (without an active TGeoManager) and simplified geometries (needed for NLT projections).
0032 // ==========================================================================================
0033 
0034 class REveGeoShape : public REveShape,
0035                      public REveProjectable
0036 {
0037 private:
0038    REveGeoShape(const REveGeoShape &) = delete;
0039    REveGeoShape &operator=(const REveGeoShape &) = delete;
0040 
0041 protected:
0042    Int_t fNSegments{0};
0043    TGeoShape *fShape{nullptr};
0044    TGeoCompositeShape *fCompositeShape{nullptr}; //! Temporary holder (if passed shape is composite shape).
0045 
0046    static TGeoManager *fgGeoManager;
0047 
0048    static REveGeoShape *SubImportShapeExtract(REveGeoShapeExtract *gse, REveElement *parent);
0049    REveGeoShapeExtract *DumpShapeTree(REveGeoShape *geon, REveGeoShapeExtract *parent = nullptr);
0050 
0051    TGeoShape *MakePolyShape();
0052 
0053 public:
0054    REveGeoShape(const std::string &name = "REveGeoShape", const std::string &title = "");
0055    ~REveGeoShape() override;
0056 
0057    Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
0058    void BuildRenderData() override;
0059 
0060    Int_t GetNSegments() const { return fNSegments; }
0061    TGeoShape *GetShape() const { return fShape; }
0062    void SetNSegments(Int_t s);
0063    void SetShape(TGeoShape *s);
0064 
0065    void ComputeBBox() override;
0066 
0067    void SaveExtract(const char *file, const char *name);
0068    void WriteExtract(const char *name);
0069 
0070    static REveGeoShape *ImportShapeExtract(REveGeoShapeExtract *gse, REveElement *parent = nullptr);
0071 
0072    // GeoProjectable
0073    virtual std::unique_ptr<TBuffer3D> MakeBuffer3D();
0074    TClass *ProjectedClass(const REveProjection *p) const override;
0075 
0076    static TGeoManager *GetGeoManager();
0077    static TGeoHMatrix *GetGeoHMatrixIdentity();
0078 };
0079 
0080 //------------------------------------------------------------------------------
0081 
0082 // ==========================================================================================
0083 // REveGeoShapeProjected
0084 // ==========================================================================================
0085 
0086 class REveGeoShapeProjected : public REveShape, public REveProjected {
0087 private:
0088    REveGeoShapeProjected(const REveGeoShapeProjected &) = delete;
0089    REveGeoShapeProjected &operator=(const REveGeoShapeProjected &) = delete;
0090 
0091 protected:
0092    std::unique_ptr<TBuffer3D> fBuff;    //! 3d buffer
0093 
0094    void SetDepthLocal(Float_t d) override;
0095 
0096 public:
0097    REveGeoShapeProjected();
0098    ~REveGeoShapeProjected() override;
0099 
0100    void SetProjection(REveProjectionManager *proj, REveProjectable *model) override;
0101    void UpdateProjection() override;
0102    REveElement *GetProjectedAsElement() override { return this; }
0103 
0104    void ComputeBBox() override;
0105 };
0106 
0107 } // namespace Experimental
0108 } // namespace ROOT
0109 
0110 #endif