Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 // $Id$
30 //
32 //
33 // TestEm8: Gaseous detector
34 //
35 // Created: 31.08.2010 V.Ivanchenko
36 //
37 // Modified:
38 //
40 //
41 
42 #include "DetectorMessenger.hh"
43 
44 #include "DetectorConstruction.hh"
45 #include "G4UIdirectory.hh"
46 #include "G4UIcmdWithAString.hh"
49 
51 
53  : fDetector(det)
54 {
55  fDetDir = new G4UIdirectory("/testem/");
56  fDetDir->SetGuidance("Detector control.");
57 
58  fGasMaterCmd = new G4UIcmdWithAString("/testem/setGasMat",this);
59  fGasMaterCmd->SetGuidance("Select material of the detector.");
60  fGasMaterCmd->SetParameterName("gmat",true);
61  fGasMaterCmd->SetDefaultValue("Argon");
63 
64  fWindowMaterCmd = new G4UIcmdWithAString("/testem/setWindowMat",this);
65  fWindowMaterCmd->SetGuidance("Select material of the window.");
66  fWindowMaterCmd->SetParameterName("wmat",true);
67  fWindowMaterCmd->SetDefaultValue("Mylar");
69 
70  fWorldMaterCmd = new G4UIcmdWithAString("/testem/setWorldMat",this);
71  fWorldMaterCmd->SetGuidance("Select material of the world.");
72  fWorldMaterCmd->SetParameterName("worldmat",true);
73  fWorldMaterCmd->SetDefaultValue("empty");
75 
76  fGasThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasThick",this);
77  fGasThickCmd->SetGuidance("Set thickness of the detector");
78  fGasThickCmd->SetParameterName("SizeZ",false,false);
79  fGasThickCmd->SetUnitCategory("Length");
80  fGasThickCmd->SetDefaultUnit("mm");
81  fGasThickCmd->SetRange("SizeZ>0.");
83 
84  fGasRadCmd = new G4UIcmdWithADoubleAndUnit("/testem/setGasRad",this);
85  fGasRadCmd->SetGuidance("Set radius of the detector");
86  fGasRadCmd->SetParameterName("SizeR",false,false);
87  fGasRadCmd->SetUnitCategory("Length");
88  fGasRadCmd->SetDefaultUnit("mm");
89  fGasRadCmd->SetRange("SizeR>0.");
91 
92  fWinThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/setWindowThick",this);
93  fWinThickCmd->SetGuidance("Set thickness of the window");
94  fWinThickCmd->SetParameterName("delta",false,false);
95  fWinThickCmd->SetUnitCategory("Length");
96  fWinThickCmd->SetDefaultUnit("mm");
97  fWinThickCmd->SetRange("delta>0.");
99 
100  fIonCmd = new G4UIcmdWithADoubleAndUnit("/testem/setPairEnergy",this);
101  fIonCmd->SetGuidance("Set energy per electron-ion pair for detector");
102  fIonCmd->SetParameterName("en",false,false);
103  fIonCmd->SetUnitCategory("Energy");
104  fIonCmd->SetDefaultUnit("eV");
105  fIonCmd->SetRange("en>0.");
107 
108 }
109 
111 
113 {
114  delete fGasMaterCmd;
115  delete fGasThickCmd;
116  delete fGasRadCmd;
117  delete fWinThickCmd;
118  delete fWindowMaterCmd;
119  delete fWorldMaterCmd;
120  delete fIonCmd;
121  delete fDetDir;
122 }
123 
125 
127 {
128  if( command == fGasMaterCmd )
129  {
130  fDetector->SetGasMaterial(newValue);
131  }
132  else if( command == fWindowMaterCmd )
133  {
134  fDetector->SetContainerMaterial(newValue);
135  }
136  else if( command == fWorldMaterCmd )
137  {
138  fDetector->SetWorldMaterial(newValue);
139  }
140  else if( command == fGasThickCmd )
141  {
142  fDetector->SetGasThickness(fGasThickCmd->GetNewDoubleValue(newValue));
143  }
144  else if( command == fGasRadCmd )
145  {
146  fDetector->SetGasRadius(fGasRadCmd->GetNewDoubleValue(newValue));
147  }
148  else if( command == fWinThickCmd )
149  {
150  fDetector->SetContainerThickness(fWinThickCmd->GetNewDoubleValue(newValue));
151  }
152  else if( command == fIonCmd )
153  {
154  fDetector->SetPairEnergy(fIonCmd->GetNewDoubleValue(newValue));
155  }
156 }
157