Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
examples/extended/medical/GammaTherapy/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 // $Id: DetectorMessenger.cc 67994 2013-03-13 11:05:39Z gcosmo $
27 //
28 /// \file medical/GammaTherapy/src/DetectorMessenger.cc
29 /// \brief Implementation of the DetectorMessenger class
30 //
31 // -------------------------------------------------------------
32 // GEANT4 test IBREM
33 //
34 // Authors: V.Grichine, V.Ivanchenko
35 //
36 // Modified:
37 //
38 // 18-02-03 V.Ivanchenko create
39 //
40 // -------------------------------------------------------------
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44 
45 #include "DetectorMessenger.hh"
46 #include "DetectorConstruction.hh"
47 #include "Histo.hh"
48 #include "G4UIdirectory.hh"
49 #include "G4UIcmdWithABool.hh"
50 #include "G4UIcmdWithAString.hh"
51 #include "G4UIcmdWithAnInteger.hh"
54 
55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
56 
58  fDetector(h)
59 {
60  fDetDir = new G4UIdirectory("/testem/");
61  fDetDir->SetGuidance("General commands");
62  fDetDir1= new G4UIdirectory("/testem/physics/");
63  fDetDir1->SetGuidance(" commands to define physics");
64  fDetDir2= new G4UIdirectory("/testem/gun/");
65  fDetDir2->SetGuidance(" commands to define gun");
66 
67  fAbsMaterCmd = new G4UIcmdWithAString("/testem/target1Material",this);
68  fAbsMaterCmd->SetGuidance("Select Material of the target1.");
69  fAbsMaterCmd->SetParameterName("Material1",false);
71 
72  fWorldMaterCmd = new G4UIcmdWithAString("/testem/target2Material",this);
73  fWorldMaterCmd->SetGuidance("Select Material of the target2.");
74  fWorldMaterCmd->SetParameterName("Material2",false);
76 
77  fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/mylarZ",this);
78  fAbsThickCmd->SetGuidance("Set mylarZ");
79  fAbsThickCmd->SetParameterName("mylarZ",false);
80  fAbsThickCmd->SetUnitCategory("Length");
82 
83  fAbsGapCmd = new G4UIcmdWithADoubleAndUnit("/testem/delta",this);
84  fAbsGapCmd->SetGuidance("Set gap between absorbers");
85  fAbsGapCmd->SetParameterName("delta",false);
86  fAbsGapCmd->SetUnitCategory("Length");
88 
89  fAbsSizYZCmd = new G4UIcmdWithADoubleAndUnit("/testem/target1Z",this);
90  fAbsSizYZCmd->SetGuidance("Set targeet1Z");
91  fAbsSizYZCmd->SetParameterName("target1Z",false);
92  fAbsSizYZCmd->SetUnitCategory("Length");
94 
95  fWorldXCmd = new G4UIcmdWithADoubleAndUnit("/testem/target2Z",this);
96  fWorldXCmd->SetGuidance("Set target2Z");
97  fWorldXCmd->SetParameterName("target2Z",false);
98  fWorldXCmd->SetUnitCategory("Length");
100 
101  fUpdateCmd = new G4UIcmdWithoutParameter("/testem/update",this);
102  fUpdateCmd->SetGuidance("Update calorimeter geometry.");
103  fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
104  fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
106 
107  fXMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/checkShiftZ",this);
108  fXMagFieldCmd->SetGuidance("Define checkShftZ");
109  fXMagFieldCmd->SetParameterName("CheckSZ",false);
110  fXMagFieldCmd->SetUnitCategory("Length");
112 
113  fYMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdZ",this);
114  fYMagFieldCmd->SetGuidance("Define sensitive detector Z");
115  fYMagFieldCmd->SetParameterName("sdZ",false);
116  fYMagFieldCmd->SetUnitCategory("Length");
118 
119  fZMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/sdShiftZ",this);
120  fZMagFieldCmd->SetGuidance("Define shift of sensitive detector");
121  fZMagFieldCmd->SetParameterName("sdShiftZ",false);
122  fZMagFieldCmd->SetUnitCategory("Length");
124 
125  fHistoCmd = new G4UIcmdWithAString("/testem/histoName",this);
126  fHistoCmd->SetGuidance("Set the name of the histo file");
127  fHistoCmd->SetParameterName("histo",false);
129 
130  fNumOfAbsCmd = new G4UIcmdWithAnInteger("/testem/numberDivR",this);
131  fNumOfAbsCmd->SetGuidance("Set number divisions R");
132  fNumOfAbsCmd->SetParameterName("NR",false);
134 
135  fNumOfEvt = new G4UIcmdWithAnInteger("/testem/numberDivZ",this);
136  fNumOfEvt->SetGuidance("Set number of divisions Z");
137  fNumOfEvt->SetParameterName("NZ",false);
139 
140  fVerbCmd = new G4UIcmdWithAnInteger("/testem/verbose",this);
141  fVerbCmd->SetGuidance("Set verbose for ");
142  fVerbCmd->SetParameterName("verb",false);
144 
145  fIntCmd = new G4UIcmdWithAnInteger("/testem/numberDivE",this);
146  fIntCmd->SetGuidance("Set number of divisions E");
147  fIntCmd->SetParameterName("NZ",false);
149 
150  fDeltaECmd = new G4UIcmdWithADoubleAndUnit("/testem/maxEnergy",this);
151  fDeltaECmd->SetGuidance("Define scale of secondary energy histogram");
152  fDeltaECmd->SetParameterName("DeltaE",false);
153  fDeltaECmd->SetUnitCategory("Energy");
155 
156 }
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
159 
161 {
162  delete fNumOfAbsCmd;
163  delete fAbsMaterCmd;
164  delete fAbsThickCmd;
165  delete fAbsGapCmd;
166  delete fAbsSizYZCmd;
167  delete fWorldMaterCmd;
168  delete fWorldXCmd;
169  delete fUpdateCmd;
170  delete fXMagFieldCmd;
171  delete fYMagFieldCmd;
172  delete fZMagFieldCmd;
173  delete fHistoCmd;
174  delete fNumOfEvt;
175  delete fVerbCmd;
176  delete fIntCmd;
177  delete fDetDir;
178  delete fDetDir1;
179  delete fDetDir2;
180  delete fDeltaECmd;
181 }
182 
183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
184 
186 {
187  if( command == fAbsMaterCmd )
188  { fDetector->SetTarget1Material(newValue);}
189 
190  if( command == fWorldMaterCmd )
191  { fDetector->SetTarget2Material(newValue);}
192 
193  if( command == fAbsThickCmd )
194  { fDetector->SetMylarZ(fAbsThickCmd->GetNewDoubleValue(newValue));}
195 
196  if( command == fAbsGapCmd )
197  { fDetector->SetGap(fAbsGapCmd->GetNewDoubleValue(newValue));}
198 
199  if( command == fAbsSizYZCmd )
200  { fDetector->SetTarget1Z(fAbsSizYZCmd->GetNewDoubleValue(newValue));}
201 
202  if( command == fWorldXCmd )
203  { fDetector->SetTarget2Z(fWorldXCmd->GetNewDoubleValue(newValue));}
204 
205  if( command == fUpdateCmd )
206  { fDetector->UpdateGeometry(); }
207 
208  if( command == fXMagFieldCmd )
209  { fDetector->SetCheckShiftZ(fXMagFieldCmd->GetNewDoubleValue(newValue));}
210 
211  if( command == fYMagFieldCmd )
212  { G4double x = fYMagFieldCmd->GetNewDoubleValue(newValue);
213  fDetector->SetAbsorberZ(x);
214  }
215 
216  if( command == fZMagFieldCmd )
217  { fDetector->SetAbsorberShiftZ(fZMagFieldCmd->GetNewDoubleValue(newValue));}
218 
219  if( command == fHistoCmd )
220  { (Histo::GetPointer())->SetHistoName(newValue);}
221 
222  if( command == fNumOfAbsCmd )
223  {(Histo::GetPointer())->SetNumberDivR(fNumOfAbsCmd->GetNewIntValue(newValue));}
224 
225  if( command == fNumOfEvt )
226  {(Histo::GetPointer())->SetNumberDivZ(fNumOfEvt->GetNewIntValue(newValue));}
227 
228  if( command == fVerbCmd ){
229  G4int ver = fVerbCmd->GetNewIntValue(newValue);
230  (Histo::GetPointer())->SetVerbose(ver);
231  }
232 
233  if( command == fIntCmd )
234  {(Histo::GetPointer())->SetNumberDivE(fIntCmd->GetNewIntValue(newValue));}
235 
236  if( command == fDeltaECmd )
237  {(Histo::GetPointer()) ->SetMaxEnergy(fDeltaECmd->GetNewDoubleValue(newValue));}
238 
239 }
240 
241 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static Histo * GetPointer()
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
double G4double
Definition: G4Types.hh:76
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)