Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file electromagnetic/TestEm8/src/Detector << 26 // $Id: DetectorMessenger.cc,v 1.2 2010-10-27 14:52:07 vnivanch Exp $ 27 /// \brief Implementation of the DetectorMesse << 27 // GEANT4 tag $Name: not supported by cvs2svn $ 28 // << 29 // 28 // 30 ////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////// 31 // 30 // 32 // TestEm8: Gaseous detector 31 // TestEm8: Gaseous detector 33 // 32 // 34 // Created: 31.08.2010 V.Ivanchenko 33 // Created: 31.08.2010 V.Ivanchenko 35 // 34 // 36 // Modified: 35 // Modified: 37 // 36 // 38 ////////////////////////////////////////////// 37 //////////////////////////////////////////////////////////////////////// 39 // << 38 // 40 << 41 //....oooOO0OOooo........oooOO0OOooo........oo << 42 39 43 #include "DetectorMessenger.hh" 40 #include "DetectorMessenger.hh" 44 41 45 #include "DetectorConstruction.hh" 42 #include "DetectorConstruction.hh" 46 << 43 #include "G4UIdirectory.hh" 47 #include "G4UIcmdWithADoubleAndUnit.hh" << 48 #include "G4UIcmdWithAString.hh" 44 #include "G4UIcmdWithAString.hh" >> 45 #include "G4UIcmdWithADoubleAndUnit.hh" 49 #include "G4UIcmdWithoutParameter.hh" 46 #include "G4UIcmdWithoutParameter.hh" 50 #include "G4UIdirectory.hh" << 51 47 52 //....oooOO0OOooo........oooOO0OOooo........oo << 48 /////////////////////////////////////////////////////////////////////////////////// 53 49 54 DetectorMessenger::DetectorMessenger(DetectorC << 50 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det) 55 { << 51 :Detector(Det) 56 fDetDir = new G4UIdirectory("/testem/"); << 52 { 57 fDetDir->SetGuidance("Detector control."); << 53 detDir = new G4UIdirectory("/testem/"); 58 << 54 detDir->SetGuidance("Detector control."); 59 fGasMaterCmd = new G4UIcmdWithAString("/test << 55 60 fGasMaterCmd->SetGuidance("Select material o << 56 GasMaterCmd = new G4UIcmdWithAString("/testem/setGasMat",this); 61 fGasMaterCmd->SetParameterName("gmat", true) << 57 GasMaterCmd->SetGuidance("Select material of the detector."); 62 fGasMaterCmd->SetDefaultValue("Argon"); << 58 GasMaterCmd->SetParameterName("gmat",true); 63 fGasMaterCmd->AvailableForStates(G4State_Pre << 59 GasMaterCmd->SetDefaultValue("Argon"); 64 << 60 GasMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 65 fWindowMaterCmd = new G4UIcmdWithAString("/t << 61 66 fWindowMaterCmd->SetGuidance("Select materia << 62 WindowMaterCmd = new G4UIcmdWithAString("/testem/setWindowMat",this); 67 fWindowMaterCmd->SetParameterName("wmat", tr << 63 WindowMaterCmd->SetGuidance("Select material of the window."); 68 fWindowMaterCmd->SetDefaultValue("Mylar"); << 64 WindowMaterCmd->SetParameterName("wmat",true); 69 fWindowMaterCmd->AvailableForStates(G4State_ << 65 WindowMaterCmd->SetDefaultValue("Mylar"); 70 << 66 WindowMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 71 fWorldMaterCmd = new G4UIcmdWithAString("/te << 67 72 fWorldMaterCmd->SetGuidance("Select material << 68 WorldMaterCmd = new G4UIcmdWithAString("/testem/setWorldMat",this); 73 fWorldMaterCmd->SetParameterName("worldmat", << 69 WorldMaterCmd->SetGuidance("Select material of the world."); 74 fWorldMaterCmd->SetDefaultValue("empty"); << 70 WorldMaterCmd->SetParameterName("worldmat",true); 75 fWorldMaterCmd->AvailableForStates(G4State_P << 71 WorldMaterCmd->SetDefaultValue("empty"); 76 << 72 WorldMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 77 fGasThickCmd = new G4UIcmdWithADoubleAndUnit << 73 78 fGasThickCmd->SetGuidance("Set thickness of << 74 GasThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasThick",this); 79 fGasThickCmd->SetParameterName("SizeZ", fals << 75 GasThickCmd->SetGuidance("Set thickness of the detector"); 80 fGasThickCmd->SetUnitCategory("Length"); << 76 GasThickCmd->SetParameterName("SizeZ",false,false); 81 fGasThickCmd->SetDefaultUnit("mm"); << 77 GasThickCmd->SetUnitCategory("Length"); 82 fGasThickCmd->SetRange("SizeZ>0."); << 78 GasThickCmd->SetDefaultUnit("mm"); 83 fGasThickCmd->AvailableForStates(G4State_Pre << 79 GasThickCmd->SetRange("SizeZ>0."); 84 << 80 GasThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 85 fGasRadCmd = new G4UIcmdWithADoubleAndUnit(" << 81 86 fGasRadCmd->SetGuidance("Set radius of the d << 82 GasRadCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasRad",this); 87 fGasRadCmd->SetParameterName("SizeR", false, << 83 GasRadCmd->SetGuidance("Set radius of the detector"); 88 fGasRadCmd->SetUnitCategory("Length"); << 84 GasRadCmd->SetParameterName("SizeR",false,false); 89 fGasRadCmd->SetDefaultUnit("mm"); << 85 GasRadCmd->SetUnitCategory("Length"); 90 fGasRadCmd->SetRange("SizeR>0."); << 86 GasRadCmd->SetDefaultUnit("mm"); 91 fGasRadCmd->AvailableForStates(G4State_PreIn << 87 GasRadCmd->SetRange("SizeR>0."); 92 << 88 GasRadCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 93 fWinThickCmd = new G4UIcmdWithADoubleAndUnit << 89 94 fWinThickCmd->SetGuidance("Set thickness of << 90 WinThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setWindowThick",this); 95 fWinThickCmd->SetParameterName("delta", fals << 91 WinThickCmd->SetGuidance("Set thickness of the window"); 96 fWinThickCmd->SetUnitCategory("Length"); << 92 WinThickCmd->SetParameterName("delta",false,false); 97 fWinThickCmd->SetDefaultUnit("mm"); << 93 WinThickCmd->SetUnitCategory("Length"); 98 fWinThickCmd->SetRange("delta>0."); << 94 WinThickCmd->SetDefaultUnit("mm"); 99 fWinThickCmd->AvailableForStates(G4State_Pre << 95 WinThickCmd->SetRange("delta>0."); 100 << 96 WinThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 101 fIonCmd = new G4UIcmdWithADoubleAndUnit("/te << 97 102 fIonCmd->SetGuidance("Set energy per electro << 98 ionCmd = new G4UIcmdWithADoubleAndUnit("/testem/setPairEnergy",this); 103 fIonCmd->SetParameterName("en", false, false << 99 ionCmd->SetGuidance("Set energy per electron-ion pair for detector"); 104 fIonCmd->SetUnitCategory("Energy"); << 100 ionCmd->SetParameterName("en",false,false); 105 fIonCmd->SetDefaultUnit("MeV"); << 101 ionCmd->SetUnitCategory("Energy"); 106 fIonCmd->SetRange("en>0."); << 102 ionCmd->SetDefaultUnit("eV"); 107 fIonCmd->AvailableForStates(G4State_PreInit, << 103 ionCmd->SetRange("en>0."); 108 << 104 ionCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 109 fStepMaxCmd = new G4UIcmdWithADoubleAndUnit( << 105 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 } 106 } 116 107 117 //....oooOO0OOooo........oooOO0OOooo........oo << 108 ////////////////////////////////////////////////////////////////////////////// 118 109 119 DetectorMessenger::~DetectorMessenger() 110 DetectorMessenger::~DetectorMessenger() 120 { 111 { 121 delete fGasMaterCmd; << 112 delete GasMaterCmd; 122 delete fGasThickCmd; << 113 delete GasThickCmd; 123 delete fGasRadCmd; << 114 delete GasRadCmd; 124 delete fWinThickCmd; << 115 delete WinThickCmd; 125 delete fWindowMaterCmd; << 116 delete WindowMaterCmd; 126 delete fWorldMaterCmd; << 117 delete WorldMaterCmd; 127 delete fIonCmd; << 118 delete ionCmd; 128 delete fStepMaxCmd; << 119 delete detDir; 129 delete fDetDir; << 130 } 120 } 131 121 132 //....oooOO0OOooo........oooOO0OOooo........oo << 122 ////////////////////////////////////////////////////////////////////////////////// 133 123 134 void DetectorMessenger::SetNewValue(G4UIcomman << 124 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 135 { << 125 { 136 if (command == fGasMaterCmd) { << 126 if( command == GasMaterCmd ) 137 fDetector->SetGasMaterial(newValue); << 127 { 138 } << 128 Detector->SetGasMaterial(newValue); 139 else if (command == fWindowMaterCmd) { << 129 } 140 fDetector->SetContainerMaterial(newValue); << 130 else if( command == WindowMaterCmd ) 141 } << 131 { 142 else if (command == fWorldMaterCmd) { << 132 Detector->SetContainerMaterial(newValue); 143 fDetector->SetWorldMaterial(newValue); << 133 } 144 } << 134 else if( command == WorldMaterCmd ) 145 else if (command == fGasThickCmd) { << 135 { 146 fDetector->SetGasThickness(fGasThickCmd->G << 136 Detector->SetWorldMaterial(newValue); 147 } << 137 } 148 else if (command == fGasRadCmd) { << 138 else if( command == GasThickCmd ) 149 fDetector->SetGasRadius(fGasRadCmd->GetNew << 139 { 150 } << 140 Detector->SetGasThickness(GasThickCmd->GetNewDoubleValue(newValue)); 151 else if (command == fWinThickCmd) { << 141 } 152 fDetector->SetContainerThickness(fWinThick << 142 else if( command == GasRadCmd ) 153 } << 143 { 154 else if (command == fStepMaxCmd) { << 144 Detector->SetGasRadius(GasRadCmd->GetNewDoubleValue(newValue)); 155 fDetector->SetMaxChargedStep(fStepMaxCmd-> << 145 } 156 } << 146 else if( command == WinThickCmd ) 157 else if (command == fIonCmd) { << 147 { 158 fDetector->SetPairEnergy(fIonCmd->GetNewDo << 148 Detector->SetContainerThickness(WinThickCmd->GetNewDoubleValue(newValue)); 159 } << 149 } >> 150 else if( command == ionCmd ) >> 151 { >> 152 Detector->SetPairEnergy(ionCmd->GetNewDoubleValue(newValue)); >> 153 } 160 } 154 } 161 155 162 //....oooOO0OOooo........oooOO0OOooo........oo << 156 ///////////////////////////////////////////////////////////////////////////////// 163 157