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 // MONTE CARLO SIMULATION OF REALISTIC G 28 // 29 // Authors and contributors: 30 // P. Barberet, S. Incerti, N. H. Tran, L. Mor 31 // 32 // University of Bordeaux, CNRS, LP2i, UMR5797 33 // 34 // If you use this code, please cite the follo 35 // P. Barberet et al., 36 // "Monte-Carlo dosimetry on a realistic cell 37 // geometry exposed to alpha particles." 38 // Ph. Barberet et al 2012 Phys. Med. Biol. 57 39 // doi: 110.1088/0031-9155/57/8/2189 40 // ------------------------------------------- 41 42 #include "DetectorMessenger.hh" 43 #include "DetectorConstruction.hh" 44 45 #include "G4UIcmdWithAString.hh" 46 #include "G4UIcmdWithADoubleAndUnit.hh" 47 48 //....oooOO0OOooo........oooOO0OOooo........oo 49 50 DetectorMessenger::DetectorMessenger(DetectorC 51 :G4UImessenger(), fDetector(det) 52 { 53 fPhantomDir = new G4UIdirectory("/phantom/") 54 fPhantomDir->SetGuidance(" Cell phantom sett 55 56 fNameCmd = new G4UIcmdWithAString("/phantom/ 57 fNameCmd->SetGuidance("Select phantom file n 58 fNameCmd->SetParameterName("fileName",true); 59 fNameCmd->SetDefaultValue("phantom.dat"); 60 fNameCmd->AvailableForStates(G4State_PreInit 61 62 fMatCmd = new G4UIcmdWithAString("/phantom/m 63 fMatCmd->SetGuidance("Select material for th 64 fMatCmd->SetParameterName("mediumMat",true); 65 fMatCmd->AvailableForStates(G4State_PreInit) 66 67 fDenRedCmd = new G4UIcmdWithADoubleAndUnit(" 68 fDenRedCmd->SetGuidance("Select density for 69 fDenRedCmd->SetParameterName("redDen",true); 70 fDenRedCmd->SetDefaultValue(1.); 71 fDenRedCmd->SetDefaultUnit("g/cm3"); 72 fDenRedCmd->AvailableForStates(G4State_PreIn 73 74 fDenGreenCmd = new G4UIcmdWithADoubleAndUnit 75 fDenGreenCmd->SetGuidance("Select density fo 76 fDenGreenCmd->SetParameterName("greenDen",tr 77 fDenGreenCmd->SetDefaultValue(1.); 78 fDenGreenCmd->SetDefaultUnit("g/cm3"); 79 fDenGreenCmd->AvailableForStates(G4State_Pre 80 81 fDenBlueCmd = new G4UIcmdWithADoubleAndUnit( 82 fDenBlueCmd->SetGuidance("Select density for 83 fDenBlueCmd->SetParameterName("blueDen",true 84 fDenBlueCmd->SetDefaultValue(1.); 85 fDenBlueCmd->SetDefaultUnit("g/cm3"); 86 fDenBlueCmd->AvailableForStates(G4State_PreI 87 88 fShiftXCmd = new G4UIcmdWithADoubleAndUnit(" 89 fShiftXCmd->SetGuidance("Set phantom X shift 90 fShiftXCmd->SetParameterName("shiftX",true); 91 fShiftXCmd->SetDefaultValue(0.); 92 fShiftXCmd->SetDefaultUnit("um"); 93 fShiftXCmd->AvailableForStates(G4State_PreIn 94 95 fShiftYCmd = new G4UIcmdWithADoubleAndUnit(" 96 fShiftYCmd->SetGuidance("Set phantom Y shift 97 fShiftYCmd->SetParameterName("shiftY",true); 98 fShiftYCmd->SetDefaultValue(0.); 99 fShiftYCmd->SetDefaultUnit("um"); 100 fShiftYCmd->AvailableForStates(G4State_PreIn 101 102 fShiftZCmd = new G4UIcmdWithADoubleAndUnit(" 103 fShiftZCmd->SetGuidance("Set phantom Z shift 104 fShiftZCmd->SetParameterName("shiftZ",true); 105 fShiftZCmd->SetDefaultValue(0.); 106 fShiftZCmd->SetDefaultUnit("um"); 107 fShiftZCmd->AvailableForStates(G4State_PreIn 108 109 fMediumSizeXYCmd = new G4UIcmdWithADoubleAnd 110 fMediumSizeXYCmd->SetGuidance("Set cellular 111 fMediumSizeXYCmd->SetParameterName("mediumSi 112 fMediumSizeXYCmd->SetDefaultUnit("um"); 113 fMediumSizeXYCmd->AvailableForStates(G4State 114 115 fMediumSizeZCmd = new G4UIcmdWithADoubleAndU 116 fMediumSizeZCmd->SetGuidance("Set cellular m 117 fMediumSizeZCmd->SetParameterName("mediumSiz 118 fMediumSizeZCmd->SetDefaultUnit("um"); 119 fMediumSizeZCmd->AvailableForStates(G4State_ 120 121 fWorldDir = new G4UIdirectory("/world/"); 122 fWorldDir->SetGuidance(" World volume settin 123 124 fWorldSizeXYCmd = new G4UIcmdWithADoubleAndU 125 fWorldSizeXYCmd->SetGuidance("Set world size 126 fWorldSizeXYCmd->SetParameterName("sizeXY",f 127 fWorldSizeXYCmd->SetDefaultUnit("um"); 128 fWorldSizeXYCmd->AvailableForStates(G4State_ 129 130 fWorldSizeZCmd = new G4UIcmdWithADoubleAndUn 131 fWorldSizeZCmd->SetGuidance("Set world size 132 fWorldSizeZCmd->SetParameterName("sizeZ",fal 133 fWorldSizeZCmd->SetDefaultUnit("um"); 134 fWorldSizeZCmd->AvailableForStates(G4State_P 135 } 136 137 //....oooOO0OOooo........oooOO0OOooo........oo 138 139 DetectorMessenger::~DetectorMessenger() 140 { 141 delete fWorldDir; 142 delete fPhantomDir; 143 delete fNameCmd; 144 delete fMatCmd; 145 delete fDenRedCmd; 146 delete fDenGreenCmd; 147 delete fDenBlueCmd; 148 delete fShiftXCmd; 149 delete fShiftYCmd; 150 delete fShiftZCmd; 151 delete fMediumSizeXYCmd; 152 delete fMediumSizeZCmd; 153 delete fWorldSizeXYCmd; 154 delete fWorldSizeZCmd; 155 } 156 157 //....oooOO0OOooo........oooOO0OOooo........oo 158 159 void DetectorMessenger::SetNewValue(G4UIcomman 160 { 161 if( command == fMatCmd ) { 162 fDetector->SetTargetMaterial(newValue); 163 } 164 else if(command == fDenRedCmd) { 165 fDetector->SetRedDensity(fDenRedCmd->GetNe 166 } 167 else if(command == fDenGreenCmd) { 168 fDetector->SetGreenDensity(fDenGreenCmd->G 169 } 170 else if(command == fDenBlueCmd) { 171 fDetector->SetBlueDensity(fDenBlueCmd->Get 172 } 173 else if (command == fShiftXCmd) { 174 fDetector->SetShiftX(fShiftXCmd->GetNewDou 175 } 176 else if (command == fShiftYCmd) { 177 fDetector->SetShiftY(fShiftYCmd->GetNewDou 178 } 179 else if (command == fShiftZCmd) { 180 fDetector->SetShiftZ(fShiftZCmd->GetNewDou 181 } 182 else if (command == fMediumSizeXYCmd) { 183 fDetector->SetMediumSizeXY(fMediumSizeXYCm 184 } 185 else if (command == fMediumSizeZCmd) { 186 fDetector->SetMediumSizeZ(fMediumSizeZCmd- 187 } 188 else if (command == fWorldSizeXYCmd) { 189 fDetector->SetWorldSizeXY(fWorldSizeXYCmd- 190 } 191 else if (command == fWorldSizeZCmd) { 192 fDetector->SetWorldSizeZ(fWorldSizeZCmd->G 193 } 194 else if(command == fNameCmd) { 195 fDetector->SetPhantomFileName(newValue); 196 } 197 } 198