Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:39

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 TGeoShape;
0018 class TGeoHMatrix;
0019 class TGeoCompositeShape;
0020 class TBuffer3D;
0021 
0022 namespace ROOT {
0023 namespace Experimental {
0024 
0025 class REveGeoShapeExtract;
0026 
0027 // ==========================================================================================
0028 // REveGeoShape
0029 // Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted
0030 // TGeoShape's (without an active TGeoManager) and simplified geometries (needed for NLT projections).
0031 // ==========================================================================================
0032 
0033 class REveGeoShape : public REveShape,
0034                      public REveProjectable
0035 {
0036 private:
0037    REveGeoShape(const REveGeoShape &) = delete;
0038    REveGeoShape &operator=(const REveGeoShape &) = delete;
0039 
0040 protected:
0041    Int_t fNSegments{0};
0042    TGeoShape *fShape{nullptr};
0043    TGeoCompositeShape *fCompositeShape{nullptr}; //! Temporary holder (if passed shape is composite shape).
0044 
0045    static TGeoManager *fgGeoManager;
0046 
0047    static REveGeoShape *SubImportShapeExtract(REveGeoShapeExtract *gse, REveElement *parent);
0048    REveGeoShapeExtract *DumpShapeTree(REveGeoShape *geon, REveGeoShapeExtract *parent = nullptr);
0049 
0050    TGeoShape *MakePolyShape();
0051 
0052 public:
0053    REveGeoShape(const std::string &name = "REveGeoShape", const std::string &title = "");
0054    ~REveGeoShape() override;
0055 
0056    Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
0057    void BuildRenderData() override;
0058 
0059    Int_t GetNSegments() const { return fNSegments; }
0060    TGeoShape *GetShape() const { return fShape; }
0061    void SetNSegments(Int_t s);
0062    void SetShape(TGeoShape *s);
0063 
0064    void ComputeBBox() override;
0065 
0066    void SaveExtract(const char *file, const char *name);
0067    void WriteExtract(const char *name);
0068 
0069    static REveGeoShape *ImportShapeExtract(REveGeoShapeExtract *gse, REveElement *parent = nullptr);
0070 
0071    // GeoProjectable
0072    virtual std::unique_ptr<TBuffer3D> MakeBuffer3D();
0073    TClass *ProjectedClass(const REveProjection *p) const override;
0074 
0075    static TGeoManager *GetGeoManager();
0076    static TGeoHMatrix *GetGeoHMatrixIdentity();
0077 };
0078 
0079 //------------------------------------------------------------------------------
0080 
0081 // ==========================================================================================
0082 // REveGeoShapeProjected
0083 // ==========================================================================================
0084 
0085 class REveGeoShapeProjected : public REveShape, public REveProjected {
0086 private:
0087    REveGeoShapeProjected(const REveGeoShapeProjected &) = delete;
0088    REveGeoShapeProjected &operator=(const REveGeoShapeProjected &) = delete;
0089 
0090 protected:
0091    std::unique_ptr<TBuffer3D> fBuff;    //! 3d buffer
0092 
0093    void SetDepthLocal(Float_t d) override;
0094 
0095 public:
0096    REveGeoShapeProjected();
0097    ~REveGeoShapeProjected() override;
0098 
0099    void SetProjection(REveProjectionManager *proj, REveProjectable *model) override;
0100    void UpdateProjection() override;
0101    REveElement *GetProjectedAsElement() override { return this; }
0102 
0103    void ComputeBBox() override;
0104 };
0105 
0106 } // namespace Experimental
0107 } // namespace ROOT
0108 
0109 #endif