Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 // 28 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oo 30 31 #include "DetectorMessenger.hh" 32 33 #include "G4UIcmdWithADoubleAndUnit.hh" 34 #include "G4UIcmdWithAString.hh" 35 #include "G4UIcmdWithAnInteger.hh" 36 #include "G4UIdirectory.hh" 37 38 #include "DetectorConstruction.hh" 39 40 //....oooOO0OOooo........oooOO0OOooo........oo 41 42 DetectorMessenger::DetectorMessenger(DetectorC 43 : G4UImessenger(), 44 fDetector(Det), 45 fTomoDir(nullptr), 46 fDetDir(nullptr), 47 fAbsMaterCmd(nullptr), 48 fAbsThickCmd(nullptr), 49 fAbsSizYZCmd(nullptr), 50 fAbsXposCmd(nullptr), 51 fWorldMaterCmd(nullptr), 52 fWorldXCmd(nullptr), 53 fWorldYZCmd(nullptr), 54 fPhantomType(nullptr) 55 { 56 fTomoDir = new G4UIdirectory("/tomography/") 57 fTomoDir->SetGuidance("UI commands specific 58 59 fDetDir = new G4UIdirectory("/tomography/det 60 fDetDir->SetGuidance("detector construction 61 62 fAbsMaterCmd = new G4UIcmdWithAString("/tomo 63 fAbsMaterCmd->SetGuidance("Select Material o 64 fAbsMaterCmd->SetParameterName("choice", fal 65 fAbsMaterCmd->AvailableForStates(G4State_Pre 66 fAbsMaterCmd->SetToBeBroadcasted(false); 67 68 fWorldMaterCmd = new G4UIcmdWithAString("/to 69 fWorldMaterCmd->SetGuidance("Select Material 70 fWorldMaterCmd->SetParameterName("wchoice", 71 fWorldMaterCmd->AvailableForStates(G4State_P 72 fWorldMaterCmd->SetToBeBroadcasted(false); 73 74 fAbsThickCmd = new G4UIcmdWithADoubleAndUnit 75 fAbsThickCmd->SetGuidance("Set Thickness of 76 fAbsThickCmd->SetParameterName("SizeZ", fals 77 fAbsThickCmd->SetRange("SizeZ>0."); 78 fAbsThickCmd->SetUnitCategory("Length"); 79 fAbsThickCmd->AvailableForStates(G4State_Pre 80 fAbsThickCmd->SetToBeBroadcasted(false); 81 82 fAbsSizYZCmd = new G4UIcmdWithADoubleAndUnit 83 fAbsSizYZCmd->SetGuidance("Set sizeYZ of the 84 fAbsSizYZCmd->SetParameterName("SizeYZ", fal 85 fAbsSizYZCmd->SetRange("SizeYZ>0."); 86 fAbsSizYZCmd->SetUnitCategory("Length"); 87 fAbsSizYZCmd->AvailableForStates(G4State_Pre 88 fAbsSizYZCmd->SetToBeBroadcasted(false); 89 90 fAbsXposCmd = new G4UIcmdWithADoubleAndUnit( 91 fAbsXposCmd->SetGuidance("Set X pos. of the 92 fAbsXposCmd->SetParameterName("Xpos", false) 93 fAbsXposCmd->SetUnitCategory("Length"); 94 fAbsXposCmd->AvailableForStates(G4State_PreI 95 fAbsXposCmd->SetToBeBroadcasted(false); 96 97 fWorldXCmd = new G4UIcmdWithADoubleAndUnit(" 98 fWorldXCmd->SetGuidance("Set X size of the W 99 fWorldXCmd->SetParameterName("WSizeX", false 100 fWorldXCmd->SetRange("WSizeX>0."); 101 fWorldXCmd->SetUnitCategory("Length"); 102 fWorldXCmd->AvailableForStates(G4State_PreIn 103 fWorldXCmd->SetToBeBroadcasted(false); 104 105 fWorldYZCmd = new G4UIcmdWithADoubleAndUnit( 106 fWorldYZCmd->SetGuidance("Set sizeYZ of the 107 fWorldYZCmd->SetParameterName("WSizeYZ", fal 108 fWorldYZCmd->SetRange("WSizeYZ>0."); 109 fWorldYZCmd->SetUnitCategory("Length"); 110 fWorldYZCmd->AvailableForStates(G4State_PreI 111 fWorldYZCmd->SetToBeBroadcasted(false); 112 113 fPhantomType = new G4UIcmdWithAnInteger("/to 114 fPhantomType->SetGuidance("Select the type o 115 fPhantomType->SetParameterName("choice", fal 116 fPhantomType->AvailableForStates(G4State_Pre 117 fPhantomType->SetToBeBroadcasted(false); 118 } 119 120 //....oooOO0OOooo........oooOO0OOooo........oo 121 122 DetectorMessenger::~DetectorMessenger() 123 { 124 delete fAbsMaterCmd; 125 delete fAbsThickCmd; 126 delete fAbsSizYZCmd; 127 delete fAbsXposCmd; 128 delete fWorldMaterCmd; 129 delete fWorldXCmd; 130 delete fWorldYZCmd; 131 delete fDetDir; 132 delete fTomoDir; 133 delete fPhantomType; 134 } 135 136 //....oooOO0OOooo........oooOO0OOooo........oo 137 138 void DetectorMessenger::SetNewValue(G4UIcomman 139 { 140 if (command == fAbsMaterCmd) { 141 fDetector->SetAbsorberMaterial(newValue); 142 } 143 144 if (command == fWorldMaterCmd) { 145 fDetector->SetWorldMaterial(newValue); 146 } 147 148 if (command == fAbsThickCmd) { 149 fDetector->SetAbsorberThickness(fAbsThickC 150 } 151 152 if (command == fAbsSizYZCmd) { 153 fDetector->SetAbsorberSizeYZ(fAbsSizYZCmd- 154 } 155 156 if (command == fAbsXposCmd) { 157 fDetector->SetAbsorberXpos(fAbsXposCmd->Ge 158 } 159 160 if (command == fWorldXCmd) { 161 fDetector->SetWorldSizeX(fWorldXCmd->GetNe 162 } 163 164 if (command == fWorldYZCmd) { 165 fDetector->SetWorldSizeYZ(fWorldYZCmd->Get 166 } 167 168 if (command == fPhantomType) { 169 fDetector->SetPhantomType(fPhantomType->Ge 170 } 171 } 172 173 //....oooOO0OOooo........oooOO0OOooo........oo 174