Garfield++ 3.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 41 of file GarfieldMessenger.cc.

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

◆ ~GarfieldMessenger()

GarfieldMessenger::~GarfieldMessenger ( )

Definition at line 191 of file GarfieldMessenger.cc.

191 {
192 delete fMaterialCmd;
193 delete fIsotopeCmd;
194 delete fAbsorberDir;
195 delete fExampleDir;
196 delete fGarfieldPhysicsDir;
197 delete fIonizationModelCmd;
198 delete fGeant4ParticleCmd;
199 delete fGarfieldParticleCmd;
200}

Member Function Documentation

◆ SetNewValue()

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

Definition at line 204 of file GarfieldMessenger.cc.

204 {
205 if (command == fMaterialCmd) {
206 fDetector->SetAbsorberMaterial(newValue);
207 } else if (command == fIsotopeCmd) {
208 G4int Z;
209 G4int A;
210 G4double dens;
211 G4String name, unt;
212 std::istringstream is(newValue);
213 is >> name >> Z >> A >> dens >> unt;
214 dens *= G4UIcommand::ValueOf(unt);
215 fDetector->AbsorberMaterialWithSingleIsotope(name, name, dens, Z, A);
216 fDetector->SetAbsorberMaterial(name);
217 } else if (command == fIonizationModelCmd) {
219 G4String modelName;
220 G4bool useDefaults;
221 std::istringstream is(newValue);
222 is >> modelName >> std::boolalpha >> useDefaults;
223 garfieldPhysics->SetIonizationModel(modelName, useDefaults);
224 } else if (command == fGeant4ParticleCmd) {
226 G4String particleName, unit, programName;
227 G4double minEnergy;
228 G4double maxEnergy;
229 std::istringstream is(newValue);
230 is >> particleName >> minEnergy >> maxEnergy >> unit;
231 minEnergy *= G4UIcommand::ValueOf(unit);
232 maxEnergy *= G4UIcommand::ValueOf(unit);
233 garfieldPhysics->AddParticleName(particleName, minEnergy, maxEnergy,
234 "geant4");
235 } else if (command == fGarfieldParticleCmd) {
237 G4String particleName, unit, programName;
238 G4double minEnergy;
239 G4double maxEnergy;
240 std::istringstream is(newValue);
241 is >> particleName >> minEnergy >> maxEnergy >> unit;
242 minEnergy *= G4UIcommand::ValueOf(unit);
243 maxEnergy *= G4UIcommand::ValueOf(unit);
244 garfieldPhysics->AddParticleName(particleName, minEnergy, maxEnergy,
245 "garfield");
246 }
247}
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: