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 hadronic/Hadr01/src/DetectorMessenge 27 /// \brief Implementation of the DetectorMesse 28 // 29 // 30 ////////////////////////////////////////////// 31 // 32 // DetectorMessenger 33 // 34 // Created: 31.01.03 V.Ivanchenko 35 // 36 // Modified: 37 // 04.06.2006 Adoptation of Hadr01 (V.Ivanchen 38 // 16.11.2006 Add beamCmd (V.Ivanchenko) 39 // 40 ////////////////////////////////////////////// 41 // 42 43 #include "DetectorMessenger.hh" 44 45 #include "DetectorConstruction.hh" 46 #include "HistoManager.hh" 47 48 #include "G4HadronicParameters.hh" 49 #include "G4UIcmdWith3Vector.hh" 50 #include "G4UIcmdWithABool.hh" 51 #include "G4UIcmdWithADoubleAndUnit.hh" 52 #include "G4UIcmdWithAString.hh" 53 #include "G4UIcmdWithAnInteger.hh" 54 #include "G4UIcmdWithoutParameter.hh" 55 #include "G4UIdirectory.hh" 56 57 //....oooOO0OOooo........oooOO0OOooo........oo 58 59 DetectorMessenger::DetectorMessenger(DetectorC 60 : G4UImessenger(), 61 fDetector(Det), 62 fTestDir(0), 63 fMatCmd(0), 64 fMat1Cmd(0), 65 fRCmd(0), 66 fLCmd(0), 67 fEdepCmd(0), 68 fBinCmd(0), 69 fNOfAbsCmd(0), 70 fVerbCmd(0), 71 fBeamCmd(0) 72 { 73 fTestDir = new G4UIdirectory("/testhadr/"); 74 fTestDir->SetGuidance(" Hadronic Extended Ex 75 76 fMatCmd = new G4UIcmdWithAString("/testhadr/ 77 fMatCmd->SetGuidance("Select Material for th 78 fMatCmd->SetParameterName("tMaterial", false 79 fMatCmd->AvailableForStates(G4State_PreInit, 80 81 fMat1Cmd = new G4UIcmdWithAString("/testhadr 82 fMat1Cmd->SetGuidance("Select Material for w 83 fMat1Cmd->SetParameterName("wMaterial", fals 84 fMat1Cmd->AvailableForStates(G4State_PreInit 85 86 fRCmd = new G4UIcmdWithADoubleAndUnit("/test 87 fRCmd->SetGuidance("Set radius of the target 88 fRCmd->SetParameterName("radius", false); 89 fRCmd->SetUnitCategory("Length"); 90 fRCmd->SetRange("radius>0"); 91 fRCmd->AvailableForStates(G4State_PreInit); 92 93 fLCmd = new G4UIcmdWithADoubleAndUnit("/test 94 fLCmd->SetGuidance("Set length of the target 95 fLCmd->SetParameterName("length", false); 96 fLCmd->SetUnitCategory("Length"); 97 fLCmd->SetRange("length>0"); 98 fLCmd->AvailableForStates(G4State_PreInit); 99 100 fBinCmd = new G4UIcmdWithAnInteger("/testhad 101 fBinCmd->SetGuidance("Set number of bins for 102 fBinCmd->SetParameterName("NEbins", false); 103 fBinCmd->AvailableForStates(G4State_PreInit) 104 105 fNOfAbsCmd = new G4UIcmdWithAnInteger("/test 106 fNOfAbsCmd->SetGuidance("Set number of slice 107 fNOfAbsCmd->SetParameterName("NZ", false); 108 fNOfAbsCmd->AvailableForStates(G4State_PreIn 109 110 fEdepCmd = new G4UIcmdWithADoubleAndUnit("/t 111 fEdepCmd->SetGuidance("Set max energy in his 112 fEdepCmd->SetParameterName("edep", false); 113 fEdepCmd->SetUnitCategory("Energy"); 114 fEdepCmd->SetRange("edep>0"); 115 fEdepCmd->AvailableForStates(G4State_PreInit 116 117 fBeamCmd = new G4UIcmdWithABool("/testhadr/D 118 fBeamCmd->SetGuidance("Use default beam posi 119 fBeamCmd->AvailableForStates(G4State_PreInit 120 121 fVerbCmd = new G4UIcmdWithAnInteger("/testha 122 fVerbCmd->SetGuidance("Set verbose for "); 123 fVerbCmd->SetParameterName("verb", false); 124 fVerbCmd->AvailableForStates(G4State_PreInit 125 126 fBertCmd = new G4UIcmdWithAnInteger("/testha 127 fBertCmd->SetGuidance("Set printout of Berti 128 fBertCmd->SetParameterName("bert", false); 129 fBertCmd->AvailableForStates(G4State_PreInit 130 131 fBCCmd = new G4UIcmdWithABool("/testhadr/BCP 132 fBCCmd->SetGuidance("Enable b-, c- hadronic 133 fBCCmd->SetParameterName("BCparticles", fals 134 fBCCmd->AvailableForStates(G4State_PreInit); 135 136 fHNCmd = new G4UIcmdWithABool("/testhadr/Hyp 137 fHNCmd->SetGuidance("Enable hyper-nuclei had 138 fHNCmd->SetParameterName("HyperNuclei", fals 139 fHNCmd->AvailableForStates(G4State_PreInit); 140 141 fNGPCmd = new G4UIcmdWithABool("/testhadr/Ne 142 fNGPCmd->SetGuidance("Enable neutron general 143 fNGPCmd->SetParameterName("NeutronGeneralPro 144 fNGPCmd->AvailableForStates(G4State_PreInit) 145 } 146 147 //....oooOO0OOooo........oooOO0OOooo........oo 148 149 DetectorMessenger::~DetectorMessenger() 150 { 151 delete fMatCmd; 152 delete fMat1Cmd; 153 delete fRCmd; 154 delete fLCmd; 155 delete fBinCmd; 156 delete fNOfAbsCmd; 157 delete fTestDir; 158 delete fBeamCmd; 159 delete fVerbCmd; 160 delete fBertCmd; 161 delete fEdepCmd; 162 delete fBCCmd; 163 delete fHNCmd; 164 delete fNGPCmd; 165 } 166 167 //....oooOO0OOooo........oooOO0OOooo........oo 168 169 void DetectorMessenger::SetNewValue(G4UIcomman 170 { 171 HistoManager* h = HistoManager::GetPointer() 172 if (command == fMatCmd) { 173 fDetector->SetTargetMaterial(newValue); 174 } 175 else if (command == fMat1Cmd) { 176 fDetector->SetWorldMaterial(newValue); 177 } 178 else if (command == fRCmd) { 179 h->SetTargetRadius(fRCmd->GetNewDoubleValu 180 } 181 else if (command == fLCmd) { 182 h->SetTargetLength(fLCmd->GetNewDoubleValu 183 } 184 else if (command == fNOfAbsCmd) { 185 h->SetNumberOfSlices(fNOfAbsCmd->GetNewInt 186 } 187 else if (command == fBinCmd) { 188 h->SetNumberOfBinsE(fBinCmd->GetNewIntValu 189 } 190 else if (command == fVerbCmd) { 191 h->SetVerbose(fVerbCmd->GetNewIntValue(new 192 } 193 else if (command == fBertCmd) { 194 h->SetPrintBertiniXS(fBertCmd->GetNewIntVa 195 } 196 else if (command == fBeamCmd) { 197 h->SetDefaultBeamPositionFlag(fBeamCmd->Ge 198 } 199 else if (command == fEdepCmd) { 200 h->SetMaxEnergyDeposit(fEdepCmd->GetNewDou 201 } 202 else if (command == fBCCmd) { 203 G4HadronicParameters::Instance()->SetEnabl 204 } 205 else if (command == fHNCmd) { 206 G4HadronicParameters::Instance()->SetEnabl 207 } 208 else if (command == fNGPCmd) { 209 G4HadronicParameters::Instance()->SetEnabl 210 fNGPCmd->GetNewBoolValue(newValue)); 211 } 212 } 213 214 //....oooOO0OOooo........oooOO0OOooo........oo 215