File indexing completed on 2025-01-31 09:22:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 #include "PhysicsListMessenger.hh"
0032
0033 #include "PhysicsList.hh"
0034 #include "G4UIdirectory.hh"
0035 #include "G4UIcmdWithADoubleAndUnit.hh"
0036 #include "G4UIcmdWithAString.hh"
0037
0038
0039 PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
0040 :pPhysicsList(pPhys)
0041 {
0042 physDir = new G4UIdirectory("/physic/");
0043 physDir->SetGuidance("Commands to activate physics models and set cuts");
0044
0045 gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/setGCut",this);
0046 gammaCutCmd->SetGuidance("Set gamma cut.");
0047 gammaCutCmd->SetParameterName("Gcut",false);
0048 gammaCutCmd->SetUnitCategory("Length");
0049 gammaCutCmd->SetRange("Gcut>0.0");
0050 gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0051
0052 electCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/setECut",this);
0053 electCutCmd->SetGuidance("Set electron cut.");
0054 electCutCmd->SetParameterName("Ecut",false);
0055 electCutCmd->SetUnitCategory("Length");
0056 electCutCmd->SetRange("Ecut>0.0");
0057 electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0058
0059 protoCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/setPCut",this);
0060 protoCutCmd->SetGuidance("Set positron cut.");
0061 protoCutCmd->SetParameterName("Pcut",false);
0062 protoCutCmd->SetUnitCategory("Length");
0063 protoCutCmd->SetRange("Pcut>0.0");
0064 protoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0065
0066 allCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/setCuts",this);
0067 allCutCmd->SetGuidance("Set cut for all.");
0068 allCutCmd->SetParameterName("cut",false);
0069 allCutCmd->SetUnitCategory("Length");
0070 allCutCmd->SetRange("cut>0.0");
0071 allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0072
0073 pListCmd = new G4UIcmdWithAString("/physic/addPhysics",this);
0074 pListCmd->SetGuidance("Add physics list.");
0075 pListCmd->SetParameterName("PList",false);
0076 pListCmd->AvailableForStates(G4State_PreInit);
0077
0078 packageListCmd = new G4UIcmdWithAString("/physic/addPackage",this);
0079 packageListCmd->SetGuidance("Add physics package.");
0080 packageListCmd->SetParameterName("package",false);
0081 packageListCmd->AvailableForStates(G4State_PreInit);
0082 }
0083
0084 PhysicsListMessenger::~PhysicsListMessenger()
0085 {
0086 delete gammaCutCmd;
0087 delete electCutCmd;
0088 delete protoCutCmd;
0089 delete allCutCmd;
0090 delete pListCmd;
0091 delete physDir;
0092 delete packageListCmd;
0093 }
0094
0095 void PhysicsListMessenger::SetNewValue(G4UIcommand* command,
0096 G4String newValue)
0097 {
0098 if( command == gammaCutCmd )
0099 { pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));}
0100
0101 if( command == electCutCmd )
0102 { pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));}
0103
0104 if( command == protoCutCmd )
0105 { pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));}
0106
0107 if( command == allCutCmd )
0108 {
0109 G4double cut = allCutCmd->GetNewDoubleValue(newValue);
0110 pPhysicsList->SetCutForGamma(cut);
0111 pPhysicsList->SetCutForElectron(cut);
0112 pPhysicsList->SetCutForPositron(cut);
0113 }
0114
0115 if( command == pListCmd )
0116 { pPhysicsList->AddPhysicsList(newValue);}
0117
0118
0119 if( command == packageListCmd )
0120 { pPhysicsList->AddPackage(newValue);}
0121 }