VMC Examples Version 6.6
Loading...
Searching...
No Matches
GarfieldMessenger Class Reference

#include <GarfieldMessenger.h>

Inheritance diagram for GarfieldMessenger:

Public Member Functions

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

Private Attributes

G4UIdirectory * fExampleDir
 
G4UIdirectory * fGarfieldPhysicsDir
 
G4UIcommand * fIonizationModelCmd
 
G4UIcommand * fGarfieldParticleCmd
 

Detailed Description

Definition at line 31 of file GarfieldMessenger.h.

Constructor & Destructor Documentation

◆ GarfieldMessenger()

GarfieldMessenger::GarfieldMessenger ( )

Definition at line 30 of file GarfieldMessenger.cxx.

31 : G4UImessenger(),
32 fExampleDir(0),
36{
37 fExampleDir = new G4UIdirectory("/exampleGarfield/");
38 fExampleDir->SetGuidance("Commands specific to this example");
39
40 G4bool broadcast = false;
42 new G4UIdirectory("/exampleGarfield/physics/", broadcast);
43 fGarfieldPhysicsDir->SetGuidance(
44 "Particle and energy ranges for Garfield++ physics model");
45
47 new G4UIcommand("/exampleGarfield/physics/setIonizationModel", this);
48 fIonizationModelCmd->SetGuidance("Select ionization model for Garfield++");
49 fIonizationModelCmd->SetGuidance(
50 " and choose whether to use default particles");
51 fIonizationModelCmd->SetGuidance(" and energy ranges for the chosen model");
52 //
53 G4UIparameter* ionizationModelPrm =
54 new G4UIparameter("ionizationModel", 's', false);
55 ionizationModelPrm->SetGuidance("ionization model (1. PAIPhot, 2. Heed)");
56 ionizationModelPrm->SetGuidance(
57 " 1. Geant4 model, delta electrons transported by Heed");
58 ionizationModelPrm->SetGuidance(" 2. Use directly Heed");
59 fIonizationModelCmd->SetParameter(ionizationModelPrm);
60 //
61 G4UIparameter* useDefaultsPrm = new G4UIparameter("useDefaults", 'b', false);
62 useDefaultsPrm->SetGuidance(
63 "true to use default, false to manually choose particles and energies");
64 fIonizationModelCmd->SetParameter(useDefaultsPrm);
65 //
66 fIonizationModelCmd->AvailableForStates(G4State_PreInit);
67
68 fGarfieldParticleCmd = new G4UIcommand(
69 "/exampleGarfield/physics/setGarfieldParticleTypeAndEnergy", this);
70 fGarfieldParticleCmd->SetGuidance(
71 "Select particle types and energies for Heed model.");
72 fGarfieldParticleCmd->SetGuidance(
73 " For PAI and PAIPhot model choose at which energy electrons are");
74 fGarfieldParticleCmd->SetGuidance(
75 " transported as delta electrons by Heed, and treatment of gammas");
76 //
77 G4UIparameter* particleGarfieldPrm =
78 new G4UIparameter("particleName", 's', false);
79 particleGarfieldPrm->SetGuidance(
80 "Particle name (gamma, e-, e+, mu-, mu+, proton, anti_proton, pi-, pi+, "
81 "kaon, kaon+, alpha, deuteron)");
82 fGarfieldParticleCmd->SetParameter(particleGarfieldPrm);
83 //
84 G4UIparameter* minEnergyGarfieldPrm =
85 new G4UIparameter("minimumEnergyGarfield", 'd', false);
86 minEnergyGarfieldPrm->SetGuidance("minimum energy");
87 minEnergyGarfieldPrm->SetParameterRange("minimumEnergyGarfield>=0");
88 fGarfieldParticleCmd->SetParameter(minEnergyGarfieldPrm);
89 //
90 G4UIparameter* maxEnergyGarfieldPrm =
91 new G4UIparameter("maximumEnergyGarfield", 'd', false);
92 maxEnergyGarfieldPrm->SetGuidance("maximum energy");
93 maxEnergyGarfieldPrm->SetParameterRange("maximumEnergyGarfield>=0");
94 fGarfieldParticleCmd->SetParameter(maxEnergyGarfieldPrm);
95 //
96 G4UIparameter* unitGarfieldPrm = new G4UIparameter("unit", 's', false);
97 unitGarfieldPrm->SetGuidance("unit of energy");
98 G4String unitListGarfield =
99 G4UIcommand::UnitsList(G4UIcommand::CategoryOf("MeV"));
100 unitGarfieldPrm->SetParameterCandidates(unitListGarfield);
101 fGarfieldParticleCmd->SetParameter(unitGarfieldPrm);
102 //
103 fGarfieldParticleCmd->AvailableForStates(G4State_PreInit);
104}
G4UIdirectory * fGarfieldPhysicsDir
G4UIcommand * fGarfieldParticleCmd
G4UIcommand * fIonizationModelCmd
G4UIdirectory * fExampleDir

◆ ~GarfieldMessenger()

GarfieldMessenger::~GarfieldMessenger ( )

Definition at line 108 of file GarfieldMessenger.cxx.

109{
110 delete fExampleDir;
111 delete fGarfieldPhysicsDir;
112 delete fIonizationModelCmd;
114}

Member Function Documentation

◆ SetNewValue()

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

Definition at line 118 of file GarfieldMessenger.cxx.

119{
120 if (command == fIonizationModelCmd) {
122 G4String modelName;
123 G4bool useDefaults;
124 std::istringstream is(newValue);
125 is >> modelName >> std::boolalpha >> useDefaults;
126 garfieldPhysics->SetIonizationModel(modelName, useDefaults);
127 }
128 else if (command == fGarfieldParticleCmd) {
130 G4String particleName, unit, programName;
131 G4double minEnergy;
132 G4double maxEnergy;
133 std::istringstream is(newValue);
134 is >> particleName >> minEnergy >> maxEnergy >> unit;
135 minEnergy *= G4UIcommand::ValueOf(unit);
136 maxEnergy *= G4UIcommand::ValueOf(unit);
137 garfieldPhysics->AddParticleName(particleName, minEnergy, maxEnergy);
138 }
139}
static GarfieldPhysics * GetInstance()
void SetIonizationModel(std::string model, bool useDefaults=true)
void AddParticleName(const std::string particleName, double ekin_min_keV, double ekin_max_keV)

Member Data Documentation

◆ fExampleDir

G4UIdirectory* GarfieldMessenger::fExampleDir
private

Definition at line 40 of file GarfieldMessenger.h.

◆ fGarfieldPhysicsDir

G4UIdirectory* GarfieldMessenger::fGarfieldPhysicsDir
private

Definition at line 41 of file GarfieldMessenger.h.

◆ fIonizationModelCmd

G4UIcommand* GarfieldMessenger::fIonizationModelCmd
private

Definition at line 42 of file GarfieldMessenger.h.

◆ fGarfieldParticleCmd

G4UIcommand* GarfieldMessenger::fGarfieldParticleCmd
private

Definition at line 43 of file GarfieldMessenger.h.


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