Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4NistMessenger Class Reference

#include <G4NistMessenger.hh>

Inheritance diagram for G4NistMessenger:

Public Member Functions

 G4NistMessenger (G4NistManager *)
 ~G4NistMessenger () override
void SetNewValue (G4UIcommand *, G4String) override
Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
virtual ~G4UImessenger ()
virtual G4String GetCurrentValue (G4UIcommand *command)
G4bool CommandsShouldBeInMaster () const

Additional Inherited Members

Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
G4String LtoS (G4long l)
G4String DtoS (G4double a)
G4String BtoS (G4bool b)
G4int StoI (const G4String &s)
G4long StoL (const G4String &s)
G4double StoD (const G4String &s)
G4bool StoB (const G4String &s)
void AddUIcommand (G4UIcommand *newCommand)
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
template<typename T>
T * CreateCommand (const G4String &cname, const G4String &dsc)
Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
G4String baseDirName = ""
G4bool commandsShouldBeInMaster = false

Detailed Description

Definition at line 71 of file G4NistMessenger.hh.

Constructor & Destructor Documentation

◆ G4NistMessenger()

G4NistMessenger::G4NistMessenger ( G4NistManager * man)
explicit

Definition at line 53 of file G4NistMessenger.cc.

53 : manager(man)
54{
55 matDir = new G4UIdirectory("/material/");
56 matDir->SetGuidance("Commands for materials");
57
58 verCmd = new G4UIcmdWithAnInteger("/material/verbose", this);
59 verCmd->SetGuidance("Set verbose level.");
60 verCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
61 verCmd->SetToBeBroadcasted(false);
62
63 nistDir = new G4UIdirectory("/material/nist/");
64 nistDir->SetGuidance("Commands for the nist dataBase");
65
66 prtElmCmd = new G4UIcmdWithAString("/material/nist/printElement", this);
67 prtElmCmd->SetGuidance("print element(s) in dataBase.");
68 prtElmCmd->SetGuidance("symbol = element.");
69 prtElmCmd->SetGuidance("all = all elements.");
70 prtElmCmd->SetParameterName("symbol", true);
71 prtElmCmd->SetDefaultValue("all");
72 prtElmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
73 prtElmCmd->SetToBeBroadcasted(false);
74
75 przElmCmd = new G4UIcmdWithAnInteger("/material/nist/printElementZ", this);
76 przElmCmd->SetGuidance("print element Z in dataBase.");
77 przElmCmd->SetGuidance("0 = all elements.");
78 przElmCmd->SetParameterName("Z", true);
79 przElmCmd->SetDefaultValue(0);
80 przElmCmd->SetRange("0<=Z && Z<108");
81 przElmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
82 przElmCmd->SetToBeBroadcasted(false);
83
84 lisMatCmd = new G4UIcmdWithAString("/material/nist/listMaterials", this);
85 lisMatCmd->SetGuidance("Materials in Geant4 dataBase.");
86 lisMatCmd->SetGuidance("simple - simple NIST materials.");
87 lisMatCmd->SetGuidance("compound - compound NIST materials.");
88 lisMatCmd->SetGuidance("hep - HEP materials.");
89 lisMatCmd->SetGuidance("bio - biomedical materials.");
90 lisMatCmd->SetGuidance("all - list of all Geant4 materials.");
91 lisMatCmd->SetParameterName("matlist", true);
92 // lisMatCmd->SetCandidates("simple compound hep bio all");
93 lisMatCmd->SetDefaultValue("all");
94 lisMatCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
95 lisMatCmd->SetToBeBroadcasted(false);
96
97 g4Dir = new G4UIdirectory("/material/g4/");
98 g4Dir->SetGuidance("Commands for G4MaterialTable");
99
100 g4ElmCmd = new G4UIcmdWithAString("/material/g4/printElement", this);
101 g4ElmCmd->SetGuidance("print Element from G4ElementTable.");
102 g4ElmCmd->SetGuidance("all - all elements.");
103 g4ElmCmd->SetParameterName("elm", true);
104 g4ElmCmd->SetDefaultValue("all");
105
106 g4MatCmd = new G4UIcmdWithAString("/material/g4/printMaterial", this);
107 g4MatCmd->SetGuidance("print Material from G4MaterialTable.");
108 g4MatCmd->SetGuidance("all - all materials");
109 g4MatCmd->SetParameterName("pmat", true);
110 g4MatCmd->SetDefaultValue("all");
111 g4MatCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
112 g4MatCmd->SetToBeBroadcasted(false);
113
114 g4DensCmd = new G4UIcmdWithAString("/material/g4/printDensityEffParam", this);
115 g4DensCmd->SetGuidance("print Material from G4DensityEffectData.");
116 g4DensCmd->SetGuidance("all - all materials");
117 g4DensCmd->SetParameterName("dmat", true);
118 g4DensCmd->SetDefaultValue("all");
119 g4DensCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
120 g4DensCmd->SetToBeBroadcasted(false);
121
122 densCmd = new G4UIcmdWithAString("/material/g4/enableDensityEffOnFly", this);
123 densCmd->SetGuidance("enable accurate computation of density effect.");
124 densCmd->SetGuidance("all - all materials.");
125 densCmd->SetParameterName("dens", true);
126 densCmd->SetDefaultValue("all");
127 densCmd->AvailableForStates(G4State_PreInit);
128 lisMatCmd->SetToBeBroadcasted(false);
129
130 adensCmd = new G4UIcmdWithAString("/material/g4/disableDensityEffOnFly", this);
131 adensCmd->SetGuidance("disable accurate computation of density effect.");
132 adensCmd->SetGuidance("all - all materials.");
133 adensCmd->SetParameterName("dens", true);
134 adensCmd->SetDefaultValue("all");
135 adensCmd->AvailableForStates(G4State_PreInit);
136 adensCmd->SetToBeBroadcasted(false);
137
138 fPosiCmd = new G4UIcommand("/material/g4/ortoPositroniumFraction", this);
139 fPosiCmd->SetGuidance("defined orto-positronium fraction for positron annihilation AtRest.");
140 fPosiCmd->SetGuidance("via material name, all - all materials.");
141 fPosiCmd->AvailableForStates(G4State_PreInit);
142 fPosiCmd->SetToBeBroadcasted(false);
143
144 auto p1 = new G4UIparameter("matname",'s', false);
145 fPosiCmd->SetParameter(p1);
146
147 auto p2 = new G4UIparameter("fraction", 'd', false);
148 p2->SetParameterRange("fraction>=0. && fraction <=1.");
149 fPosiCmd->SetParameter(p2);
150}
@ G4State_Idle
@ G4State_PreInit

◆ ~G4NistMessenger()

G4NistMessenger::~G4NistMessenger ( )
override

Definition at line 154 of file G4NistMessenger.cc.

155{
156 delete verCmd;
157 delete prtElmCmd;
158 delete przElmCmd;
159 delete lisMatCmd;
160 delete nistDir;
161
162 delete g4ElmCmd;
163 delete g4MatCmd;
164 delete g4DensCmd;
165 delete densCmd;
166 delete adensCmd;
167 delete fPosiCmd;
168
169 delete g4Dir;
170 delete matDir;
171}

Member Function Documentation

◆ SetNewValue()

void G4NistMessenger::SetNewValue ( G4UIcommand * command,
G4String newValue )
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 175 of file G4NistMessenger.cc.

176{
177 // G4cout << "G4NistMessenger::SetNewValue <" << newValue << ">" << G4endl;
178 if (command == verCmd) {
179 manager->SetVerbose(verCmd->GetNewIntValue(newValue));
180 }
181 else if (command == prtElmCmd) {
182 manager->PrintElement(newValue);
183 }
184 else if (command == przElmCmd) {
185 G4int Z = przElmCmd->GetNewIntValue(newValue);
186 if (Z >= 0 && Z < 108) {
187 manager->PrintElement(Z);
188 }
189 }
190 else if (command == lisMatCmd) {
191 manager->ListMaterials(newValue);
192 }
193 else if (command == g4ElmCmd) {
194 manager->PrintG4Element(newValue);
195 }
196 else if (command == g4MatCmd) {
197 manager->PrintG4Material(newValue);
198 }
199 else if (command == g4DensCmd) {
201 }
202 else if (command == densCmd) {
203 manager->SetDensityEffectCalculatorFlag(newValue, true);
204 }
205 else if (command == adensCmd) {
206 manager->SetDensityEffectCalculatorFlag(newValue, false);
207 }
208 else if (command == fPosiCmd) {
209 G4String mnam{""};
210 G4double f{0.0};
211 std::istringstream ss(newValue);
212 ss >> mnam >> f;
213 // set fraction for all materials
214 if (mnam == "all" || mnam == "none") {
215 if (mnam == "none" || f < 0.0) { f = 0.0; }
216 auto mtable = G4Material::GetMaterialTable();
217 for ( auto const & mat : *mtable ) {
218 mat->GetIonisation()->SetOrtoPositroniumFraction(f);
219 }
220 } else {
221 // set fraction for one material
222 auto mat = manager->FindOrBuildMaterial(mnam, true);
223 if (nullptr != mat) {
224 mat->GetIonisation()->SetOrtoPositroniumFraction(f);
225 }
226 }
227 }
228}
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
void PrintData(const G4String &matName) const
static G4DensityEffectData * GetDensityEffectData()
static G4MaterialTable * GetMaterialTable()

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