File indexing completed on 2026-04-17 07:51:37
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 #include "ActionInitializationMessenger.hh"
0030 #include "ActionInitialization.hh"
0031 #include "G4UIdirectory.hh"
0032 #include "G4UIcmdWithADoubleAndUnit.hh"
0033 #include "G4UIcmdWithAString.hh"
0034
0035
0036
0037 ActionInitializationMessenger::
0038 ActionInitializationMessenger(ActionInitialization* act)
0039 :fAction(act)
0040 {
0041 fActionDir = new G4UIdirectory("/action/");
0042 fActionDir->SetGuidance("Commands for action initialization status");
0043
0044 fIAEAphspReaderDir = new G4UIdirectory("/action/IAEAphspReader/");
0045 fIAEAphspReaderDir->SetGuidance("Commands to set IAEAphsp reader object.");
0046
0047 fIAEAphspWriterDir = new G4UIdirectory("/action/IAEAphspWriter/");
0048 fIAEAphspWriterDir->SetGuidance("Commands to set IAEAphsp writer object.");
0049
0050 fIAEAphspReaderFileCmd =
0051 new G4UIcmdWithAString("/action/IAEAphspReader/fileName",this);
0052 fIAEAphspReaderFileCmd
0053 ->SetGuidance("Set IAEAphsp source file name, including path if needed.");
0054 fIAEAphspReaderFileCmd
0055 ->SetGuidance("(.IAEAphsp or .IAEAheader extension must not be written)");
0056 fIAEAphspReaderFileCmd->SetParameterName("name",false);
0057 fIAEAphspReaderFileCmd->AvailableForStates(G4State_PreInit);
0058
0059 fIAEAphspWriterFileCmd =
0060 new G4UIcmdWithAString("/action/IAEAphspWriter/namePrefix",this);
0061 fIAEAphspWriterFileCmd
0062 ->SetGuidance("Set the name prefix of IAEAphsp output files, ");
0063 fIAEAphspWriterFileCmd
0064 ->SetGuidance("including path if needed.");
0065 fIAEAphspWriterFileCmd
0066 ->SetGuidance("Name pattern: \"prefix_zphsp[_runID].IAEA[phsp|header]\".");
0067 fIAEAphspWriterFileCmd->SetGuidance("NOTE:");
0068 fIAEAphspWriterFileCmd
0069 ->SetGuidance("At least ONE zphsp value must be issued.");
0070 fIAEAphspWriterFileCmd->SetParameterName("prefix",false);
0071 fIAEAphspWriterFileCmd->AvailableForStates(G4State_PreInit);
0072
0073 fIAEAphspWriterZphspCmd =
0074 new G4UIcmdWithADoubleAndUnit("/action/IAEAphspWriter/zphsp", this);
0075 fIAEAphspWriterZphspCmd
0076 ->SetGuidance("Add z-coordinate of output phsp plane.");
0077 fIAEAphspWriterZphspCmd
0078 ->SetGuidance("At least one value is NEEDED to get this writer working.");
0079 fIAEAphspWriterZphspCmd->SetParameterName("zphsp",false);
0080 fIAEAphspWriterZphspCmd->SetDefaultUnit("cm");
0081 fIAEAphspWriterZphspCmd->SetUnitCandidates("cm mm m");
0082 fIAEAphspWriterZphspCmd->AvailableForStates(G4State_PreInit);
0083 }
0084
0085
0086
0087 ActionInitializationMessenger::~ActionInitializationMessenger()
0088 {
0089 delete fActionDir;
0090 delete fIAEAphspReaderDir;
0091 delete fIAEAphspWriterDir;
0092 delete fIAEAphspReaderFileCmd;
0093 delete fIAEAphspWriterFileCmd;
0094 delete fIAEAphspWriterZphspCmd;
0095 }
0096
0097
0098
0099 void ActionInitializationMessenger::SetNewValue(G4UIcommand* command,
0100 G4String newValue)
0101 {
0102 if ( command == fIAEAphspReaderFileCmd )
0103 fAction->SetIAEAphspReader(newValue);
0104
0105 else if ( command == fIAEAphspWriterFileCmd )
0106 fAction->SetIAEAphspWriterPrefix(newValue);
0107
0108 else if ( command == fIAEAphspWriterZphspCmd )
0109 fAction->AddZphsp(fIAEAphspWriterZphspCmd->GetNewDoubleValue(newValue));
0110 }
0111
0112