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
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #include "G4TrackingMessenger.hh"
00046 #include "G4UIdirectory.hh"
00047 #include "G4UIcmdWithoutParameter.hh"
00048 #include "G4UIcmdWithAnInteger.hh"
00049 #include "G4UImanager.hh"
00050 #include "globals.hh"
00051 #include "G4TrackingManager.hh"
00052 #include "G4SteppingManager.hh"
00053 #include "G4TrackStatus.hh"
00054 #include "G4ios.hh"
00055
00057 G4TrackingMessenger::G4TrackingMessenger(G4TrackingManager * trMan)
00059 : trackingManager(trMan)
00060 {
00061 steppingManager = trackingManager->GetSteppingManager();
00062
00063 TrackingDirectory = new G4UIdirectory("/tracking/");
00064 TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
00065
00066 AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
00067 AbortCmd->SetGuidance("Abort current G4Track processing.");
00068
00069
00070 ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume",this);
00071 ResumeCmd->SetGuidance("Resume current G4Track processing.");
00072
00073 StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory",this);
00074 StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
00075 StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
00076 StoreTrajectoryCmd->SetGuidance(" !=0 : Store trajectories.");
00077 StoreTrajectoryCmd->SetGuidance(" 1 : Choose G4Trajectory as default.");
00078 StoreTrajectoryCmd->SetGuidance(" 2 : Choose G4SmoothTrajectory as default.");
00079 StoreTrajectoryCmd->SetGuidance(" 3 : Choose G4RichTrajectory as default.");
00080 StoreTrajectoryCmd->SetParameterName("Store",true);
00081 StoreTrajectoryCmd->SetDefaultValue(0);
00082 StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 3");
00083
00084
00085 VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose",this);
00086 #ifdef G4VERBOSE
00087 VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
00088 VerboseCmd->SetGuidance(" -1 : Silent.");
00089 VerboseCmd->SetGuidance(" 0 : Silent.");
00090 VerboseCmd->SetGuidance(" 1 : Minium information of each Step.");
00091 VerboseCmd->SetGuidance(" 2 : Addition to Level=1, info of secondary particles.");
00092 VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
00093 VerboseCmd->SetGuidance(" after all AlongStep/PostStep process executions.");
00094 VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
00095 VerboseCmd->SetGuidance(" at each AlongStepPostStep process execuation.");
00096 VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
00097 VerboseCmd->SetGuidance(" from each AlongStepPostStep process.");
00098 VerboseCmd->SetParameterName("verbose_level",true);
00099 VerboseCmd->SetDefaultValue(0);
00100 VerboseCmd->SetRange("verbose_level >=-1 ");
00101 #else
00102 VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");
00103 #endif
00104 }
00105
00107 G4TrackingMessenger::~G4TrackingMessenger()
00109 {
00110 delete TrackingDirectory;
00111 delete AbortCmd;
00112 delete ResumeCmd;
00113 delete StoreTrajectoryCmd;
00114 delete VerboseCmd;
00115 }
00116
00118 void G4TrackingMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
00120 {
00121 if( command == VerboseCmd ){
00122 trackingManager->SetVerboseLevel(VerboseCmd->ConvertToInt(newValues));
00123 }
00124
00125 if( command == AbortCmd ){
00126 steppingManager->GetTrack()->SetTrackStatus(fStopAndKill);
00127 G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
00128 }
00129
00130 if( command == ResumeCmd ){
00131 G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
00132 }
00133
00134 if( command == StoreTrajectoryCmd ){
00135 trackingManager->SetStoreTrajectory(StoreTrajectoryCmd->ConvertToInt(newValues));
00136 }
00137 }
00138
00139
00141 G4String G4TrackingMessenger::GetCurrentValue(G4UIcommand * command)
00143 {
00144 if( command == VerboseCmd ){
00145 return VerboseCmd->ConvertToString(trackingManager->GetVerboseLevel());
00146 }
00147 else if( command == StoreTrajectoryCmd ){
00148 return StoreTrajectoryCmd->ConvertToString(trackingManager->GetStoreTrajectory());
00149 }
00150 return G4String('\0');
00151 }
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164