00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "G4FastSimulationMessenger.hh"
00031 #include "G4UIdirectory.hh"
00032 #include "G4UIcmdWithAString.hh"
00033 #include "G4UIcmdWithoutParameter.hh"
00034
00035 #include "G4ios.hh"
00036
00037 G4FastSimulationMessenger::
00038 G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM)
00039 : fGlobalFastSimulationManager(theGFSM)
00040 {
00041 fFSDirectory = new G4UIdirectory("/param/");
00042 fFSDirectory->SetGuidance("Fast Simulation print/control commands.");
00043
00044 fShowSetupCmd =
00045 new G4UIcmdWithoutParameter("/param/showSetup", this);
00046 fShowSetupCmd->SetGuidance("Show fast simulation setup:");
00047 fShowSetupCmd->SetGuidance(" - for each world region:");
00048 fShowSetupCmd->SetGuidance(" 1) fast simulation manager process attached;");
00049 fShowSetupCmd->SetGuidance(" - and to which particles the process is attached to;");
00050 fShowSetupCmd->SetGuidance(" 2) region hierarchy;");
00051 fShowSetupCmd->SetGuidance(" - with for each the fast simulation models attached;");
00052 fShowSetupCmd->AvailableForStates(G4State_Idle, G4State_GeomClosed);
00053
00054 fListEnvelopesCmd =
00055 new G4UIcmdWithAString("/param/listEnvelopes", this);
00056 fListEnvelopesCmd->SetParameterName("ParticleName",true);
00057 fListEnvelopesCmd->SetDefaultValue("all");
00058 fListEnvelopesCmd->SetGuidance("List all the envelope names for a given Particle");
00059 fListEnvelopesCmd->SetGuidance("(or for all particles if without parameters).");
00060 fListEnvelopesCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00061
00062 fListModelsCmd =
00063 new G4UIcmdWithAString("/param/listModels", this);
00064 fListModelsCmd->SetParameterName("EnvelopeName",true);
00065 fListModelsCmd->SetDefaultValue("all");
00066 fListModelsCmd->SetGuidance("List all the Model names for a given Envelope");
00067 fListModelsCmd->SetGuidance("(or for all envelopes if without parameters).");
00068 fListModelsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00069
00070 fListIsApplicableCmd =
00071 new G4UIcmdWithAString("/param/listIsApplicable", this);
00072 fListIsApplicableCmd->SetParameterName("ModelName",true);
00073 fListIsApplicableCmd->SetDefaultValue("all");
00074 fListIsApplicableCmd->SetGuidance("List all the Particle names a given Model is applicable");
00075 fListIsApplicableCmd->SetGuidance("(or for all Models if without parameters).");
00076
00077 fActivateModel =
00078 new G4UIcmdWithAString("/param/ActivateModel", this);
00079 fActivateModel->SetParameterName("ModelName",false);
00080 fActivateModel->SetGuidance("Activate a given Model.");
00081
00082 fInActivateModel =
00083 new G4UIcmdWithAString("/param/InActivateModel", this);
00084 fInActivateModel->SetParameterName("ModelName",false);
00085 fInActivateModel->SetGuidance("InActivate a given Model.");
00086 }
00087
00088 G4FastSimulationMessenger::~G4FastSimulationMessenger()
00089 {
00090 delete fShowSetupCmd;
00091 fShowSetupCmd = 0;
00092 delete fListIsApplicableCmd;
00093 fListIsApplicableCmd = 0;
00094 delete fActivateModel;
00095 fActivateModel = 0;
00096 delete fInActivateModel;
00097 fInActivateModel = 0;
00098 delete fListModelsCmd;
00099 fListModelsCmd = 0;
00100 delete fListEnvelopesCmd;
00101 fListEnvelopesCmd = 0;
00102 delete fFSDirectory;
00103 fFSDirectory = 0;
00104 }
00105
00106 void G4FastSimulationMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
00107 {
00108 if (command == fShowSetupCmd)
00109 fGlobalFastSimulationManager->ShowSetup();
00110 if( command == fListEnvelopesCmd)
00111 {
00112 if(newValue == "all")
00113 fGlobalFastSimulationManager->ListEnvelopes();
00114 else
00115 fGlobalFastSimulationManager->
00116 ListEnvelopes(G4ParticleTable::GetParticleTable()->
00117 FindParticle(newValue));
00118 }
00119 if( command == fListModelsCmd)
00120 fGlobalFastSimulationManager->ListEnvelopes(newValue, MODELS);
00121 if( command == fListIsApplicableCmd)
00122 fGlobalFastSimulationManager->ListEnvelopes(newValue, ISAPPLICABLE);
00123 if( command == fActivateModel)
00124 fGlobalFastSimulationManager->ActivateFastSimulationModel(newValue);
00125 if( command == fInActivateModel)
00126 fGlobalFastSimulationManager->InActivateFastSimulationModel(newValue);
00127 }