Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ASCIITreeMessenger.cc
Go to the documentation of this file.
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// $Id$
28//
29//
30// John Allison 5th April 2001
31// A scene handler to dump geometry hierarchy in readable ASCII.
32// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
33
35
36#include "G4ASCIITree.hh"
37#include "G4UIcommand.hh"
38#include "G4UIdirectory.hh"
40#include "G4UIcmdWithAString.hh"
41
43
45(G4ASCIITree* ASCIITree):
46 fpASCIITree(ASCIITree) {
47
48 G4bool omitable;
49
50 fpDirectory = new G4UIdirectory ("/vis/ASCIITree/");
51 fpDirectory -> SetGuidance ("Commands for ASCIITree control.");
52
53 fpDirectorySet = new G4UIdirectory ("/vis/ASCIITree/set/");
54 fpDirectorySet -> SetGuidance ("Settings for ASCIITree control.");
55
56 fpCommandVerbose = new G4UIcmdWithAnInteger ("/vis/ASCIITree/verbose", this);
57 fVerbosityGuidance.push_back
58 (" < 10: - does not print daughters of repeated placements,"
59 " does not repeat replicas.");
60 fVerbosityGuidance.push_back
61 (" >= 10: prints all physical volumes.");
62 fVerbosityGuidance.push_back
63 ("The level of detail is given by verbosity%10:");
64 fVerbosityGuidance.push_back
65 ("for each volume:");
66 fVerbosityGuidance.push_back
67 (" >= 0: physical volume name.");
68 fVerbosityGuidance.push_back
69 (" >= 1: logical volume name (and names of sensitive detector"
70 " and readout geometry, if any).");
71 fVerbosityGuidance.push_back
72 (" >= 2: solid name and type.");
73 fVerbosityGuidance.push_back
74 (" >= 3: volume and density.");
75 fVerbosityGuidance.push_back
76 (" >= 5: daughter-subtracted volume and mass.");
77 fVerbosityGuidance.push_back
78 ("and in the summary at the end of printing:");
79 fVerbosityGuidance.push_back
80 (" >= 4: daughter-included mass of top physical volume(s) in scene"
81 " to depth specified.");
82 fVerbosityGuidance.push_back
83 ("Note: by default, culling is switched off so all volumes are seen.");
84 fVerbosityGuidance.push_back
85 ("Note: the mass calculation takes into account daughters, which can be"
86 " time consuming. If you want the mass of a particular subtree to a"
87 " particular depth:");
88 fVerbosityGuidance.push_back
89 (" /vis/open ATree");
90 fVerbosityGuidance.push_back
91 (" /vis/ASCIITree/verbose 14");
92 fVerbosityGuidance.push_back
93 (" /vis/scene/create");
94 fVerbosityGuidance.push_back
95 (" /vis/scene/add/volume <subtree-physical-volume> ! <depth>");
96 fVerbosityGuidance.push_back
97 (" /vis/sceneHandler/attach");
98 fVerbosityGuidance.push_back
99 (" /vis/viewer/flush");
100 for (size_t i = 0; i < fVerbosityGuidance.size(); ++i) {
101 fpCommandVerbose -> SetGuidance(fVerbosityGuidance[i]);
102 }
103 fpCommandVerbose -> SetParameterName ("verbosity",omitable = true);
104 fpCommandVerbose -> SetDefaultValue(0);
105
106 fpCommandSetOutFile = new G4UIcmdWithAString ("/vis/ASCIITree/set/outFile", this
107);
108 fpCommandSetOutFile -> SetGuidance ("Set name of output file.");
109 fpCommandSetOutFile -> SetParameterName ("out-filename",
110 omitable = true);
111 fpCommandSetOutFile -> SetDefaultValue ("G4cout");
112}
113
115 delete fpCommandSetOutFile;
116 delete fpDirectorySet;
117 delete fpCommandVerbose;
118 delete fpDirectory;
119}
120
122 return "";
123}
124
126(G4UIcommand* command,
127 G4String newValue) {
128 if (command == fpCommandVerbose)
129 {
130 fpASCIITree->SetVerbosity
131 (fpCommandVerbose->GetNewIntValue(newValue));
132 G4cout << "G4ASCIITree verbosity now "
133 << fpASCIITree->GetVerbosity()
134 << G4endl;
135 }
136 else if (command == fpCommandSetOutFile)
137 {
138 fpASCIITree -> SetOutFileName (newValue);
139 G4cout << "G4ASCIITree out filename now "
140 << fpASCIITree -> GetOutFileName()
141 << G4endl;
142 }
143}
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4String GetCurrentValue(G4UIcommand *command)
static std::vector< G4String > fVerbosityGuidance
G4ASCIITreeMessenger(G4ASCIITree *)
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetVerbosity(G4int verbosity)
Definition: G4ASCIITree.hh:49
G4int GetVerbosity() const
Definition: G4ASCIITree.hh:47
static G4int GetNewIntValue(const char *paramString)