Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:59:21

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4ReflectedSolid
0027 //
0028 // Class description:
0029 //
0030 // A Reflected solid is a solid that has been shifted from its original
0031 // frame of reference to a new one.
0032 
0033 // 23.07.01, V.Grichine - created
0034 // --------------------------------------------------------------------
0035 #ifndef G4ReflectedSolid_HH
0036 #define G4ReflectedSolid_HH
0037 
0038 #include "G4VSolid.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4Transform3D.hh"
0041 
0042 class G4ReflectedSolid : public G4VSolid
0043 {
0044   public:
0045 
0046     G4ReflectedSolid( const G4String& pName,
0047                             G4VSolid* pSolid ,
0048                       const G4Transform3D& transform ) ;
0049       // For use in instantiating a transient instance.
0050 
0051     ~G4ReflectedSolid() override;
0052       // Virtual destructor.
0053 
0054     // Includes all the methods that a solid requires.
0055 
0056     EInside Inside( const G4ThreeVector& p ) const override; 
0057 
0058     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0059 
0060     G4bool CalculateExtent( const EAxis pAxis,
0061                             const G4VoxelLimits& pVoxelLimit,
0062                             const G4AffineTransform& pTransform,
0063                                   G4double& pMin, G4double& pMax) const override;
0064 
0065     G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
0066 
0067     G4double DistanceToIn( const G4ThreeVector& p,
0068                            const G4ThreeVector& v ) const override;
0069 
0070     G4double DistanceToIn( const G4ThreeVector& p) const override;
0071 
0072     G4double DistanceToOut( const G4ThreeVector& p,
0073                             const G4ThreeVector& v,
0074                             const G4bool calcNorm = false,
0075                                   G4bool* validNorm = nullptr,
0076                                   G4ThreeVector* n = nullptr ) const override;
0077 
0078     G4double DistanceToOut( const G4ThreeVector& p ) const override;
0079 
0080     void ComputeDimensions(       G4VPVParameterisation* p,
0081                             const G4int n,
0082                             const G4VPhysicalVolume* pRep ) override;
0083 
0084     G4double GetCubicVolume() override;
0085     G4double GetSurfaceArea() override;
0086 
0087     G4ThreeVector GetPointOnSurface() const override;
0088 
0089     G4int GetNumOfConstituents() const override;
0090 
0091     G4bool IsFaceted() const override;
0092 
0093     G4VSolid* Clone() const override;
0094 
0095     G4GeometryType  GetEntityType() const override;
0096 
0097     virtual const G4ReflectedSolid* GetReflectedSolidPtr() const;
0098     virtual       G4ReflectedSolid* GetReflectedSolidPtr();
0099       // If the Solid is a "G4ReflectedSolid",
0100       // return a self pointer else return nullptr.
0101 
0102     G4VSolid* GetConstituentMovedSolid() const;
0103 
0104     G4Transform3D GetTransform3D() const; 
0105     G4Transform3D GetDirectTransform3D() const; 
0106     void SetDirectTransform3D(G4Transform3D&);
0107       // Accessors methods.
0108 
0109     std::ostream& StreamInfo(std::ostream& os) const override;
0110 
0111     G4ReflectedSolid(const G4ReflectedSolid& rhs);
0112     G4ReflectedSolid& operator=(const G4ReflectedSolid& rhs);
0113       // Copy constructor and assignment operator.
0114 
0115     void DescribeYourselfTo ( G4VGraphicsScene& scene ) const override;
0116     G4Polyhedron* CreatePolyhedron () const override;
0117     G4Polyhedron* GetPolyhedron    () const override;
0118       // For creating graphical representations (i.e. for visualisation).
0119 
0120   protected:
0121 
0122     G4VSolid*          fPtrSolid = nullptr;
0123     G4Transform3D*     fDirectTransform3D = nullptr;
0124 
0125     mutable G4bool fRebuildPolyhedron = false;
0126     mutable G4Polyhedron* fpPolyhedron = nullptr;
0127       // Caches reflected G4Polyhedron.
0128 };
0129 
0130 #endif