ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4BooleanSolid.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4BooleanSolid.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // G4BooleanSolid
27 //
28 // Class description:
29 //
30 // Abstract base class for solids created by boolean operations
31 // between other solids.
32 
33 // 10.09.98 V.Grichine - created
34 // --------------------------------------------------------------------
35 #ifndef G4BOOLEANSOLID_HH
36 #define G4BOOLEANSOLID_HH
37 
38 #include "G4DisplacedSolid.hh"
39 
40 #include "G4ThreeVector.hh"
41 #include "G4RotationMatrix.hh"
42 #include "G4Transform3D.hh"
43 
45 
46 class G4BooleanSolid : public G4VSolid
47 {
48  public: // with description
49 
50  G4BooleanSolid( const G4String& pName,
51  G4VSolid* pSolidA ,
52  G4VSolid* pSolidB );
53 
54  G4BooleanSolid( const G4String& pName,
55  G4VSolid* pSolidA ,
56  G4VSolid* pSolidB,
57  G4RotationMatrix* rotMatrix,
58  const G4ThreeVector& transVector );
59 
60  G4BooleanSolid( const G4String& pName,
61  G4VSolid* pSolidA ,
62  G4VSolid* pSolidB ,
63  const G4Transform3D& transform );
64 
65  virtual ~G4BooleanSolid();
66 
67  virtual const G4VSolid* GetConstituentSolid(G4int no) const;
68  virtual G4VSolid* GetConstituentSolid(G4int no);
69  // If Solid is made up from a Boolean operation of two solids,
70  // return the corresponding solid (for no=0 and 1).
71  // If the solid is not a "Boolean", return 0.
72 
73  inline G4double GetCubicVolume();
74  inline G4double GetSurfaceArea();
75 
76  virtual G4GeometryType GetEntityType() const;
77  virtual G4Polyhedron* GetPolyhedron () const;
78 
79  std::ostream& StreamInfo(std::ostream& os) const;
80 
81  inline G4int GetCubVolStatistics() const;
82  inline G4double GetCubVolEpsilon() const;
83  inline void SetCubVolStatistics(G4int st);
84  inline void SetCubVolEpsilon(G4double ep);
85 
86  inline G4int GetAreaStatistics() const;
87  inline G4double GetAreaAccuracy() const;
88  inline void SetAreaStatistics(G4int st);
89  inline void SetAreaAccuracy(G4double ep);
90 
92 
93  public: // without description
94 
95  G4BooleanSolid(__void__&);
96  // Fake default constructor for usage restricted to direct object
97  // persistency for clients requiring preallocation of memory for
98  // persistifiable objects.
99 
100  G4BooleanSolid(const G4BooleanSolid& rhs);
102  // Copy constructor and assignment operator.
103 
104  protected:
105 
106  void GetListOfPrimitives(std::vector<std::pair<G4VSolid *,G4Transform3D>>&,
107  const G4Transform3D&) const;
108  // Get list of constituent primitives of the solid and their placements.
109 
111  const G4VSolid*) const;
112  // Stack polyhedra for processing. Return top polyhedron.
113 
114  protected:
115 
116  G4VSolid* fPtrSolidA = nullptr;
117  G4VSolid* fPtrSolidB = nullptr;
118 
119  private:
120 
121  G4int fStatistics = 1000000;
126 
127  mutable G4bool fRebuildPolyhedron = false;
128  mutable G4Polyhedron* fpPolyhedron = nullptr;
129 
130  mutable std::vector<std::pair<G4VSolid *,G4Transform3D>> fPrimitives;
132 
134  // If & only if this object created it, it must delete it
135 } ;
136 
137 #include "G4BooleanSolid.icc"
138 
139 #endif