Skip to content

Commit 7502d71

Browse files
committed
Adding a command to set the "Mean Energy Per Ion Pair" value of a given material to with a default value of 5 eV. (Analogous to setting the ionization potential value of a given material.)
1 parent 9416e81 commit 7502d71

4 files changed

Lines changed: 33 additions & 3 deletions

File tree

source/geometry/include/GateDetectorConstruction.hh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ public:
159159
void SetMaterialIoniPotential(G4String n,G4double v){theListOfIonisationPotential[n]=v;}
160160
G4double GetMaterialIoniPotential(G4String n){ return theListOfIonisationPotential[n];}
161161

162-
162+
void SetMaterialMeanEnergyPerIonPair(G4String n,G4double v){theListOfMeanEnergyPerIonPair[n]=v;}
163+
G4double GetMaterialMeanEnergyPerIonPair(G4String n){ return theListOfMeanEnergyPerIonPair[n];}
163164

164165
private :
165166

@@ -185,6 +186,7 @@ protected :
185186
G4bool moveFlag;
186187

187188
std::map<G4String,G4double> theListOfIonisationPotential;
189+
std::map<G4String,G4double> theListOfMeanEnergyPerIonPair;
188190

189191

190192
private:

source/geometry/include/GateDetectorMessenger.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class GateDetectorMessenger: public G4UImessenger
5858

5959
G4UIcmdWithoutParameter* pListCreatorsCmd;
6060
G4UIcmdWithAString* IoniCmd;
61+
G4UIcmdWithAString* IonPairCmd;
6162

6263
//G4UIcmdWithABool* pEnableAutoUpdateCmd;
6364
//G4UIcmdWithABool* pDisableAutoUpdateCmd;

source/geometry/src/GateDetectorConstruction.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,22 @@ G4VPhysicalVolume* GateDetectorConstruction::Construct()
153153

154154
const G4MaterialTable * theTable = G4Material::GetMaterialTable();
155155
for(unsigned int i =0;i<(*theTable).size();i++){
156+
// Set the default value
157+
G4double defaultMeanEnergyPerIonPair = 5. * eV;
158+
(*theTable)[i]->GetIonisation()->SetMeanEnergyPerIonPair(defaultMeanEnergyPerIonPair);
159+
160+
// Update, if given
161+
if(theListOfMeanEnergyPerIonPair[(*theTable)[i]->GetName()]){
162+
(*theTable)[i]->GetIonisation()->SetMeanEnergyPerIonPair(theListOfMeanEnergyPerIonPair[(*theTable)[i]->GetName()]);
163+
GateMessage("Physic", 1, " - " << (*theTable)[i]->GetName() << "\t updating the default 'mean energy per ion pair' value of " <<
164+
G4BestUnit(defaultMeanEnergyPerIonPair,"Energy") << "to " <<
165+
G4BestUnit((*theTable)[i]->GetIonisation()->GetMeanEnergyPerIonPair(),"Energy") << Gateendl);
166+
}
167+
else {
168+
GateMessage("Physic", 1, " - " << (*theTable)[i]->GetName() << "\t using the default 'mean energy per ion pair' value of " <<
169+
G4BestUnit((*theTable)[i]->GetIonisation()->GetMeanEnergyPerIonPair(),"Energy") << Gateendl);
170+
}
171+
156172
if(theListOfIonisationPotential[(*theTable)[i]->GetName()]){
157173
(*theTable)[i]->GetIonisation()->SetMeanExcitationEnergy(theListOfIonisationPotential[(*theTable)[i]->GetName()]);
158174
GateMessage("Physic", 1, " - " << (*theTable)[i]->GetName() << "\t defaut value: I = " <<

source/geometry/src/GateDetectorMessenger.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,12 @@ GateDetectorMessenger::GateDetectorMessenger(GateDetectorConstruction* GateDet)
171171
IoniCmd = new G4UIcmdWithAString(cmd,this);
172172
IoniCmd->SetGuidance("Set the ionisation potential for a material (two parameters 'material' and 'value and unit')");
173173

174-
175-
174+
cmd = "/gate/geometry/setMeanEnergyPerIonPair";
175+
IonPairCmd = new G4UIcmdWithAString(cmd,this);
176+
IonPairCmd->SetGuidance("Set the mean energy per ion pair. "
177+
"This controls the magnitude of the acollinearity effect for electron-positron annihilation. "
178+
"The default value is 5 eV (see https://www.geant4.org/download/release-notes/notes-v10.7.0.html). "
179+
"(two parameters 'material' and 'value with unit')");
176180

177181
GateDistributionListManager::Init();
178182
}
@@ -245,6 +249,13 @@ void GateDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
245249
GetStringAndValueFromCommand(command, newValue, matName, value);
246250
pDetectorConstruction->SetMaterialIoniPotential(matName,value);
247251
}
252+
else if( command == IonPairCmd )
253+
{
254+
G4String matName;
255+
double value;
256+
GetStringAndValueFromCommand(command, newValue, matName, value);
257+
pDetectorConstruction->SetMaterialMeanEnergyPerIonPair(matName,value);
258+
}
248259
else
249260
G4UImessenger::SetNewValue(command,newValue);
250261

0 commit comments

Comments
 (0)