Import Geant4 5.1.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UserPhysicsListMessenger.cc,v 1.11 2002/12/04 21:52:40 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
// $Id: G4UserPhysicsListMessenger.cc,v 1.22 2003/04/28 22:54:37 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-01 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -49,6 +49,7 @@
|
||||
|
||||
G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pParticleList):thePhysicsList(pParticleList)
|
||||
{
|
||||
G4UIparameter* param = 0;
|
||||
// /run/particle directory
|
||||
theDirectory = new G4UIdirectory("/run/particle/");
|
||||
theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
|
||||
@@ -64,29 +65,43 @@ G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pPart
|
||||
verboseCmd->SetRange("level >=0 && level <=3");
|
||||
|
||||
// /run/particle/setCut command
|
||||
setCutCmd = new G4UIcmdWithADoubleAndUnit("/run/particle/setCut",this);
|
||||
setPCutCmd = new G4UIcmdWithADoubleAndUnit("/run/particle/setCut",this);
|
||||
setPCutCmd->SetGuidance("Set default cut value ");
|
||||
setPCutCmd->SetGuidance("This command is equivallent to /run/setCut command.");
|
||||
setPCutCmd->SetGuidance("This command is kept for backward compatibility.");
|
||||
setPCutCmd->SetParameterName("cut",false);
|
||||
setPCutCmd->SetDefaultValue(1.0);
|
||||
setPCutCmd->SetRange("cut >0.0");
|
||||
setPCutCmd->SetDefaultUnit("mm");
|
||||
setPCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
// /run/setCut command
|
||||
setCutCmd = new G4UIcmdWithADoubleAndUnit("/run/setCut",this);
|
||||
setCutCmd->SetGuidance("Set default cut value ");
|
||||
setCutCmd->SetParameterName("cut",false);
|
||||
setCutCmd->SetDefaultValue(1.0);
|
||||
setCutCmd->SetRange("cut >0.0");
|
||||
setCutCmd->SetUnitCandidates("m cm mm microm");
|
||||
setCutCmd->SetDefaultUnit("mm");
|
||||
setCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
// /run/setCutForRegion command
|
||||
setCutRCmd = new G4UIcommand("/run/setCutForRegion",this);
|
||||
setCutRCmd->SetGuidance("Set cut value for a region");
|
||||
param = new G4UIparameter("Region",'s',false);
|
||||
setCutRCmd->SetParameter(param);
|
||||
param = new G4UIparameter("cut",'d',false);
|
||||
param->SetParameterRange("cut >0.0");
|
||||
setCutRCmd->SetParameter(param);
|
||||
param = new G4UIparameter("Unit",'s',true);
|
||||
param->SetDefaultValue("mm");
|
||||
param->SetParameterCandidates(setCutRCmd->UnitsList(setCutRCmd->CategoryOf("mm")));
|
||||
setCutRCmd->SetParameter(param);
|
||||
setCutRCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
// /run/particle/DumpList command
|
||||
dumpListCmd = new G4UIcmdWithoutParameter("/run/particle/dumpList",this);
|
||||
dumpListCmd->SetGuidance("Dump List of particles in G4VUserPhysicsList. ");
|
||||
|
||||
|
||||
// /run/particle/DumpCutValues command
|
||||
dumpCutValuesCmd = new G4UIcmdWithAString("/run/particle/dumpCutValues",this);
|
||||
dumpCutValuesCmd->SetGuidance("Dump cut value information ");
|
||||
dumpCutValuesCmd->SetGuidance("Enter particle name ");
|
||||
dumpCutValuesCmd->SetGuidance(" enter all for all particles");
|
||||
dumpCutValuesCmd->SetParameterName("particle", true);
|
||||
dumpCutValuesCmd->SetDefaultValue("table");
|
||||
dumpCutValuesCmd->AvailableForStates(G4State_Idle,G4State_GeomClosed,G4State_EventProc);
|
||||
|
||||
// /run/particle/addProcManager command
|
||||
addProcManCmd = new G4UIcmdWithAString("/run/particle/addProcManager", this);
|
||||
addProcManCmd->SetGuidance("add process manager to specified particle type");
|
||||
@@ -128,39 +143,80 @@ G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pPart
|
||||
|
||||
//Commnad /run/particle/applyCuts command
|
||||
applyCutsCmd = new G4UIcommand("/run/particle/applyCuts",this);
|
||||
applyCutsCmd->SetGuidance("Set ApplyCuts flag ");
|
||||
applyCutsCmd->SetGuidance(" applyCuts [value] [particle]");
|
||||
applyCutsCmd->SetGuidance(" value : true(default) or false ");
|
||||
applyCutsCmd->SetGuidance(" particle : all(default) or particle name ");
|
||||
G4UIparameter* param = new G4UIparameter("Flag",'s',true);
|
||||
applyCutsCmd->SetGuidance("Set applyCuts flag for a particle.");
|
||||
applyCutsCmd->SetGuidance(" Some EM processes which do not have infrared divergence");
|
||||
applyCutsCmd->SetGuidance("may generate gamma, e- and/or e+ with kinetic energies");
|
||||
applyCutsCmd->SetGuidance("below the production threshold. By setting this flag,");
|
||||
applyCutsCmd->SetGuidance("such secondaries below threshold are eliminated and");
|
||||
applyCutsCmd->SetGuidance("kinetic energies of such secondaries are accumulated");
|
||||
applyCutsCmd->SetGuidance("to the energy deposition of their mother.");
|
||||
applyCutsCmd->SetGuidance(" Note that 'applyCuts' makes sense only for gamma,");
|
||||
applyCutsCmd->SetGuidance("e- and e+. If this command is issued for other particle,");
|
||||
applyCutsCmd->SetGuidance("a warning message is displayed and the command is");
|
||||
applyCutsCmd->SetGuidance("ignored.");
|
||||
applyCutsCmd->SetGuidance(" If particle name is 'all', this command affects on");
|
||||
applyCutsCmd->SetGuidance("gamma, e- and e+.");
|
||||
param = new G4UIparameter("Flag",'s',true);
|
||||
param->SetDefaultValue("true");
|
||||
applyCutsCmd->SetParameter(param);
|
||||
param = new G4UIparameter("Particle",'s',true);
|
||||
param->SetDefaultValue("all");
|
||||
applyCutsCmd->SetParameter(param);
|
||||
applyCutsCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
|
||||
|
||||
// /run/particle/dumpCutValues command
|
||||
dumpCutValuesCmd = new G4UIcmdWithAString("/run/particle/dumpCutValues",this);
|
||||
dumpCutValuesCmd->SetGuidance("Dump a list of production threshold values in range and energy");
|
||||
dumpCutValuesCmd->SetGuidance("for all registered material-cuts-couples.");
|
||||
dumpCutValuesCmd->SetGuidance("Dumping a list takes place when you issue 'beamOn' and");
|
||||
dumpCutValuesCmd->SetGuidance("actual conversion tables from range to energy are available.");
|
||||
dumpCutValuesCmd->SetGuidance("If you want a list 'immediately', use '/run/dumpRegion' for threshold");
|
||||
dumpCutValuesCmd->SetGuidance("list given in gange only. Also, '/run/dumpCouples' gives you the");
|
||||
dumpCutValuesCmd->SetGuidance("current list if you have already issued 'run/beamOn' at least once.");
|
||||
dumpCutValuesCmd->SetParameterName("particle",true);
|
||||
dumpCutValuesCmd->SetDefaultValue("all");
|
||||
dumpCutValuesCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger()
|
||||
{
|
||||
delete setPCutCmd;
|
||||
delete setCutCmd;
|
||||
delete setCutRCmd;
|
||||
delete verboseCmd;
|
||||
delete dumpListCmd;
|
||||
delete dumpCutValuesCmd;
|
||||
delete addProcManCmd;
|
||||
delete buildPTCmd;
|
||||
delete storeCmd;
|
||||
delete retrieveCmd;
|
||||
delete theDirectory;
|
||||
delete asciiCmd;
|
||||
delete applyCutsCmd;
|
||||
delete dumpCutValuesCmd;
|
||||
delete theDirectory;
|
||||
}
|
||||
|
||||
void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command==setCutCmd ){
|
||||
if( command==setCutCmd || command==setPCutCmd ){
|
||||
G4double newCut = setCutCmd->GetNewDoubleValue(newValue);
|
||||
thePhysicsList->SetDefaultCutValue(newCut);
|
||||
thePhysicsList->SetCutsWithDefault();
|
||||
|
||||
} else if( command==setCutRCmd ){
|
||||
//G4Tokenizer next( newValue );
|
||||
//G4String rName = G4String(next());
|
||||
//G4String cValue = G4String(next())+" "+G4String(next());
|
||||
//G4double newCut = setCutCmd->GetNewDoubleValue(cValue);
|
||||
//thePhysicsList->SetCutsForRegion(newCut,rName);
|
||||
G4std::istrstream is(newValue);
|
||||
char regName[50];
|
||||
G4double cVal;
|
||||
char uniName[10];
|
||||
is >> regName >> cVal >> uniName;
|
||||
G4String regN = regName;
|
||||
G4String uniN = uniName;
|
||||
thePhysicsList->SetCutsForRegion(cVal*(setCutRCmd->ValueOf(uniN)),regN);
|
||||
|
||||
} else if( command==verboseCmd ) {
|
||||
thePhysicsList->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
|
||||
@@ -168,13 +224,6 @@ void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newV
|
||||
} else if( command==dumpListCmd ){
|
||||
thePhysicsList->DumpList();
|
||||
|
||||
} else if( command==dumpCutValuesCmd ){
|
||||
if (newValue == "table") {
|
||||
thePhysicsList->DumpCutValuesTable();
|
||||
} else {
|
||||
thePhysicsList->DumpCutValues(newValue);
|
||||
}
|
||||
|
||||
} else if( command == addProcManCmd ){
|
||||
G4ParticleDefinition* particle = (G4ParticleTable::GetParticleTable())->FindParticle(newValue);
|
||||
if (particle == 0) return;
|
||||
@@ -215,6 +264,8 @@ void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newV
|
||||
|
||||
thePhysicsList->SetApplyCuts(flag, name);
|
||||
|
||||
} else if( command == dumpCutValuesCmd ) {
|
||||
thePhysicsList->DumpCutValuesTable(1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -225,7 +276,7 @@ G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
G4String candidates("none");
|
||||
G4ParticleTable::G4PTblDicIterator *piter = (G4ParticleTable::GetParticleTable())->GetIterator();
|
||||
|
||||
if( command==setCutCmd ){
|
||||
if( command==setCutCmd || command==setPCutCmd ){
|
||||
cv = setCutCmd->ConvertToString( thePhysicsList->GetDefaultCutValue(), "mm" );
|
||||
|
||||
} else if( command==verboseCmd ){
|
||||
@@ -268,12 +319,12 @@ G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
cv = "0";
|
||||
}
|
||||
|
||||
} else if( command == applyCutsCmd ) {
|
||||
if (thePhysicsList->GetApplyCuts("proton")){
|
||||
cv = "true";
|
||||
} else {
|
||||
cv = "false";
|
||||
}
|
||||
// } else if( command == applyCutsCmd ) {
|
||||
// if (thePhysicsList->GetApplyCuts("gamma")){
|
||||
// cv = "true";
|
||||
// } else {
|
||||
// cv = "false";
|
||||
// }
|
||||
}
|
||||
|
||||
return cv;
|
||||
|
||||
Reference in New Issue
Block a user