Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4ASCIITreeMessenger.cc
이 파일의 문서화 페이지로 가기
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: G4ASCIITreeMessenger.cc 108859 2018-03-12 07:44:53Z gcosmo $
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 
34 #include "G4ASCIITreeMessenger.hh"
35 
36 #include "G4ASCIITree.hh"
37 #include "G4UIcommand.hh"
38 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithAnInteger.hh"
40 #include "G4UIcmdWithAString.hh"
41 
42 std::vector<G4String> G4ASCIITreeMessenger::fVerbosityGuidance;
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: notifies but does not print details of repeated volumes.");
59  fVerbosityGuidance.push_back
60  (" >= 10: prints all physical volumes (touchables).");
61  fVerbosityGuidance.push_back
62  ("The level of detail is given by verbosity%10:");
63  fVerbosityGuidance.push_back
64  (" >= 0: physical volume name.");
65  fVerbosityGuidance.push_back
66  (" >= 1: logical volume name (and names of sensitive detector"
67  " and readout geometry, if any).");
68  fVerbosityGuidance.push_back
69  (" >= 2: solid name and type.");
70  fVerbosityGuidance.push_back
71  (" >= 3: volume and density.");
72  fVerbosityGuidance.push_back
73  (" >= 5: daughter-subtracted volume and mass.");
74  fVerbosityGuidance.push_back
75  (" >= 6: physical volume dump.");
76  fVerbosityGuidance.push_back
77  (" >= 7: polyhedron dump.");
78  fVerbosityGuidance.push_back
79  ("and in the summary at the end of printing:");
80  fVerbosityGuidance.push_back
81  (" >= 4: daughter-included mass of top physical volume(s) in scene"
82  " to depth specified.");
83  fVerbosityGuidance.push_back
84  ("Note: by default, culling is switched off so all volumes are seen.");
85  fVerbosityGuidance.push_back
86  ("Note: the mass calculation takes into account daughters, which can be"
87  " time consuming. If you want the mass of a particular subtree try:");
88  fVerbosityGuidance.push_back
89  (" /vis/drawTree <subtree-physical-volume-name>");
90  fVerbosityGuidance.push_back
91  ("Or if you want more control, for example:");
92  fVerbosityGuidance.push_back
93  (" /vis/open ATree");
94  fVerbosityGuidance.push_back
95  (" /vis/ASCIITree/verbose 14");
96  fVerbosityGuidance.push_back
97  (" /vis/scene/create");
98  fVerbosityGuidance.push_back
99  (" /vis/scene/add/volume <subtree-physical-volume-name> ! <depth>");
100  fVerbosityGuidance.push_back
101  (" /vis/sceneHandler/attach");
102  fVerbosityGuidance.push_back
103  (" /vis/viewer/flush");
104  fVerbosityGuidance.push_back
105  ("Note: dumping the physical volumes produces a lot of output. It is"
106  " advisable to select the volume of interest, as for a sub-tree above.");
107  for (size_t i = 0; i < fVerbosityGuidance.size(); ++i) {
108  fpCommandVerbose -> SetGuidance(fVerbosityGuidance[i]);
109  }
110  fpCommandVerbose -> SetParameterName ("verbosity",omitable = true);
111  fpCommandVerbose -> SetDefaultValue(1);
112 
113  fpCommandSetOutFile = new G4UIcmdWithAString ("/vis/ASCIITree/set/outFile", this
114 );
115  fpCommandSetOutFile -> SetGuidance ("Set name of output file.");
116  fpCommandSetOutFile -> SetParameterName ("out-filename",
117  omitable = true);
118  fpCommandSetOutFile -> SetDefaultValue ("G4cout");
119 }
120 
122  delete fpCommandSetOutFile;
123  delete fpDirectorySet;
124  delete fpCommandVerbose;
125  delete fpDirectory;
126 }
127 
129  return "";
130 }
131 
133 (G4UIcommand* command,
134  G4String newValue) {
135  if (command == fpCommandVerbose)
136  {
137  fpASCIITree->SetVerbosity
138  (fpCommandVerbose->GetNewIntValue(newValue));
139  G4cout << "G4ASCIITree verbosity now "
140  << fpASCIITree->GetVerbosity()
141  << G4endl;
142  }
143  else if (command == fpCommandSetOutFile)
144  {
145  fpASCIITree -> SetOutFileName (newValue);
146  G4cout << "G4ASCIITree out filename now "
147  << fpASCIITree -> GetOutFileName()
148  << G4endl;
149  }
150 }
G4ASCIITreeMessenger(G4ASCIITree *)
#define G4endl
Definition: G4ios.hh:61
G4String GetCurrentValue(G4UIcommand *command)
bool G4bool
Definition: G4Types.hh:79
G4UIcmdWithAString * fpCommandSetOutFile
void SetNewValue(G4UIcommand *command, G4String newValue)
G4GLOB_DLL std::ostream G4cout
static std::vector< G4String > fVerbosityGuidance
G4UIcmdWithAnInteger * fpCommandVerbose