33#include "G4UIcmdWithADoubleAndUnit.hh"
34#include "G4UIcmdWithAString.hh"
35#include "G4UIcmdWithoutParameter.hh"
36#include "G4UIcommand.hh"
37#include "G4UIdirectory.hh"
38#include "G4UIparameter.hh"
47 fGarfieldPhysicsDir(0),
50 fIonizationModelCmd(0),
51 fGeant4ParticleCmd(0) {
52 fExampleDir =
new G4UIdirectory(
"/exampleGarfield/");
53 fExampleDir->SetGuidance(
"Commands specific to this example");
55 G4bool broadcast =
false;
56 fAbsorberDir =
new G4UIdirectory(
"/exampleGarfield/absorber/", broadcast);
57 fAbsorberDir->SetGuidance(
"Absorber construction commands");
60 new G4UIdirectory(
"/exampleGarfield/physics/", broadcast);
61 fGarfieldPhysicsDir->SetGuidance(
62 "Particle and energy ranges for Garfield++ physics model");
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);
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");
75 G4UIparameter* symbPrm =
new G4UIparameter(
"isotope",
's',
false);
76 symbPrm->SetGuidance(
"isotope symbol");
77 fIsotopeCmd->SetParameter(symbPrm);
79 G4UIparameter* ZPrm =
new G4UIparameter(
"Z",
'i',
false);
80 ZPrm->SetGuidance(
"Z");
81 ZPrm->SetParameterRange(
"Z>0");
82 fIsotopeCmd->SetParameter(ZPrm);
84 G4UIparameter* APrm =
new G4UIparameter(
"A",
'i',
false);
85 APrm->SetGuidance(
"A");
86 APrm->SetParameterRange(
"A>0");
87 fIsotopeCmd->SetParameter(APrm);
89 G4UIparameter* densityPrm =
new G4UIparameter(
"density",
'd',
false);
90 densityPrm->SetGuidance(
"density of material");
91 densityPrm->SetParameterRange(
"density>0.");
92 fIsotopeCmd->SetParameter(densityPrm);
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);
100 fIsotopeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
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");
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);
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);
125 fIonizationModelCmd->AvailableForStates(G4State_PreInit);
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");
133 G4UIparameter* particleGeant4Prm =
134 new G4UIparameter(
"particleName",
's',
false);
135 particleGeant4Prm->SetGuidance(
136 "Particle name (e-, e+, mu-, mu+, proton, pi-, pi+, alpha, He3, "
138 fGeant4ParticleCmd->SetParameter(particleGeant4Prm);
140 G4UIparameter* minEnergyGeant4Prm =
141 new G4UIparameter(
"minimumEnergyGeant4",
'd',
false);
142 minEnergyGeant4Prm->SetGuidance(
"minimum energy");
143 minEnergyGeant4Prm->SetParameterRange(
"minimumEnergyGeant4>=0");
144 fGeant4ParticleCmd->SetParameter(minEnergyGeant4Prm);
146 G4UIparameter* maxEnergyGeant4Prm =
147 new G4UIparameter(
"maximumEnergyGeant4",
'd',
false);
148 maxEnergyGeant4Prm->SetGuidance(
"maximum energy");
149 maxEnergyGeant4Prm->SetParameterRange(
"maximumEnergyGeant4>=0");
150 fGeant4ParticleCmd->SetParameter(maxEnergyGeant4Prm);
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);
159 fGeant4ParticleCmd->AvailableForStates(G4State_PreInit);
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");
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);
177 G4UIparameter* minEnergyGarfieldPrm =
178 new G4UIparameter(
"minimumEnergyGarfield",
'd',
false);
179 minEnergyGarfieldPrm->SetGuidance(
"minimum energy");
180 minEnergyGarfieldPrm->SetParameterRange(
"minimumEnergyGarfield>=0");
181 fGarfieldParticleCmd->SetParameter(minEnergyGarfieldPrm);
183 G4UIparameter* maxEnergyGarfieldPrm =
184 new G4UIparameter(
"maximumEnergyGarfield",
'd',
false);
185 maxEnergyGarfieldPrm->SetGuidance(
"maximum energy");
186 maxEnergyGarfieldPrm->SetParameterRange(
"maximumEnergyGarfield>=0");
187 fGarfieldParticleCmd->SetParameter(maxEnergyGarfieldPrm);
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);
196 fGarfieldParticleCmd->AvailableForStates(G4State_PreInit);
206 delete fGarfieldPhysicsDir;
207 delete fIonizationModelCmd;
208 delete fGeant4ParticleCmd;
209 delete fGarfieldParticleCmd;
215 if (command == fMaterialCmd) {
217 }
else if (command == fIsotopeCmd) {
222 std::istringstream is(newValue);
223 is >> name >> Z >> A >> dens >> unt;
224 dens *= G4UIcommand::ValueOf(unt);
227 }
else if (command == fIonizationModelCmd) {
231 std::istringstream is(newValue);
232 is >> modelName >> std::boolalpha >> useDefaults;
234 }
else if (command == fGeant4ParticleCmd) {
236 G4String particleName, unit, programName;
239 std::istringstream is(newValue);
240 is >> particleName >> minEnergy >> maxEnergy >> unit;
241 minEnergy *= G4UIcommand::ValueOf(unit);
242 maxEnergy *= G4UIcommand::ValueOf(unit);
245 }
else if (command == fGarfieldParticleCmd) {
247 G4String particleName, unit, programName;
250 std::istringstream is(newValue);
251 is >> particleName >> minEnergy >> maxEnergy >> unit;
252 minEnergy *= G4UIcommand::ValueOf(unit);
253 maxEnergy *= G4UIcommand::ValueOf(unit);
Definition of the GarfieldDetectorConstruction class.
Definition of the GarfieldMessenger class.
Definition of the GarfieldPhysics class.
void SetAbsorberMaterial(G4String materialChoice)
G4Material * AbsorberMaterialWithSingleIsotope(G4String name, G4String symbol, G4double density, G4int Z, G4int A)
GarfieldMessenger(GarfieldDetectorConstruction *)
virtual void SetNewValue(G4UIcommand *, G4String)
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)