File indexing completed on 2025-01-31 09:22:13
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 "GammaRayTelPhysicsListMessenger.hh"
0032 #include "GammaRayTelPhysicsList.hh"
0033
0034 #include "G4UIdirectory.hh"
0035 #include "G4UIcmdWithADoubleAndUnit.hh"
0036 #include "G4UIcmdWithAString.hh"
0037
0038
0039
0040 GammaRayTelPhysicsListMessenger::GammaRayTelPhysicsListMessenger(GammaRayTelPhysicsList *pPhys) : pPhysicsList(pPhys) {
0041 physDir = new G4UIdirectory("/physics/");
0042 physDir->SetGuidance("Commands to activate physics models and set cuts");
0043
0044 gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/physics/setGCut", this);
0045 gammaCutCmd->SetGuidance("Set gamma cut.");
0046 gammaCutCmd->SetParameterName("Gcut", false);
0047 gammaCutCmd->SetUnitCategory("Length");
0048 gammaCutCmd->SetRange("Gcut>0.0");
0049 gammaCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0050
0051 electronCutCmd = new G4UIcmdWithADoubleAndUnit("/physics/setECut", this);
0052 electronCutCmd->SetGuidance("Set electron cut.");
0053 electronCutCmd->SetParameterName("Ecut", false);
0054 electronCutCmd->SetUnitCategory("Length");
0055 electronCutCmd->SetRange("Ecut>0.0");
0056 electronCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0057
0058 protonCutCmd = new G4UIcmdWithADoubleAndUnit("/physics/setPCut", this);
0059 protonCutCmd->SetGuidance("Set positron cut.");
0060 protonCutCmd->SetParameterName("Pcut", false);
0061 protonCutCmd->SetUnitCategory("Length");
0062 protonCutCmd->SetRange("Pcut>0.0");
0063 protonCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0064
0065 allCutCmd = new G4UIcmdWithADoubleAndUnit("/physics/setCuts", this);
0066 allCutCmd->SetGuidance("Set cut for all.");
0067 allCutCmd->SetParameterName("cut", false);
0068 allCutCmd->SetUnitCategory("Length");
0069 allCutCmd->SetRange("cut>0.0");
0070 allCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0071
0072 pListCmd = new G4UIcmdWithAString("/physics/addPhysics", this);
0073 pListCmd->SetGuidance("Add physics list.");
0074 pListCmd->SetParameterName("PList", false);
0075 pListCmd->AvailableForStates(G4State_PreInit);
0076
0077 packageListCmd = new G4UIcmdWithAString("/physics/addPackage", this);
0078 packageListCmd->SetGuidance("Add physics package.");
0079 packageListCmd->SetParameterName("package", false);
0080 packageListCmd->AvailableForStates(G4State_PreInit);
0081 }
0082
0083
0084
0085 GammaRayTelPhysicsListMessenger::~GammaRayTelPhysicsListMessenger() {
0086 delete gammaCutCmd;
0087 delete electronCutCmd;
0088 delete protonCutCmd;
0089 delete allCutCmd;
0090 delete pListCmd;
0091 delete physDir;
0092 delete packageListCmd;
0093 }
0094
0095
0096
0097 void GammaRayTelPhysicsListMessenger::SetNewValue(G4UIcommand *command, G4String newValue) {
0098 if (command == gammaCutCmd) {
0099 pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));
0100 } else if (command == electronCutCmd) {
0101 pPhysicsList->SetCutForElectron(electronCutCmd->GetNewDoubleValue(newValue));
0102 } else if (command == protonCutCmd) {
0103 pPhysicsList->SetCutForPositron(protonCutCmd->GetNewDoubleValue(newValue));
0104 } else if (command == allCutCmd) {
0105 G4double cut = allCutCmd->GetNewDoubleValue(newValue);
0106 pPhysicsList->SetCutForGamma(cut);
0107 pPhysicsList->SetCutForElectron(cut);
0108 pPhysicsList->SetCutForPositron(cut);
0109 } else if (command == pListCmd) {
0110 pPhysicsList->AddPhysicsList(newValue);
0111 } else if (command == packageListCmd) {
0112 pPhysicsList->AddPackage(newValue);
0113 }
0114 }