Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:20

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 // G4GenericPolycone
0027 //
0028 // Class description:
0029 //
0030 //   Class implementing a GenericPolycone constructed by points with
0031 //          (r,z)coordinates, allows Z 'go back'
0032 //
0033 //
0034 //   G4GenericPolycone( const G4String& name,
0035 //               G4double phiStart,   // initial phi starting angle
0036 //               G4double phiTotal,   // total phi angle
0037 //               G4int    numRZ,      // number corners in r,z space
0038 //               const G4double r[],  // r coordinate of these corners
0039 //               const G4double z[])  // z coordinate of these corners
0040 //
0041 
0042 // Authors: T.Nikitina, G.Cosmo - CERN
0043 // --------------------------------------------------------------------
0044 #ifndef G4GENERICPOLYCONE_HH
0045 #define G4GENERICPOLYCONE_HH
0046 
0047 #include "G4GeomTypes.hh"
0048 
0049 #if defined(G4GEOM_USE_USOLIDS)
0050 #define G4GEOM_USE_UGENERICPOLYCONE 1
0051 #endif
0052 
0053 #if defined(G4GEOM_USE_UGENERICPOLYCONE)
0054   #define G4UGenericPolycone G4GenericPolycone
0055   #include "G4UGenericPolycone.hh"
0056 #else
0057 
0058 #include "G4VCSGfaceted.hh"
0059 #include "G4PolyconeSide.hh"
0060 
0061 class G4EnclosingCylinder;
0062 class G4ReduciblePolygon;
0063 class G4VCSGface;
0064 
0065 class G4GenericPolycone : public G4VCSGfaceted
0066 {
0067   public:
0068 
0069     G4GenericPolycone( const G4String& name,
0070                              G4double phiStart, // initial phi starting angle
0071                              G4double phiTotal, // total phi angle
0072                              G4int    numRZ,    // number corners in r,z space
0073                        const G4double r[],   // r coordinate of these corners
0074                        const G4double z[] ); // z coordinate of these corners
0075 
0076     ~G4GenericPolycone() override;
0077 
0078     EInside Inside( const G4ThreeVector &p ) const override;
0079     G4double DistanceToIn( const G4ThreeVector &p,
0080                            const G4ThreeVector &v ) const override;
0081     G4double DistanceToIn( const G4ThreeVector &p ) const override;
0082 
0083     void BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const override;
0084     G4bool CalculateExtent(const EAxis pAxis,
0085                            const G4VoxelLimits& pVoxelLimit,
0086                            const G4AffineTransform& pTransform,
0087                                  G4double& pmin, G4double& pmax) const override;
0088 
0089     G4double GetCubicVolume() override;
0090     G4double GetSurfaceArea() override;
0091 
0092     G4ThreeVector GetPointOnSurface() const override;
0093 
0094     G4GeometryType GetEntityType() const override;
0095 
0096     G4VSolid* Clone() const override;
0097 
0098     std::ostream& StreamInfo(std::ostream& os) const override;
0099 
0100     G4Polyhedron* CreatePolyhedron() const override;
0101 
0102     G4bool Reset();
0103 
0104     // Accessors
0105 
0106     inline G4double GetStartPhi()    const;
0107     inline G4double GetEndPhi()      const;
0108     inline G4double GetSinStartPhi() const;
0109     inline G4double GetCosStartPhi() const;
0110     inline G4double GetSinEndPhi()   const;
0111     inline G4double GetCosEndPhi()   const;
0112     inline G4bool IsOpen()           const;
0113     inline G4int  GetNumRZCorner()   const;
0114     inline G4PolyconeSideRZ GetCorner(G4int index) const;
0115 
0116     G4GenericPolycone(__void__&);
0117       // Fake default constructor for usage restricted to direct object
0118       // persistency for clients requiring preallocation of memory for
0119       // persistifiable objects.
0120 
0121     G4GenericPolycone( const G4GenericPolycone& source );
0122     G4GenericPolycone& operator=( const G4GenericPolycone& source );
0123       // Copy constructor and assignment operator.
0124 
0125   protected:
0126 
0127     // Generic initializer, called by all constructors
0128 
0129     void Create( G4double phiStart,        // initial phi starting angle
0130                  G4double phiTotal,        // total phi angle
0131                  G4ReduciblePolygon* rz ); // r/z coordinate of these corners
0132 
0133     void CopyStuff( const G4GenericPolycone& source );
0134 
0135     // Methods for random point generation
0136 
0137     void SetSurfaceElements() const;
0138 
0139   protected:
0140 
0141     // Here are our parameters
0142 
0143     G4double startPhi;            // Starting phi value (0 < phiStart < 2pi)
0144     G4double endPhi;              // end phi value (0 < endPhi-phiStart < 2pi)
0145     G4bool   phiIsOpen = false;   // true if there is a phi segment
0146     G4int    numCorner;           // number RZ points
0147     G4PolyconeSideRZ* corners = nullptr;  // corner r,z points
0148 
0149     G4EnclosingCylinder* enclosingCylinder = nullptr; // Our quick test
0150 
0151     struct surface_element { G4double area = 0.; G4int i0 = 0, i1 = 0, i2 = 0; };
0152     mutable std::vector<surface_element>* fElements = nullptr;
0153 };
0154 
0155 #include "G4GenericPolycone.icc"
0156 
0157 #endif
0158 
0159 #endif