Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/electromagnetic/TestEm8/src/DetectorMessenger.cc
Go to the documentation of this file.
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 //
26 /// \file electromagnetic/TestEm8/src/DetectorMessenger.cc
27 /// \brief Implementation of the DetectorMessenger class
28 //
29 // $Id: DetectorMessenger.cc 68198 2013-03-18 16:39:51Z maire $
30 //
31 /////////////////////////////////////////////////////////////////////////
32 //
33 // TestEm8: Gaseous detector
34 //
35 // Created: 31.08.2010 V.Ivanchenko
36 //
37 // Modified:
38 //
39 ////////////////////////////////////////////////////////////////////////
40 //
41 
42 #include "DetectorMessenger.hh"
43 
44 #include "DetectorConstruction.hh"
45 #include "G4UIdirectory.hh"
46 #include "G4UIcmdWithAString.hh"
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51 
53  : G4UImessenger(),fDetector(det),
54  fDetDir(0),
55  fGasMaterCmd(0),
56  fGasThickCmd(0),
57  fGasRadCmd(0),
58  fWinThickCmd(0),
59  fWindowMaterCmd(0),
60  fWorldMaterCmd(0),
61  fIonCmd(0)
62 {
63  fDetDir = new G4UIdirectory("/testem/");
64  fDetDir->SetGuidance("Detector control.");
65 
66  fGasMaterCmd = new G4UIcmdWithAString("/testem/setGasMat",this);
67  fGasMaterCmd->SetGuidance("Select material of the detector.");
68  fGasMaterCmd->SetParameterName("gmat",true);
69  fGasMaterCmd->SetDefaultValue("Argon");
71 
72  fWindowMaterCmd = new G4UIcmdWithAString("/testem/setWindowMat",this);
73  fWindowMaterCmd->SetGuidance("Select material of the window.");
74  fWindowMaterCmd->SetParameterName("wmat",true);
75  fWindowMaterCmd->SetDefaultValue("Mylar");
77 
78  fWorldMaterCmd = new G4UIcmdWithAString("/testem/setWorldMat",this);
79  fWorldMaterCmd->SetGuidance("Select material of the world.");
80  fWorldMaterCmd->SetParameterName("worldmat",true);
81  fWorldMaterCmd->SetDefaultValue("empty");
83 
84  fGasThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasThick",this);
85  fGasThickCmd->SetGuidance("Set thickness of the detector");
86  fGasThickCmd->SetParameterName("SizeZ",false,false);
87  fGasThickCmd->SetUnitCategory("Length");
88  fGasThickCmd->SetDefaultUnit("mm");
89  fGasThickCmd->SetRange("SizeZ>0.");
91 
92  fGasRadCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasRad",this);
93  fGasRadCmd->SetGuidance("Set radius of the detector");
94  fGasRadCmd->SetParameterName("SizeR",false,false);
95  fGasRadCmd->SetUnitCategory("Length");
96  fGasRadCmd->SetDefaultUnit("mm");
97  fGasRadCmd->SetRange("SizeR>0.");
99 
100  fWinThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setWindowThick",this);
101  fWinThickCmd->SetGuidance("Set thickness of the window");
102  fWinThickCmd->SetParameterName("delta",false,false);
103  fWinThickCmd->SetUnitCategory("Length");
104  fWinThickCmd->SetDefaultUnit("mm");
105  fWinThickCmd->SetRange("delta>0.");
107 
108  fIonCmd = new G4UIcmdWithADoubleAndUnit("/testem/setPairEnergy",this);
109  fIonCmd->SetGuidance("Set energy per electron-ion pair for detector");
110  fIonCmd->SetParameterName("en",false,false);
111  fIonCmd->SetUnitCategory("Energy");
112  fIonCmd->SetDefaultUnit("MeV");
113  fIonCmd->SetRange("en>0.");
115 }
116 
117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
118 
120 {
121  delete fGasMaterCmd;
122  delete fGasThickCmd;
123  delete fGasRadCmd;
124  delete fWinThickCmd;
125  delete fWindowMaterCmd;
126  delete fWorldMaterCmd;
127  delete fIonCmd;
128  delete fDetDir;
129 }
130 
131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
132 
134 {
135  if( command == fGasMaterCmd )
136  {
137  fDetector->SetGasMaterial(newValue);
138  }
139  else if( command == fWindowMaterCmd )
140  {
141  fDetector->SetContainerMaterial(newValue);
142  }
143  else if( command == fWorldMaterCmd )
144  {
145  fDetector->SetWorldMaterial(newValue);
146  }
147  else if( command == fGasThickCmd )
148  {
149  fDetector->SetGasThickness(fGasThickCmd->GetNewDoubleValue(newValue));
150  }
151  else if( command == fGasRadCmd )
152  {
153  fDetector->SetGasRadius(fGasRadCmd->GetNewDoubleValue(newValue));
154  }
155  else if( command == fWinThickCmd )
156  {
157  fDetector->SetContainerThickness(fWinThickCmd->GetNewDoubleValue(newValue));
158  }
159  else if( command == fIonCmd )
160  {
161  fDetector->SetPairEnergy(fIonCmd->GetNewDoubleValue(newValue));
162  }
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)