Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:04

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 // G4ScaledSolid
0027 //
0028 // Class description:
0029 //
0030 // A scaled solid is a solid that has been scaled in dimensions
0031 // in X, Y or Z, from its original description.
0032 
0033 // 27.10.15 G.Cosmo: created
0034 // --------------------------------------------------------------------
0035 #ifndef G4SCALEDSOLID_HH
0036 #define G4SCALEDSOLID_HH
0037 
0038 #include "G4VSolid.hh"
0039 #include "G4ThreeVector.hh"
0040 #include "G4Transform3D.hh"
0041 #include "G4AffineTransform.hh"
0042 
0043 class G4ScaleTransform;
0044 
0045 class G4ScaledSolid : public G4VSolid
0046 {
0047   public:
0048 
0049     G4ScaledSolid( const G4String& pName,
0050                          G4VSolid* pSolid ,
0051                    const G4Scale3D& pScale  );
0052 
0053     ~G4ScaledSolid() override;
0054 
0055     EInside Inside( const G4ThreeVector& p ) const override;
0056 
0057     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0058 
0059     G4bool CalculateExtent(const EAxis pAxis,
0060                            const G4VoxelLimits& pVoxelLimit,
0061                            const G4AffineTransform& pTransform,
0062                                  G4double& pMin, G4double& pMax) const override;
0063 
0064     G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const override;
0065 
0066     G4double DistanceToIn( const G4ThreeVector& p,
0067                            const G4ThreeVector& v  ) const override;
0068 
0069     G4double DistanceToIn( const G4ThreeVector& p) const override;
0070 
0071     G4double DistanceToOut( const G4ThreeVector& p,
0072                             const G4ThreeVector& v,
0073                             const G4bool calcNorm = false,
0074                                   G4bool* validNorm = nullptr,
0075                                   G4ThreeVector* n = nullptr ) const override;
0076 
0077     G4double DistanceToOut( const G4ThreeVector& p ) const override;
0078 
0079     void ComputeDimensions(       G4VPVParameterisation* p,
0080                             const G4int n,
0081                             const G4VPhysicalVolume* pRep ) override;
0082 
0083     G4double GetCubicVolume() override;
0084     G4double GetSurfaceArea() override;
0085 
0086     void CleanTransformations();
0087 
0088     G4ThreeVector GetPointOnSurface() const override;
0089 
0090     G4Scale3D GetScaleTransform() const; 
0091     void SetScaleTransform(const G4Scale3D& scale); 
0092 
0093     G4VSolid* GetUnscaledSolid() const;
0094 
0095     G4GeometryType  GetEntityType() const override;
0096     G4VSolid* Clone() const override;
0097 
0098     std::ostream& StreamInfo(std::ostream& os) const override;
0099 
0100     G4ScaledSolid(__void__&);
0101       // Fake default constructor for usage restricted to direct object
0102       // persistency for clients requiring preallocation of memory for
0103       // persistifiable objects.
0104 
0105     G4ScaledSolid(const G4ScaledSolid& rhs);
0106     G4ScaledSolid& operator=(const G4ScaledSolid& rhs);
0107       // Copy constructor and assignment operator.
0108 
0109     void DescribeYourselfTo ( G4VGraphicsScene& scene ) const override;
0110     G4Polyhedron* CreatePolyhedron () const override;
0111     G4Polyhedron* GetPolyhedron    () const override;
0112       // For creating graphical representations (i.e. for visualisation).
0113 
0114   private:
0115 
0116     G4VSolid* fPtrSolid = nullptr;
0117     G4ScaleTransform* fScale = nullptr;
0118     G4double fCubicVolume = -1.0;
0119     G4double fSurfaceArea = -1.0;
0120     mutable G4bool fRebuildPolyhedron = false;
0121     mutable G4Polyhedron* fpPolyhedron = nullptr;
0122 };
0123 
0124 #endif