Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 // 27 // 28 // 28 // 29 // John Allison 31st December 1997. 29 // John Allison 31st December 1997. 30 // 30 // 31 // Class Description: 31 // Class Description: 32 // 32 // 33 // Parameters associated with the modeling of 33 // Parameters associated with the modeling of GEANT4 objects. 34 34 35 #ifndef G4MODELINGPARAMETERS_HH 35 #ifndef G4MODELINGPARAMETERS_HH 36 #define G4MODELINGPARAMETERS_HH 36 #define G4MODELINGPARAMETERS_HH 37 37 38 #include "globals.hh" 38 #include "globals.hh" 39 #include "G4VisExtent.hh" 39 #include "G4VisExtent.hh" 40 #include "G4VisAttributes.hh" 40 #include "G4VisAttributes.hh" 41 #include "G4VPhysicalVolume.hh" 41 #include "G4VPhysicalVolume.hh" 42 42 43 #include <vector> 43 #include <vector> 44 #include <utility> 44 #include <utility> 45 45 46 class G4LogicalVolume; 46 class G4LogicalVolume; 47 class G4VisAttributes; 47 class G4VisAttributes; 48 class G4VSolid; 48 class G4VSolid; 49 class G4DisplacedSolid; 49 class G4DisplacedSolid; 50 class G4Event; 50 class G4Event; 51 51 52 class G4ModelingParameters { 52 class G4ModelingParameters { 53 53 54 public: // With description 54 public: // With description 55 55 56 // Currently requested drawing style. 56 // Currently requested drawing style. 57 enum DrawingStyle { 57 enum DrawingStyle { 58 wf, // Draw edges - no hidden l 58 wf, // Draw edges - no hidden line removal (wireframe). 59 hlr, // Draw edges - hidden line 59 hlr, // Draw edges - hidden lines removed. 60 hsr, // Draw surfaces - hidden surf 60 hsr, // Draw surfaces - hidden surfaces removed. 61 hlhsr, // Draw surfaces and edges - h 61 hlhsr, // Draw surfaces and edges - hidden removed. 62 cloud // Draw as a cloud of points 62 cloud // Draw as a cloud of points 63 }; 63 }; 64 64 65 enum CutawayMode { 65 enum CutawayMode { 66 cutawayUnion, // Union (addition) of 66 cutawayUnion, // Union (addition) of result of each cutaway plane. 67 cutawayIntersection // Intersection (multi 67 cutawayIntersection // Intersection (multiplication). 68 }; 68 }; 69 69 70 // enums and nested class for communicating 70 // enums and nested class for communicating a modification to the vis 71 // attributes for a specfic touchable define 71 // attributes for a specfic touchable defined by PVNameCopyNoPath. 72 enum VisAttributesSignifier { 72 enum VisAttributesSignifier { 73 VASVisibility, 73 VASVisibility, 74 VASDaughtersInvisible, 74 VASDaughtersInvisible, 75 VASColour, 75 VASColour, 76 VASLineStyle, 76 VASLineStyle, 77 VASLineWidth, 77 VASLineWidth, 78 VASForceWireframe, 78 VASForceWireframe, 79 VASForceSolid, 79 VASForceSolid, 80 VASForceCloud, 80 VASForceCloud, 81 VASForceNumberOfCloudPoints, 81 VASForceNumberOfCloudPoints, 82 VASForceAuxEdgeVisible, 82 VASForceAuxEdgeVisible, 83 VASForceLineSegmentsPerCircle 83 VASForceLineSegmentsPerCircle 84 }; 84 }; 85 85 86 class PVNameCopyNo { 86 class PVNameCopyNo { 87 public: 87 public: 88 // Normal constructor 88 // Normal constructor 89 PVNameCopyNo(const G4String& name, G4int c << 89 PVNameCopyNo(G4String name, G4int copyNo) 90 : fName(name), fCopyNo(copyNo) {} 90 : fName(name), fCopyNo(copyNo) {} 91 const G4String& GetName() const {return fN 91 const G4String& GetName() const {return fName;} 92 G4int GetCopyNo() const {return fCopyNo;} 92 G4int GetCopyNo() const {return fCopyNo;} 93 G4bool operator!=(const PVNameCopyNo&) con 93 G4bool operator!=(const PVNameCopyNo&) const; 94 G4bool operator==(const PVNameCopyNo& rhs) 94 G4bool operator==(const PVNameCopyNo& rhs) const {return !operator!=(rhs);} 95 private: 95 private: 96 G4String fName; 96 G4String fName; 97 G4int fCopyNo; 97 G4int fCopyNo; 98 }; 98 }; 99 typedef std::vector<PVNameCopyNo> PVNameCopy 99 typedef std::vector<PVNameCopyNo> PVNameCopyNoPath; 100 typedef PVNameCopyNoPath::const_iterator PVN 100 typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator; 101 101 102 class PVPointerCopyNo { 102 class PVPointerCopyNo { 103 public: 103 public: 104 // Normal constructor 104 // Normal constructor 105 PVPointerCopyNo(G4VPhysicalVolume* pPV, G4 105 PVPointerCopyNo(G4VPhysicalVolume* pPV, G4int copyNo) 106 : fpPV(pPV), fCopyNo(copyNo) {} 106 : fpPV(pPV), fCopyNo(copyNo) {} 107 const G4String& GetName() const; 107 const G4String& GetName() const; 108 const G4VPhysicalVolume* GetPVPointer() co 108 const G4VPhysicalVolume* GetPVPointer() const {return fpPV;} 109 G4int GetCopyNo() const {return fCopyNo;} 109 G4int GetCopyNo() const {return fCopyNo;} 110 G4bool operator!=(const PVPointerCopyNo&) 110 G4bool operator!=(const PVPointerCopyNo&) const; 111 G4bool operator==(const PVPointerCopyNo& r 111 G4bool operator==(const PVPointerCopyNo& rhs) const {return !operator!=(rhs);} 112 private: 112 private: 113 G4VPhysicalVolume* fpPV; 113 G4VPhysicalVolume* fpPV; 114 G4int fCopyNo; 114 G4int fCopyNo; 115 }; 115 }; 116 typedef std::vector<PVPointerCopyNo> PVPoint 116 typedef std::vector<PVPointerCopyNo> PVPointerCopyNoPath; 117 typedef PVPointerCopyNoPath::const_iterator 117 typedef PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator; 118 118 119 class VisAttributesModifier { 119 class VisAttributesModifier { 120 public: 120 public: 121 VisAttributesModifier 121 VisAttributesModifier 122 (const G4VisAttributes& visAtts, 122 (const G4VisAttributes& visAtts, 123 VisAttributesSignifier signifier, 123 VisAttributesSignifier signifier, 124 const PVNameCopyNoPath& path): 124 const PVNameCopyNoPath& path): 125 fVisAtts(visAtts), fSignifier(signifier), 125 fVisAtts(visAtts), fSignifier(signifier), fPVNameCopyNoPath(path) {} 126 const G4VisAttributes& GetVisAttributes() 126 const G4VisAttributes& GetVisAttributes() const 127 {return fVisAtts;} 127 {return fVisAtts;} 128 VisAttributesSignifier GetVisAttributesSig 128 VisAttributesSignifier GetVisAttributesSignifier() const 129 {return fSignifier;} 129 {return fSignifier;} 130 const PVNameCopyNoPath& GetPVNameCopyNoPat 130 const PVNameCopyNoPath& GetPVNameCopyNoPath() const 131 {return fPVNameCopyNoPath;} 131 {return fPVNameCopyNoPath;} 132 void SetVisAttributes(const G4VisAttribute 132 void SetVisAttributes(const G4VisAttributes& visAtts) 133 {fVisAtts = visAtts;} 133 {fVisAtts = visAtts;} 134 void SetVisAttributesSignifier(VisAttribut 134 void SetVisAttributesSignifier(VisAttributesSignifier signifier) 135 {fSignifier = signifier;} 135 {fSignifier = signifier;} 136 void SetPVNameCopyNoPath(const PVNameCopyN 136 void SetPVNameCopyNoPath(const PVNameCopyNoPath& PVNameCopyNoPath) 137 {fPVNameCopyNoPath = PVNameCopyNoPath;} 137 {fPVNameCopyNoPath = PVNameCopyNoPath;} 138 G4bool operator!=(const VisAttributesModif 138 G4bool operator!=(const VisAttributesModifier&) const; 139 G4bool operator==(const VisAttributesModif 139 G4bool operator==(const VisAttributesModifier& rhs) const 140 {return !operator!=(rhs);} 140 {return !operator!=(rhs);} 141 private: 141 private: 142 G4VisAttributes fVisAtts; 142 G4VisAttributes fVisAtts; 143 VisAttributesSignifier fSignifier; 143 VisAttributesSignifier fSignifier; 144 PVNameCopyNoPath fPVNameCopyNoPath; 144 PVNameCopyNoPath fPVNameCopyNoPath; 145 }; 145 }; 146 146 147 G4ModelingParameters (); 147 G4ModelingParameters (); 148 148 149 G4ModelingParameters (const G4VisAttributes* 149 G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes, 150 DrawingStyle drawingSt 150 DrawingStyle drawingStyle, 151 G4bool isCulling, 151 G4bool isCulling, 152 G4bool isCullingInvisible, 152 G4bool isCullingInvisible, 153 G4bool isDensityCulling, 153 G4bool isDensityCulling, 154 G4double visibleDensity, 154 G4double visibleDensity, 155 G4bool isCullingCovered, 155 G4bool isCullingCovered, 156 G4int noOfSides); 156 G4int noOfSides); 157 // Culling and clipping policy for G4Physica 157 // Culling and clipping policy for G4PhysicalVolumeModel. 158 158 159 ~G4ModelingParameters (); 159 ~G4ModelingParameters (); 160 160 161 // Note: uses default assignment operator an 161 // Note: uses default assignment operator and copy constructor. 162 162 163 G4bool operator != (const G4ModelingParamete 163 G4bool operator != (const G4ModelingParameters&) const; 164 164 165 // Get and Is functions... 165 // Get and Is functions... 166 G4bool IsWarning 166 G4bool IsWarning () const; 167 const G4VisAttributes* GetDefaultVisAttribut 167 const G4VisAttributes* GetDefaultVisAttributes () const; 168 DrawingStyle GetDrawingStyle 168 DrawingStyle GetDrawingStyle () const; 169 G4int GetNumberOfCloudPoints 169 G4int GetNumberOfCloudPoints () const; 170 G4bool IsCulling 170 G4bool IsCulling () const; 171 G4bool IsCullingInvisible 171 G4bool IsCullingInvisible () const; 172 G4bool IsDensityCulling 172 G4bool IsDensityCulling () const; 173 G4double GetVisibleDensity 173 G4double GetVisibleDensity () const; 174 G4bool IsCullingCovered 174 G4bool IsCullingCovered () const; 175 G4int GetCBDAlgorithmNumber 175 G4int GetCBDAlgorithmNumber () const; 176 const std::vector<G4double>& GetCBDParameter 176 const std::vector<G4double>& GetCBDParameters () const; 177 G4bool IsExplode 177 G4bool IsExplode () const; 178 G4double GetExplodeFactor 178 G4double GetExplodeFactor () const; 179 const G4Point3D& GetExplodeCentre 179 const G4Point3D& GetExplodeCentre () const; 180 G4int GetNoOfSides 180 G4int GetNoOfSides () const; 181 G4DisplacedSolid* GetSectionSolid 181 G4DisplacedSolid* GetSectionSolid () const; 182 CutawayMode GetCutawayMode 182 CutawayMode GetCutawayMode () const; 183 G4DisplacedSolid* GetCutawaySolid 183 G4DisplacedSolid* GetCutawaySolid () const; 184 const G4Event* GetEvent 184 const G4Event* GetEvent () const; 185 const std::vector<VisAttributesModifier>& Ge 185 const std::vector<VisAttributesModifier>& GetVisAttributesModifiers() const; 186 G4bool IsSpecialMeshRendering 186 G4bool IsSpecialMeshRendering () const; 187 const std::vector<PVNameCopyNo>& GetSpecialM 187 const std::vector<PVNameCopyNo>& GetSpecialMeshVolumes() const; 188 188 189 // Set functions... 189 // Set functions... 190 void SetWarning (G4bool); 190 void SetWarning (G4bool); 191 void SetDefaultVisAttributes (const G4VisAtt 191 void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes); 192 void SetDrawingStyle (DrawingStyle); 192 void SetDrawingStyle (DrawingStyle); 193 void SetNumberOfCloudPoints (G4int); 193 void SetNumberOfCloudPoints (G4int); 194 void SetCulling (G4bool); 194 void SetCulling (G4bool); 195 void SetCullingInvisible (G4bool); 195 void SetCullingInvisible (G4bool); 196 void SetDensityCulling (G4bool); 196 void SetDensityCulling (G4bool); 197 void SetVisibleDensity (G4double); 197 void SetVisibleDensity (G4double); 198 void SetCullingCovered (G4bool); 198 void SetCullingCovered (G4bool); 199 void SetCBDAlgorithmNumber (G4int); 199 void SetCBDAlgorithmNumber (G4int); 200 void SetCBDParameters (const std::vec 200 void SetCBDParameters (const std::vector<G4double>&); 201 void SetExplodeFactor (G4double explo 201 void SetExplodeFactor (G4double explodeFactor); 202 void SetExplodeCentre (const G4Point3 202 void SetExplodeCentre (const G4Point3D& explodeCentre); 203 G4int SetNoOfSides (G4int); // Re 203 G4int SetNoOfSides (G4int); // Returns actual number set. 204 void SetSectionSolid (G4DisplacedSol 204 void SetSectionSolid (G4DisplacedSolid* pSectionSolid); 205 void SetCutawayMode (CutawayMode); 205 void SetCutawayMode (CutawayMode); 206 void SetCutawaySolid (G4DisplacedSol 206 void SetCutawaySolid (G4DisplacedSolid* pCutawaySolid); 207 void SetEvent (const G4Event* 207 void SetEvent (const G4Event* pEvent); 208 void SetVisAttributesModifiers(const std::ve 208 void SetVisAttributesModifiers(const std::vector<VisAttributesModifier>&); 209 void SetSpecialMeshRendering (G4bool); 209 void SetSpecialMeshRendering (G4bool); 210 void SetSpecialMeshVolumes (const std::vec 210 void SetSpecialMeshVolumes (const std::vector<PVNameCopyNo>&); 211 211 212 friend std::ostream& operator << 212 friend std::ostream& operator << 213 (std::ostream& os, const G4ModelingParameter 213 (std::ostream& os, const G4ModelingParameters&); 214 214 215 friend std::ostream& operator << 215 friend std::ostream& operator << 216 (std::ostream& os, const PVNameCopyNoPath&); 216 (std::ostream& os, const PVNameCopyNoPath&); 217 217 218 friend std::ostream& operator << 218 friend std::ostream& operator << 219 (std::ostream& os, const PVPointerCopyNoPath 219 (std::ostream& os, const PVPointerCopyNoPath&); 220 220 221 friend std::ostream& operator << 221 friend std::ostream& operator << 222 (std::ostream& os, 222 (std::ostream& os, 223 const std::vector<VisAttributesModifier>&); 223 const std::vector<VisAttributesModifier>&); 224 224 225 private: 225 private: 226 226 227 // Data members... 227 // Data members... 228 G4bool fWarning; // Print warn 228 G4bool fWarning; // Print warnings if true. 229 const G4VisAttributes* fpDefaultVisAttribute 229 const G4VisAttributes* fpDefaultVisAttributes; 230 DrawingStyle fDrawingStyle; // Drawing st 230 DrawingStyle fDrawingStyle; // Drawing style. 231 G4int fNumberOfCloudPoints; // For d 231 G4int fNumberOfCloudPoints; // For drawing in cloud style. 232 // <= 0 232 // <= 0 means use viewer default. 233 G4bool fCulling; // Culling re 233 G4bool fCulling; // Culling requested. 234 G4bool fCullInvisible; // Cull (don' 234 G4bool fCullInvisible; // Cull (don't Draw) invisible objects. 235 G4bool fDensityCulling; // Density cu 235 G4bool fDensityCulling; // Density culling requested. If so... 236 G4double fVisibleDensity; // ...density 236 G4double fVisibleDensity; // ...density lower than this not drawn. 237 G4bool fCullCovered; // Cull daugh 237 G4bool fCullCovered; // Cull daughters covered by opaque mothers. 238 G4int fCBDAlgorithmNumber; // Colour 238 G4int fCBDAlgorithmNumber; // Colour by density algorithm number. 239 std::vector<G4double> fCBDParameters; // Col 239 std::vector<G4double> fCBDParameters; // Colour by density parameters. 240 G4double fExplodeFactor; // Explode al 240 G4double fExplodeFactor; // Explode along radius by this factor... 241 G4Point3D fExplodeCentre; // ...about t 241 G4Point3D fExplodeCentre; // ...about this centre. 242 G4int fNoOfSides; // ...if poly 242 G4int fNoOfSides; // ...if polygon approximates circle. 243 G4DisplacedSolid* fpSectionSolid; // For ge 243 G4DisplacedSolid* fpSectionSolid; // For generic section (DCUT). 244 CutawayMode fCutawayMode; // Cutaway mo 244 CutawayMode fCutawayMode; // Cutaway mode. 245 G4DisplacedSolid* fpCutawaySolid; // For ge 245 G4DisplacedSolid* fpCutawaySolid; // For generic cutaways. 246 const G4Event* fpEvent; // Event bein 246 const G4Event* fpEvent; // Event being processed. 247 std::vector<VisAttributesModifier> fVisAttri 247 std::vector<VisAttributesModifier> fVisAttributesModifiers; 248 G4bool fSpecialMeshRendering; // Requ 248 G4bool fSpecialMeshRendering; // Request special rendering of parameterised volumes 249 std::vector<PVNameCopyNo> fSpecialMeshVolume 249 std::vector<PVNameCopyNo> fSpecialMeshVolumes; // If empty, all meshes. 250 }; 250 }; 251 251 252 std::ostream& operator << 252 std::ostream& operator << 253 (std::ostream& os, const G4ModelingParameters& 253 (std::ostream& os, const G4ModelingParameters&); 254 254 255 std::ostream& operator << 255 std::ostream& operator << 256 (std::ostream& os, const G4ModelingParameters: 256 (std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath&); 257 257 258 std::ostream& operator << 258 std::ostream& operator << 259 (std::ostream& os, const G4ModelingParameters: 259 (std::ostream& os, const G4ModelingParameters::PVPointerCopyNoPath&); 260 260 261 std::ostream& operator << 261 std::ostream& operator << 262 (std::ostream& os, 262 (std::ostream& os, 263 const std::vector<G4ModelingParameters::VisAt 263 const std::vector<G4ModelingParameters::VisAttributesModifier>&); 264 264 265 #include "G4ModelingParameters.icc" 265 #include "G4ModelingParameters.icc" 266 266 267 #endif 267 #endif 268 268