Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
examples/extended/hadronic/Hadr00/src/DetectorMessenger.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 // $Id: DetectorMessenger.cc 106244 2017-09-26 01:58:00Z gcosmo $
31 //
32 //
34 //
35 // DetectorMessenger
36 //
37 // Created: 20.06.08 V.Ivanchenko
38 //
39 // Modified:
40 //
42 //
43 
44 #include "DetectorMessenger.hh"
45 
46 #include "DetectorConstruction.hh"
47 #include "G4UIdirectory.hh"
48 #include "G4UIcmdWithABool.hh"
49 #include "G4UIcmdWithAString.hh"
50 #include "G4UIcmdWithAnInteger.hh"
51 #include "G4UIcmdWith3Vector.hh"
54 #include "HistoManager.hh"
56 #include "G4VModularPhysicsList.hh"
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61 :G4UImessenger(), fDetector(Det)
62 {
63  ftestDir = new G4UIdirectory("/testhadr/");
64  ftestDir->SetGuidance(" Hadronic Extended Example.");
65 
66  fmatCmd = new G4UIcmdWithAString("/testhadr/TargetMat",this);
67  fmatCmd->SetGuidance("Select Material for the target");
68  fmatCmd->SetParameterName("tMaterial",false);
71 
72  fmat1Cmd = new G4UIcmdWithAString("/testhadr/WorldMat",this);
73  fmat1Cmd->SetGuidance("Select Material for world");
74  fmat1Cmd->SetParameterName("wMaterial",false);
77 
78  fRDCmd = new G4UIcmdWithABool("/testhadr/RadDecay",this);
79  fRDCmd->SetGuidance("Enable radioactive decay");
80  fRDCmd->SetParameterName("RD",false);
82  fRDCmd->SetToBeBroadcasted(false);
83 
84  frCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetRadius",this);
85  frCmd->SetGuidance("Set radius of the target");
86  frCmd->SetParameterName("radius",false);
87  frCmd->SetUnitCategory("Length");
88  frCmd->SetRange("radius>0");
90  frCmd->SetToBeBroadcasted(false);
91 
92  flCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetLength",this);
93  flCmd->SetGuidance("Set length of the target");
94  flCmd->SetParameterName("length",false);
95  flCmd->SetUnitCategory("Length");
96  flCmd->SetRange("length>0");
98  flCmd->SetToBeBroadcasted(false);
99 
100 }
101 
102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
103 
105 {
106  delete fmatCmd;
107  delete fmat1Cmd;
108  delete fRDCmd;
109  delete frCmd;
110  delete flCmd;
111  delete ftestDir;
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 
116 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
117 {
118  if( command == fmatCmd ) {
119  fDetector->SetTargetMaterial(newValue);
120  } else if( command == fmat1Cmd ) {
121  fDetector->SetWorldMaterial(newValue);
122  } else if( command == frCmd ) {
124  } else if( command == flCmd ) {
126  } else if( command == fRDCmd ) {
127  if(fRDCmd->GetNewBoolValue(newValue)) {
130  }
131  }
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
static G4bool GetNewBoolValue(const char *paramString)
void SetWorldMaterial(const G4String &materialName)
static G4double GetNewDoubleValue(const char *paramString)
void SetUnitCategory(const char *unitCategory)
void RegisterPhysics(G4VPhysicsConstructor *)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242
Simple detector construction with a box volume placed in a world.
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184