Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
GarfieldMessenger Class Reference

#include <GarfieldMessenger.hh>

+ Inheritance diagram for GarfieldMessenger:

Public Member Functions

 GarfieldMessenger (GarfieldDetectorConstruction *)
 
 ~GarfieldMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 

Detailed Description

Definition at line 46 of file GarfieldMessenger.hh.

Constructor & Destructor Documentation

◆ GarfieldMessenger()

GarfieldMessenger::GarfieldMessenger ( GarfieldDetectorConstruction Det)

Definition at line 42 of file GarfieldMessenger.cc.

43 : G4UImessenger(),
44 fDetector(Det),
45 fExampleDir(0),
46 fAbsorberDir(0),
47 fGarfieldPhysicsDir(0),
48 fMaterialCmd(0),
49 fIsotopeCmd(0),
50 fIonizationModelCmd(0),
51 fGeant4ParticleCmd(0) {
52 fExampleDir = new G4UIdirectory("/exampleGarfield/");
53 fExampleDir->SetGuidance("Commands specific to this example");
54
55 G4bool broadcast = false;
56 fAbsorberDir = new G4UIdirectory("/exampleGarfield/absorber/", broadcast);
57 fAbsorberDir->SetGuidance("Absorber construction commands");
58
59 fGarfieldPhysicsDir =
60 new G4UIdirectory("/exampleGarfield/physics/", broadcast);
61 fGarfieldPhysicsDir->SetGuidance(
62 "Particle and energy ranges for Garfield++ physics model");
63
64 fMaterialCmd =
65 new G4UIcmdWithAString("/exampleGarfield/absorber/setMat", this);
66 fMaterialCmd->SetGuidance("Select material of the absorber:");
67 fMaterialCmd->SetParameterName("choice", false);
68 fMaterialCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
69
70 fIsotopeCmd =
71 new G4UIcommand("/exampleGarfield/absorber/setIsotopeMat", this);
72 fIsotopeCmd->SetGuidance("Build and select a material with single isotope");
73 fIsotopeCmd->SetGuidance(" symbol of isotope, Z, A, density of material");
74 //
75 G4UIparameter* symbPrm = new G4UIparameter("isotope", 's', false);
76 symbPrm->SetGuidance("isotope symbol");
77 fIsotopeCmd->SetParameter(symbPrm);
78 //
79 G4UIparameter* ZPrm = new G4UIparameter("Z", 'i', false);
80 ZPrm->SetGuidance("Z");
81 ZPrm->SetParameterRange("Z>0");
82 fIsotopeCmd->SetParameter(ZPrm);
83 //
84 G4UIparameter* APrm = new G4UIparameter("A", 'i', false);
85 APrm->SetGuidance("A");
86 APrm->SetParameterRange("A>0");
87 fIsotopeCmd->SetParameter(APrm);
88 //
89 G4UIparameter* densityPrm = new G4UIparameter("density", 'd', false);
90 densityPrm->SetGuidance("density of material");
91 densityPrm->SetParameterRange("density>0.");
92 fIsotopeCmd->SetParameter(densityPrm);
93 //
94 G4UIparameter* unitPrm = new G4UIparameter("unit", 's', false);
95 unitPrm->SetGuidance("unit of density");
96 G4String unitList = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("g/cm3"));
97 unitPrm->SetParameterCandidates(unitList);
98 fIsotopeCmd->SetParameter(unitPrm);
99 //
100 fIsotopeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
101
102 fIonizationModelCmd =
103 new G4UIcommand("/exampleGarfield/physics/setIonizationModel", this);
104 fIonizationModelCmd->SetGuidance("Select ionization model for Garfield++");
105 fIonizationModelCmd->SetGuidance(
106 " and choose whether to use default particles");
107 fIonizationModelCmd->SetGuidance(" and energy ranges for the chosen model");
108 //
109 G4UIparameter* ionizationModelPrm =
110 new G4UIparameter("ionizationModel", 's', false);
111 ionizationModelPrm->SetGuidance(
112 "ionization model (1. PAIPhot, 2. PAI or 3. Heed)");
113 ionizationModelPrm->SetGuidance(
114 " 1. PAIPhot model in Geant4, delta electrons transported by Heed");
115 ionizationModelPrm->SetGuidance(
116 " 2. PAI model in Geant4, delta electrons transported by Heed");
117 ionizationModelPrm->SetGuidance(" 3. Use directly Heed");
118 fIonizationModelCmd->SetParameter(ionizationModelPrm);
119 //
120 G4UIparameter* useDefaultsPrm = new G4UIparameter("useDefaults", 'b', false);
121 useDefaultsPrm->SetGuidance(
122 "true to use default, false to manually choose particles and energies");
123 fIonizationModelCmd->SetParameter(useDefaultsPrm);
124 //
125 fIonizationModelCmd->AvailableForStates(G4State_PreInit);
126
127 fGeant4ParticleCmd = new G4UIcommand(
128 "/exampleGarfield/physics/setGeant4ParticleTypeAndEnergy", this);
129 fGeant4ParticleCmd->SetGuidance(
130 "Select particle types and energies for PAI and PAIPhot model");
131 fGeant4ParticleCmd->SetGuidance(" in Geant4");
132 //
133 G4UIparameter* particleGeant4Prm =
134 new G4UIparameter("particleName", 's', false);
135 particleGeant4Prm->SetGuidance(
136 "Particle name (e-, e+, mu-, mu+, proton, pi-, pi+, alpha, He3, "
137 "GenericIon)");
138 fGeant4ParticleCmd->SetParameter(particleGeant4Prm);
139 //
140 G4UIparameter* minEnergyGeant4Prm =
141 new G4UIparameter("minimumEnergyGeant4", 'd', false);
142 minEnergyGeant4Prm->SetGuidance("minimum energy");
143 minEnergyGeant4Prm->SetParameterRange("minimumEnergyGeant4>=0");
144 fGeant4ParticleCmd->SetParameter(minEnergyGeant4Prm);
145 //
146 G4UIparameter* maxEnergyGeant4Prm =
147 new G4UIparameter("maximumEnergyGeant4", 'd', false);
148 maxEnergyGeant4Prm->SetGuidance("maximum energy");
149 maxEnergyGeant4Prm->SetParameterRange("maximumEnergyGeant4>=0");
150 fGeant4ParticleCmd->SetParameter(maxEnergyGeant4Prm);
151 //
152 G4UIparameter* unitGeant4Prm = new G4UIparameter("unit", 's', false);
153 unitGeant4Prm->SetGuidance("unit of energy");
154 G4String unitListGeant4 =
155 G4UIcommand::UnitsList(G4UIcommand::CategoryOf("MeV"));
156 unitGeant4Prm->SetParameterCandidates(unitListGeant4);
157 fGeant4ParticleCmd->SetParameter(unitGeant4Prm);
158 //
159 fGeant4ParticleCmd->AvailableForStates(G4State_PreInit);
160
161 fGarfieldParticleCmd = new G4UIcommand(
162 "/exampleGarfield/physics/setGarfieldParticleTypeAndEnergy", this);
163 fGarfieldParticleCmd->SetGuidance(
164 "Select particle types and energies for Heed model.");
165 fGarfieldParticleCmd->SetGuidance(
166 " For PAI and PAIPhot model choose at which energy electrons are");
167 fGarfieldParticleCmd->SetGuidance(
168 " transported as delta electrons by Heed, and treatment of gammas");
169 //
170 G4UIparameter* particleGarfieldPrm =
171 new G4UIparameter("particleName", 's', false);
172 particleGarfieldPrm->SetGuidance(
173 "Particle name (gamma, e-, e+, mu-, mu+, proton, anti_proton, pi-, pi+, "
174 "kaon, kaon+, alpha, deuteron)");
175 fGarfieldParticleCmd->SetParameter(particleGarfieldPrm);
176 //
177 G4UIparameter* minEnergyGarfieldPrm =
178 new G4UIparameter("minimumEnergyGarfield", 'd', false);
179 minEnergyGarfieldPrm->SetGuidance("minimum energy");
180 minEnergyGarfieldPrm->SetParameterRange("minimumEnergyGarfield>=0");
181 fGarfieldParticleCmd->SetParameter(minEnergyGarfieldPrm);
182 //
183 G4UIparameter* maxEnergyGarfieldPrm =
184 new G4UIparameter("maximumEnergyGarfield", 'd', false);
185 maxEnergyGarfieldPrm->SetGuidance("maximum energy");
186 maxEnergyGarfieldPrm->SetParameterRange("maximumEnergyGarfield>=0");
187 fGarfieldParticleCmd->SetParameter(maxEnergyGarfieldPrm);
188 //
189 G4UIparameter* unitGarfieldPrm = new G4UIparameter("unit", 's', false);
190 unitGarfieldPrm->SetGuidance("unit of energy");
191 G4String unitListGarfield =
192 G4UIcommand::UnitsList(G4UIcommand::CategoryOf("MeV"));
193 unitGarfieldPrm->SetParameterCandidates(unitListGarfield);
194 fGarfieldParticleCmd->SetParameter(unitGarfieldPrm);
195 //
196 fGarfieldParticleCmd->AvailableForStates(G4State_PreInit);
197}

◆ ~GarfieldMessenger()

GarfieldMessenger::~GarfieldMessenger ( )

Definition at line 201 of file GarfieldMessenger.cc.

201 {
202 delete fMaterialCmd;
203 delete fIsotopeCmd;
204 delete fAbsorberDir;
205 delete fExampleDir;
206 delete fGarfieldPhysicsDir;
207 delete fIonizationModelCmd;
208 delete fGeant4ParticleCmd;
209 delete fGarfieldParticleCmd;
210}

Member Function Documentation

◆ SetNewValue()

void GarfieldMessenger::SetNewValue ( G4UIcommand *  command,
G4String  newValue 
)
virtual

Definition at line 214 of file GarfieldMessenger.cc.

214 {
215 if (command == fMaterialCmd) {
216 fDetector->SetAbsorberMaterial(newValue);
217 } else if (command == fIsotopeCmd) {
218 G4int Z;
219 G4int A;
220 G4double dens;
221 G4String name, unt;
222 std::istringstream is(newValue);
223 is >> name >> Z >> A >> dens >> unt;
224 dens *= G4UIcommand::ValueOf(unt);
225 fDetector->AbsorberMaterialWithSingleIsotope(name, name, dens, Z, A);
226 fDetector->SetAbsorberMaterial(name);
227 } else if (command == fIonizationModelCmd) {
229 G4String modelName;
230 G4bool useDefaults;
231 std::istringstream is(newValue);
232 is >> modelName >> std::boolalpha >> useDefaults;
233 garfieldPhysics->SetIonizationModel(modelName, useDefaults);
234 } else if (command == fGeant4ParticleCmd) {
236 G4String particleName, unit, programName;
237 G4double minEnergy;
238 G4double maxEnergy;
239 std::istringstream is(newValue);
240 is >> particleName >> minEnergy >> maxEnergy >> unit;
241 minEnergy *= G4UIcommand::ValueOf(unit);
242 maxEnergy *= G4UIcommand::ValueOf(unit);
243 garfieldPhysics->AddParticleName(particleName, minEnergy, maxEnergy,
244 "geant4");
245 } else if (command == fGarfieldParticleCmd) {
247 G4String particleName, unit, programName;
248 G4double minEnergy;
249 G4double maxEnergy;
250 std::istringstream is(newValue);
251 is >> particleName >> minEnergy >> maxEnergy >> unit;
252 minEnergy *= G4UIcommand::ValueOf(unit);
253 maxEnergy *= G4UIcommand::ValueOf(unit);
254 garfieldPhysics->AddParticleName(particleName, minEnergy, maxEnergy,
255 "garfield");
256 }
257}
void SetAbsorberMaterial(G4String materialChoice)
G4Material * AbsorberMaterialWithSingleIsotope(G4String name, G4String symbol, G4double density, G4int Z, G4int A)
static GarfieldPhysics * GetInstance()
void SetIonizationModel(std::string model, bool useDefaults=true)
void AddParticleName(const std::string particleName, double ekin_min_MeV, double ekin_max_MeV, std::string program)

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