Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExExChDetectorConstructionMessenger.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 
32 #include "G4UIdirectory.hh"
34 #include "G4UIcmdWithAString.hh"
36 #include "G4UIcmdWith3Vector.hh"
37 #include "G4RunManager.hh"
38 
39 #include "G4ios.hh"
40 
44 :fTarget(mpga){
45  fMyXtalDirectory = new G4UIdirectory("/xtal/");
46  fMyXtalDirectory->SetGuidance("Xtal setup control commands.");
47 
48  fXtalMaterialCmd = new G4UIcmdWithAString("/xtal/setMaterial",
49  this);
50  fXtalMaterialCmd->SetGuidance("Set Xtal material.");
51  fXtalMaterialCmd->SetParameterName("xMat",true);
52  fXtalMaterialCmd->SetDefaultValue("G4_Si");
53 
54  fXtalCurvatureRadiusCmd =
55  new G4UIcmdWith3VectorAndUnit("/xtal/setCurvRadius",this);
56  fXtalCurvatureRadiusCmd->SetGuidance("Set Xtal curvature radius.");
57  fXtalCurvatureRadiusCmd->SetParameterName("xtalcrx",
58  "xtalcry",
59  "xtalcrz",
60  true);
61  fXtalCurvatureRadiusCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
62  fXtalCurvatureRadiusCmd->SetDefaultUnit("m");
63 
64  fXtalSizeCmd = new G4UIcmdWith3VectorAndUnit("/xtal/setSize",this);
65  fXtalSizeCmd->SetGuidance("Set Xtal size.");
66  fXtalSizeCmd->SetParameterName("xtalSizeX",
67  "xtalSizeY",
68  "xtalSizeZ",
69  true);
70  fXtalSizeCmd->SetDefaultValue(G4ThreeVector(6.,2.,6.));
71  fXtalSizeCmd->SetDefaultUnit("mm");
72 
73  fXtalAngleCmd = new G4UIcmdWith3VectorAndUnit("/xtal/setAngle",this);
74  fXtalAngleCmd->SetGuidance("Set Xtal angles in the world.");
75  fXtalAngleCmd->SetParameterName("xtalAngleX",
76  "xtalAngleY",
77  "xtalAngleZ",
78  true);
79  fXtalAngleCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
80  fXtalAngleCmd->SetDefaultUnit("rad");
81 
82  fXtalCellSizeCmd = new G4UIcmdWith3VectorAndUnit("/xtal/setCellSize",this);
83  fXtalCellSizeCmd->SetGuidance("Set Xtal cell size.");
84  fXtalCellSizeCmd->SetParameterName("xtalCellSizeX",
85  "xtalCellSizeY",
86  "xtalCellSizeZ",
87  true);
88  fXtalCellSizeCmd->SetDefaultValue(G4ThreeVector(5.431,5.431,5.431));
89  fXtalCellSizeCmd->SetDefaultUnit("angstrom");
90 
91  fXtalCellAngleCmd =
92  new G4UIcmdWith3VectorAndUnit("/xtal/setCellAngle",this);
93  fXtalCellAngleCmd->SetGuidance("Set Xtal cell angles in the world.");
94  fXtalCellAngleCmd->SetParameterName("xtalCellAngleX",
95  "xtalCellAngleY",
96  "xtalCellAngleZ",
97  true);
98  fXtalCellAngleCmd->SetDefaultValue(G4ThreeVector(90.,90.,90.));
99  fXtalCellAngleCmd->SetDefaultUnit("deg");
100 
101  fXtalCellThermalVibration =
102  new G4UIcmdWithADoubleAndUnit("/xtal/setThermVibr",this);
103  fXtalCellThermalVibration->SetGuidance("Thermal vibration amplitude");
104  fXtalCellThermalVibration->SetParameterName("xtalThermVibr",true);
105  fXtalCellThermalVibration->SetDefaultValue(0.075);
106  fXtalCellThermalVibration->SetDefaultUnit("angstrom");
107 
108  fXtalMillerCmd = new G4UIcmdWith3Vector("/xtal/setMiller",this);
109  fXtalMillerCmd->SetGuidance("Set Miller Indexes");
110  fXtalMillerCmd->SetParameterName("xtalMiller1",
111  "xtalMiller2",
112  "xtalMiller3",
113  true);
114  fXtalMillerCmd->SetDefaultValue(G4ThreeVector(2,2,0));
115 
116  fAddXtal = new G4UIcmdWithAString("/addxtal",this);
117  fAddXtal->SetGuidance("Add Xtal.");
118  fAddXtal->SetParameterName("addxtal",true);
119 }
120 
121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
122 
125  delete fXtalMaterialCmd;
126  delete fXtalMillerCmd;
127  delete fXtalCurvatureRadiusCmd;
128  delete fXtalSizeCmd;
129  delete fXtalAngleCmd;
130  delete fXtalCellSizeCmd;
131  delete fXtalCellAngleCmd;
132  delete fAddXtal;
133 }
134 
135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
136 
138  G4UIcommand *command,
139  G4String newValue){
140  if(command==fXtalMaterialCmd ){
141  fTarget->SetXtalMaterial(newValue);
142  }
143  if(command==fXtalCurvatureRadiusCmd ){
144  fTarget->SetXtalCurvatureRadius(
145  fXtalCurvatureRadiusCmd->GetNew3VectorValue(newValue));
146  }
147  if(command==fXtalSizeCmd ){
148  fTarget->SetXtalSize(fXtalSizeCmd->GetNew3VectorValue(newValue));
149  }
150  if(command==fXtalAngleCmd ){
151  fTarget->SetXtalAngle(fXtalAngleCmd->GetNew3VectorValue(newValue));
152  }
153  if(command==fXtalCellSizeCmd ){
154  fTarget->SetXtalCellSize(
155  fXtalCellSizeCmd->GetNew3VectorValue(newValue));
156  }
157  if(command==fXtalCellAngleCmd ){
158  fTarget->SetXtalCellAngle(
159  fXtalCellAngleCmd->GetNew3VectorValue(newValue));
160  }
161  if(command==fXtalCellThermalVibration ){
163  fXtalCellThermalVibration->GetNewDoubleValue(newValue));
164  }
165  if(command==fXtalMillerCmd ){
166  fTarget->SetXtalMiller(fXtalMillerCmd->GetNew3VectorValue(newValue));
167  }
168  if(command==fAddXtal ){
169  fTarget->AddXtalTarget();
170  }
171 
172 }
173 
174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
175 
177  G4UIcommand * command){
178  G4String cv;
179 
180  if( command==fXtalMaterialCmd ){
181  cv = fTarget->GetXtalMaterial();
182  }
183  if( command==fXtalCurvatureRadiusCmd ){
184  cv = fXtalCurvatureRadiusCmd->ConvertToString(
185  fTarget->GetXtalCurvatureRadius(),"m");
186  }
187  if( command==fXtalSizeCmd ){
188  cv = fXtalSizeCmd->ConvertToString(fTarget->GetXtalSize(),"mm");
189  }
190  if( command==fXtalAngleCmd ){
191  cv = fXtalAngleCmd->ConvertToString(fTarget->GetXtalAngle(),"rad");
192  }
193  if( command==fXtalCellSizeCmd ){
194  cv = fXtalCellSizeCmd->ConvertToString(
195  fTarget->GetXtalCellSize(),"angstrom");
196  }
197  if( command==fXtalCellAngleCmd ){
198  cv = fXtalCellAngleCmd->ConvertToString(
199  fTarget->GetXtalCellAngle(),"deg");
200  }
201  if( command==fXtalCellThermalVibration ){
202  cv = fXtalCellThermalVibration->ConvertToString(
203  fTarget->GetXtalThermalVibrationAmplitude(),"angstrom");
204  }
205  if( command==fXtalMillerCmd ){
206  cv = fXtalMillerCmd->ConvertToString(fTarget->GetXtalMiller());
207  }
208 
209  return cv;
210 }
211 
212 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
CLHEP::Hep3Vector G4ThreeVector
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
static G4double GetNewDoubleValue(const char *paramString)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
virtual G4String GetCurrentValue(G4UIcommand *command)
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
virtual void SetNewValue(G4UIcommand *command, G4String newValues)
void SetDefaultValue(G4ThreeVector defVal)
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetXtalMaterial(const G4String &name)
Definition of the ExExChDetectorConstructionMessenger class.
ExExChDetectorConstructionMessenger(ExExChDetectorConstruction *mpga)
void SetDefaultValue(G4ThreeVector defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
Definition of the ExExChDetectorConstruction class.