ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ModelingParameters.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ModelingParameters.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 //
27 //
28 //
29 // John Allison 31st December 1997.
30 //
31 // Class Description:
32 //
33 // Parameters associated with the modeling of GEANT4 objects.
34 
35 #ifndef G4MODELINGPARAMETERS_HH
36 #define G4MODELINGPARAMETERS_HH
37 
38 #include "globals.hh"
39 #include "G4VisExtent.hh"
40 #include "G4VisAttributes.hh"
41 #include "G4VPhysicalVolume.hh"
42 
43 #include <vector>
44 #include <utility>
45 
46 class G4LogicalVolume;
47 class G4VisAttributes;
48 class G4VSolid;
49 class G4DisplacedSolid;
50 class G4Event;
51 
53 
54 public: // With description
55 
56  // Currently requested drawing style.
57  enum DrawingStyle {
58  wf, // Draw edges - no hidden line removal (wireframe).
59  hlr, // Draw edges - hidden lines removed.
60  hsr, // Draw surfaces - hidden surfaces removed.
61  hlhsr, // Draw surfaces and edges - hidden removed.
62  cloud // Draw as a cloud of points
63  };
64 
65  // enums and nested class for communicating a modification to the vis
66  // attributes for a specfic touchable defined by PVNameCopyNoPath.
79  };
80 
81  class PVNameCopyNo {
82  public:
83  // Normal constructor
85  : fName(name), fCopyNo(copyNo) {}
86  const G4String& GetName() const {return fName;}
87  G4int GetCopyNo() const {return fCopyNo;}
88  G4bool operator!=(const PVNameCopyNo&) const;
89  G4bool operator==(const PVNameCopyNo& rhs) const {return !operator!=(rhs);}
90  private:
93  };
94  typedef std::vector<PVNameCopyNo> PVNameCopyNoPath;
95  typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator;
96 
98  public:
99  // Normal constructor
101  : fpPV(pPV), fCopyNo(copyNo) {}
102  const G4String& GetName() const;
103  const G4VPhysicalVolume* GetPVPointer() const {return fpPV;}
104  G4int GetCopyNo() const {return fCopyNo;}
105  G4bool operator!=(const PVPointerCopyNo&) const;
106  G4bool operator==(const PVPointerCopyNo& rhs) const {return !operator!=(rhs);}
107  private:
110  };
111  typedef std::vector<PVPointerCopyNo> PVPointerCopyNoPath;
112  typedef PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator;
113 
115  public:
117  (const G4VisAttributes& visAtts,
118  VisAttributesSignifier signifier,
119  const PVNameCopyNoPath& path):
120  fVisAtts(visAtts), fSignifier(signifier), fPVNameCopyNoPath(path) {}
122  {return fVisAtts;}
124  {return fSignifier;}
126  {return fPVNameCopyNoPath;}
127  void SetVisAttributes(const G4VisAttributes& visAtts)
128  {fVisAtts = visAtts;}
130  {fSignifier = signifier;}
135  {return !operator!=(rhs);}
136  private:
140  };
141 
143 
144  G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
145  DrawingStyle drawingStyle,
146  G4bool isCulling,
147  G4bool isCullingInvisible,
148  G4bool isDensityCulling,
149  G4double visibleDensity,
150  G4bool isCullingCovered,
151  G4int noOfSides);
152  // Culling and clipping policy for G4PhysicalVolumeModel.
153 
155 
156  // Note: uses default assignment operator and copy constructor.
157 
159 
160  // Get and Is functions...
161  G4bool IsWarning () const;
163  DrawingStyle GetDrawingStyle () const;
164  G4int GetNumberOfCloudPoints () const;
165  G4bool IsCulling () const;
166  G4bool IsCullingInvisible () const;
167  G4bool IsDensityCulling () const;
168  G4double GetVisibleDensity () const;
169  G4bool IsCullingCovered () const;
170  G4int GetCBDAlgorithmNumber () const;
171  const std::vector<G4double>& GetCBDParameters () const;
172  G4bool IsExplode () const;
173  G4double GetExplodeFactor () const;
174  const G4Point3D& GetExplodeCentre () const;
175  G4int GetNoOfSides () const;
178  const G4Event* GetEvent () const;
179  const std::vector<VisAttributesModifier>& GetVisAttributesModifiers() const;
180 
181  // Set functions...
182  void SetWarning (G4bool);
183  void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
186  void SetCulling (G4bool);
188  void SetDensityCulling (G4bool);
190  void SetCullingCovered (G4bool);
192  void SetCBDParameters (const std::vector<G4double>&);
193  void SetExplodeFactor (G4double explodeFactor);
194  void SetExplodeCentre (const G4Point3D& explodeCentre);
195  G4int SetNoOfSides (G4int); // Returns actual number set.
196  void SetSectionSolid (G4DisplacedSolid* pSectionSolid);
197  void SetCutawaySolid (G4DisplacedSolid* pCutawaySolid);
198  void SetEvent (const G4Event* pEvent);
199  void SetVisAttributesModifiers(const std::vector<VisAttributesModifier>&);
200 
201  friend std::ostream& operator <<
202  (std::ostream& os, const G4ModelingParameters&);
203 
204  friend std::ostream& operator <<
205  (std::ostream& os, const PVNameCopyNoPath&);
206 
207  friend std::ostream& operator <<
208  (std::ostream& os, const PVPointerCopyNoPath&);
209 
210  friend std::ostream& operator <<
211  (std::ostream& os,
212  const std::vector<VisAttributesModifier>&);
213 
214 private:
215 
216  // Data members...
217  G4bool fWarning; // Print warnings if true.
219  DrawingStyle fDrawingStyle; // Drawing style.
220  G4int fNumberOfCloudPoints; // For drawing in cloud style.
221  // <= 0 means use viewer default.
222  G4bool fCulling; // Culling requested.
223  G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
224  G4bool fDensityCulling; // Density culling requested. If so...
225  G4double fVisibleDensity; // ...density lower than this not drawn.
226  G4bool fCullCovered; // Cull daughters covered by opaque mothers.
227  G4int fCBDAlgorithmNumber; // Colour by density algorithm number.
228  std::vector<G4double> fCBDParameters; // Colour by density parameters.
229  G4double fExplodeFactor; // Explode along radius by this factor...
230  G4Point3D fExplodeCentre; // ...about this centre.
231  G4int fNoOfSides; // ...if polygon approximates circle.
232  G4DisplacedSolid* fpSectionSolid; // For generic section (DCUT).
233  G4DisplacedSolid* fpCutawaySolid; // For generic cutaways.
234  const G4Event* fpEvent; // Event being processed.
235  std::vector<VisAttributesModifier> fVisAttributesModifiers;
236 };
237 
238 std::ostream& operator <<
239 (std::ostream& os, const G4ModelingParameters&);
240 
241 std::ostream& operator <<
242 (std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath&);
243 
244 std::ostream& operator <<
245 (std::ostream& os, const G4ModelingParameters::PVPointerCopyNoPath&);
246 
247 std::ostream& operator <<
248 (std::ostream& os,
249  const std::vector<G4ModelingParameters::VisAttributesModifier>&);
250 
251 #include "G4ModelingParameters.icc"
252 
253 #endif