File indexing completed on 2025-01-31 09:22:17
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 "HadrontherapyAnalysisFileMessenger.hh"
0030 #include "G4UIcmdWithAString.hh"
0031 #include "G4UIcmdWithABool.hh"
0032 #include "G4UIdirectory.hh"
0033 #include "G4SystemOfUnits.hh"
0034
0035 #include "HadrontherapyMatrix.hh"
0036 #include "HadrontherapyLet.hh"
0037
0038
0039 HadrontherapyAnalysisFileMessenger::HadrontherapyAnalysisFileMessenger(HadrontherapyAnalysis* amgr)
0040 :AnalysisManager(amgr)
0041 {
0042 secondaryCmd = new G4UIcmdWithABool("/analysis/secondary",this);
0043 secondaryCmd -> SetParameterName("secondary", true);
0044 secondaryCmd -> SetDefaultValue("true");
0045 secondaryCmd -> SetGuidance("Set if dose/fluence for the secondary particles will be written"
0046 "\n[usage]: /analysis/secondary [true/false]");
0047 secondaryCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
0048
0049 DoseMatrixCmd = new G4UIcmdWithAString("/analysis/writeDoseFile",this);
0050 DoseMatrixCmd->SetGuidance("Write the dose/fluence to an ASCII file");
0051 DoseMatrixCmd->SetDefaultValue("Dose.out");
0052 DoseMatrixCmd->SetParameterName("choice",true);
0053
0054 LetCmd = new G4UIcmdWithABool("/analysis/computeLet",this);
0055 LetCmd -> SetParameterName("choice",true);
0056 LetCmd -> SetDefaultValue(true);
0057 LetCmd -> SetGuidance("Set if Let must be computed and write the ASCII filename for the Let");
0058 LetCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
0059
0060 }
0061
0062
0063 HadrontherapyAnalysisFileMessenger::~HadrontherapyAnalysisFileMessenger()
0064 {
0065 delete secondaryCmd;
0066 delete DoseMatrixCmd;
0067 delete LetCmd;
0068 }
0069
0070
0071 void HadrontherapyAnalysisFileMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0072 {
0073 if (command == secondaryCmd)
0074 {
0075 if (HadrontherapyMatrix::GetInstance())
0076 {
0077 HadrontherapyMatrix::GetInstance() -> secondary = secondaryCmd -> GetNewBoolValue(newValue);
0078 }
0079 }
0080
0081 else if (command == DoseMatrixCmd)
0082 {
0083 if ( HadrontherapyMatrix * pMatrix = HadrontherapyMatrix::GetInstance() )
0084 {
0085
0086 pMatrix -> StoreDoseFluenceAscii(newValue);
0087 }
0088 }
0089
0090 else if (command == LetCmd)
0091 {
0092 if (HadrontherapyLet::GetInstance())
0093 HadrontherapyLet::GetInstance() -> doCalculation = LetCmd -> GetNewBoolValue(newValue);
0094 }
0095 }
0096