00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "G4ASCIITreeMessenger.hh"
00035
00036 #include "G4ASCIITree.hh"
00037 #include "G4UIcommand.hh"
00038 #include "G4UIdirectory.hh"
00039 #include "G4UIcmdWithAnInteger.hh"
00040 #include "G4UIcmdWithAString.hh"
00041
00042 std::vector<G4String> G4ASCIITreeMessenger::fVerbosityGuidance;
00043
00044 G4ASCIITreeMessenger::G4ASCIITreeMessenger
00045 (G4ASCIITree* ASCIITree):
00046 fpASCIITree(ASCIITree) {
00047
00048 G4bool omitable;
00049
00050 fpDirectory = new G4UIdirectory ("/vis/ASCIITree/");
00051 fpDirectory -> SetGuidance ("Commands for ASCIITree control.");
00052
00053 fpDirectorySet = new G4UIdirectory ("/vis/ASCIITree/set/");
00054 fpDirectorySet -> SetGuidance ("Settings for ASCIITree control.");
00055
00056 fpCommandVerbose = new G4UIcmdWithAnInteger ("/vis/ASCIITree/verbose", this);
00057 fVerbosityGuidance.push_back
00058 (" < 10: - does not print daughters of repeated placements,"
00059 " does not repeat replicas.");
00060 fVerbosityGuidance.push_back
00061 (" >= 10: prints all physical volumes.");
00062 fVerbosityGuidance.push_back
00063 ("The level of detail is given by verbosity%10:");
00064 fVerbosityGuidance.push_back
00065 ("for each volume:");
00066 fVerbosityGuidance.push_back
00067 (" >= 0: physical volume name.");
00068 fVerbosityGuidance.push_back
00069 (" >= 1: logical volume name (and names of sensitive detector"
00070 " and readout geometry, if any).");
00071 fVerbosityGuidance.push_back
00072 (" >= 2: solid name and type.");
00073 fVerbosityGuidance.push_back
00074 (" >= 3: volume and density.");
00075 fVerbosityGuidance.push_back
00076 (" >= 5: daughter-subtracted volume and mass.");
00077 fVerbosityGuidance.push_back
00078 ("and in the summary at the end of printing:");
00079 fVerbosityGuidance.push_back
00080 (" >= 4: daughter-included mass of top physical volume(s) in scene"
00081 " to depth specified.");
00082 fVerbosityGuidance.push_back
00083 ("Note: by default, culling is switched off so all volumes are seen.");
00084 fVerbosityGuidance.push_back
00085 ("Note: the mass calculation takes into account daughters, which can be"
00086 " time consuming. If you want the mass of a particular subtree to a"
00087 " particular depth:");
00088 fVerbosityGuidance.push_back
00089 (" /vis/open ATree");
00090 fVerbosityGuidance.push_back
00091 (" /vis/ASCIITree/verbose 14");
00092 fVerbosityGuidance.push_back
00093 (" /vis/scene/create");
00094 fVerbosityGuidance.push_back
00095 (" /vis/scene/add/volume <subtree-physical-volume> ! <depth>");
00096 fVerbosityGuidance.push_back
00097 (" /vis/sceneHandler/attach");
00098 fVerbosityGuidance.push_back
00099 (" /vis/viewer/flush");
00100 for (size_t i = 0; i < fVerbosityGuidance.size(); ++i) {
00101 fpCommandVerbose -> SetGuidance(fVerbosityGuidance[i]);
00102 }
00103 fpCommandVerbose -> SetParameterName ("verbosity",omitable = true);
00104 fpCommandVerbose -> SetDefaultValue(0);
00105
00106 fpCommandSetOutFile = new G4UIcmdWithAString ("/vis/ASCIITree/set/outFile", this
00107 );
00108 fpCommandSetOutFile -> SetGuidance ("Set name of output file.");
00109 fpCommandSetOutFile -> SetParameterName ("out-filename",
00110 omitable = true);
00111 fpCommandSetOutFile -> SetDefaultValue ("G4cout");
00112 }
00113
00114 G4ASCIITreeMessenger::~G4ASCIITreeMessenger() {
00115 delete fpCommandSetOutFile;
00116 delete fpDirectorySet;
00117 delete fpCommandVerbose;
00118 delete fpDirectory;
00119 }
00120
00121 G4String G4ASCIITreeMessenger::GetCurrentValue(G4UIcommand*) {
00122 return "";
00123 }
00124
00125 void G4ASCIITreeMessenger::SetNewValue
00126 (G4UIcommand* command,
00127 G4String newValue) {
00128 if (command == fpCommandVerbose)
00129 {
00130 fpASCIITree->SetVerbosity
00131 (fpCommandVerbose->GetNewIntValue(newValue));
00132 G4cout << "G4ASCIITree verbosity now "
00133 << fpASCIITree->GetVerbosity()
00134 << G4endl;
00135 }
00136 else if (command == fpCommandSetOutFile)
00137 {
00138 fpASCIITree -> SetOutFileName (newValue);
00139 G4cout << "G4ASCIITree out filename now "
00140 << fpASCIITree -> GetOutFileName()
00141 << G4endl;
00142 }
00143 }