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 /// \file electromagnetic/TestEm8/src/Detector 27 /// \brief Implementation of the DetectorMesse 28 // 29 // 30 ////////////////////////////////////////////// 31 // 32 // TestEm8: Gaseous detector 33 // 34 // Created: 31.08.2010 V.Ivanchenko 35 // 36 // Modified: 37 // 38 ////////////////////////////////////////////// 39 // 40 41 //....oooOO0OOooo........oooOO0OOooo........oo 42 43 #include "DetectorMessenger.hh" 44 45 #include "DetectorConstruction.hh" 46 47 #include "G4UIcmdWithADoubleAndUnit.hh" 48 #include "G4UIcmdWithAString.hh" 49 #include "G4UIcmdWithoutParameter.hh" 50 #include "G4UIdirectory.hh" 51 52 //....oooOO0OOooo........oooOO0OOooo........oo 53 54 DetectorMessenger::DetectorMessenger(DetectorC 55 { 56 fDetDir = new G4UIdirectory("/testem/"); 57 fDetDir->SetGuidance("Detector control."); 58 59 fGasMaterCmd = new G4UIcmdWithAString("/test 60 fGasMaterCmd->SetGuidance("Select material o 61 fGasMaterCmd->SetParameterName("gmat", true) 62 fGasMaterCmd->SetDefaultValue("Argon"); 63 fGasMaterCmd->AvailableForStates(G4State_Pre 64 65 fWindowMaterCmd = new G4UIcmdWithAString("/t 66 fWindowMaterCmd->SetGuidance("Select materia 67 fWindowMaterCmd->SetParameterName("wmat", tr 68 fWindowMaterCmd->SetDefaultValue("Mylar"); 69 fWindowMaterCmd->AvailableForStates(G4State_ 70 71 fWorldMaterCmd = new G4UIcmdWithAString("/te 72 fWorldMaterCmd->SetGuidance("Select material 73 fWorldMaterCmd->SetParameterName("worldmat", 74 fWorldMaterCmd->SetDefaultValue("empty"); 75 fWorldMaterCmd->AvailableForStates(G4State_P 76 77 fGasThickCmd = new G4UIcmdWithADoubleAndUnit 78 fGasThickCmd->SetGuidance("Set thickness of 79 fGasThickCmd->SetParameterName("SizeZ", fals 80 fGasThickCmd->SetUnitCategory("Length"); 81 fGasThickCmd->SetDefaultUnit("mm"); 82 fGasThickCmd->SetRange("SizeZ>0."); 83 fGasThickCmd->AvailableForStates(G4State_Pre 84 85 fGasRadCmd = new G4UIcmdWithADoubleAndUnit(" 86 fGasRadCmd->SetGuidance("Set radius of the d 87 fGasRadCmd->SetParameterName("SizeR", false, 88 fGasRadCmd->SetUnitCategory("Length"); 89 fGasRadCmd->SetDefaultUnit("mm"); 90 fGasRadCmd->SetRange("SizeR>0."); 91 fGasRadCmd->AvailableForStates(G4State_PreIn 92 93 fWinThickCmd = new G4UIcmdWithADoubleAndUnit 94 fWinThickCmd->SetGuidance("Set thickness of 95 fWinThickCmd->SetParameterName("delta", fals 96 fWinThickCmd->SetUnitCategory("Length"); 97 fWinThickCmd->SetDefaultUnit("mm"); 98 fWinThickCmd->SetRange("delta>0."); 99 fWinThickCmd->AvailableForStates(G4State_Pre 100 101 fIonCmd = new G4UIcmdWithADoubleAndUnit("/te 102 fIonCmd->SetGuidance("Set energy per electro 103 fIonCmd->SetParameterName("en", false, false 104 fIonCmd->SetUnitCategory("Energy"); 105 fIonCmd->SetDefaultUnit("MeV"); 106 fIonCmd->SetRange("en>0."); 107 fIonCmd->AvailableForStates(G4State_PreInit, 108 109 fStepMaxCmd = new G4UIcmdWithADoubleAndUnit( 110 fStepMaxCmd->SetGuidance("Set max allowed st 111 fStepMaxCmd->SetParameterName("mxStep", fals 112 fStepMaxCmd->SetRange("mxStep>0."); 113 fStepMaxCmd->SetUnitCategory("Length"); 114 fStepMaxCmd->AvailableForStates(G4State_PreI 115 } 116 117 //....oooOO0OOooo........oooOO0OOooo........oo 118 119 DetectorMessenger::~DetectorMessenger() 120 { 121 delete fGasMaterCmd; 122 delete fGasThickCmd; 123 delete fGasRadCmd; 124 delete fWinThickCmd; 125 delete fWindowMaterCmd; 126 delete fWorldMaterCmd; 127 delete fIonCmd; 128 delete fStepMaxCmd; 129 delete fDetDir; 130 } 131 132 //....oooOO0OOooo........oooOO0OOooo........oo 133 134 void DetectorMessenger::SetNewValue(G4UIcomman 135 { 136 if (command == fGasMaterCmd) { 137 fDetector->SetGasMaterial(newValue); 138 } 139 else if (command == fWindowMaterCmd) { 140 fDetector->SetContainerMaterial(newValue); 141 } 142 else if (command == fWorldMaterCmd) { 143 fDetector->SetWorldMaterial(newValue); 144 } 145 else if (command == fGasThickCmd) { 146 fDetector->SetGasThickness(fGasThickCmd->G 147 } 148 else if (command == fGasRadCmd) { 149 fDetector->SetGasRadius(fGasRadCmd->GetNew 150 } 151 else if (command == fWinThickCmd) { 152 fDetector->SetContainerThickness(fWinThick 153 } 154 else if (command == fStepMaxCmd) { 155 fDetector->SetMaxChargedStep(fStepMaxCmd-> 156 } 157 else if (command == fIonCmd) { 158 fDetector->SetPairEnergy(fIonCmd->GetNewDo 159 } 160 } 161 162 //....oooOO0OOooo........oooOO0OOooo........oo 163