Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ModelingParameters Class Reference

#include <G4ModelingParameters.hh>

Classes

class  PVNameCopyNo
 
class  PVPointerCopyNo
 
class  VisAttributesModifier
 

Public Types

enum  DrawingStyle {
  wf , hlr , hsr , hlhsr ,
  cloud
}
 
enum  VisAttributesSignifier {
  VASVisibility , VASDaughtersInvisible , VASColour , VASLineStyle ,
  VASLineWidth , VASForceWireframe , VASForceSolid , VASForceCloud ,
  VASForceNumberOfCloudPoints , VASForceAuxEdgeVisible , VASForceLineSegmentsPerCircle
}
 
typedef std::vector< PVNameCopyNoPVNameCopyNoPath
 
typedef PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator
 
typedef std::vector< PVPointerCopyNoPVPointerCopyNoPath
 
typedef PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator
 

Public Member Functions

 G4ModelingParameters ()
 
 G4ModelingParameters (const G4VisAttributes *pDefaultVisAttributes, DrawingStyle drawingStyle, G4bool isCulling, G4bool isCullingInvisible, G4bool isDensityCulling, G4double visibleDensity, G4bool isCullingCovered, G4int noOfSides)
 
 ~G4ModelingParameters ()
 
G4bool operator!= (const G4ModelingParameters &) const
 
G4bool IsWarning () const
 
const G4VisAttributesGetDefaultVisAttributes () const
 
DrawingStyle GetDrawingStyle () const
 
G4int GetNumberOfCloudPoints () const
 
G4bool IsCulling () const
 
G4bool IsCullingInvisible () const
 
G4bool IsDensityCulling () const
 
G4double GetVisibleDensity () const
 
G4bool IsCullingCovered () const
 
G4int GetCBDAlgorithmNumber () const
 
const std::vector< G4double > & GetCBDParameters () const
 
G4bool IsExplode () const
 
G4double GetExplodeFactor () const
 
const G4Point3DGetExplodeCentre () const
 
G4int GetNoOfSides () const
 
G4DisplacedSolidGetSectionSolid () const
 
G4DisplacedSolidGetCutawaySolid () const
 
const G4EventGetEvent () const
 
const std::vector< VisAttributesModifier > & GetVisAttributesModifiers () const
 
void SetWarning (G4bool)
 
void SetDefaultVisAttributes (const G4VisAttributes *pDefaultVisAttributes)
 
void SetDrawingStyle (DrawingStyle)
 
void SetNumberOfCloudPoints (G4int)
 
void SetCulling (G4bool)
 
void SetCullingInvisible (G4bool)
 
void SetDensityCulling (G4bool)
 
void SetVisibleDensity (G4double)
 
void SetCullingCovered (G4bool)
 
void SetCBDAlgorithmNumber (G4int)
 
void SetCBDParameters (const std::vector< G4double > &)
 
void SetExplodeFactor (G4double explodeFactor)
 
void SetExplodeCentre (const G4Point3D &explodeCentre)
 
G4int SetNoOfSides (G4int)
 
void SetSectionSolid (G4DisplacedSolid *pSectionSolid)
 
void SetCutawaySolid (G4DisplacedSolid *pCutawaySolid)
 
void SetEvent (const G4Event *pEvent)
 
void SetVisAttributesModifiers (const std::vector< VisAttributesModifier > &)
 

Friends

std::ostream & operator<< (std::ostream &os, const G4ModelingParameters &)
 
std::ostream & operator<< (std::ostream &os, const PVNameCopyNoPath &)
 
std::ostream & operator<< (std::ostream &os, const PVPointerCopyNoPath &)
 
std::ostream & operator<< (std::ostream &os, const std::vector< VisAttributesModifier > &)
 

Detailed Description

Definition at line 52 of file G4ModelingParameters.hh.

Member Typedef Documentation

◆ PVNameCopyNoPath

Definition at line 94 of file G4ModelingParameters.hh.

◆ PVNameCopyNoPathConstIterator

typedef PVNameCopyNoPath::const_iterator G4ModelingParameters::PVNameCopyNoPathConstIterator

Definition at line 95 of file G4ModelingParameters.hh.

◆ PVPointerCopyNoPath

◆ PVPointerCopyNoPathConstIterator

typedef PVPointerCopyNoPath::const_iterator G4ModelingParameters::PVPointerCopyNoPathConstIterator

Definition at line 112 of file G4ModelingParameters.hh.

Member Enumeration Documentation

◆ DrawingStyle

Enumerator
wf 
hlr 
hsr 
hlhsr 
cloud 

Definition at line 57 of file G4ModelingParameters.hh.

57 {
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 };

◆ VisAttributesSignifier

Enumerator
VASVisibility 
VASDaughtersInvisible 
VASColour 
VASLineStyle 
VASLineWidth 
VASForceWireframe 
VASForceSolid 
VASForceCloud 
VASForceNumberOfCloudPoints 
VASForceAuxEdgeVisible 
VASForceLineSegmentsPerCircle 

Definition at line 67 of file G4ModelingParameters.hh.

Constructor & Destructor Documentation

◆ G4ModelingParameters() [1/2]

G4ModelingParameters::G4ModelingParameters ( )

Definition at line 44 of file G4ModelingParameters.cc.

44 :
45 fWarning (true),
46 fpDefaultVisAttributes (0),
47 fDrawingStyle (wf),
48 fNumberOfCloudPoints (10000),
49 fCulling (false),
50 fCullInvisible (false),
51 fDensityCulling (false),
52 fVisibleDensity (0.01 * g / cm3),
53 fCullCovered (false),
54 fCBDAlgorithmNumber (0),
55 fExplodeFactor (1.),
56 fNoOfSides (24),
57 fpSectionSolid (0),
58 fpCutawaySolid (0),
59 fpEvent (0)
60{}

◆ G4ModelingParameters() [2/2]

G4ModelingParameters::G4ModelingParameters ( const G4VisAttributes pDefaultVisAttributes,
G4ModelingParameters::DrawingStyle  drawingStyle,
G4bool  isCulling,
G4bool  isCullingInvisible,
G4bool  isDensityCulling,
G4double  visibleDensity,
G4bool  isCullingCovered,
G4int  noOfSides 
)

Definition at line 62 of file G4ModelingParameters.cc.

71 :
72 fWarning (true),
73 fpDefaultVisAttributes (pDefaultVisAttributes),
74 fDrawingStyle (drawingStyle),
75 fNumberOfCloudPoints (10000),
76 fCulling (isCulling),
77 fCullInvisible (isCullingInvisible),
78 fDensityCulling (isDensityCulling),
79 fVisibleDensity (visibleDensity),
80 fCullCovered (isCullingCovered),
81 fCBDAlgorithmNumber (0),
82 fExplodeFactor (1.),
83 fNoOfSides (noOfSides),
84 fpSectionSolid (0),
85 fpCutawaySolid (0),
86 fpEvent (0)
87{}

◆ ~G4ModelingParameters()

G4ModelingParameters::~G4ModelingParameters ( )

Definition at line 89 of file G4ModelingParameters.cc.

90{
91 delete fpSectionSolid;
92 delete fpCutawaySolid;
93}

Member Function Documentation

◆ GetCBDAlgorithmNumber()

G4int G4ModelingParameters::GetCBDAlgorithmNumber ( ) const

◆ GetCBDParameters()

const std::vector< G4double > & G4ModelingParameters::GetCBDParameters ( ) const

◆ GetCutawaySolid()

G4DisplacedSolid * G4ModelingParameters::GetCutawaySolid ( ) const

◆ GetDefaultVisAttributes()

const G4VisAttributes * G4ModelingParameters::GetDefaultVisAttributes ( ) const

◆ GetDrawingStyle()

DrawingStyle G4ModelingParameters::GetDrawingStyle ( ) const

◆ GetEvent()

◆ GetExplodeCentre()

const G4Point3D & G4ModelingParameters::GetExplodeCentre ( ) const

◆ GetExplodeFactor()

G4double G4ModelingParameters::GetExplodeFactor ( ) const

◆ GetNoOfSides()

G4int G4ModelingParameters::GetNoOfSides ( ) const

◆ GetNumberOfCloudPoints()

G4int G4ModelingParameters::GetNumberOfCloudPoints ( ) const

◆ GetSectionSolid()

G4DisplacedSolid * G4ModelingParameters::GetSectionSolid ( ) const

◆ GetVisAttributesModifiers()

const std::vector< VisAttributesModifier > & G4ModelingParameters::GetVisAttributesModifiers ( ) const

◆ GetVisibleDensity()

G4double G4ModelingParameters::GetVisibleDensity ( ) const

◆ IsCulling()

G4bool G4ModelingParameters::IsCulling ( ) const

◆ IsCullingCovered()

G4bool G4ModelingParameters::IsCullingCovered ( ) const

◆ IsCullingInvisible()

G4bool G4ModelingParameters::IsCullingInvisible ( ) const

◆ IsDensityCulling()

G4bool G4ModelingParameters::IsDensityCulling ( ) const

◆ IsExplode()

G4bool G4ModelingParameters::IsExplode ( ) const

◆ IsWarning()

G4bool G4ModelingParameters::IsWarning ( ) const

◆ operator!=()

G4bool G4ModelingParameters::operator!= ( const G4ModelingParameters mp) const

Definition at line 243 of file G4ModelingParameters.cc.

244 {
245
246 if (
247 (fWarning != mp.fWarning) ||
248 (*fpDefaultVisAttributes != *mp.fpDefaultVisAttributes) ||
249 (fDrawingStyle != mp.fDrawingStyle) ||
250 (fNumberOfCloudPoints != mp.fNumberOfCloudPoints) ||
251 (fCulling != mp.fCulling) ||
252 (fCullInvisible != mp.fCullInvisible) ||
253 (fDensityCulling != mp.fDensityCulling) ||
254 (fCullCovered != mp.fCullCovered) ||
255 (fCBDAlgorithmNumber != mp.fCBDAlgorithmNumber) ||
256 (fExplodeFactor != mp.fExplodeFactor) ||
257 (fExplodeCentre != mp.fExplodeCentre) ||
258 (fNoOfSides != mp.fNoOfSides) ||
259 (fpSectionSolid != mp.fpSectionSolid) ||
260 (fpCutawaySolid != mp.fpCutawaySolid) ||
261 (fpEvent != mp.fpEvent)
262 )
263 return true;
264
265 if (fDensityCulling &&
266 (fVisibleDensity != mp.fVisibleDensity)) return true;
267
268 if (fCBDAlgorithmNumber > 0) {
269 if (fCBDParameters.size() != mp.fCBDParameters.size()) return true;
270 else if (fCBDParameters != mp.fCBDParameters) return true;
271 }
272
273 if (fVisAttributesModifiers != mp.fVisAttributesModifiers)
274 return true;
275
276 return false;
277}

◆ SetCBDAlgorithmNumber()

void G4ModelingParameters::SetCBDAlgorithmNumber ( G4int  )

◆ SetCBDParameters()

void G4ModelingParameters::SetCBDParameters ( const std::vector< G4double > &  )

◆ SetCulling()

void G4ModelingParameters::SetCulling ( G4bool  )

◆ SetCullingCovered()

void G4ModelingParameters::SetCullingCovered ( G4bool  )

◆ SetCullingInvisible()

void G4ModelingParameters::SetCullingInvisible ( G4bool  )

◆ SetCutawaySolid()

void G4ModelingParameters::SetCutawaySolid ( G4DisplacedSolid pCutawaySolid)

Definition at line 151 of file G4ModelingParameters.cc.

152 {
153 delete fpCutawaySolid;
154 fpCutawaySolid = pCutawaySolid;
155}

Referenced by G4VSceneHandler::CreateModelingParameters().

◆ SetDefaultVisAttributes()

void G4ModelingParameters::SetDefaultVisAttributes ( const G4VisAttributes pDefaultVisAttributes)

◆ SetDensityCulling()

void G4ModelingParameters::SetDensityCulling ( G4bool  )

◆ SetDrawingStyle()

void G4ModelingParameters::SetDrawingStyle ( DrawingStyle  )

◆ SetEvent()

void G4ModelingParameters::SetEvent ( const G4Event pEvent)

◆ SetExplodeCentre()

void G4ModelingParameters::SetExplodeCentre ( const G4Point3D explodeCentre)

◆ SetExplodeFactor()

void G4ModelingParameters::SetExplodeFactor ( G4double  explodeFactor)

◆ SetNoOfSides()

G4int G4ModelingParameters::SetNoOfSides ( G4int  nSides)

Definition at line 132 of file G4ModelingParameters.cc.

132 {
133 const G4int nSidesMin = fpDefaultVisAttributes->GetMinLineSegmentsPerCircle();
134 if (nSides < nSidesMin) {
135 nSides = nSidesMin;
136 if (fWarning)
137 G4cout << "G4ModelingParameters::SetNoOfSides: attempt to set the"
138 "\nnumber of sides per circle < " << nSidesMin
139 << "; forced to" << nSides << G4endl;
140 }
141 fNoOfSides = nSides;
142 return fNoOfSides;
143}
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4int GetMinLineSegmentsPerCircle()

◆ SetNumberOfCloudPoints()

void G4ModelingParameters::SetNumberOfCloudPoints ( G4int  )

◆ SetSectionSolid()

void G4ModelingParameters::SetSectionSolid ( G4DisplacedSolid pSectionSolid)

Definition at line 145 of file G4ModelingParameters.cc.

146 {
147 delete fpSectionSolid;
148 fpSectionSolid = pSectionSolid;
149}

Referenced by G4VSceneHandler::CreateModelingParameters().

◆ SetVisAttributesModifiers()

void G4ModelingParameters::SetVisAttributesModifiers ( const std::vector< VisAttributesModifier > &  )

◆ SetVisibleDensity()

void G4ModelingParameters::SetVisibleDensity ( G4double  visibleDensity)

Definition at line 115 of file G4ModelingParameters.cc.

115 {
116 const G4double reasonableMaximum = 10.0 * g / cm3;
117 if (visibleDensity < 0 && fWarning) {
118 G4cout << "G4ModelingParameters::SetVisibleDensity: attempt to set negative "
119 "density - ignored." << G4endl;
120 }
121 else {
122 if (fVisibleDensity > reasonableMaximum && fWarning) {
123 G4cout << "G4ModelingParameters::SetVisibleDensity: density > "
124 << reasonableMaximum
125 << " g / cm3 - did you mean this?"
126 << G4endl;
127 }
128 fVisibleDensity = visibleDensity;
129 }
130}
double G4double
Definition: G4Types.hh:83

◆ SetWarning()

void G4ModelingParameters::SetWarning ( G4bool  )

Friends And Related Function Documentation

◆ operator<< [1/4]

std::ostream & operator<< ( std::ostream &  os,
const G4ModelingParameters mp 
)
friend

Definition at line 157 of file G4ModelingParameters.cc.

158{
159 os << "Modeling parameters (warning ";
160 if (mp.fWarning) os << "true";
161 else os << "false";
162 os << "):";
163
164 const G4VisAttributes* va = mp.fpDefaultVisAttributes;
165 os << "\n Default vis. attributes: ";
166 if (va) os << *va;
167 else os << "none";
168
169 os << "\n Current requested drawing style: ";
170 switch (mp.fDrawingStyle) {
172 os << "wireframe"; break;
174 os << "hidden line removal (hlr)"; break;
176 os << "surface (hsr)"; break;
178 os << "surface and edges (hlhsr)"; break;
180 os << "cloud"; break;
181 default: os << "unrecognised"; break;
182 }
183
184 os << "\n Number of cloud points: " << mp.fNumberOfCloudPoints;
185
186 os << "\n Culling: ";
187 if (mp.fCulling) os << "on";
188 else os << "off";
189
190 os << "\n Culling invisible objects: ";
191 if (mp.fCullInvisible) os << "on";
192 else os << "off";
193
194 os << "\n Density culling: ";
195 if (mp.fDensityCulling) {
196 os << "on - invisible if density less than "
197 << mp.fVisibleDensity / (1. * g / cm3) << " g cm^-3";
198 }
199 else os << "off";
200
201 os << "\n Culling daughters covered by opaque mothers: ";
202 if (mp.fCullCovered) os << "on";
203 else os << "off";
204
205 os << "\n Colour by density: ";
206 if (mp.fCBDAlgorithmNumber <= 0) {
207 os << "inactive";
208 } else {
209 os << "Algorithm " << mp.fCBDAlgorithmNumber << ", Parameters:";
210 for (auto p: mp.fCBDParameters) {
211 os << ' ' << G4BestUnit(p,"Volumic Mass");
212 }
213 }
214
215 os << "\n Explode factor: " << mp.fExplodeFactor
216 << " about centre: " << mp.fExplodeCentre;
217
218 os << "\n No. of sides used in circle polygon approximation: "
219 << mp.fNoOfSides;
220
221 os << "\n Section (DCUT) shape (G4DisplacedSolid) pointer: ";
222 if (!mp.fpSectionSolid) os << "non-";
223 os << "null";
224
225 os << "\n Cutaway (DCUT) shape (G4DisplacedSolid) pointer: ";
226 if (!mp.fpCutawaySolid) os << "non-";
227 os << "null";
228
229 os << "\n Event pointer: " << mp.fpEvent;
230
231 os << "\n Vis attributes modifiers: ";
232 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
233 mp.fVisAttributesModifiers;
234 if (vams.empty()) {
235 os << "None";
236 } else {
237 os << vams;
238 }
239
240 return os;
241}
#define G4BestUnit(a, b)

◆ operator<< [2/4]

std::ostream & operator<< ( std::ostream &  os,
const PVNameCopyNoPath path 
)
friend

Definition at line 342 of file G4ModelingParameters.cc.

344{
345 os << "Touchable path: ";
346 if (path.empty()) {
347 os << "empty";
348 } else {
349 os << "physical-volume-name:copy-number pairs:\n ";
351 for (i = path.begin(); i != path.end(); ++i) {
352 if (i != path.begin()) {
353 os << ',';
354 }
355 os << i->GetName() << ':' << i->GetCopyNo();
356 }
357 }
358 return os;
359}
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator

◆ operator<< [3/4]

std::ostream & operator<< ( std::ostream &  os,
const PVPointerCopyNoPath path 
)
friend

Definition at line 374 of file G4ModelingParameters.cc.

376{
377 os << "Touchable path: physical-volume-pointer:copy-number pairs:\n ";
379 for (i = path.begin(); i != path.end(); ++i) {
380 if (i != path.begin()) {
381 os << ',';
382 }
383 os << '(' << (void*)(i->GetPVPointer()) << ')' << i->GetName() << ':' << i->GetCopyNo();
384 }
385 return os;
386}
PVPointerCopyNoPath::const_iterator PVPointerCopyNoPathConstIterator

◆ operator<< [4/4]

std::ostream & operator<< ( std::ostream &  os,
const std::vector< VisAttributesModifier > &  vams 
)
friend

Definition at line 388 of file G4ModelingParameters.cc.

391{
392 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
393 iModifier;
394 for (iModifier = vams.begin();
395 iModifier != vams.end();
396 ++iModifier) {
398 iModifier->GetPVNameCopyNoPath();
399 os << '\n' << vamPath;
400 const G4VisAttributes& vamVisAtts = iModifier->GetVisAttributes();
401 const G4Colour& c = vamVisAtts.GetColour();
402 switch (iModifier->GetVisAttributesSignifier()) {
404 os << " visibility ";
405 if (vamVisAtts.IsVisible()) {
406 os << "true";
407 } else {
408 os << "false";
409 }
410 break;
412 os << " daughtersInvisible ";
413 if (vamVisAtts.IsDaughtersInvisible()) {
414 os << "true";
415 } else {
416 os << "false";
417 }
418 break;
420 os << " colour " << c;
421 break;
423 os << " lineStyle ";
424 switch (vamVisAtts.GetLineStyle()) {
426 os << "unbroken";
427 break;
429 os << "dashed";
430 break;
432 os << "dotted";
433 }
434 break;
436 os << " lineWidth "
437 << vamVisAtts.GetLineWidth();
438 break;
441 os << " forceWireframe ";
442 if (vamVisAtts.IsForceDrawingStyle()) {
443 os << "true";
444 } else {
445 os << "false";
446 }
447 }
448 break;
450 if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::solid) {
451 os << " forceSolid ";
452 if (vamVisAtts.IsForceDrawingStyle()) {
453 os << "true";
454 } else {
455 os << "false";
456 }
457 }
458 break;
460 if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::cloud) {
461 os << " forceCloud ";
462 if (vamVisAtts.IsForceDrawingStyle()) {
463 os << "true";
464 } else {
465 os << "false";
466 }
467 }
468 break;
470 os << " numberOfCloudPoints "
471 << vamVisAtts.GetForcedNumberOfCloudPoints();
472 break;
474 os << " forceAuxEdgeVisible: ";
475 if (!vamVisAtts.IsForceDrawingStyle()) {
476 os << "not ";
477 }
478 os << " forced";
479 if (vamVisAtts.IsForceAuxEdgeVisible()) {
480 os << ": ";
481 if (vamVisAtts.IsForcedAuxEdgeVisible()) {
482 os << "true";
483 } else {
484 os << "false";
485 }
486 }
487 break;
489 os << " lineSegmentsPerCircle "
490 << vamVisAtts.GetForcedLineSegmentsPerCircle();
491 break;
492 }
493 }
494
495 return os;
496}
std::vector< PVNameCopyNo > PVNameCopyNoPath
G4int GetForcedNumberOfCloudPoints() const
G4double GetLineWidth() const
G4bool IsDaughtersInvisible() const
G4int GetForcedLineSegmentsPerCircle() const
LineStyle GetLineStyle() const
const G4Colour & GetColour() const
G4bool IsVisible() const
G4bool IsForceAuxEdgeVisible() const
G4bool IsForcedAuxEdgeVisible() const
ForcedDrawingStyle GetForcedDrawingStyle() const
G4bool IsForceDrawingStyle() const

The documentation for this class was generated from the following files: