Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
G4ASCIITreeSceneHandler Class Reference

#include <G4ASCIITreeSceneHandler.hh>

Inheritance diagram for G4ASCIITreeSceneHandler:
G4VTreeSceneHandler G4VSceneHandler G4VGraphicsScene

Public Member Functions

 G4ASCIITreeSceneHandler (G4VGraphicsSystem &system, const G4String &name)
 
virtual ~G4ASCIITreeSceneHandler ()
 
virtual void BeginModeling ()
 
virtual void EndModeling ()
 
- Public Member Functions inherited from G4VTreeSceneHandler
 G4VTreeSceneHandler (G4VGraphicsSystem &system, const G4String &name)
 
virtual ~G4VTreeSceneHandler ()
 
void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &)
 
void PostAddSolid ()
 
virtual void AddPrimitive (const G4Polyline &)
 
virtual void AddPrimitive (const G4Text &)
 
virtual void AddPrimitive (const G4Circle &)
 
virtual void AddPrimitive (const G4Square &)
 
virtual void AddPrimitive (const G4Polyhedron &)
 
virtual void AddPrimitive (const G4Polymarker &)
 
virtual void AddPrimitive (const G4Scale &)
 
- Public Member Functions inherited from G4VSceneHandler
 G4VSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4VSceneHandler ()
 
virtual void AddSolid (const G4Box &)
 
virtual void AddSolid (const G4Cons &)
 
virtual void AddSolid (const G4Tubs &)
 
virtual void AddSolid (const G4Trd &)
 
virtual void AddSolid (const G4Trap &)
 
virtual void AddSolid (const G4Sphere &)
 
virtual void AddSolid (const G4Para &)
 
virtual void AddSolid (const G4Torus &)
 
virtual void AddSolid (const G4Polycone &)
 
virtual void AddSolid (const G4Polyhedra &)
 
virtual void AddSolid (const G4VSolid &)
 
virtual void AddCompound (const G4VTrajectory &)
 
virtual void AddCompound (const G4VHit &)
 
virtual void AddCompound (const G4VDigi &)
 
virtual void AddCompound (const G4THitsMap< G4double > &)
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation)
 
virtual void EndPrimitives ()
 
virtual void BeginPrimitives2D (const G4Transform3D &objectTransformation)
 
virtual void EndPrimitives2D ()
 
virtual const G4VisExtent & GetExtent () const
 
const G4String & GetName () const
 
G4int GetSceneHandlerId () const
 
G4int GetViewCount () const
 
G4VGraphicsSystem * GetGraphicsSystem () const
 
G4Scene * GetScene () const
 
const G4ViewerList & GetViewerList () const
 
G4VModel * GetModel () const
 
G4VViewer * GetCurrentViewer () const
 
G4bool GetMarkForClearingTransientStore () const
 
G4bool IsReadyForTransients () const
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetTransientsDrawnThisRun () const
 
const G4Transform3D & GetObjectTransformation () const
 
void SetName (const G4String &)
 
void SetCurrentViewer (G4VViewer *)
 
virtual void SetScene (G4Scene *)
 
G4ViewerList & SetViewerList ()
 
void SetModel (G4VModel *)
 
void SetMarkForClearingTransientStore (G4bool)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetTransientsDrawnThisRun (G4bool)
 
void SetObjectTransformation (const G4Transform3D &)
 
const G4Colour & GetColour (const G4Visible &)
 
const G4Colour & GetColor (const G4Visible &)
 
const G4Colour & GetTextColour (const G4Text &)
 
const G4Colour & GetTextColor (const G4Text &)
 
G4double GetLineWidth (const G4VisAttributes *)
 
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes *)
 
G4bool GetAuxEdgeVisible (const G4VisAttributes *)
 
G4int GetNoOfSides (const G4VisAttributes *)
 
G4double GetMarkerSize (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerDiameter (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerRadius (const G4VMarker &, MarkerSizeType &)
 
G4ModelingParameters * CreateModelingParameters ()
 
void DrawEvent (const G4Event *)
 
void DrawEndOfRunModels ()
 
G4int IncrementViewCount ()
 
virtual void ClearStore ()
 
virtual void ClearTransientStore ()
 
void AddViewerToList (G4VViewer *pView)
 
void RemoveViewerFromList (G4VViewer *pView)
 
- Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
 
virtual ~G4VGraphicsScene ()
 

Protected Types

typedef std::set
< G4LogicalVolume * >
::iterator 
LVSetIterator
 
typedef
G4PhysicalVolumeModel::G4PhysicalVolumeNodeID 
PVNodeID
 
typedef std::vector< PVNodeID > PVPath
 
typedef std::set< PVPath >
::iterator 
ReplicaSetIterator
 
typedef std::set< PVPath >
::reverse_iterator 
ReplicaSetReverseIterator
 

Protected Member Functions

virtual void RequestPrimitives (const G4VSolid &)
 
void WriteHeader (std::ostream &)
 
- Protected Member Functions inherited from G4VSceneHandler
virtual void ProcessScene ()
 
virtual G4VSolid * CreateSectionSolid ()
 
virtual G4VSolid * CreateCutawaySolid ()
 
void LoadAtts (const G4Visible &, G4AttHolder *)
 

Protected Attributes

std::ostream * fpOutFile
 
std::ofstream fOutFile
 
std::ostringstream fRestOfLine
 
const G4VPhysicalVolume * fpLastPV
 
G4String fLastPVName
 
G4int fLastCopyNo
 
G4int fLastNonSequentialCopyNo
 
std::set< G4LogicalVolume * > fLVSet
 
std::set< PVPath > fReplicaSet
 
- Protected Attributes inherited from G4VTreeSceneHandler
const G4Transform3D * fpCurrentObjectTransformation
 
std::set< G4LogicalVolume * > fDrawnLVStore
 
- Protected Attributes inherited from G4VSceneHandler
G4VGraphicsSystem & fSystem
 
const G4int fSceneHandlerId
 
G4String fName
 
G4int fViewCount
 
G4ViewerList fViewerList
 
G4VViewer * fpViewer
 
G4Scene * fpScene
 
G4bool fMarkForClearingTransientStore
 
G4bool fReadyForTransients
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4bool fProcessingSolid
 
G4bool fProcessing2D
 
G4VModel * fpModel
 
G4Transform3D fObjectTransformation
 
G4int fNestingDepth
 
const G4VisAttributes * fpVisAttribs
 
const G4Transform3D fIdentityTransformation
 

Additional Inherited Members

- Public Types inherited from G4VSceneHandler
enum  MarkerSizeType { world, screen }
 
- Static Protected Attributes inherited from G4VTreeSceneHandler
static G4int fSceneIdCount = 0
 

Detailed Description

Definition at line 48 of file G4ASCIITreeSceneHandler.hh.

Member Typedef Documentation

typedef std::set<G4LogicalVolume*>::iterator G4ASCIITreeSceneHandler::LVSetIterator
protected

Definition at line 73 of file G4ASCIITreeSceneHandler.hh.

Definition at line 74 of file G4ASCIITreeSceneHandler.hh.

typedef std::vector<PVNodeID> G4ASCIITreeSceneHandler::PVPath
protected

Definition at line 75 of file G4ASCIITreeSceneHandler.hh.

typedef std::set<PVPath>::iterator G4ASCIITreeSceneHandler::ReplicaSetIterator
protected

Definition at line 77 of file G4ASCIITreeSceneHandler.hh.

typedef std::set<PVPath>::reverse_iterator G4ASCIITreeSceneHandler::ReplicaSetReverseIterator
protected

Definition at line 78 of file G4ASCIITreeSceneHandler.hh.

Constructor & Destructor Documentation

G4ASCIITreeSceneHandler::G4ASCIITreeSceneHandler ( G4VGraphicsSystem &  system,
const G4String &  name 
)

Definition at line 54 of file G4ASCIITreeSceneHandler.cc.

55  :
56  G4VTreeSceneHandler(system, name),
57  fpOutFile(0),
58  fpLastPV(0),
59  fLastCopyNo(-99),
61 {}
G4VTreeSceneHandler(G4VGraphicsSystem &system, const G4String &name)
const G4VPhysicalVolume * fpLastPV
G4ASCIITreeSceneHandler::~G4ASCIITreeSceneHandler ( )
virtual

Definition at line 63 of file G4ASCIITreeSceneHandler.cc.

63 {}

Member Function Documentation

void G4ASCIITreeSceneHandler::BeginModeling ( )
virtual

Reimplemented from G4VTreeSceneHandler.

Definition at line 65 of file G4ASCIITreeSceneHandler.cc.

References G4VTreeSceneHandler::BeginModeling(), fOutFile, fpOutFile, G4cout, G4endl, G4VSceneHandler::GetGraphicsSystem(), and WriteHeader().

65  {
66 
67  G4VTreeSceneHandler::BeginModeling (); // To re-use "culling off" code.
68 
69  const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
70  const G4String& outFileName = pSystem -> GetOutFileName();
71  if (outFileName == "G4cout") {
72  fpOutFile = &G4cout;
73  } else {
74  fOutFile.open (outFileName);
76  }
77 
78  G4cout << "G4ASCIITreeSceneHandler::BeginModeling: writing to ";
79  if (outFileName == "G4cout") {
80  G4cout << "G4 standard output (G4cout)";
81  } else {
82  G4cout << "file \"" << outFileName << "\"";
83  }
84  G4cout << G4endl;
85 
87  if (outFileName != "G4cout") {
88  WriteHeader (fOutFile); fOutFile << std::endl;
89  }
90 }
G4GLOB_DLL std::ostream G4cout
G4VGraphicsSystem * GetGraphicsSystem() const
#define G4endl
Definition: G4ios.hh:61
void WriteHeader(std::ostream &)
virtual void BeginModeling()
void G4ASCIITreeSceneHandler::EndModeling ( )
virtual

Reimplemented from G4VTreeSceneHandler.

Definition at line 113 of file G4ASCIITreeSceneHandler.cc.

References G4PhysicalVolumeModel::DescribeYourselfTo(), G4VTreeSceneHandler::EndModeling(), fLastCopyNo, fLastNonSequentialCopyNo, fLastPVName, fLVSet, fOutFile, fpLastPV, fpOutFile, G4VSceneHandler::fpScene, fReplicaSet, fRestOfLine, G4BestUnit, G4cout, G4endl, G4VPhysicalVolume::GetCopyNo(), G4VSceneHandler::GetGraphicsSystem(), G4PhysicalVolumeMassScene::GetMass(), G4VModel::GetModelingParameters(), G4VPhysicalVolume::GetName(), G4TransportationManager::GetNavigatorForTracking(), G4PhysicalVolumeModel::GetRequestedDepth(), G4Scene::GetRunDurationModelList(), G4PhysicalVolumeModel::GetTopPhysicalVolume(), G4TransportationManager::GetTransportationManager(), G4ASCIITree::GetVerbosity(), G4PhysicalVolumeMassScene::GetVolume(), G4Navigator::GetWorldVolume(), G4VModel::SetModelingParameters(), and G4PhysicalVolumeModel::UNLIMITED.

113  {
114  const G4ASCIITree* pSystem = (G4ASCIITree*) GetGraphicsSystem();
115  const G4int verbosity = pSystem->GetVerbosity();
116  const G4int detail = verbosity % 10;
117  const G4String& outFileName = pSystem -> GetOutFileName();
118 
119  // Output left over copy number, if any...
121  if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
122  else *fpOutFile << '-';
124  }
125  // Output outstanding rest of line, if any...
126  if (!fRestOfLine.str().empty()) *fpOutFile << fRestOfLine.str();
127  fRestOfLine.str("");
128  fpLastPV = 0;
129  fLastPVName.clear();
130  fLastCopyNo = -99;
132 
133  // This detail to G4cout regardless of outFileName...
134  if (detail >= 4) {
135  G4cout << "Calculating mass(es)..." << G4endl;
136  const std::vector<G4Scene::Model>& models = fpScene->GetRunDurationModelList();
137  std::vector<G4Scene::Model>::const_iterator i;
138  for (i = models.begin(); i != models.end(); ++i) {
139  G4PhysicalVolumeModel* pvModel =
140  dynamic_cast<G4PhysicalVolumeModel*>(i->fpModel);
141  if (pvModel) {
142  if (pvModel->GetTopPhysicalVolume() ==
145  const G4ModelingParameters* tempMP =
146  pvModel->GetModelingParameters();
147  G4ModelingParameters mp; // Default - no culling.
148  pvModel->SetModelingParameters (&mp);
149  G4PhysicalVolumeMassScene massScene(pvModel);
150  pvModel->DescribeYourselfTo (massScene);
151  G4double volume = massScene.GetVolume();
152  G4double mass = massScene.GetMass();
153 
154  G4cout << "Overall volume of \""
155  << pvModel->GetTopPhysicalVolume()->GetName()
156  << "\":"
157  << pvModel->GetTopPhysicalVolume()->GetCopyNo()
158  << ", is "
159  << G4BestUnit (volume, "Volume")
160  << " and the daughter-included mass";
161  G4int requestedDepth = pvModel->GetRequestedDepth();
162  if (requestedDepth == G4PhysicalVolumeModel::UNLIMITED) {
163  G4cout << " to unlimited depth";
164  } else {
165  G4cout << ", ignoring daughters at depth "
166  << requestedDepth
167  << " and below,";
168  }
169  G4cout << " is " << G4BestUnit (mass, "Mass")
170  << G4endl;
171 
172  pvModel->SetModelingParameters (tempMP);
173  }
174  }
175  }
176  }
177 
178  if (outFileName != "G4cout") {
179  fOutFile.close();
180  G4cout << "Output file \"" << outFileName << "\" closed." << G4endl;
181  }
182  fLVSet.clear();
183  fReplicaSet.clear();
184  G4cout << "G4ASCIITreeSceneHandler::EndModeling" << G4endl;
185  G4VTreeSceneHandler::EndModeling (); // To re-use "culling off" code.
186 }
G4Navigator * GetNavigatorForTracking() const
const G4ModelingParameters * GetModelingParameters() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
void SetModelingParameters(const G4ModelingParameters *)
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
const std::vector< Model > & GetRunDurationModelList() const
G4VGraphicsSystem * GetGraphicsSystem() const
G4VPhysicalVolume * GetTopPhysicalVolume() const
static G4TransportationManager * GetTransportationManager()
G4int GetVerbosity() const
Definition: G4ASCIITree.hh:47
virtual void EndModeling()
virtual G4int GetCopyNo() const =0
const G4VPhysicalVolume * fpLastPV
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
std::set< G4LogicalVolume * > fLVSet
G4VPhysicalVolume * GetWorldVolume() const
void DescribeYourselfTo(G4VGraphicsScene &)
void G4ASCIITreeSceneHandler::RequestPrimitives ( const G4VSolid &  solid)
protectedvirtual

Reimplemented from G4VSceneHandler.

Definition at line 188 of file G4ASCIITreeSceneHandler.cc.

References G4PhysicalVolumeModel::CurtailDescent(), fLastCopyNo, fLastNonSequentialCopyNo, fLastPVName, fLVSet, fpLastPV, G4VSceneHandler::fpModel, fpOutFile, fReplicaSet, fRestOfLine, G4BestUnit, G4Exception(), G4VPhysicalVolume::GetCopyNo(), G4PhysicalVolumeModel::GetCurrentLV(), G4PhysicalVolumeModel::GetCurrentMaterial(), G4PhysicalVolumeModel::GetCurrentPV(), G4Material::GetDensity(), G4PhysicalVolumeModel::GetDrawnPVPath(), G4VSolid::GetEntityType(), G4VSceneHandler::GetGraphicsSystem(), G4VPhysicalVolume::GetLogicalVolume(), G4LogicalVolume::GetMass(), G4VReadOutGeometry::GetName(), G4VSolid::GetName(), G4VSensitiveDetector::GetName(), G4VPhysicalVolume::GetName(), G4Material::GetName(), G4LogicalVolume::GetName(), G4LogicalVolume::GetNoDaughters(), G4VPhysicalVolume::GetParameterisation(), G4VPhysicalVolume::GetReplicationData(), G4VSensitiveDetector::GetROgeometry(), G4LogicalVolume::GetSensitiveDetector(), G4ASCIITree::GetVerbosity(), G4VPhysicalVolume::IsParameterised(), G4VPhysicalVolume::IsReplicated(), JustWarning, and width.

188  {
189 
190  G4PhysicalVolumeModel* pPVModel =
191  dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
192  if (!pPVModel) return; // Not from a G4PhysicalVolumeModel.
193 
194  // This call comes from a G4PhysicalVolumeModel. drawnPVPath is
195  // the path of the current drawn (non-culled) volume in terms of
196  // drawn (non-culled) ancesters. Each node is identified by a
197  // PVNodeID object, which is a physical volume and copy number. It
198  // is a vector of PVNodeIDs corresponding to the geometry hierarchy
199  // actually selected, i.e., not culled.
200  // The following typedef's already set in header file...
201  //typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
202  //typedef std::vector<PVNodeID> PVPath;
203  const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
204  //G4int currentDepth = pPVModel->GetCurrentDepth();
205  G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
206  G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
207  G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
208 
210  G4int verbosity = pSystem->GetVerbosity();
211  G4int detail = verbosity % 10;
212 
213  if (verbosity < 10 && pCurrentPV->IsReplicated()) {
214  // See if this has been a replica found before with same mother LV...
215  PVPath::const_reverse_iterator thisID = drawnPVPath.rbegin();
216  PVPath::const_reverse_iterator motherID = ++drawnPVPath.rbegin();
217  G4bool ignore = false;
218  for (ReplicaSetIterator i = fReplicaSet.begin(); i != fReplicaSet.end();
219  ++i) {
220  if (i->back().GetPhysicalVolume()->GetLogicalVolume() ==
221  thisID->GetPhysicalVolume()->GetLogicalVolume()) {
222  // For each one previously found (if more than one, they must
223  // have different mothers)...
224  // To avoid compilation errors on VC++ .Net 7.1...
225  // Previously:
226  // PVNodeID previousMotherID = ++(i->rbegin());
227  // (Should that have been: PVNodeID::const_iterator previousMotherID?)
228  // Replace
229  // previousMotherID == i->rend()
230  // by
231  // i->size() <= 1
232  // Replace
233  // previousMotherID != i->rend()
234  // by
235  // i->size() > 1
236  // Replace
237  // previousMotherID->
238  // by
239  // (*i)[i->size() - 2].
240  if (motherID == drawnPVPath.rend() &&
241  i->size() <= 1)
242  ignore = true; // Both have no mother.
243  if (motherID != drawnPVPath.rend() &&
244  i->size() > 1 &&
245  motherID->GetPhysicalVolume()->GetLogicalVolume() ==
246  (*i)[i->size() - 2].GetPhysicalVolume()->GetLogicalVolume())
247  ignore = true; // Same mother LV...
248  }
249  }
250  if (ignore) {
251  pPVModel->CurtailDescent();
252  return;
253  }
254  }
255 
256  const G4String& currentPVName = pCurrentPV->GetName();
257  const G4int currentCopyNo = pCurrentPV->GetCopyNo();
258 
259  if (verbosity < 10 &&
260  currentPVName == fLastPVName &&
261  currentCopyNo != fLastCopyNo) {
262  // For low verbosity, trap series of G4PVPlacements with the same name but
263  // different copy number (replicas should have been taken out above)...
264  // Check...
265  if (pCurrentPV->IsReplicated()) {
266  G4Exception("G4ASCIITreeSceneHandler::RequestPrimitives",
267  "vistree0001",
268  JustWarning,
269  "Replica unexpected");
270  }
271  // Check mothers are identical...
272  else if (pCurrentLV == (fpLastPV? fpLastPV->GetLogicalVolume(): 0)) {
273  if (currentCopyNo != fLastCopyNo + 1) {
274  // Non-sequential copy number...
275  *fpOutFile << ',' << currentCopyNo;
276  fLastNonSequentialCopyNo = currentCopyNo;
277  }
278  fLastCopyNo = currentCopyNo;
279  pPVModel->CurtailDescent();
280  return;
281  }
282  }
283  fpLastPV = pCurrentPV;
284 
285  // High verbosity or a new G4VPhysicalVolume...
286  // Output copy number, if any, from previous invocation...
288  if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
289  else *fpOutFile << '-';
291  }
292  // Output rest of line, if any, from previous invocation...
293  if (!fRestOfLine.str().empty()) *fpOutFile << fRestOfLine.str();
294  fRestOfLine.str("");
295  fLastPVName = currentPVName;
296  fLastCopyNo = currentCopyNo;
297  fLastNonSequentialCopyNo = currentCopyNo;
298  // Indent according to drawn path depth...
299  for (size_t i = 0; i < drawnPVPath.size(); i++ ) *fpOutFile << " ";
300  // Start next line...
301  *fpOutFile << "\"" << currentPVName
302  << "\":" << currentCopyNo;
303 
304  if (pCurrentPV->IsReplicated()) {
305  if (verbosity < 10) {
306  // Add printing for replicas (when replicas are ignored)...
307  EAxis axis;
308  G4int nReplicas;
309  G4double width;
310  G4double offset;
311  G4bool consuming;
312  pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
313  G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
314  if (pP) {
315  if (detail < 3) {
316  fReplicaSet.insert(drawnPVPath);
317  if (nReplicas > 2) fRestOfLine << '-';
318  else fRestOfLine << ',';
319  fRestOfLine << nReplicas - 1
320  << " (" << nReplicas << " parametrised volumes)";
321  }
322  }
323  else {
324  fReplicaSet.insert(drawnPVPath);
325  if (nReplicas > 2) fRestOfLine << '-';
326  else fRestOfLine << ',';
327  fRestOfLine << nReplicas - 1
328  << " (" << nReplicas << " replicas)";
329  }
330  }
331  } else {
332  if (fLVSet.find(pCurrentLV) != fLVSet.end()) {
333  if (verbosity < 10) {
334  // Add printing for repeated LV (if it has daughters)...
335  if (pCurrentLV->GetNoDaughters()) fRestOfLine << " (repeated LV)";
336  // ...and curtail descent.
337  pPVModel->CurtailDescent();
338  }
339  }
340  }
341 
342  if (detail >= 1) {
343  fRestOfLine << " / \""
344  << pCurrentLV->GetName() << "\"";
345  G4VSensitiveDetector* sd = pCurrentLV->GetSensitiveDetector();
346  if (sd) {
347  fRestOfLine << " (SD=\"" << sd->GetName() << "\"";
348  G4VReadOutGeometry* roGeom = sd->GetROgeometry();
349  if (roGeom) {
350  fRestOfLine << ",RO=\"" << roGeom->GetName() << "\"";
351  }
352  fRestOfLine << ")";
353  }
354  }
355 
356  if (detail >= 2) {
357  fRestOfLine << " / \""
358  << solid.GetName()
359  << "\"("
360  << solid.GetEntityType() << ")";
361  }
362 
363  if (detail >= 3) {
364  fRestOfLine << ", "
365  << G4BestUnit(((G4VSolid&)solid).GetCubicVolume(),"Volume")
366  << ", ";
367  if (pCurrentMaterial) {
369  << G4BestUnit(pCurrentMaterial->GetDensity(), "Volumic Mass")
370  << " (" << pCurrentMaterial->GetName() << ")";
371  } else {
372  fRestOfLine << "(No material)";
373  }
374  }
375 
376  if (detail >= 5) {
377  if (pCurrentMaterial) {
378  G4Material* pMaterial = const_cast<G4Material*>(pCurrentMaterial);
379  // ...and find daughter-subtracted mass...
380  G4double daughter_subtracted_mass = pCurrentLV->GetMass
381  (pCurrentPV->IsParameterised(), // Force if parametrised.
382  false, // Do not propagate - calculate for this volume minus
383  // volume of daughters.
384  pMaterial);
385  G4double daughter_subtracted_volume =
386  daughter_subtracted_mass / pCurrentMaterial->GetDensity();
387  fRestOfLine << ", "
388  << G4BestUnit(daughter_subtracted_volume,"Volume")
389  << ", "
390  << G4BestUnit(daughter_subtracted_mass,"Mass");
391  }
392  }
393 
394  if (fLVSet.find(pCurrentLV) == fLVSet.end()) {
395  fLVSet.insert(pCurrentLV); // Record new logical volume.
396  }
397 
398  fRestOfLine << std::endl;
399 
400  return;
401 }
G4String GetName() const
G4String GetName() const
virtual G4bool IsReplicated() const =0
const G4String & GetName() const
Definition: G4Material.hh:176
G4Material * GetCurrentMaterial() const
G4double GetDensity() const
Definition: G4Material.hh:178
#define width
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
virtual G4GeometryType GetEntityType() const =0
const std::vector< G4PhysicalVolumeNodeID > & GetDrawnPVPath() const
int G4int
Definition: G4Types.hh:78
std::vector< PVNodeID > PVPath
std::set< PVPath >::iterator ReplicaSetIterator
const G4String & GetName() const
bool G4bool
Definition: G4Types.hh:79
virtual G4VPVParameterisation * GetParameterisation() const =0
G4String GetName() const
G4VReadOutGeometry * GetROgeometry() const
G4VGraphicsSystem * GetGraphicsSystem() const
G4int GetNoDaughters() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4bool IsParameterised() const =0
G4int GetVerbosity() const
Definition: G4ASCIITree.hh:47
G4LogicalVolume * GetLogicalVolume() const
EAxis
Definition: geomdefs.hh:54
virtual G4int GetCopyNo() const =0
const G4VPhysicalVolume * fpLastPV
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
G4double GetMass(G4bool forced=false, G4bool propagate=true, G4Material *parMaterial=0)
double G4double
Definition: G4Types.hh:76
G4LogicalVolume * GetCurrentLV() const
G4VPhysicalVolume * GetCurrentPV() const
std::set< G4LogicalVolume * > fLVSet
G4VSensitiveDetector * GetSensitiveDetector() const
void G4ASCIITreeSceneHandler::WriteHeader ( std::ostream &  os)
protected

Definition at line 92 of file G4ASCIITreeSceneHandler.cc.

References G4ASCIITreeMessenger::fVerbosityGuidance, G4VSceneHandler::GetGraphicsSystem(), and G4ASCIITree::GetVerbosity().

Referenced by BeginModeling().

93 {
94  const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
95  const G4int verbosity = pSystem->GetVerbosity();
96  const G4int detail = verbosity % 10;
97  os << "# Set verbosity with \"/vis/ASCIITree/verbose <verbosity>\":";
98  for (size_t i = 0;
100  os << "\n# " << G4ASCIITreeMessenger::fVerbosityGuidance[i];
101  }
102  os << "\n# Now printing with verbosity " << verbosity;
103  os << "\n# Format is: PV:n";
104  if (detail >= 1) os << " / LV (SD,RO)";
105  if (detail >= 2) os << " / Solid(type)";
106  if (detail >= 3) os << ", volume, density";
107  if (detail >= 5) os << ", daughter-subtracted volume and mass";
108  os <<
109  "\n# Abbreviations: PV = Physical Volume, LV = Logical Volume,"
110  "\n# SD = Sensitive Detector, RO = Read Out Geometry.";
111 }
int G4int
Definition: G4Types.hh:78
static std::vector< G4String > fVerbosityGuidance
G4VGraphicsSystem * GetGraphicsSystem() const
G4int GetVerbosity() const
Definition: G4ASCIITree.hh:47

Field Documentation

G4int G4ASCIITreeSceneHandler::fLastCopyNo
protected

Definition at line 69 of file G4ASCIITreeSceneHandler.hh.

Referenced by EndModeling(), and RequestPrimitives().

G4int G4ASCIITreeSceneHandler::fLastNonSequentialCopyNo
protected

Definition at line 70 of file G4ASCIITreeSceneHandler.hh.

Referenced by EndModeling(), and RequestPrimitives().

G4String G4ASCIITreeSceneHandler::fLastPVName
protected

Definition at line 68 of file G4ASCIITreeSceneHandler.hh.

Referenced by EndModeling(), and RequestPrimitives().

std::set<G4LogicalVolume*> G4ASCIITreeSceneHandler::fLVSet
protected

Definition at line 72 of file G4ASCIITreeSceneHandler.hh.

Referenced by EndModeling(), and RequestPrimitives().

std::ofstream G4ASCIITreeSceneHandler::fOutFile
protected

Definition at line 63 of file G4ASCIITreeSceneHandler.hh.

Referenced by BeginModeling(), and EndModeling().

const G4VPhysicalVolume* G4ASCIITreeSceneHandler::fpLastPV
protected

Definition at line 67 of file G4ASCIITreeSceneHandler.hh.

Referenced by EndModeling(), and RequestPrimitives().

std::ostream* G4ASCIITreeSceneHandler::fpOutFile
protected

Definition at line 62 of file G4ASCIITreeSceneHandler.hh.

Referenced by BeginModeling(), EndModeling(), and RequestPrimitives().

std::set<PVPath> G4ASCIITreeSceneHandler::fReplicaSet
protected

Definition at line 76 of file G4ASCIITreeSceneHandler.hh.

Referenced by EndModeling(), and RequestPrimitives().

std::ostringstream G4ASCIITreeSceneHandler::fRestOfLine
protected

Definition at line 64 of file G4ASCIITreeSceneHandler.hh.

Referenced by EndModeling(), and RequestPrimitives().


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