Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:29:47

0001 // @(#)root/geom:$Id$
0002 // Author: Andrei Gheata   09/02/03
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, 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 ROOT_TGeoOverlap
0013 #define ROOT_TGeoOverlap
0014 
0015 #include "TNamed.h"
0016 
0017 #include "TAttLine.h"
0018 
0019 #include "TAttFill.h"
0020 
0021 #include "TAtt3D.h"
0022 
0023 #include "TGeoMatrix.h"
0024 
0025 ///////////////////////////////////////////////////////////////////////////
0026 //                                                                       //
0027 // TGeoOverlap - base class describing geometry overlaps. Overlaps apply //
0028 //   to the nodes contained inside a volume. These should not overlap to //
0029 //   each other nor extrude the shape of their mother volume.            //
0030 //                                                                       //
0031 ///////////////////////////////////////////////////////////////////////////
0032 
0033 class TGeoVolume;
0034 class TPolyMarker3D;
0035 class TBrowser;
0036 
0037 class TGeoOverlap : public TNamed, public TAttLine, public TAttFill, public TAtt3D {
0038 public:
0039    enum EOverlapType { kGeoOverlap = BIT(14), kGeoExtrusion = BIT(15) };
0040 
0041 private:
0042    TGeoOverlap(const TGeoOverlap &) = delete;
0043    TGeoOverlap &operator=(const TGeoOverlap &) = delete;
0044 
0045 protected:
0046    Double_t fOverlap;      // overlap distance
0047    TGeoVolume *fVolume1;   // first volume
0048    TGeoVolume *fVolume2;   // second volume
0049    TGeoHMatrix *fMatrix1;  // positioning matrix for first volume
0050    TGeoHMatrix *fMatrix2;  // positioning matrix for second volume
0051    TPolyMarker3D *fMarker; // points in the overlapping region
0052 
0053 public:
0054    TGeoOverlap();
0055    TGeoOverlap(const char *name, TGeoVolume *vol1, TGeoVolume *vol2, const TGeoMatrix *matrix1,
0056                const TGeoMatrix *matrix2, Bool_t isovlp = kTRUE, Double_t ovlp = 0.01);
0057    ~TGeoOverlap() override;
0058 
0059    void Browse(TBrowser *b) override;
0060    Int_t Compare(const TObject *obj) const override;
0061    Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
0062    void Draw(Option_t *option = "") override; // *MENU*
0063    void ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0064    TPolyMarker3D *GetPolyMarker() const { return fMarker; }
0065    TGeoVolume *GetFirstVolume() const { return fVolume1; }
0066    TGeoVolume *GetSecondVolume() const { return fVolume2; }
0067    TGeoHMatrix *GetFirstMatrix() const { return fMatrix1; }
0068    TGeoHMatrix *GetSecondMatrix() const { return fMatrix2; }
0069    Double_t GetOverlap() const { return fOverlap; }
0070    Bool_t IsExtrusion() const { return TObject::TestBit(kGeoExtrusion); }
0071    Bool_t IsOverlap() const { return TObject::TestBit(kGeoOverlap); }
0072    Bool_t IsFolder() const override { return kFALSE; }
0073    Bool_t IsSortable() const override { return kTRUE; }
0074    void Paint(Option_t *option = "") override;
0075    void Print(Option_t *option = "") const override; // *MENU*
0076    virtual void PrintInfo() const;
0077    void Sizeof3D() const override;
0078    void SampleOverlap(Int_t npoints = 1000000); // *MENU*
0079    void SetIsExtrusion(Bool_t flag = kTRUE)
0080    {
0081       TObject::SetBit(kGeoExtrusion, flag);
0082       TObject::SetBit(kGeoOverlap, !flag);
0083    }
0084    void SetIsOverlap(Bool_t flag = kTRUE)
0085    {
0086       TObject::SetBit(kGeoOverlap, flag);
0087       TObject::SetBit(kGeoExtrusion, !flag);
0088    }
0089    void SetNextPoint(Double_t x, Double_t y, Double_t z);
0090    void SetFirstVolume(TGeoVolume *vol) { fVolume1 = vol; }
0091    void SetSecondVolume(TGeoVolume *vol) { fVolume2 = vol; }
0092    void SetFirstMatrix(TGeoMatrix *matrix) { *fMatrix1 = matrix; }
0093    void SetSecondMatrix(TGeoMatrix *matrix) { *fMatrix2 = matrix; }
0094    void SetOverlap(Double_t ovlp) { fOverlap = ovlp; }
0095    void Validate() const; // *MENU*
0096 
0097    ClassDefOverride(TGeoOverlap, 2) // base class for geometical overlaps
0098 };
0099 
0100 #endif