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: G4NistMessenger.cc,v 1.4 2007/05/02 10:48:52 vnivanch Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // File name: G4NistMessenger |
---|
32 | // |
---|
33 | // Author: Vladimir Ivanchenko |
---|
34 | // |
---|
35 | // Creation date: 23.12.2004 |
---|
36 | // |
---|
37 | // Modifications: |
---|
38 | // |
---|
39 | // |
---|
40 | // ------------------------------------------------------------------- |
---|
41 | // |
---|
42 | |
---|
43 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
44 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
45 | |
---|
46 | #include "G4NistMessenger.hh" |
---|
47 | |
---|
48 | #include "G4NistManager.hh" |
---|
49 | |
---|
50 | #include "G4UIdirectory.hh" |
---|
51 | #include "G4UIcmdWithAnInteger.hh" |
---|
52 | #include "G4UIcmdWithAString.hh" |
---|
53 | |
---|
54 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
55 | |
---|
56 | G4NistMessenger::G4NistMessenger(G4NistManager* man) |
---|
57 | :manager(man) |
---|
58 | { |
---|
59 | matDir = new G4UIdirectory("/material/"); |
---|
60 | matDir->SetGuidance("Commands for materials"); |
---|
61 | |
---|
62 | verCmd = new G4UIcmdWithAnInteger("/material/verbose",this); |
---|
63 | verCmd->SetGuidance("Set verbose level."); |
---|
64 | |
---|
65 | nistDir = new G4UIdirectory("/material/nist/"); |
---|
66 | nistDir->SetGuidance("Commands for the nist dataBase"); |
---|
67 | |
---|
68 | prtElmCmd = new G4UIcmdWithAString("/material/nist/printElement",this); |
---|
69 | prtElmCmd->SetGuidance("print element(s) in dataBase."); |
---|
70 | prtElmCmd->SetGuidance("symbol = element."); |
---|
71 | prtElmCmd->SetGuidance("all = all elements."); |
---|
72 | prtElmCmd->SetGuidance("verbose>1 : list associated isotopes."); |
---|
73 | prtElmCmd->SetParameterName("symbol", true); |
---|
74 | prtElmCmd->SetDefaultValue("all"); |
---|
75 | |
---|
76 | przElmCmd = new G4UIcmdWithAnInteger("/material/nist/printElementZ",this); |
---|
77 | przElmCmd->SetGuidance("print element Z in dataBase."); |
---|
78 | przElmCmd->SetGuidance("verbose>1 : list associated isotopes."); |
---|
79 | |
---|
80 | lisMatCmd = new G4UIcmdWithAString("/material/nist/listMaterials",this); |
---|
81 | lisMatCmd->SetGuidance("list materials in dataBase."); |
---|
82 | lisMatCmd->SetGuidance("simple = simple nist materials."); |
---|
83 | lisMatCmd->SetGuidance("compound = compound nist materials."); |
---|
84 | lisMatCmd->SetGuidance("hep = hep materials."); |
---|
85 | lisMatCmd->SetGuidance("all = all materials."); |
---|
86 | lisMatCmd->SetParameterName("list", true); |
---|
87 | lisMatCmd->SetCandidates("simple compound hep all"); |
---|
88 | lisMatCmd->SetDefaultValue("all"); |
---|
89 | |
---|
90 | g4Dir = new G4UIdirectory("/material/g4/"); |
---|
91 | g4Dir->SetGuidance("Commands for G4MaterialTable"); |
---|
92 | |
---|
93 | g4ElmCmd = new G4UIcmdWithAString("/material/g4/printElement",this); |
---|
94 | g4ElmCmd->SetGuidance("print Element in G4ElementTable."); |
---|
95 | |
---|
96 | g4MatCmd = new G4UIcmdWithAString("/material/g4/printMaterial",this); |
---|
97 | g4MatCmd->SetGuidance("print Material in G4MaterialTable."); |
---|
98 | |
---|
99 | } |
---|
100 | |
---|
101 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
102 | |
---|
103 | G4NistMessenger::~G4NistMessenger() |
---|
104 | { |
---|
105 | delete verCmd; |
---|
106 | delete prtElmCmd; |
---|
107 | delete przElmCmd; |
---|
108 | delete lisMatCmd; |
---|
109 | delete nistDir; |
---|
110 | |
---|
111 | delete g4ElmCmd; |
---|
112 | delete g4MatCmd; |
---|
113 | delete g4Dir; |
---|
114 | delete matDir; |
---|
115 | } |
---|
116 | |
---|
117 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
118 | |
---|
119 | void G4NistMessenger::SetNewValue(G4UIcommand* command, G4String newValue) |
---|
120 | { |
---|
121 | if (command == verCmd) |
---|
122 | { manager->SetVerbose(verCmd->GetNewIntValue(newValue));} |
---|
123 | |
---|
124 | if (command == prtElmCmd) |
---|
125 | { manager->PrintElement(newValue);} |
---|
126 | |
---|
127 | if (command == przElmCmd) |
---|
128 | { manager->PrintElement(przElmCmd->GetNewIntValue(newValue));} |
---|
129 | |
---|
130 | if (command == lisMatCmd) |
---|
131 | { manager->ListMaterials(newValue);} |
---|
132 | |
---|
133 | if (command == g4ElmCmd) |
---|
134 | { manager->PrintG4Element(newValue);} |
---|
135 | |
---|
136 | if (command == g4MatCmd) |
---|
137 | { manager->PrintG4Material(newValue);} |
---|
138 | } |
---|
139 | |
---|
140 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|