File indexing completed on 2025-01-31 09:21:58
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
0032
0033
0034
0035
0036
0037
0038
0039
0040 #include "G4UIdirectory.hh"
0041 #include "G4UIcmdWithAnInteger.hh"
0042 #include "G4UIcmdWithADouble.hh"
0043 #include "G4UIcmdWithAString.hh"
0044 #include "G4UIcmdWithoutParameter.hh"
0045
0046 #include "doiPETDetectorConstruction.hh"
0047 #include "doiPETDetectorConstructionMessenger.hh"
0048 #include "G4UIcmdWithADoubleAndUnit.hh"
0049
0050 #include "G4UIcmdWith3VectorAndUnit.hh"
0051
0052
0053
0054 doiPETDetectorConstructionMessenger::doiPETDetectorConstructionMessenger(doiPETDetectorConstruction* det)
0055 :Detector (det)
0056 {
0057 Dir = new G4UIdirectory("/changePhantom/");
0058 Dir->SetGuidance("Choose the phantom");
0059
0060 ChoosePhantomCmd = new G4UIcmdWithAString("/changePhantom/setPhantom",this);
0061 ChoosePhantomCmd->SetGuidance("Select Phantom type");
0062 ChoosePhantomCmd->SetParameterName("choice",false);
0063 ChoosePhantomCmd->AvailableForStates(G4State_PreInit);
0064
0065
0066 changeThePhantomPositionCmd = new G4UIcmdWith3VectorAndUnit("/changePhantom/position", this);
0067 changeThePhantomPositionCmd -> SetGuidance("Insert X Y and Z dimensions for the position of the center of the Phantom" " respect to that of the \"World\"");
0068 changeThePhantomPositionCmd -> SetParameterName("PositionAlongX", "PositionAlongY", "PositionAlongZ", false);
0069 changeThePhantomPositionCmd -> SetDefaultUnit("mm");
0070 changeThePhantomPositionCmd -> SetUnitCandidates("um mm cm m");
0071 changeThePhantomPositionCmd -> AvailableForStates(G4State_PreInit);
0072
0073
0074 changePhantomRadiusCmd = new G4UIcmdWithADoubleAndUnit("/changePhantom/Radius",this);
0075 changePhantomRadiusCmd->SetGuidance("Set radius of the phantom");
0076 changePhantomRadiusCmd->SetParameterName("radius",false);
0077 changePhantomRadiusCmd->SetUnitCategory("Length");
0078 changePhantomRadiusCmd->SetRange("radius>0");
0079 changePhantomRadiusCmd->AvailableForStates(G4State_PreInit);
0080
0081
0082 changePhantomLengthCmd = new G4UIcmdWithADoubleAndUnit("/changePhantom/Length",this);
0083 changePhantomLengthCmd->SetGuidance("Set length of the phantom");
0084 changePhantomLengthCmd->SetParameterName("length",false);
0085 changePhantomLengthCmd->SetUnitCategory("Length");
0086 changePhantomLengthCmd->SetRange("length>0");
0087 changePhantomLengthCmd->AvailableForStates(G4State_PreInit);
0088
0089
0090 changeNumOfSleevesCmd = new G4UIcmdWithAnInteger("/changePhantom/NumberOfSleeves",this);
0091 changeNumOfSleevesCmd->SetParameterName("choice",false);
0092 changeNumOfSleevesCmd->AvailableForStates(G4State_PreInit);
0093
0094
0095 }
0096
0097
0098 doiPETDetectorConstructionMessenger::~doiPETDetectorConstructionMessenger()
0099 {
0100 delete Dir;
0101 delete ChoosePhantomCmd;
0102
0103 delete changeThePhantomPositionCmd;
0104 delete changePhantomRadiusCmd;
0105 delete changePhantomLengthCmd;
0106 delete changeNumOfSleevesCmd;
0107
0108
0109 }
0110
0111
0112 void doiPETDetectorConstructionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0113 {
0114 if ( command == ChoosePhantomCmd ) Detector->ChangePhantom(newValue);
0115 else if (command == changeThePhantomPositionCmd )
0116 {
0117 G4ThreeVector size = changeThePhantomPositionCmd -> GetNew3VectorValue(newValue);
0118 Detector -> SetPhantomPosition(size);
0119 }
0120 else if (command == changePhantomRadiusCmd)
0121 {
0122 Detector->SetPhantomRadius(changePhantomRadiusCmd->GetNewDoubleValue(newValue));
0123 }
0124 else if (command == changePhantomLengthCmd)
0125 {
0126 Detector->SetPhantomLength(changePhantomLengthCmd->GetNewDoubleValue(newValue));
0127 }
0128 else if (command == changeNumOfSleevesCmd)
0129 {
0130 Detector->SetNumberOfSleeves(changeNumOfSleevesCmd->GetNewIntValue(newValue));
0131 }
0132 }
0133
0134